--- a/.hgtags Thu Sep 17 09:19:40 2015 -0700
+++ b/.hgtags Tue Sep 22 11:01:54 2015 -0700
@@ -324,3 +324,4 @@
3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
3c9f5bd909ae7187f24622ee4b69f8a5756a9271 jdk9-b80
2050b3a0aadcb0e024bf798197421d58e54ec8bf jdk9-b81
+6521875cb63e1d0121b30af56ebbc36db078c4c6 jdk9-b82
--- a/.hgtags-top-repo Thu Sep 17 09:19:40 2015 -0700
+++ b/.hgtags-top-repo Tue Sep 22 11:01:54 2015 -0700
@@ -324,3 +324,4 @@
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
f7c5ae2933c0b8510a420d1713a955e4ffc7ad0b jdk9-b80
b8afcf91331d78626a583ec1b63164468d6f4181 jdk9-b81
+42b56d1f418523ecb61a49d7493302c80c8009cc jdk9-b82
--- a/common/autoconf/generated-configure.sh Thu Sep 17 09:19:40 2015 -0700
+++ b/common/autoconf/generated-configure.sh Tue Sep 22 11:01:54 2015 -0700
@@ -841,7 +841,6 @@
JDK_MAJOR_VERSION
USER_RELEASE_SUFFIX
COMPRESS_JARS
-RMICONNECTOR_IIOP
UNLIMITED_CRYPTO
CACERTS_FILE
TEST_IN_BUILD
@@ -1060,7 +1059,6 @@
enable_hotspot_test_in_build
with_cacerts_file
enable_unlimited_crypto
-enable_rmiconnector_iiop
with_milestone
with_update_version
with_user_release_suffix
@@ -1848,9 +1846,6 @@
run the Queens test after Hotspot build [disabled]
--enable-unlimited-crypto
Enable unlimited crypto policy [disabled]
- --enable-rmiconnector-iiop
- enable the JMX RMIConnector iiop transport
- [disabled]
--disable-warnings-as-errors
do not consider native warnings to be an error
[enabled]
@@ -3951,7 +3946,7 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -20100,22 +20095,6 @@
###############################################################################
#
- # --enable-rmiconnector-iiop
- #
- # Check whether --enable-rmiconnector-iiop was given.
-if test "${enable_rmiconnector_iiop+set}" = set; then :
- enableval=$enable_rmiconnector_iiop;
-fi
-
- if test "x$enable_rmiconnector_iiop" = "xyes"; then
- RMICONNECTOR_IIOP=true
- else
- RMICONNECTOR_IIOP=false
- fi
-
-
- ###############################################################################
- #
# Compress jars
#
COMPRESS_JARS=false
--- a/common/autoconf/jdk-options.m4 Thu Sep 17 09:19:40 2015 -0700
+++ b/common/autoconf/jdk-options.m4 Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -455,19 +455,6 @@
###############################################################################
#
- # --enable-rmiconnector-iiop
- #
- AC_ARG_ENABLE(rmiconnector-iiop, [AS_HELP_STRING([--enable-rmiconnector-iiop],
- [enable the JMX RMIConnector iiop transport @<:@disabled@:>@])])
- if test "x$enable_rmiconnector_iiop" = "xyes"; then
- RMICONNECTOR_IIOP=true
- else
- RMICONNECTOR_IIOP=false
- fi
- AC_SUBST(RMICONNECTOR_IIOP)
-
- ###############################################################################
- #
# Compress jars
#
COMPRESS_JARS=false
--- a/common/autoconf/spec.gmk.in Thu Sep 17 09:19:40 2015 -0700
+++ b/common/autoconf/spec.gmk.in Tue Sep 22 11:01:54 2015 -0700
@@ -262,9 +262,6 @@
# Enable unlimited crypto policy
UNLIMITED_CRYPTO=@UNLIMITED_CRYPTO@
-# Enable RMIConnector IIOP transport
-RMICONNECTOR_IIOP=@RMICONNECTOR_IIOP@
-
GCOV_ENABLED=@GCOV_ENABLED@
# Necessary additional compiler flags to compile X11
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/bin/blessed-modifier-order.sh Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# Copyright 2015 Google, 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.
+
+usage() {
+ (
+ echo "$0 DIR ..."
+ echo "Modifies in place all the java source files found"
+ echo "in the given directories so that all java language modifiers"
+ echo "are in the canonical order given by Modifier#toString()."
+ echo "Tries to get it right even within javadoc comments,"
+ echo "and even if the list of modifiers spans 2 lines."
+ echo
+ echo "See:"
+ echo "https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Modifier.html#toString-int-"
+ echo
+ echo "Example:"
+ echo "$0 jdk/src/java.base jdk/test/java/{util,io,lang}"
+ ) >&2
+ exit 1
+}
+
+set -eu
+declare -ar dirs=("$@")
+[[ "${#dirs[@]}" > 0 ]] || usage
+for dir in "${dirs[@]}"; do [[ -d "$dir" ]] || usage; done
+
+declare -ar modifiers=(
+ public protected private
+ abstract static final transient
+ volatile synchronized native strictfp
+)
+declare -r SAVE_IFS="$IFS"
+for ((i = 3; i < "${#modifiers[@]}"; i++)); do
+ IFS='|'; x="${modifiers[*]:0:i}" y="${modifiers[*]:i}"; IFS="$SAVE_IFS"
+ if [[ -n "$x" && -n "$y" ]]; then
+ find "${dirs[@]}" -name '*.java' -type f -print0 | \
+ xargs -0 perl -0777 -p -i -e \
+ "do {} while s/^([A-Za-z@* ]*)\b($y)(\s|(?:\s|\n\s+\*)*\s)($x)\b/\1\4\3\2/mg"
+ fi
+done
--- a/corba/.hgtags Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/.hgtags Tue Sep 22 11:01:54 2015 -0700
@@ -324,3 +324,4 @@
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
821a0373ef2d1642a9824facb938b901ad010413 jdk9-b80
45c35b7f5b40d5af0085e4a7b3a4d6e3e0347c35 jdk9-b81
+c20d8ebddaa6fb09cc81d3edf3d1d05f4232700a jdk9-b82
--- a/corba/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java Tue Sep 22 11:01:54 2015 -0700
@@ -37,9 +37,9 @@
protected byte elementData[];
/**
- * The number of valid components in this <tt>ByteBuffer</tt> object.
- * Components <tt>elementData[0]</tt> through
- * <tt>elementData[elementCount-1]</tt> are the actual items.
+ * The number of valid components in this {@code ByteBuffer} object.
+ * Components {@code elementData[0]} through
+ * {@code elementData[elementCount-1]} are the actual items.
*
* @serial
*/
@@ -88,7 +88,7 @@
/**
* Constructs an empty ByteBuffer so that its internal data array
- * has size <tt>10</tt> and its standard capacity increment is
+ * has size {@code 10} and its standard capacity increment is
* zero.
*/
public ByteBuffer() {
@@ -99,7 +99,7 @@
* Trims the capacity of this ByteBuffer to be the ByteBuffer's current
* size. If the capacity of this cector is larger than its current
* size, then the capacity is changed to equal the size by replacing
- * its internal data array, kept in the field <tt>elementData</tt>,
+ * its internal data array, kept in the field {@code elementData},
* with a smaller one. An application can use this operation to
* minimize the storage of a ByteBuffer.
*/
@@ -138,7 +138,7 @@
* Returns the current capacity of this ByteBuffer.
*
* @return the current capacity (the length of its internal
- * data arary, kept in the field <tt>elementData</tt>
+ * data arary, kept in the field {@code elementData}
* of this ByteBuffer.
*/
public int capacity() {
@@ -157,9 +157,9 @@
/**
* Tests if this ByteBuffer has no components.
*
- * @return <code>true</code> if and only if this ByteBuffer has
+ * @return {@code true} if and only if this ByteBuffer has
* no components, that is, its size is zero;
- * <code>false</code> otherwise.
+ * {@code false} otherwise.
*/
public boolean isEmpty() {
return elementCount == 0;
--- a/corba/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java Tue Sep 22 11:01:54 2015 -0700
@@ -438,11 +438,11 @@
}
/**
- * Writes a java.lang.Object as a CORBA Object. If <code>obj</code> is
+ * Writes a java.lang.Object as a CORBA Object. If {@code obj} is
* an exported RMI-IIOP server object, the tie is found
- * and wired to <code>obj</code>, then written to <code>out.write_Object(org.omg.CORBA.Object)</code>.
- * If <code>obj</code> is a CORBA Object, it is written to
- * <code>out.write_Object(org.omg.CORBA.Object)</code>.
+ * and wired to {@code obj}, then written to {@code out.write_Object(org.omg.CORBA.Object)}.
+ * If {@code obj} is a CORBA Object, it is written to
+ * {@code out.write_Object(org.omg.CORBA.Object)}.
* @param out the stream in which to write the object.
* @param obj the object to write.
*/
@@ -457,10 +457,10 @@
/**
* Writes a java.lang.Object as either a value or a CORBA Object.
- * If <code>obj</code> is a value object or a stub object, it is written to
- * <code>out.write_abstract_interface(java.lang.Object)</code>. If <code>obj</code> is an exported
- * RMI-IIOP server object, the tie is found and wired to <code>obj</code>,
- * then written to <code>out.write_abstract_interface(java.lang.Object)</code>.
+ * If {@code obj} is a value object or a stub object, it is written to
+ * {@code out.write_abstract_interface(java.lang.Object)}. If {@code obj} is an exported
+ * RMI-IIOP server object, the tie is found and wired to {@code obj},
+ * then written to {@code out.write_abstract_interface(java.lang.Object)}.
* @param out the stream in which to write the object.
* @param obj the object to write.
*/
@@ -595,7 +595,7 @@
* the class might be found. May be null.
* @param loader a class whose ClassLoader may be used to
* load the class if all other methods fail.
- * @return the <code>Class</code> object representing the loaded class.
+ * @return the {@code Class} object representing the loaded class.
* @exception ClassNotFoundException if class cannot be loaded.
*/
public Class loadClass( String className, String remoteCodebase,
@@ -605,20 +605,20 @@
}
/**
- * The <tt>isLocal</tt> method has the same semantics as the
+ * The {@code isLocal} method has the same semantics as the
* ObjectImpl._is_local method, except that it can throw a RemoteException.
* (no it doesn't but the spec says it should.)
*
- * The <tt>_is_local()</tt> method is provided so that stubs may determine
+ * The {@code _is_local()} method is provided so that stubs may determine
* if a particular object is implemented by a local servant and hence local
* invocation APIs may be used.
*
* @param stub the stub to test.
*
- * @return The <tt>_is_local()</tt> method returns true if
+ * @return The {@code _is_local()} method returns true if
* the servant incarnating the object is located in the same process as
- * the stub and they both share the same ORB instance. The <tt>_is_local()</tt>
- * method returns false otherwise. The default behavior of <tt>_is_local()</tt> is
+ * the stub and they both share the same ORB instance. The {@code _is_local()}
+ * method returns false otherwise. The default behavior of {@code _is_local()} is
* to return false.
*
* @throws RemoteException The Java to IDL specification does to
--- a/corba/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java Tue Sep 22 11:01:54 2015 -0700
@@ -93,7 +93,7 @@
* @param name Ignored
* @param ctx The non-null CNCtx whose ORB to use.
* @param env Ignored
- * @return The CORBA object for <tt>orig</tt> or null.
+ * @return The CORBA object for {@code orig} or null.
* @exception ConfigurationException If the CORBA object cannot be obtained
* due to configuration problems
* @exception NamingException If some other problem prevented a CORBA
--- a/corba/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/ORBSocketFactory.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/ORBSocketFactory.java Tue Sep 22 11:01:54 2015 -0700
@@ -165,7 +165,7 @@
* If number is 0 then use an emphemeral port for the listener of
* the associated type. <p>
*
- * If number is greater then 0 use that port number. <p>
+ * If number is greater than 0 use that port number. <p>
*
* An ORB creates a listener socket for each type
* specified by the user by calling
--- a/corba/src/java.corba/share/classes/javax/rmi/CORBA/Util.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/javax/rmi/CORBA/Util.java Tue Sep 22 11:01:54 2015 -0700
@@ -108,12 +108,12 @@
}
/**
- * Writes a java.lang.Object as a CORBA Object. If <code>obj</code> is
+ * Writes a java.lang.Object as a CORBA Object. If {@code obj} is
* an exported RMI-IIOP server object, the tie is found
- * and wired to <code>obj</code>, then written to
-<code>out.write_Object(org.omg.CORBA.Object)</code>.
- * If <code>obj</code> is a CORBA Object, it is written to
- * <code>out.write_Object(org.omg.CORBA.Object)</code>.
+ * and wired to {@code obj}, then written to
+ * {@code out.write_Object(org.omg.CORBA.Object)}.
+ * If {@code obj} is a CORBA Object, it is written to
+ * {@code out.write_Object(org.omg.CORBA.Object)}.
* @param out the stream in which to write the object.
* @param obj the object to write.
*/
@@ -128,12 +128,11 @@
/**
* Writes a java.lang.Object as either a value or a CORBA Object.
- * If <code>obj</code> is a value object or a stub object, it is written to
- * <code>out.write_abstract_interface(java.lang.Object)</code>. If <code>obj</code>
-is
-an exported
- * RMI-IIOP server object, the tie is found and wired to <code>obj</code>,
- * then written to <code>out.write_abstract_interface(java.lang.Object)</code>.
+ * If {@code obj} is a value object or a stub object, it is written to
+ * {@code out.write_abstract_interface(java.lang.Object)}.
+ * If {@code obj} is an exported
+ * RMI-IIOP server object, the tie is found and wired to {@code obj},
+ * then written to {@code out.write_abstract_interface(java.lang.Object)}.
* @param out the stream in which to write the object.
* @param obj the object to write.
*/
@@ -161,8 +160,8 @@
}
/**
- * Removes the associated tie from an internal table and calls {@link
-Tie#deactivate}
+ * Removes the associated tie from an internal table
+ * and calls {@link Tie#deactivate}
* to deactivate the object.
* @param target the object to unexport.
*/
@@ -219,27 +218,27 @@
* <P>The spec for this method is the "Java to IDL language
* mapping", ptc/00-01-06.
* <P>In Java SE Platform, this method works as follows:
- * <UL><LI>Find the first non-null <tt>ClassLoader</tt> on the
+ * <UL><LI>Find the first non-null {@code ClassLoader} on the
* call stack and attempt to load the class using this
- * <tt>ClassLoader</tt>.
- * <LI>If the first step fails, and if <tt>remoteCodebase</tt>
+ * {@code ClassLoader}.
+ * <LI>If the first step fails, and if {@code remoteCodebase}
* is non-null and
- * <tt>useCodebaseOnly</tt> is false, then call
- * <tt>java.rmi.server.RMIClassLoader.loadClass(remoteCodebase, className)</tt>.
- * <LI>If <tt>remoteCodebase</tt> is null or <tt>useCodebaseOnly</tt>
- * is true, then call <tt>java.rmi.server.RMIClassLoader.loadClass(className)</tt>.
+ * {@code useCodebaseOnly} is false, then call
+ * {@code java.rmi.server.RMIClassLoader.loadClass(remoteCodebase, className)}.
+ * <LI>If {@code remoteCodebase} is null or {@code useCodebaseOnly}
+ * is true, then call {@code java.rmi.server.RMIClassLoader.loadClass(className)}.
* <LI>If a class was not successfully loaded by step 1, 2, or 3,
- * and <tt>loader</tt> is non-null, then call <tt>loader.loadClass(className)</tt>.
+ * and {@code loader} is non-null, then call {@code loader.loadClass(className)}.
* <LI>If a class was successfully loaded by step 1, 2, 3, or 4, then
- * return the loaded class, else throw <tt>ClassNotFoundException</tt>.
+ * return the loaded class, else throw {@code ClassNotFoundException}.
* </UL>
*
* @param className the name of the class.
* @param remoteCodebase a space-separated list of URLs at which
* the class might be found. May be null.
- * @param loader a <tt>ClassLoader</tt> that may be used to
+ * @param loader a {@code ClassLoader} that may be used to
* load the class if all other methods fail.
- * @return the <code>Class</code> object representing the loaded class.
+ * @return the {@code Class} object representing the loaded class.
* @exception ClassNotFoundException if class cannot be loaded.
*/
public static Class loadClass(String className,
@@ -254,24 +253,24 @@
/**
- * The <tt>isLocal</tt> method has the same semantics as the
- * <tt>ObjectImpl._is_local</tt>
- * method, except that it can throw a <tt>RemoteException</tt>.
+ * The {@code isLocal} method has the same semantics as the
+ * {@code ObjectImpl._is_local}
+ * method, except that it can throw a {@code RemoteException}.
*
- * The <tt>_is_local()</tt> method is provided so that stubs may determine if a
+ * The {@code _is_local()} method is provided so that stubs may determine if a
* particular object is implemented by a local servant and hence local
* invocation APIs may be used.
*
* @param stub the stub to test.
*
- * @return The <tt>_is_local()</tt> method returns true if
+ * @return The {@code _is_local()} method returns true if
* the servant incarnating the object is located in the same process as
- * the stub and they both share the same ORB instance. The <tt>_is_local()</tt>
- * method returns false otherwise. The default behavior of <tt>_is_local()</tt> is
+ * the stub and they both share the same ORB instance. The {@code _is_local()}
+ * method returns false otherwise. The default behavior of {@code _is_local()} is
* to return false.
*
* @throws RemoteException The Java to IDL specification does not
- * specify the conditions that cause a <tt>RemoteException</tt> to be thrown.
+ * specify the conditions that cause a {@code RemoteException} to be thrown.
*/
public static boolean isLocal(Stub stub) throws RemoteException {
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/AnyHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/AnyHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,52 +30,52 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>Any</tt>. For more information on
+ * The Holder for {@code Any}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for <code>Any</code> objects
+ * A Holder class for {@code Any} objects
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>any</code> as an "out"
+ * If an IDL method signature has an IDL {@code any} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>AnyHolder</code> as the corresponding
+ * {@code AnyHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myAnyHolder</code> is an instance of <code>AnyHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myAnyHolder.value</code>.
+ * If {@code myAnyHolder} is an instance of {@code AnyHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myAnyHolder.value}.
*
* @since JDK1.2
*/
public final class AnyHolder implements Streamable {
/**
- * The <code>Any</code> value held by this <code>AnyHolder</code> object.
+ * The {@code Any} value held by this {@code AnyHolder} object.
*/
public Any value;
/**
- * Constructs a new <code>AnyHolder</code> object with its
- * <code>value</code> field initialized to <code>null</code>.
+ * Constructs a new {@code AnyHolder} object with its
+ * {@code value} field initialized to {@code null}.
*/
public AnyHolder() {
}
/**
- * Constructs a new <code>AnyHolder</code> object for the given
- * <code>Any</code> object.
- * @param initial the <code>Any</code> object with which to initialize
- * the <code>value</code> field of the new
- * <code>AnyHolder</code> object
+ * Constructs a new {@code AnyHolder} object for the given
+ * {@code Any} object.
+ * @param initial the {@code Any} object with which to initialize
+ * the {@code value} field of the new
+ * {@code AnyHolder} object
*/
public AnyHolder(Any initial) {
value = initial;
}
/**
- * Reads from <code>input</code> and initalizes the value in the Holder
+ * Reads from {@code input} and initalizes the value in the Holder
* with the unmarshalled data.
*
* @param input the InputStream containing CDR formatted data from the wire.
@@ -85,8 +85,8 @@
}
/**
- * Marshals to <code>output</code> the value in
- * this <code>AnyHolder</code> object.
+ * Marshals to {@code output} the value in
+ * this {@code AnyHolder} object.
*
* @param output the OutputStream which will contain the CDR formatted data.
*/
@@ -95,11 +95,11 @@
}
/**
- * Returns the <code>TypeCode</code> object corresponding to the value
- * held in this <code>AnyHolder</code> object.
+ * Returns the {@code TypeCode} object corresponding to the value
+ * held in this {@code AnyHolder} object.
*
* @return the TypeCode of the value held in
- * this <code>AnyHolder</code> object
+ * this {@code AnyHolder} object
*/
public TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_any);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/AnySeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/AnySeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,26 +26,26 @@
/**
-* The Helper for <tt>AnySeq</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/AnySeqHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*
-* The class definition has been modified to conform to the following
-* OMG specifications :
-* <ul>
-* <li> ORB core as defined by CORBA 2.3.1
-* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
-* </li>
-*
-* <li> IDL/Java Language Mapping as defined in
-* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
-* </li>
-* </ul>
-*/
+ * The Helper for {@code AnySeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/AnySeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
public abstract class AnySeqHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/AnySeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/AnySeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>AnySeq</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/AnySeqHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*/
+ * The Holder for {@code AnySeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/AnySeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
public final class AnySeqHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,8 +25,8 @@
package org.omg.CORBA;
/**
- * A <tt>PolicyErrorCode</tt> which would be filled in
- * the <tt>PolicyError</tt> exception.
+ * A {@code PolicyErrorCode} which would be filled in
+ * the {@code PolicyError} exception.
*
* @author rip-dev
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_TYPE.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_TYPE.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,8 +26,8 @@
package org.omg.CORBA;
/**
- * A <tt>PolicyErrorCode</tt> which would be filled in
- * the <tt>PolicyError</tt> exception.
+ * A {@code PolicyErrorCode} which would be filled in
+ * the {@code PolicyError} exception.
*
* @author rip-dev
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java Tue Sep 22 11:01:54 2015 -0700
@@ -27,7 +27,7 @@
/**
* Exception thrown when the ORB has encountered a malformed type code
- * (for example, a type code with an invalid <tt>TCKind</tt> value).<P>
+ * (for example, a type code with an invalid {@code TCKind} value).<P>
* It contains a minor code, which gives more detailed information about
* what caused the exception, and a completion status. It may also contain
* a string describing the exception.
@@ -40,7 +40,7 @@
public final class BAD_TYPECODE extends SystemException {
/**
- * Constructs a <code>BAD_TYPECODE</code> exception with a default
+ * Constructs a {@code BAD_TYPECODE} exception with a default
* minor code of 0 and a completion state of COMPLETED_NO.
*/
public BAD_TYPECODE() {
@@ -48,7 +48,7 @@
}
/**
- * Constructs a <code>BAD_TYPECODE</code> exception with the specified detail,
+ * Constructs a {@code BAD_TYPECODE} exception with the specified detail,
* a minor code of 0, and a completion state of COMPLETED_NO.
*
* @param s the String containing a detail message
@@ -58,10 +58,10 @@
}
/**
- * Constructs a <code>BAD_TYPECODE</code> exception with the specified
+ * Constructs a {@code BAD_TYPECODE} exception with the specified
* minor code and completion status.
* @param minor the minor code
- * @param completed an instance of <code>CompletionStatus</code> indicating
+ * @param completed an instance of {@code CompletionStatus} indicating
* the completion status
*/
public BAD_TYPECODE(int minor, CompletionStatus completed) {
@@ -69,12 +69,12 @@
}
/**
- * Constructs a <code>BAD_TYPECODE</code> exception with the specified detail
+ * Constructs a {@code BAD_TYPECODE} exception with the specified detail
* message, minor code, and completion status.
* A detail message is a String that describes this particular exception.
* @param s the String containing a detail message
* @param minor the minor code
- * @param completed an instance of <code>CompletionStatus</code> indicating
+ * @param completed an instance of {@code CompletionStatus} indicating
* the completion status
*/
public BAD_TYPECODE(String s, int minor, CompletionStatus completed) {
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/BooleanHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BooleanHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,56 +30,56 @@
/**
- * The Holder for <tt>Boolean</tt>. For more information on
+ * The Holder for {@code Boolean}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>boolean</code>
+ * A Holder class for a {@code boolean}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>boolean</code> as an "out"
+ * If an IDL method signature has an IDL {@code boolean} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>BooleanHolder</code> as the corresponding
+ * {@code BooleanHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myBooleanHolder</code> is an instance of <code>BooleanHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myBooleanHolder.value</code>.
+ * If {@code myBooleanHolder} is an instance of {@code BooleanHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myBooleanHolder.value}.
*
* @since JDK1.2
*/
public final class BooleanHolder implements Streamable {
/**
- * The <code>boolean</code> value held by this <code>BooleanHolder</code>
+ * The {@code boolean} value held by this {@code BooleanHolder}
* object.
*/
public boolean value;
/**
- * Constructs a new <code>BooleanHolder</code> object with its
- * <code>value</code> field initialized to <code>false</code>.
+ * Constructs a new {@code BooleanHolder} object with its
+ * {@code value} field initialized to {@code false}.
*/
public BooleanHolder() {
}
/**
- * Constructs a new <code>BooleanHolder</code> object with its
- * <code>value</code> field initialized with the given <code>boolean</code>.
- * @param initial the <code>boolean</code> with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>BooleanHolder</code> object
+ * Constructs a new {@code BooleanHolder} object with its
+ * {@code value} field initialized with the given {@code boolean}.
+ * @param initial the {@code boolean} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code BooleanHolder} object
*/
public BooleanHolder(boolean initial) {
value = initial;
}
/**
- * Reads unmarshalled data from <code>input</code> and assigns it to this
- * <code>BooleanHolder</code> object's <code>value</code> field.
+ * Reads unmarshalled data from {@code input} and assigns it to this
+ * {@code BooleanHolder} object's {@code value} field.
*
- * @param input the <code>InputStream</code> object containing
+ * @param input the {@code InputStream} object containing
* CDR formatted data from the wire
*/
public void _read(InputStream input) {
@@ -87,8 +87,8 @@
}
/**
- * Marshals the value in this <code>BooleanHolder</code> object's
- * <code>value</code> field to the output stream <code>output</code>.
+ * Marshals the value in this {@code BooleanHolder} object's
+ * {@code value} field to the output stream {@code output}.
*
* @param output the OutputStream which will contain the CDR formatted data
*/
@@ -97,11 +97,11 @@
}
/**
- * Retrieves the <code>TypeCode</code> object that corresponds to the
- * value held in this <code>BooleanHolder</code> object.
+ * Retrieves the {@code TypeCode} object that corresponds to the
+ * value held in this {@code BooleanHolder} object.
*
- * @return the <code>TypeCode</code> for the value held
- * in this <code>BooleanHolder</code> object
+ * @return the {@code TypeCode} for the value held
+ * in this {@code BooleanHolder} object
*/
public TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_boolean);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,26 +26,26 @@
/**
-* The Helper for <tt>BooleanSeq</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/BooleanSeqHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*
-* The class definition has been modified to conform to the following
-* OMG specifications :
-* <ul>
-* <li> ORB core as defined by CORBA 2.3.1
-* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
-* </li>
-*
-* <li> IDL/Java Language Mapping as defined in
-* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
-* </li>
-* </ul>
-*/
+ * The Helper for {@code BooleanSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/BooleanSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
public abstract class BooleanSeqHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>BooleanSeq</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/BooleanSeqHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*/
+ * The Holder for {@code BooleanSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/BooleanSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
public final class BooleanSeqHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ByteHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ByteHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,54 +31,54 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>Byte</tt>. For more information on
+ * The Holder for {@code Byte}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>byte</code>
+ * A Holder class for a {@code byte}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>octet</code> as an "out"
+ * If an IDL method signature has an IDL {@code octet} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>ByteHolder</code> as the corresponding
+ * {@code ByteHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myByteHolder</code> is an instance of <code>ByteHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myByteHolder.value</code>.
+ * If {@code myByteHolder} is an instance of {@code ByteHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myByteHolder.value}.
*
* @since JDK1.2
*/
public final class ByteHolder implements Streamable {
/**
- * The <code>byte</code> value held by this <code>ByteHolder</code>
+ * The {@code byte} value held by this {@code ByteHolder}
* object.
*/
public byte value;
/**
- * Constructs a new <code>ByteHolder</code> object with its
- * <code>value</code> field initialized to 0.
+ * Constructs a new {@code ByteHolder} object with its
+ * {@code value} field initialized to 0.
*/
public ByteHolder() {
}
/**
- * Constructs a new <code>ByteHolder</code> object for the given
- * <code>byte</code>.
- * @param initial the <code>byte</code> with which to initialize
- * the <code>value</code> field of the new
- * <code>ByteHolder</code> object
+ * Constructs a new {@code ByteHolder} object for the given
+ * {@code byte}.
+ * @param initial the {@code byte} with which to initialize
+ * the {@code value} field of the new
+ * {@code ByteHolder} object
*/
public ByteHolder(byte initial) {
value = initial;
}
/**
- * Reads from <code>input</code> and initalizes the value in
- * this <code>ByteHolder</code> object
+ * Reads from {@code input} and initalizes the value in
+ * this {@code ByteHolder} object
* with the unmarshalled data.
*
* @param input the InputStream containing CDR formatted data from the wire.
@@ -88,8 +88,8 @@
}
/**
- * Marshals to <code>output</code> the value in
- * this <code>ByteHolder</code> object.
+ * Marshals to {@code output} the value in
+ * this {@code ByteHolder} object.
*
* @param output the OutputStream which will contain the CDR formatted data.
*/
@@ -99,10 +99,10 @@
/**
* Returns the TypeCode corresponding to the value held in
- * this <code>ByteHolder</code> object.
+ * this {@code ByteHolder} object.
*
- * @return the TypeCode of the value held in
- * this <code>ByteHolder</code> object
+ * @return the TypeCode of the value held in
+ * this {@code ByteHolder} object
*/
public org.omg.CORBA.TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_octet);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CharHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CharHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,54 +31,54 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>Char</tt>. For more information on
+ * The Holder for {@code Char}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>char</code>
+ * A Holder class for a {@code char}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>char</code> as an "out"
+ * If an IDL method signature has an IDL {@code char} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>CharHolder</code> as the corresponding
+ * {@code CharHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myCharHolder</code> is an instance of <code>CharHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myCharHolder.value</code>.
+ * If {@code myCharHolder} is an instance of {@code CharHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myCharHolder.value}.
*
* @since JDK1.2
*/
public final class CharHolder implements Streamable {
/**
- * The <code>char</code> value held by this <code>CharHolder</code>
+ * The {@code char} value held by this {@code CharHolder}
* object.
*/
public char value;
/**
- * Constructs a new <code>CharHolder</code> object with its
- * <code>value</code> field initialized to <code>0</code>.
+ * Constructs a new {@code CharHolder} object with its
+ * {@code value} field initialized to {@code 0}.
*/
public CharHolder() {
}
/**
- * Constructs a new <code>CharHolder</code> object for the given
- * <code>char</code>.
- * @param initial the <code>char</code> with which to initialize
- * the <code>value</code> field of the new
- * <code>CharHolder</code> object
+ * Constructs a new {@code CharHolder} object for the given
+ * {@code char}.
+ * @param initial the {@code char} with which to initialize
+ * the {@code value} field of the new
+ * {@code CharHolder} object
*/
public CharHolder(char initial) {
value = initial;
}
/**
- * Reads from <code>input</code> and initalizes the value in
- * this <code>CharHolder</code> object
+ * Reads from {@code input} and initalizes the value in
+ * this {@code CharHolder} object
* with the unmarshalled data.
*
* @param input the InputStream containing CDR formatted data from the wire
@@ -88,8 +88,8 @@
}
/**
- * Marshals to <code>output</code> the value in
- * this <code>CharHolder</code> object.
+ * Marshals to {@code output} the value in
+ * this {@code CharHolder} object.
*
* @param output the OutputStream which will contain the CDR formatted data
*/
@@ -98,12 +98,12 @@
}
/**
- * Returns the <code>TypeCode</code> object corresponding
+ * Returns the {@code TypeCode} object corresponding
* to the value held in
- * this <code>CharHolder</code> object.
+ * this {@code CharHolder} object.
*
* @return the TypeCode of the value held in
- * this <code>CharHolder</code> object
+ * this {@code CharHolder} object
*/
public org.omg.CORBA.TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_char);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CharSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CharSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,26 +26,26 @@
/**
-* The Helper for <tt>CharSeq</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/CharSeqHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*
-* The class definition has been modified to conform to the following
-* OMG specifications :
-* <ul>
-* <li> ORB core as defined by CORBA 2.3.1
-* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
-* </li>
-*
-* <li> IDL/Java Language Mapping as defined in
-* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
-* </li>
-* </ul>
-*/
+ * The Helper for {@code CharSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/CharSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
public abstract class CharSeqHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CharSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CharSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>CharSeq</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/CharSeqHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*/
+ * The Holder for {@code CharSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/CharSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
public final class CharSeqHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CompletionStatusHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CompletionStatusHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,13 +26,13 @@
/**
-* The Helper for <tt>CompletionStatus</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/CompletionStatusHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* 03 June 1999 11:52:03 o'clock GMT+00:00
-*/
+ * The Helper for {@code CompletionStatus}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/CompletionStatusHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * 03 June 1999 11:52:03 o'clock GMT+00:00
+ */
abstract public class CompletionStatusHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/Current.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/Current.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,16 +26,16 @@
/**
-* Interfaces derived from the <tt>Current</tt> interface enable ORB and CORBA
+* Interfaces derived from the {@code Current} interface enable ORB and CORBA
* services to provide access to information (context) associated with
* the thread of execution in which they are running. This information
* is accessed in a structured manner using interfaces derived from the
-* <tt>Current</tt> interface defined in the CORBA module.
+* {@code Current} interface defined in the CORBA module.
*
* <P>Each ORB or CORBA service that needs its own context derives an
-* interface from the CORBA module's <tt>Current</tt>. Users of the
-* service can obtain an instance of the appropriate <tt>Current</tt>
-* interface by invoking <tt>ORB::resolve_initial_references</tt>.<P>
+* interface from the CORBA module's {@code Current}. Users of the
+* service can obtain an instance of the appropriate {@code Current}
+* interface by invoking {@code ORB::resolve_initial_references}.<P>
*
* org/omg/CORBA/Current.java
* Generated by the IDL-to-Java compiler (portable), version "3.0"
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CurrentHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CurrentHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Helper for <tt>Current</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/CurrentHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:21 AM PDT
-*/
+ * The Helper for {@code Current}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/CurrentHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT
+ */
abstract public class CurrentHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CurrentHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CurrentHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,14 +25,14 @@
package org.omg.CORBA;
/**
-* The Holder for <tt>Current</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/CurrentHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:21 AM PDT
-*/
+ * The Holder for {@code Current}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/CurrentHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT
+ */
public final class CurrentHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CurrentOperations.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CurrentOperations.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,15 +26,15 @@
/**
-* The interface for <tt>Current</tt>. For more information on
-* Operations interfaces, see <a href="doc-files/generatedfiles.html">
-* "Generated Files"</a>.
-*
-* org/omg/CORBA/CurrentOperations.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:21 AM PDT.
-*/
+ * The interface for {@code Current}. For more information on
+ * Operations interfaces, see <a href="doc-files/generatedfiles.html">
+ * "Generated Files"</a>.
+ *
+ * org/omg/CORBA/CurrentOperations.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT.
+ */
public interface CurrentOperations
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/CustomMarshal.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/CustomMarshal.java Tue Sep 22 11:01:54 2015 -0700
@@ -34,7 +34,7 @@
* as a custom value type's implicit base class, although the custom
* valuetype does not actually inherit it in IDL. The implementer
* of a custom value type shall provide an implementation of the
- * <tt>CustomMarshal</tt> operations. The manner in which this is done is
+ * {@code CustomMarshal} operations. The manner in which this is done is
* specified in the IDL to Java langauge mapping. Each custom
* marshaled value type shall have its own implementation.
* @see DataInputStream
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DefinitionKindHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DefinitionKindHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Helper for <tt>DefinitionKind</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/DefinitionKindHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ir.idl
-* 03 June 1999 11:33:43 o'clock GMT+00:00
-*/
+ * The Helper for {@code DefinitionKind}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/DefinitionKindHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ir.idl
+ * 03 June 1999 11:33:43 o'clock GMT+00:00
+ */
abstract public class DefinitionKindHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DomainManager.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DomainManager.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,11 +25,12 @@
package org.omg.CORBA;
-/** Provides mechanisms for establishing and navigating relationships to
+/**
+ * Provides mechanisms for establishing and navigating relationships to
* superior and subordinate domains, as well as for creating and accessing
- * policies. The <tt>DomainManager</tt> has associated with it the policy
- * objects for a
- * particular domain. The domain manager also records the membership of
+ * policies. The {@code DomainManager} has associated with it the policy
+ * objects for a particular domain.
+ * The domain manager also records the membership of
* the domain and provides the means to add and remove members. The domain
* manager is itself a member of a domain, possibly the domain it manages.
* The domain manager provides mechanisms for establishing and navigating
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DomainManagerOperations.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DomainManagerOperations.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,9 +26,9 @@
package org.omg.CORBA;
/**
- * Provides the <tt>DomainManager</tt> with the means to access policies.
+ * Provides the {@code DomainManager} with the means to access policies.
* <P>
- * The <tt>DomainManager</tt> has associated with it the policy objects for a
+ * The {@code DomainManager} has associated with it the policy objects for a
* particular domain. The domain manager also records the membership of
* the domain and provides the means to add and remove members. The domain
* manager is itself a member of a domain, possibly the domain it manages.
@@ -39,11 +39,12 @@
public interface DomainManagerOperations
{
- /** This returns the policy of the specified type for objects in
+ /**
+ * This returns the policy of the specified type for objects in
* this domain. The types of policies available are domain specific.
* See the CORBA specification for a list of standard ORB policies.
*
- *@param policy_type Type of policy to request
+ * @param policy_type Type of policy to request
*/
public org.omg.CORBA.Policy get_domain_policy(int policy_type);
}
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DoubleHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DoubleHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,47 +30,47 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>Double</tt>. For more information on
+ * The Holder for {@code Double}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>double</code>
+ * A Holder class for a {@code double}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>double</code> as an "out"
+ * If an IDL method signature has an IDL {@code double} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>DoubleHolder</code> as the corresponding
+ * {@code DoubleHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myDoubleHolder</code> is an instance of <code>DoubleHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myDoubleHolder.value</code>.
+ * If {@code myDoubleHolder} is an instance of {@code DoubleHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myDoubleHolder.value}.
*
* @since JDK1.2
*/
public final class DoubleHolder implements Streamable {
/**
- * The <code>double</code> value held by this <code>DoubleHolder</code>
+ * The {@code double} value held by this {@code DoubleHolder}
* object.
*/
public double value;
/**
- * Constructs a new <code>DoubleHolder</code> object with its
- * <code>value</code> field initialized to 0.0.
+ * Constructs a new {@code DoubleHolder} object with its
+ * {@code value} field initialized to 0.0.
*/
public DoubleHolder() {
}
/**
- * Constructs a new <code>DoubleHolder</code> object for the given
- * <code>double</code>.
- * @param initial the <code>double</code> with which to initialize
- * the <code>value</code> field of the new
- * <code>DoubleHolder</code> object
+ * Constructs a new {@code DoubleHolder} object for the given
+ * {@code double}.
+ * @param initial the {@code double} with which to initialize
+ * the {@code value} field of the new
+ * {@code DoubleHolder} object
*/
public DoubleHolder(double initial) {
value = initial;
@@ -80,7 +80,7 @@
* Read a double value from the input stream and store it in the
* value member.
*
- * @param input the <code>InputStream</code> to read from.
+ * @param input the {@code InputStream} to read from.
*/
public void _read(InputStream input) {
value = input.read_double();
@@ -88,18 +88,18 @@
/**
* Write the double value stored in this holder to an
- * <code>OutputStream</code>.
+ * {@code OutputStream}.
*
- * @param output the <code>OutputStream</code> to write into.
+ * @param output the {@code OutputStream} to write into.
*/
public void _write(OutputStream output) {
output.write_double(value);
}
/**
- * Return the <code>TypeCode</code> of this holder object.
+ * Return the {@code TypeCode} of this holder object.
*
- * @return the <code>TypeCode</code> object.
+ * @return the {@code TypeCode} object.
*/
public org.omg.CORBA.TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_double);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,26 +26,26 @@
/**
-* The Helper for <tt>DoubleSeq</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/DoubleSeqHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:37 o'clock GMT+00:00
-*
-* The class definition has been modified to conform to the following
-* OMG specifications :
-* <ul>
-* <li> ORB core as defined by CORBA 2.3.1
-* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
-* </li>
-*
-* <li> IDL/Java Language Mapping as defined in
-* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
-* </li>
-* </ul>
-*/
+ * The Helper for {@code DoubleSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/DoubleSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
public abstract class DoubleSeqHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>DoubleSeq</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/DoubleSeqHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:37 o'clock GMT+00:00
-*/
+ * The Holder for {@code DoubleSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/DoubleSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ */
public final class DoubleSeqHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DynAny.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DynAny.java Tue Sep 22 11:01:54 2015 -0700
@@ -27,367 +27,368 @@
package org.omg.CORBA;
-/** Enables <tt>org.omg.CORBA.Any</tt> values to be dynamically
+/**
+ * Enables {@code org.omg.CORBA.Any} values to be dynamically
* interpreted (traversed) and
- * constructed. A <tt>DynAny</tt> object is associated with a data value
- * which may correspond to a copy of the value inserted into an <tt>Any</tt>.
- * The <tt>DynAny</tt> APIs enable traversal of the data value associated with an
- * Any at runtime and extraction of the primitive constituents of the
- * data value.
+ * constructed. A {@code DynAny} object is associated with a data value
+ * which may correspond to a copy of the value inserted into an {@code Any}.
+ * The {@code DynAny} APIs enable traversal of the data value associated with an
+ * Any at runtime and extraction of the primitive constituents of the
+ * data value.
* @deprecated Use the new <a href="../DynamicAny/DynAny.html">DynAny</a> instead
*/
@Deprecated
public interface DynAny extends org.omg.CORBA.Object
{
/**
- * Returns the <code>TypeCode</code> of the object inserted into
- * this <code>DynAny</code>.
+ * Returns the {@code TypeCode} of the object inserted into
+ * this {@code DynAny}.
*
- * @return the <code>TypeCode</code> object.
+ * @return the {@code TypeCode} object.
*/
public org.omg.CORBA.TypeCode type() ;
/**
* Copy the contents from one Dynamic Any into another.
*
- * @param dyn_any the <code>DynAny</code> object whose contents
- * are assigned to this <code>DynAny</code>.
+ * @param dyn_any the {@code DynAny} object whose contents
+ * are assigned to this {@code DynAny}.
* @throws org.omg.CORBA.DynAnyPackage.Invalid if the source
- * <code>DynAny</code> is invalid
+ * {@code DynAny} is invalid
*/
public void assign(org.omg.CORBA.DynAny dyn_any)
throws org.omg.CORBA.DynAnyPackage.Invalid;
/**
- * Make a <code>DynAny</code> object from an <code>Any</code>
+ * Make a {@code DynAny} object from an {@code Any}
* object.
*
- * @param value the <code>Any</code> object.
+ * @param value the {@code Any} object.
* @throws org.omg.CORBA.DynAnyPackage.Invalid if the source
- * <code>Any</code> object is empty or bad
+ * {@code Any} object is empty or bad
*/
public void from_any(org.omg.CORBA.Any value)
throws org.omg.CORBA.DynAnyPackage.Invalid;
/**
- * Convert a <code>DynAny</code> object to an <code>Any</code>
+ * Convert a {@code DynAny} object to an {@code Any}
* object.
*
- * @return the <code>Any</code> object.
+ * @return the {@code Any} object.
* @throws org.omg.CORBA.DynAnyPackage.Invalid if this
- * <code>DynAny</code> is empty or bad.
+ * {@code DynAny} is empty or bad.
* created or does not contain a meaningful value
*/
public org.omg.CORBA.Any to_any()
throws org.omg.CORBA.DynAnyPackage.Invalid;
/**
- * Destroys this <code>DynAny</code> object and frees any resources
+ * Destroys this {@code DynAny} object and frees any resources
* used to represent the data value associated with it. This method
- * also destroys all <code>DynAny</code> objects obtained from it.
+ * also destroys all {@code DynAny} objects obtained from it.
* <p>
- * Destruction of <code>DynAny</code> objects should be handled with
+ * Destruction of {@code DynAny} objects should be handled with
* care, taking into account issues dealing with the representation of
- * data values associated with <code>DynAny</code> objects. A programmer
- * who wants to destroy a <code>DynAny</code> object but still be able
+ * data values associated with {@code DynAny} objects. A programmer
+ * who wants to destroy a {@code DynAny} object but still be able
* to manipulate some component of the data value associated with it,
- * should first create a <code>DynAny</code> object for the component
- * and then make a copy of the created <code>DynAny</code> object.
+ * should first create a {@code DynAny} object for the component
+ * and then make a copy of the created {@code DynAny} object.
*/
public void destroy() ;
/**
- * Clones this <code>DynAny</code> object.
+ * Clones this {@code DynAny} object.
*
- * @return a copy of this <code>DynAny</code> object
+ * @return a copy of this {@code DynAny} object
*/
public org.omg.CORBA.DynAny copy() ;
/**
- * Inserts the given <code>boolean</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code boolean} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>boolean</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code boolean} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_boolean(boolean value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>byte</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code byte} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>byte</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code byte} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_octet(byte value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>char</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code char} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>char</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code char} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_char(char value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>short</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code short} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>short</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code short} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_short(short value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>short</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code short} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>short</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code short} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_ushort(short value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>int</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code int} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>int</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code int} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_long(int value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>int</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code int} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>int</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code int} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_ulong(int value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>float</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code float} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>float</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code float} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_float(float value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>double</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code double} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>double</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code double} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_double(double value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>String</code> object as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code String} object as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>String</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code String} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_string(String value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>org.omg.CORBA.Object</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code org.omg.CORBA.Object} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>org.omg.CORBA.Object</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code org.omg.CORBA.Object} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_reference(org.omg.CORBA.Object value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>org.omg.CORBA.TypeCode</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code org.omg.CORBA.TypeCode} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>org.omg.CORBA.TypeCode</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code org.omg.CORBA.TypeCode} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_typecode(org.omg.CORBA.TypeCode value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>long</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code long} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>long</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code long} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_longlong(long value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>long</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code long} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>long</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code long} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_ulonglong(long value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>char</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code char} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>char</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code char} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_wchar(char value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>String</code> as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code String} as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>String</code> to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code String} to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_wstring(String value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Inserts the given <code>org.omg.CORBA.Any</code> object as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code org.omg.CORBA.Any} object as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>org.omg.CORBA.Any</code> object to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code org.omg.CORBA.Any} object to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_any(org.omg.CORBA.Any value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
@@ -395,32 +396,32 @@
// orbos 98-01-18: Objects By Value -- begin
/**
- * Inserts the given <code>java.io.Serializable</code> object as the value for this
- * <code>DynAny</code> object.
+ * Inserts the given {@code java.io.Serializable} object as the value for this
+ * {@code DynAny} object.
*
- * <p> If this method is called on a constructed <code>DynAny</code>
+ * <p> If this method is called on a constructed {@code DynAny}
* object, it initializes the next component of the constructed data
- * value associated with this <code>DynAny</code> object.
+ * value associated with this {@code DynAny} object.
*
- * @param value the <code>java.io.Serializable</code> object to insert into this
- * <code>DynAny</code> object
+ * @param value the {@code java.io.Serializable} object to insert into this
+ * {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.InvalidValue
* if the value inserted is not consistent with the type
- * of the accessed component in this <code>DynAny</code> object
+ * of the accessed component in this {@code DynAny} object
*/
public void insert_val(java.io.Serializable value)
throws org.omg.CORBA.DynAnyPackage.InvalidValue;
/**
- * Retrieves the <code>java.io.Serializable</code> object contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code java.io.Serializable} object contained
+ * in this {@code DynAny} object.
*
- * @return the <code>java.io.Serializable</code> object that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code java.io.Serializable} object that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>java.io.Serializable</code> object
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code java.io.Serializable} object
*/
public java.io.Serializable get_val()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
@@ -428,284 +429,284 @@
// orbos 98-01-18: Objects By Value -- end
/**
- * Retrieves the <code>boolean</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code boolean} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>boolean</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code boolean} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>boolean</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code boolean}
*/
public boolean get_boolean()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>byte</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code byte} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>byte</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code byte} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>byte</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code byte}
*/
public byte get_octet()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>char</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code char} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>char</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code char} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>char</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code char}
*/
public char get_char()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>short</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code short} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>short</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code short} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>short</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code short}
*/
public short get_short()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>short</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code short} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>short</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code short} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>short</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code short}
*/
public short get_ushort()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>int</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code int} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>int</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code int} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>int</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code int}
*/
public int get_long()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>int</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code int} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>int</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code int} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>int</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code int}
*/
public int get_ulong()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>float</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code float} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>float</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code float} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>float</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code float}
*/
public float get_float()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>double</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code double} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>double</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code double} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>double</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code double}
*/
public double get_double()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>String</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code String} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>String</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code String} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>String</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code String}
*/
public String get_string()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>org.omg.CORBA.Other</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code org.omg.CORBA.Other} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>org.omg.CORBA.Other</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code org.omg.CORBA.Other} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for an <code>org.omg.CORBA.Other</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for an {@code org.omg.CORBA.Other}
*/
public org.omg.CORBA.Object get_reference()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>org.omg.CORBA.TypeCode</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code org.omg.CORBA.TypeCode} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>org.omg.CORBA.TypeCode</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code org.omg.CORBA.TypeCode} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>org.omg.CORBA.TypeCode</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code org.omg.CORBA.TypeCode}
*/
public org.omg.CORBA.TypeCode get_typecode()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>long</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code long} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>long</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code long} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>long</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code long}
*/
public long get_longlong()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>long</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code long} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>long</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code long} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>long</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code long}
*/
public long get_ulonglong()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>char</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code char} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>char</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code char} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>char</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code char}
*/
public char get_wchar()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>String</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code String} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>String</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code String} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for a <code>String</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code String}
*/
public String get_wstring()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Retrieves the <code>org.omg.CORBA.Any</code> contained
- * in this <code>DynAny</code> object.
+ * Retrieves the {@code org.omg.CORBA.Any} contained
+ * in this {@code DynAny} object.
*
- * @return the <code>org.omg.CORBA.Any</code> that is the
- * value for this <code>DynAny</code> object
+ * @return the {@code org.omg.CORBA.Any} that is the
+ * value for this {@code DynAny} object
* @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
* if the type code of the accessed component in this
- * <code>DynAny</code> object is not equivalent to
- * the type code for an <code>org.omg.CORBA.Any</code>
+ * {@code DynAny} object is not equivalent to
+ * the type code for an {@code org.omg.CORBA.Any}
*/
public org.omg.CORBA.Any get_any()
throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
/**
- * Returns a <code>DynAny</code> object reference that can
+ * Returns a {@code DynAny} object reference that can
* be used to get/set the value of the component currently accessed.
- * The appropriate <code>insert</code> method
- * can be called on the resulting <code>DynAny</code> object
+ * The appropriate {@code insert} method
+ * can be called on the resulting {@code DynAny} object
* to initialize the component.
- * The appropriate <code>get</code> method
- * can be called on the resulting <code>DynAny</code> object
+ * The appropriate {@code get} method
+ * can be called on the resulting {@code DynAny} object
* to extract the value of the component.
*
- * @return a <code>DynAny</code> object reference that can be
+ * @return a {@code DynAny} object reference that can be
* used to retrieve or set the value of the component currently
* accessed
*/
public org.omg.CORBA.DynAny current_component() ;
/**
- * Moves to the next component of this <code>DynAny</code> object.
+ * Moves to the next component of this {@code DynAny} object.
* This method is used for iterating through the components of
* a constructed type, effectively moving a pointer from one
* component to the next. The pointer starts out on the first
- * component when a <code>DynAny</code> object is created.
+ * component when a {@code DynAny} object is created.
*
- * @return <code>true</code> if the pointer points to a component;
- * <code>false</code> if there are no more components or this
- * <code>DynAny</code> is associated with a basic type rather than
+ * @return {@code true} if the pointer points to a component;
+ * {@code false} if there are no more components or this
+ * {@code DynAny} is associated with a basic type rather than
* a constructed type
*/
public boolean next() ;
@@ -714,12 +715,12 @@
* Moves the internal pointer to the given index. Logically, this method
* sets a new offset for this pointer.
*
- * @param index an <code>int</code> indicating the position to which
+ * @param index an {@code int} indicating the position to which
* the pointer should move. The first position is 0.
- * @return <code>true</code> if the pointer points to a component;
- * <code>false</code> if there is no component at the designated
- * index. If this <code>DynAny</code> object is associated with a
- * basic type, this method returns <code>false</code> for any index
+ * @return {@code true} if the pointer points to a component;
+ * {@code false} if there is no component at the designated
+ * index. If this {@code DynAny} object is associated with a
+ * basic type, this method returns {@code false} for any index
* other than 0.
*/
public boolean seek(int index) ;
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DynArray.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DynArray.java Tue Sep 22 11:01:54 2015 -0700
@@ -27,8 +27,9 @@
package org.omg.CORBA;
-/** Represents a <tt>DynAny</tt> object associated
- * with an array.
+/**
+ * Represents a {@code DynAny} object associated with an array.
+ *
* @deprecated Use the new <a href="../DynamicAny/DynArray.html">DynArray</a> instead
*/
@Deprecated
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/DynEnum.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/DynEnum.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,8 +26,9 @@
package org.omg.CORBA;
-/** Represents a <tt>DynAny</tt> object associated
- * with an IDL enum.
+/**
+ * Represents a {@code DynAny} object associated with an IDL enum.
+ *
* @deprecated Use the new <a href="../DynamicAny/DynEnum.html">DynEnum</a> instead
*/
@Deprecated
@@ -35,14 +36,14 @@
{
/**
* Return the value of the IDL enum stored in this
- * <code>DynEnum</code> as a string.
+ * {@code DynEnum} as a string.
*
* @return the stringified value.
*/
public String value_as_string();
/**
- * Set a particular enum in this <code>DynEnum</code>.
+ * Set a particular enum in this {@code DynEnum}.
*
* @param arg the string corresponding to the value.
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/FieldNameHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/FieldNameHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,13 +26,13 @@
/**
-* The Helper for <tt>FieldName</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/FieldNameHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* 03 June 1999 11:52:03 o'clock GMT+00:00
-*/
+ * The Helper for {@code FieldName}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/FieldNameHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * 03 June 1999 11:52:03 o'clock GMT+00:00
+ */
abstract public class FieldNameHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/FixedHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/FixedHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,7 +31,7 @@
/**
- * The Holder for <tt>Fixed</tt>. For more information on
+ * The Holder for {@code Fixed}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* FixedHolder is a container class for values of IDL type "fixed",
@@ -69,7 +69,7 @@
* Read a fixed point value from the input stream and store it in
* the value member.
*
- * @param input the <code>InputStream</code> to read from.
+ * @param input the {@code InputStream} to read from.
*/
public void _read(InputStream input) {
value = input.read_fixed();
@@ -77,9 +77,9 @@
/**
* Write the fixed point value stored in this holder to an
- * <code>OutputStream</code>.
+ * {@code OutputStream}.
*
- * @param output the <code>OutputStream</code> to write into.
+ * @param output the {@code OutputStream} to write into.
*/
public void _write(OutputStream output) {
output.write_fixed(value);
@@ -87,9 +87,9 @@
/**
- * Return the <code>TypeCode</code> of this holder object.
+ * Return the {@code TypeCode} of this holder object.
*
- * @return the <code>TypeCode</code> object.
+ * @return the {@code TypeCode} object.
*/
public org.omg.CORBA.TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_fixed);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/FloatHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/FloatHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,45 +31,45 @@
/**
- * The Holder for <tt>Float</tt>. For more information on
+ * The Holder for {@code Float}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>float</code>
+ * A Holder class for a {@code float}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>float</code> as an "out"
+ * If an IDL method signature has an IDL {@code float} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>FloatHolder</code> as the corresponding
+ * {@code FloatHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myFloatHolder</code> is an instance of <code>FloatHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myFloatHolder.value</code>.
+ * If {@code myFloatHolder} is an instance of {@code FloatHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myFloatHolder.value}.
*
* @since JDK1.2
*/
public final class FloatHolder implements Streamable {
/**
- * The <code>float</code> value held by this <code>FloatHolder</code>
+ * The {@code float} value held by this {@code FloatHolder}
* object.
*/
public float value;
/**
- * Constructs a new <code>FloatHolder</code> object with its
- * <code>value</code> field initialized to 0.0.
+ * Constructs a new {@code FloatHolder} object with its
+ * {@code value} field initialized to 0.0.
*/
public FloatHolder() {
}
/**
- * Constructs a new <code>FloatHolder</code> object for the given
- * <code>float</code>.
- * @param initial the <code>float</code> with which to initialize
- * the <code>value</code> field of the new
- * <code>FloatHolder</code> object
+ * Constructs a new {@code FloatHolder} object for the given
+ * {@code float}.
+ * @param initial the {@code float} with which to initialize
+ * the {@code value} field of the new
+ * {@code FloatHolder} object
*/
public FloatHolder(float initial) {
value = initial;
@@ -79,7 +79,7 @@
* Read a float from an input stream and initialize the value
* member with the float value.
*
- * @param input the <code>InputStream</code> to read from.
+ * @param input the {@code InputStream} to read from.
*/
public void _read(InputStream input) {
value = input.read_float();
@@ -88,16 +88,16 @@
/**
* Write the float value into an output stream.
*
- * @param output the <code>OutputStream</code> to write into.
+ * @param output the {@code OutputStream} to write into.
*/
public void _write(OutputStream output) {
output.write_float(value);
}
/**
- * Return the <code>TypeCode</code> of this Streamable.
+ * Return the {@code TypeCode} of this Streamable.
*
- * @return the <code>TypeCode</code> object.
+ * @return the {@code TypeCode} object.
*/
public org.omg.CORBA.TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_float);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,26 +26,26 @@
/**
-* The Helper for <tt>FloatSeq</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/FloatSeqHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:37 o'clock GMT+00:00
-*
-* The class definition has been modified to conform to the following
-* OMG specifications :
-* <ul>
-* <li> ORB core as defined by CORBA 2.3.1
-* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
-* </li>
-*
-* <li> IDL/Java Language Mapping as defined in
-* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
-* </li>
-* </ul>
-*/
+ * The Helper for {@code FloatSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/FloatSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
public abstract class FloatSeqHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>FloatSeq</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/FloatSeqHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:37 o'clock GMT+00:00
-*/
+ * The Holder for {@code FloatSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/FloatSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ */
public final class FloatSeqHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/IDLTypeHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/IDLTypeHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Helper for <tt>IDLType</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/IDLTypeHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ir.idl
-* 03 June 1999 11:33:44 o'clock GMT+00:00
-*/
+ * The Helper for {@code IDLType}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/IDLTypeHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ir.idl
+ * 03 June 1999 11:33:44 o'clock GMT+00:00
+ */
abstract public class IDLTypeHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/IDLTypeOperations.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/IDLTypeOperations.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,10 +25,10 @@
package org.omg.CORBA;
/**
-* The interface for <tt>IDLType</tt>. For more information on
-* Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
-* "Generated Files: Operations files"</a>.
-*/
+ * The interface for {@code IDLType}. For more information on
+ * Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
+ * "Generated Files: Operations files"</a>.
+ */
/*
tempout/org/omg/CORBA/IDLTypeOperations.java
@@ -51,8 +51,8 @@
{
/**
* The type attribute describes the type defined by an object
- * derived from <code>IDLType</code>.
- * @return the <code>TypeCode</code> defined by this object.
+ * derived from {@code IDLType}.
+ * @return the {@code TypeCode} defined by this object.
*/
org.omg.CORBA.TypeCode type ();
} // interface IDLTypeOperations
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java Tue Sep 22 11:01:54 2015 -0700
@@ -32,7 +32,7 @@
* exception is raised by ORB::string_to_object if the passed
* string does not decode correctly. An ORB may choose to detect
* calls via nil references (but is not obliged to do detect them).
- * <tt>INV_OBJREF</tt> is used to indicate this.<P>
+ * {@code INV_OBJREF} is used to indicate this.<P>
* It contains a minor code, which gives more detailed information about
* what caused the exception, and a completion status. It may also contain
* a string describing the exception.
@@ -47,7 +47,7 @@
public final class INV_OBJREF extends SystemException {
/**
- * Constructs an <code>INV_OBJREF</code> exception with a default
+ * Constructs an {@code INV_OBJREF} exception with a default
* minor code of 0 and a completion state of COMPLETED_NO.
*/
public INV_OBJREF() {
@@ -55,7 +55,7 @@
}
/**
- * Constructs an <code>INV_OBJREF</code> exception with the specified detail
+ * Constructs an {@code INV_OBJREF} exception with the specified detail
* message, a minor code of 0, and a completion state of COMPLETED_NO.
* @param s the String containing a detail message
*/
@@ -64,10 +64,10 @@
}
/**
- * Constructs an <code>INV_OBJREF</code> exception with the specified
+ * Constructs an {@code INV_OBJREF} exception with the specified
* minor code and completion status.
* @param minor the minor code
- * @param completed a <code>CompletionStatus</code> instance indicating
+ * @param completed a {@code CompletionStatus} instance indicating
* the completion status
*/
public INV_OBJREF(int minor, CompletionStatus completed) {
@@ -75,12 +75,12 @@
}
/**
- * Constructs an <code>INV_OBJREF</code> exception with the specified detail
+ * Constructs an {@code INV_OBJREF} exception with the specified detail
* message, minor code, and completion status.
* A detail message is a String that describes this particular exception.
* @param s the String containing a detail message
* @param minor the minor code
- * @param completed a <code>CompletionStatus</code> instance indicating
+ * @param completed a {@code CompletionStatus} instance indicating
* the completion status
*/
public INV_OBJREF(String s, int minor, CompletionStatus completed) {
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java Tue Sep 22 11:01:54 2015 -0700
@@ -28,7 +28,7 @@
/**
* Standard exception thrown
* when an invocation cannot be made because of an incompatibility between
- * <tt>Policy</tt> overrides that apply to the particular invocation.
+ * {@code Policy} overrides that apply to the particular invocation.
* It contains a minor code, which gives more detailed information about
* what caused the exception, and a completion status. It may also contain
* a string describing the exception.
@@ -39,7 +39,7 @@
public final class INV_POLICY extends SystemException {
/**
- * Constructs a <code>INV_POLICY</code> exception with a default minor code
+ * Constructs a {@code INV_POLICY} exception with a default minor code
* of 0, a completion state of CompletionStatus.COMPLETED_NO,
* and a null description.
*/
@@ -48,7 +48,7 @@
}
/**
- * Constructs a <code>INV_POLICY</code> exception with the
+ * Constructs a {@code INV_POLICY} exception with the
* specified description message,
* a minor code of 0, and a completion state of COMPLETED_NO.
* @param s the String containing a detail message
@@ -58,7 +58,7 @@
}
/**
- * Constructs a <code>INV_POLICY</code> exception with the specified
+ * Constructs a {@code INV_POLICY} exception with the specified
* minor code and completion status.
* @param minor the minor code
* @param completed the completion status
@@ -68,7 +68,7 @@
}
/**
- * Constructs a <code>INV_POLICY</code> exception with the
+ * Constructs a {@code INV_POLICY} exception with the
* specified description message, minor code, and completion status.
* @param s the String containing a description message
* @param minor the minor code
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/IRObjectOperations.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/IRObjectOperations.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,10 +26,10 @@
/**
-* The interface for <tt>IRObject</tt>. For more information on
-* Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
-* "Generated Files: Operations files"</a>.
-*/
+ * The interface for {@code IRObject}. For more information on
+ * Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
+ * "Generated Files: Operations files"</a>.
+ */
/*
tempout/org/omg/CORBA/IRObjectOperations.java
@@ -39,7 +39,7 @@
*/
/**
- * This is the Operations interface for the mapping from <tt>IRObject</tt>.
+ * This is the Operations interface for the mapping from {@code IRObject}.
* Several interfaces are used as base interfaces for objects in
* the Interface Repository (IR). These base interfaces are not instantiable.
* A common set of operations is used to locate objects within the
@@ -59,8 +59,8 @@
// read interface
/**
- * Returns the <code>DefinitionKind</code> corresponding to this Interface Repository object.
- * @return the <code>DefinitionKind</code> corresponding to this Interface Repository object.
+ * Returns the {@code DefinitionKind} corresponding to this Interface Repository object.
+ * @return the {@code DefinitionKind} corresponding to this Interface Repository object.
*/
org.omg.CORBA.DefinitionKind def_kind ();
@@ -70,13 +70,13 @@
* this method is applied to all its contents. If the object contains an IDLType
* attribute for an anonymous type, that IDLType is destroyed.
* If the object is currently contained in some other object, it is removed.
- * If the method is invoked on a <code>Repository</code> or on a <code>PrimitiveDef</code>
- * then the <code>BAD_INV_ORDER</code> exception is raised with minor value 2.
+ * If the method is invoked on a {@code Repository} or on a {@code PrimitiveDef}
+ * then the {@code BAD_INV_ORDER} exception is raised with minor value 2.
* An attempt to destroy an object that would leave the repository in an
- * incoherent state causes <code>BAD_INV_ORDER</code> exception to be raised
+ * incoherent state causes {@code BAD_INV_ORDER} exception to be raised
* with the minor code 1.
* @exception BAD_INV_ORDER if this method is invoked on a repository or
- * <code>PrimitiveDef</code>, or if an attempt to destroy an
+ * {@code PrimitiveDef}, or if an attempt to destroy an
* object would leave the repository in an incoherent state
*/
void destroy ();
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/IdentifierHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/IdentifierHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Helper for <tt>Identifier</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/IdentifierHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ir.idl
-* 03 June 1999 11:33:42 o'clock GMT+00:00
-*/
+ * The Helper for {@code Identifier}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/IdentifierHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ir.idl
+ * 03 June 1999 11:33:42 o'clock GMT+00:00
+ */
abstract public class IdentifierHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/IntHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/IntHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,57 +30,57 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>Int</tt>. For more information on
+ * The Holder for {@code Int}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for an <code>int</code>
+ * A Holder class for an {@code int}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>long</code> as an "out"
+ * If an IDL method signature has an IDL {@code long} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>IntHolder</code> as the corresponding
+ * {@code IntHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myIntHolder</code> is an instance of <code>IntHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myIntHolder.value</code>.
+ * If {@code myIntHolder} is an instance of {@code IntHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myIntHolder.value}.
*
* @since JDK1.2
*/
public final class IntHolder implements Streamable {
/**
- * The <code>int</code> value held by this <code>IntHolder</code>
- * object in its <code>value</code> field.
+ * The {@code int} value held by this {@code IntHolder}
+ * object in its {@code value} field.
*/
public int value;
/**
- * Constructs a new <code>IntHolder</code> object with its
- * <code>value</code> field initialized to <code>0</code>.
+ * Constructs a new {@code IntHolder} object with its
+ * {@code value} field initialized to {@code 0}.
*/
public IntHolder() {
}
/**
- * Constructs a new <code>IntHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>int</code>.
- * @param initial the <code>int</code> with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>IntHolder</code> object
+ * Constructs a new {@code IntHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code int}.
+ * @param initial the {@code int} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code IntHolder} object
*/
public IntHolder(int initial) {
value = initial;
}
/**
- * Reads unmarshalled data from <code>input</code> and assigns it to
- * the <code>value</code> field in this <code>IntHolder</code> object.
+ * Reads unmarshalled data from {@code input} and assigns it to
+ * the {@code value} field in this {@code IntHolder} object.
*
- * @param input the <code>InputStream</code> object containing CDR
+ * @param input the {@code InputStream} object containing CDR
* formatted data from the wire
*/
public void _read(InputStream input) {
@@ -88,10 +88,10 @@
}
/**
- * Marshals the value in this <code>IntHolder</code> object's
- * <code>value</code> field to the output stream <code>output</code>.
+ * Marshals the value in this {@code IntHolder} object's
+ * {@code value} field to the output stream {@code output}.
*
- * @param output the <code>OutputStream</code> object that will contain
+ * @param output the {@code OutputStream} object that will contain
* the CDR formatted data
*/
public void _write(OutputStream output) {
@@ -99,11 +99,11 @@
}
/**
- * Retrieves the <code>TypeCode</code> object that corresponds
- * to the value held in this <code>IntHolder</code> object's
- * <code>value</code> field.
+ * Retrieves the {@code TypeCode} object that corresponds
+ * to the value held in this {@code IntHolder} object's
+ * {@code value} field.
*
- * @return the type code for the value held in this <code>IntHolder</code>
+ * @return the type code for the value held in this {@code IntHolder}
* object
*/
public org.omg.CORBA.TypeCode _type() {
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,26 +30,26 @@
/**
* Used as a base class for implementation of a local IDL interface in the
* Java language mapping. It is a class which implements all the operations
- * in the <tt>org.omg.CORBA.Object</tt> interface.
+ * in the {@code org.omg.CORBA.Object} interface.
* <P>Local interfaces are implemented by using CORBA::LocalObject
- * to provide implementations of <code>Object</code> pseudo
- * operations and any other ORB-specific support mechanisms that are
- * appropriate for such objects. Object implementation techniques are
- * inherently language-mapping specific. Therefore, the
- * <code>LocalObject</code> type is not defined in IDL, but is specified
- * in each language mapping.
- * <P>Methods that do not apply to local objects throw
- * an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with the message,
- * "This is a locally contrained object." Attempting to use a
- * <TT>LocalObject</TT> to create a DII request results in NO_IMPLEMENT
- * system exception. Attempting to marshal or stringify a
- * <TT>LocalObject</TT> results in a MARSHAL system exception. Narrowing
- * and widening references to <TT>LocalObjects</TT> must work as for regular
- * object references.
- * <P><code>LocalObject</code> is to be used as the base class of locally
- * constrained objects, such as those in the PortableServer module.
- * The specification here is based on the CORBA Components
- * Volume I - orbos/99-07-01
+ * to provide implementations of {@code Object} pseudo
+ * operations and any other ORB-specific support mechanisms that are
+ * appropriate for such objects. Object implementation techniques are
+ * inherently language-mapping specific. Therefore, the
+ * {@code LocalObject} type is not defined in IDL, but is specified
+ * in each language mapping.
+ * <P>Methods that do not apply to local objects throw
+ * an {@code org.omg.CORBA.NO_IMPLEMENT} exception with the message,
+ * "This is a locally contrained object." Attempting to use a
+ * {@code LocalObject} to create a DII request results in NO_IMPLEMENT
+ * system exception. Attempting to marshal or stringify a
+ * {@code LocalObject} results in a MARSHAL system exception. Narrowing
+ * and widening references to {@code LocalObjects} must work as for regular
+ * object references.
+ * <P>{@code LocalObject} is to be used as the base class of locally
+ * constrained objects, such as those in the PortableServer module.
+ * The specification here is based on the CORBA Components
+ * Volume I - orbos/99-07-01
*
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
@@ -60,7 +60,7 @@
private static String reason = "This is a locally constrained object.";
/**
- * Constructs a default <code>LocalObject</code> instance.
+ * Constructs a default {@code LocalObject} instance.
*/
public LocalObject() {}
@@ -75,9 +75,9 @@
* <P>Default implementation of the org.omg.CORBA.Object method.
*
* @param that the object reference with which to check for equivalence
- * @return <code>true</code> if this object reference is known to be
+ * @return {@code true} if this object reference is known to be
* equivalent to the given object reference.
- * Note that <code>false</code> indicates only that the two
+ * Note that {@code false} indicates only that the two
* object references are distinct, not necessarily that
* they reference distinct objects.
*/
@@ -86,11 +86,11 @@
}
/**
- * Always returns <code>false</code>.
+ * Always returns {@code false}.
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @return <code>false</code>
+ * @return {@code false}
*/
public boolean _non_existent() {
return false;
@@ -100,9 +100,9 @@
* Returns a hash value that is consistent for the
* lifetime of the object, using the given number as the maximum.
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @param maximum an <code>int</code> identifying maximum value of
+ * @param maximum an {@code int} identifying maximum value of
* the hashcode
* @return this instance's hashcode
*/
@@ -111,13 +111,13 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object." This method
* does not apply to local objects and is therefore not implemented.
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @param repository_id a <code>String</code>
+ * @param repository_id a {@code String}
* @return NO_IMPLEMENT because this is a locally constrained object
* and this method does not apply to local objects
* @exception NO_IMPLEMENT because this is a locally constrained object
@@ -130,12 +130,12 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @return a duplicate of this <code>LocalObject</code> instance.
+ * @return a duplicate of this {@code LocalObject} instance.
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
@@ -145,10 +145,10 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -159,14 +159,14 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @param operation a <code>String</code> giving the name of an operation
+ * @param operation a {@code String} giving the name of an operation
* to be performed by the request that is returned
- * @return a <code>Request</code> object with the given operation
+ * @return a {@code Request} object with the given operation
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
@@ -176,20 +176,20 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @param ctx a <code>Context</code> object containing
+ * @param ctx a {@code Context} object containing
* a list of properties
- * @param operation the <code>String</code> representing the name of the
+ * @param operation the {@code String} representing the name of the
* method to be invoked
- * @param arg_list an <code>NVList</code> containing the actual arguments
+ * @param arg_list an {@code NVList} containing the actual arguments
* to the method being invoked
- * @param result a <code>NamedValue</code> object to serve as a
+ * @param result a {@code NamedValue} object to serve as a
* container for the method's return value
- * @return a new <code>Request</code> object initialized with the given
+ * @return a new {@code Request} object initialized with the given
* arguments
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -203,25 +203,25 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @param ctx a <code>Context</code> object containing
+ * @param ctx a {@code Context} object containing
* a list of properties
* @param operation the name of the method to be invoked
- * @param arg_list an <code>NVList</code> containing the actual arguments
+ * @param arg_list an {@code NVList} containing the actual arguments
* to the method being invoked
- * @param result a <code>NamedValue</code> object to serve as a
+ * @param result a {@code NamedValue} object to serve as a
* container for the method's return value
- * @param exceptions an <code>ExceptionList</code> object containing a
+ * @param exceptions an {@code ExceptionList} object containing a
* list of possible exceptions the method can throw
- * @param contexts a <code>ContextList</code> object containing a list of
+ * @param contexts a {@code ContextList} object containing a list of
* context strings that need to be resolved and sent
* with the
- * <code>Request</code> instance
- * @return the new <code>Request</code> object initialized with the given
+ * {@code Request} instance
+ * @return the new {@code Request} object initialized with the given
* arguments
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -237,11 +237,11 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object." This method
* does not apply to local objects and is therefore not implemented.
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
* @return NO_IMPLEMENT because this is a locally constrained object
* and this method does not apply to local objects
@@ -256,10 +256,10 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -278,12 +278,12 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
* @return the ORB instance that created the Delegate contained in this
- * <code>ObjectImpl</code>
+ * {@code ObjectImpl}
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
@@ -293,13 +293,13 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object." This method
* does not apply to local objects and is therefore not implemented.
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @param policy_type an <code>int</code>
+ * @param policy_type an {@code int}
* @return NO_IMPLEMENT because this is a locally constrained object
* and this method does not apply to local objects
* @exception NO_IMPLEMENT because this is a locally constrained object
@@ -313,11 +313,11 @@
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object." This method
* does not apply to local objects and is therefore not implemented.
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
@@ -328,11 +328,11 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object." This method
* does not apply to local objects and is therefore not implemented.
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
* @param policies an array
* @param set_add a flag
@@ -351,13 +351,13 @@
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.<P>
- * Returns <code>true</code> for this <code>LocalObject</code> instance.
+ * {@code org.omg.CORBA.Object} method.<P>
+ * Returns {@code true} for this {@code LocalObject} instance.
*
- * @return <code>true</code> always
+ * @return {@code true} always
* @exception NO_IMPLEMENT
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
@@ -367,12 +367,12 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
- * @param operation a <code>String</code> indicating which operation
+ * @param operation a {@code String} indicating which operation
* to preinvoke
* @param expectedType the class of the type of operation mentioned above
* @return NO_IMPLEMENT because this is a locally constrained object
@@ -388,10 +388,10 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
* @param servant the servant object on which to post-invoke
* @exception NO_IMPLEMENT
@@ -408,17 +408,17 @@
*/
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
* <P>Called by a stub to obtain an OutputStream for
* marshaling arguments. The stub must supply the operation name,
* and indicate if a response is expected (i.e is this a oneway call).
*
* @param operation the name of the operation being requested
- * @param responseExpected <code>true</code> if a response is expected,
- * <code>false</code> if it is a one-way call
+ * @param responseExpected {@code true} if a response is expected,
+ * {@code false} if it is a one-way call
* @return NO_IMPLEMENT because this is a locally constrained object
* and this method does not apply to local objects
* @exception NO_IMPLEMENT because this is a locally constrained object
@@ -432,32 +432,32 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
* <P>Called to invoke an operation. The stub provides an
- * <code>OutputStream</code> that was previously returned by a
- * <code>_request()</code>
- * call. <code>_invoke</code> returns an <code>InputStream</code> which
+ * {@code OutputStream} that was previously returned by a
+ * {@code _request()}
+ * call. {@code _invoke} returns an {@code InputStream} which
* contains the
- * marshaled reply. If an exception occurs, <code>_invoke</code> may throw an
- * <code>ApplicationException</code> object which contains an
- * <code>InputStream</code> from
+ * marshaled reply. If an exception occurs, {@code _invoke} may throw an
+ * {@code ApplicationException} object which contains an
+ * {@code InputStream} from
* which the user exception state may be unmarshaled.
*
- * @param output the <code>OutputStream</code> to invoke
+ * @param output the {@code OutputStream} to invoke
* @return NO_IMPLEMENT because this is a locally constrained object
* and this method does not apply to local objects
* @throws ApplicationException If an exception occurs,
- * <code>_invoke</code> may throw an
- * <code>ApplicationException</code> object which contains
- * an <code>InputStream</code> from
+ * {@code _invoke} may throw an
+ * {@code ApplicationException} object which contains
+ * an {@code InputStream} from
* which the user exception state may be unmarshaled.
* @throws RemarshalException If an exception occurs,
- * <code>_invoke</code> may throw an
- * <code>ApplicationException</code> object which contains
- * an <code>InputStream</code> from
+ * {@code _invoke} may throw an
+ * {@code ApplicationException} object which contains
+ * an {@code InputStream} from
* which the user exception state may be unmarshaled.
* @exception NO_IMPLEMENT because this is a locally constrained object
* and this method does not apply to local objects
@@ -471,17 +471,17 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object."
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
* <P>May optionally be called by a stub to release a
* reply stream back to the ORB when the unmarshaling has
- * completed. The stub passes the <code>InputStream</code> returned by
- * <code>_invoke()</code> or
- * <code>ApplicationException.getInputStream()</code>.
+ * completed. The stub passes the {@code InputStream} returned by
+ * {@code _invoke()} or
+ * {@code ApplicationException.getInputStream()}.
* A null
- * value may also be passed to <code>_releaseReply</code>, in which case the
+ * value may also be passed to {@code _releaseReply}, in which case the
* method is a no-op.
*
* @param input the reply stream back to the ORB or null
@@ -494,11 +494,11 @@
}
/**
- * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception with
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
* the message "This is a locally constrained object." This method
* does not apply to local objects and is therefore not implemented.
* This method is the default implementation of the
- * <code>org.omg.CORBA.Object</code> method.
+ * {@code org.omg.CORBA.Object} method.
*
* @return NO_IMPLEMENT because this is a locally constrained object
* and this method does not apply to local objects
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/LongHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/LongHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,54 +30,54 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>Long</tt>. For more information on
+ * The Holder for {@code Long}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>long</code>
+ * A Holder class for a {@code long}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>long long</code> as an "out"
+ * If an IDL method signature has an IDL {@code long long} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>LongHolder</code> as the corresponding
+ * {@code LongHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myLongHolder</code> is an instance of <code>LongHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myLongHolder.value</code>.
+ * If {@code myLongHolder} is an instance of {@code LongHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myLongHolder.value}.
*
* @since JDK1.2
*/
public final class LongHolder implements Streamable {
/**
- * The <code>long</code> value held by this <code>LongHolder</code>
+ * The {@code long} value held by this {@code LongHolder}
* object.
*/
public long value;
/**
- * Constructs a new <code>LongHolder</code> object with its
- * <code>value</code> field initialized to <code>0</code>.
+ * Constructs a new {@code LongHolder} object with its
+ * {@code value} field initialized to {@code 0}.
*/
public LongHolder() {
}
/**
- * Constructs a new <code>LongHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>long</code>.
- * @param initial the <code>long</code> with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>LongHolder</code> object
+ * Constructs a new {@code LongHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code long}.
+ * @param initial the {@code long} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code LongHolder} object
*/
public LongHolder(long initial) {
value = initial;
}
/**
- * Reads from <code>input</code> and initalizes the value in the Holder
+ * Reads from {@code input} and initalizes the value in the Holder
* with the unmarshalled data.
*
* @param input the InputStream containing CDR formatted data from the wire
@@ -87,7 +87,7 @@
}
/**
- * Marshals to <code>output</code> the value in the Holder.
+ * Marshals to {@code output} the value in the Holder.
*
* @param output the OutputStream which will contain the CDR formatted data
*/
@@ -96,7 +96,7 @@
}
/**
- * Returns the <code>TypeCode</code> object
+ * Returns the {@code TypeCode} object
* corresponding to the value held in the Holder.
*
* @return the TypeCode of the value held in the holder
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,26 +26,26 @@
/**
-* The Helper for <tt>LongLongSeq</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/LongLongSeqHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:37 o'clock GMT+00:00
-*
-* The class definition has been modified to conform to the following
-* OMG specifications :
-* <ul>
-* <li> ORB core as defined by CORBA 2.3.1
-* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
-* </li>
-*
-* <li> IDL/Java Language Mapping as defined in
-* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
-* </li>
-* </ul>
-*/
+ * The Helper for {@code LongLongSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/LongLongSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
public abstract class LongLongSeqHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>LongLongSeq</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/LongLongSeqHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*/
+ * The Holder for {@code LongLongSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/LongLongSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
public final class LongLongSeqHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/LongSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/LongSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,26 +26,26 @@
/**
-* The Helper for <tt>LongSeqHelper</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/LongSeqHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*
-* The class definition has been modified to conform to the following
-* OMG specifications :
-* <ul>
-* <li> ORB core as defined by CORBA 2.3.1
-* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
-* </li>
-*
-* <li> IDL/Java Language Mapping as defined in
-* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
-* </li>
-* </ul>
-*/
+ * The Helper for {@code LongSeqHelper}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/LongSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
public abstract class LongSeqHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/LongSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/LongSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>LongSeq</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/LongSeqHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*/
+ * The Holder for {@code LongSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/LongSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
public final class LongSeqHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,7 +31,7 @@
* or server-side run time. For example, if a reply from the server
* indicates that the message contains 1000 bytes, but the actual
* message is shorter or longer than 1000 bytes, the ORB raises
- * this exception. <tt>MARSHAL</tt> can also be caused by using
+ * this exception. {@code MARSHAL} can also be caused by using
* the DII or DSI incorrectly, for example, if the type of the
* actual parameters sent does not agree with IDL signature of an
* operation.<P>
@@ -47,7 +47,7 @@
public final class MARSHAL extends SystemException {
/**
- * Constructs a <code>MARSHAL</code> exception with a default minor code
+ * Constructs a {@code MARSHAL} exception with a default minor code
* of 0, a completion state of CompletionStatus.COMPLETED_NO,
* and a null description.
*/
@@ -56,7 +56,7 @@
}
/**
- * Constructs a <code>MARSHAL</code> exception with the specified description message,
+ * Constructs a {@code MARSHAL} exception with the specified description message,
* a minor code of 0, and a completion state of COMPLETED_NO.
* @param s the String containing a description of the exception
*/
@@ -65,7 +65,7 @@
}
/**
- * Constructs a <code>MARSHAL</code> exception with the specified
+ * Constructs a {@code MARSHAL} exception with the specified
* minor code and completion status.
* @param minor the minor code
* @param completed the completion status
@@ -75,7 +75,7 @@
}
/**
- * Constructs a <code>MARSHAL</code> exception with the specified description
+ * Constructs a {@code MARSHAL} exception with the specified description
* message, minor code, and completion status.
* @param s the String containing a description message
* @param minor the minor code
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java Tue Sep 22 11:01:54 2015 -0700
@@ -28,7 +28,7 @@
/**
* This exception indicates that even though the operation that
* was invoked exists (it has an IDL definition), no implementation
- * for that operation exists. <tt>NO_IMPLEMENT</tt> can, for
+ * for that operation exists. {@code NO_IMPLEMENT} can, for
* example, be raised by an ORB if a client asks for an object's
* type definition from the interface repository, but no interface
* repository is provided by the ORB.<P>
@@ -44,7 +44,7 @@
public final class NO_IMPLEMENT extends SystemException {
/**
- * Constructs a <code>NO_IMPLEMENT</code> exception with a default minor code
+ * Constructs a {@code NO_IMPLEMENT} exception with a default minor code
* of 0, a completion state of CompletionStatus.COMPLETED_NO,
* and a null description.
*/
@@ -53,7 +53,7 @@
}
/**
- * Constructs a <code>NO_IMPLEMENT</code> exception with the specified description message,
+ * Constructs a {@code NO_IMPLEMENT} exception with the specified description message,
* a minor code of 0, and a completion state of COMPLETED_NO.
* @param s the String containing a description of the exception
*/
@@ -62,10 +62,10 @@
}
/**
- * Constructs a <code>NO_IMPLEMENT</code> exception with the specified
+ * Constructs a {@code NO_IMPLEMENT} exception with the specified
* minor code and completion status.
- * @param minor an <code>int</code> specifying the minor code
- * @param completed a <code>CompletionStatus</code> instance indicating
+ * @param minor an {@code int} specifying the minor code
+ * @param completed a {@code CompletionStatus} instance indicating
* the completion status
*/
public NO_IMPLEMENT(int minor, CompletionStatus completed) {
@@ -73,11 +73,11 @@
}
/**
- * Constructs a <code>NO_IMPLEMENT</code> exception with the specified description
+ * Constructs a {@code NO_IMPLEMENT} exception with the specified description
* message, minor code, and completion status.
* @param s the String containing a description message
- * @param minor an <code>int</code> specifying the minor code
- * @param completed a <code>CompletionStatus</code> instance indicating
+ * @param minor an {@code int} specifying the minor code
+ * @param completed a {@code CompletionStatus} instance indicating
* the completion status
*/
public NO_IMPLEMENT(String s, int minor, CompletionStatus completed) {
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/NameValuePair.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NameValuePair.java Tue Sep 22 11:01:54 2015 -0700
@@ -28,33 +28,33 @@
/**
* Associates a name with a value that is an
- * attribute of an IDL struct, and is used in the <tt>DynStruct</tt> APIs.
+ * attribute of an IDL struct, and is used in the {@code DynStruct} APIs.
*/
public final class NameValuePair implements org.omg.CORBA.portable.IDLEntity {
/**
- * The name to be associated with a value by this <code>NameValuePair</code> object.
+ * The name to be associated with a value by this {@code NameValuePair} object.
*/
public String id;
/**
- * The value to be associated with a name by this <code>NameValuePair</code> object.
+ * The value to be associated with a name by this {@code NameValuePair} object.
*/
public org.omg.CORBA.Any value;
/**
- * Constructs an empty <code>NameValuePair</code> object.
+ * Constructs an empty {@code NameValuePair} object.
* To associate a name with a value after using this constructor, the fields
* of this object have to be accessed individually.
*/
public NameValuePair() { }
/**
- * Constructs a <code>NameValuePair</code> object that associates
- * the given name with the given <code>org.omg.CORBA.Any</code> object.
- * @param __id the name to be associated with the given <code>Any</code> object
- * @param __value the <code>Any</code> object to be associated with the given name
+ * Constructs a {@code NameValuePair} object that associates
+ * the given name with the given {@code org.omg.CORBA.Any} object.
+ * @param __id the name to be associated with the given {@code Any} object
+ * @param __value the {@code Any} object to be associated with the given name
*/
public NameValuePair(String __id, org.omg.CORBA.Any __value) {
id = __id;
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/NameValuePairHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/NameValuePairHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,13 +26,13 @@
/**
-* The Helper for <tt>NameValuePair</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/NameValuePairHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* 03 June 1999 11:52:03 o'clock GMT+00:00
-*/
+ * The Helper for {@code NameValuePair}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/NameValuePairHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * 03 June 1999 11:52:03 o'clock GMT+00:00
+ */
abstract public class NameValuePairHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java Tue Sep 22 11:01:54 2015 -0700
@@ -40,7 +40,7 @@
/**
* A class providing APIs for the CORBA Object Request Broker
- * features. The <code>ORB</code> class also provides
+ * features. The {@code ORB} class also provides
* "pluggable ORB implementation" APIs that allow another vendor's ORB
* implementation to be used.
* <P>
@@ -49,12 +49,12 @@
* objects servicing requests (servers).
* <P>
*
- * The <code>ORB</code> class, which
+ * The {@code ORB} class, which
* encapsulates generic CORBA functionality, does the following:
* (Note that items 5 and 6, which include most of the methods in
- * the class <code>ORB</code>, are typically used with the <code>Dynamic Invocation
- * Interface</code> (DII) and the <code>Dynamic Skeleton Interface</code>
- * (DSI).
+ * the class {@code ORB}, are typically used with the
+ * {@code Dynamic Invocation Interface} (DII) and
+ * the {@code Dynamic Skeleton Interface} (DSI).
* These interfaces may be used by a developer directly, but
* most commonly they are used by the ORB internally and are
* not seen by the general programmer.)
@@ -62,29 +62,29 @@
* <li> initializes the ORB implementation by supplying values for
* predefined properties and environmental parameters
* <li> obtains initial object references to services such as
- * the NameService using the method <code>resolve_initial_references</code>
+ * the NameService using the method {@code resolve_initial_references}
* <li> converts object references to strings and back
* <li> connects the ORB to a servant (an instance of a CORBA object
* implementation) and disconnects the ORB from a servant
* <li> creates objects such as
* <ul>
- * <li><code>TypeCode</code>
- * <li><code>Any</code>
- * <li><code>NamedValue</code>
- * <li><code>Context</code>
- * <li><code>Environment</code>
- * <li>lists (such as <code>NVList</code>) containing these objects
+ * <li>{@code TypeCode}
+ * <li>{@code Any}
+ * <li>{@code NamedValue}
+ * <li>{@code Context}
+ * <li>{@code Environment}
+ * <li>lists (such as {@code NVList}) containing these objects
* </ul>
* <li> sends multiple messages in the DII
* </OL>
*
* <P>
- * The <code>ORB</code> class can be used to obtain references to objects
+ * The {@code ORB} class can be used to obtain references to objects
* implemented anywhere on the network.
* <P>
* An application or applet gains access to the CORBA environment
- * by initializing itself into an <code>ORB</code> using one of
- * three <code>init</code> methods. Two of the three methods use the properties
+ * by initializing itself into an {@code ORB} using one of
+ * three {@code init} methods. Two of the three methods use the properties
* (associations of a name with a value) shown in the
* table below.<BR>
* <TABLE BORDER=1 SUMMARY="Standard Java CORBA Properties">
@@ -93,10 +93,10 @@
* <TR><TD>org.omg.CORBA.ORBClass</TD>
* <TD>class name of an ORB implementation</TD></TR>
* <TR><TD>org.omg.CORBA.ORBSingletonClass</TD>
- * <TD>class name of the ORB returned by <code>init()</code></TD></TR>
+ * <TD>class name of the ORB returned by {@code init()}</TD></TR>
* </TABLE>
* <P>
- * These properties allow a different vendor's <code>ORB</code>
+ * These properties allow a different vendor's {@code ORB}
* implementation to be "plugged in."
* <P>
* When an ORB instance is being created, the class name of the ORB
@@ -122,12 +122,12 @@
* <P>
* Note that Java IDL provides a default implementation for the
* fully-functional ORB and for the Singleton ORB. When the method
- * <code>init</code> is given no parameters, the default Singleton
- * ORB is returned. When the method <code>init</code> is given parameters
+ * {@code init} is given no parameters, the default Singleton
+ * ORB is returned. When the method {@code init} is given parameters
* but no ORB class is specified, the Java IDL ORB implementation
* is returned.
* <P>
- * The following code fragment creates an <code>ORB</code> object
+ * The following code fragment creates an {@code ORB} object
* initialized with the default ORB Singleton.
* This ORB has a
* restricted implementation to prevent malicious applets from doing
@@ -138,9 +138,9 @@
* ORB orb = ORB.init();
* </PRE>
* <P>
- * The following code fragment creates an <code>ORB</code> object
- * for an application. The parameter <code>args</code>
- * represents the arguments supplied to the application's <code>main</code>
+ * The following code fragment creates an {@code ORB} object
+ * for an application. The parameter {@code args}
+ * represents the arguments supplied to the application's {@code main}
* method. Since the property specifies the ORB class to be
* "SomeORBImplementation", the new ORB will be initialized with
* that ORB implementation. If p had been null,
@@ -153,7 +153,7 @@
* ORB orb = ORB.init(args, p);
* </PRE>
* <P>
- * The following code fragment creates an <code>ORB</code> object
+ * The following code fragment creates an {@code ORB} object
* for the applet supplied as the first parameter. If the given
* applet does not specify an ORB class, the new ORB will be
* initialized with the default Java IDL implementation.
@@ -271,27 +271,27 @@
}
/**
- * Returns the <code>ORB</code> singleton object. This method always returns the
+ * Returns the {@code ORB} singleton object. This method always returns the
* same ORB instance, which is an instance of the class described by the
- * <code>org.omg.CORBA.ORBSingletonClass</code> system property.
+ * {@code org.omg.CORBA.ORBSingletonClass} system property.
* <P>
- * This no-argument version of the method <code>init</code> is used primarily
- * as a factory for <code>TypeCode</code> objects, which are used by
- * <code>Helper</code> classes to implement the method <code>type</code>.
- * It is also used to create <code>Any</code> objects that are used to
- * describe <code>union</code> labels (as part of creating a <code>
- * TypeCode</code> object for a <code>union</code>).
+ * This no-argument version of the method {@code init} is used primarily
+ * as a factory for {@code TypeCode} objects, which are used by
+ * {@code Helper} classes to implement the method {@code type}.
+ * It is also used to create {@code Any} objects that are used to
+ * describe {@code union} labels (as part of creating a
+ * {@code TypeCode} object for a {@code union}).
* <P>
* This method is not intended to be used by applets, and in the event
* that it is called in an applet environment, the ORB it returns
* is restricted so that it can be used only as a factory for
- * <code>TypeCode</code> objects. Any <code>TypeCode</code> objects
+ * {@code TypeCode} objects. Any {@code TypeCode} objects
* it produces can be safely shared among untrusted applets.
* <P>
* If an ORB is created using this method from an applet,
* a system exception will be thrown if
* methods other than those for
- * creating <code>TypeCode</code> objects are invoked.
+ * creating {@code TypeCode} objects are invoked.
*
* @return the singleton ORB
*
@@ -350,13 +350,13 @@
}
/**
- * Creates a new <code>ORB</code> instance for a standalone
+ * Creates a new {@code ORB} instance for a standalone
* application. This method may be called from applications
- * only and returns a new fully functional <code>ORB</code> object
+ * only and returns a new fully functional {@code ORB} object
* each time it is called.
- * @param args command-line arguments for the application's <code>main</code>
- * method; may be <code>null</code>
- * @param props application-specific properties; may be <code>null</code>
+ * @param args command-line arguments for the application's {@code main}
+ * method; may be {@code null}
+ * @param props application-specific properties; may be {@code null}
* @return the newly-created ORB instance
*
* @implNote
@@ -394,11 +394,11 @@
/**
- * Creates a new <code>ORB</code> instance for an applet. This
+ * Creates a new {@code ORB} instance for an applet. This
* method may be called from applets only and returns a new
- * fully-functional <code>ORB</code> object each time it is called.
- * @param app the applet; may be <code>null</code>
- * @param props applet-specific properties; may be <code>null</code>
+ * fully-functional {@code ORB} object each time it is called.
+ * @param app the applet; may be {@code null}
+ * @param props applet-specific properties; may be {@code null}
* @return the newly-created ORB instance
*
* @implNote
@@ -430,11 +430,11 @@
* Allows the ORB implementation to be initialized with the given
* parameters and properties. This method, used in applications only,
* is implemented by subclass ORB implementations and called
- * by the appropriate <code>init</code> method to pass in its parameters.
+ * by the appropriate {@code init} method to pass in its parameters.
*
- * @param args command-line arguments for the application's <code>main</code>
- * method; may be <code>null</code>
- * @param props application-specific properties; may be <code>null</code>
+ * @param args command-line arguments for the application's {@code main}
+ * method; may be {@code null}
+ * @param props application-specific properties; may be {@code null}
*/
abstract protected void set_parameters(String[] args, Properties props);
@@ -442,10 +442,10 @@
* Allows the ORB implementation to be initialized with the given
* applet and parameters. This method, used in applets only,
* is implemented by subclass ORB implementations and called
- * by the appropriate <code>init</code> method to pass in its parameters.
+ * by the appropriate {@code init} method to pass in its parameters.
*
- * @param app the applet; may be <code>null</code>
- * @param props applet-specific properties; may be <code>null</code>
+ * @param app the applet; may be {@code null}
+ * @param props applet-specific properties; may be {@code null}
*/
abstract protected void set_parameters(Applet app, Properties props);
@@ -453,17 +453,17 @@
* Connects the given servant object (a Java object that is
* an instance of the server implementation class)
* to the ORB. The servant class must
- * extend the <code>ImplBase</code> class corresponding to the interface that is
+ * extend the {@code ImplBase} class corresponding to the interface that is
* supported by the server. The servant must thus be a CORBA object
- * reference, and inherit from <code>org.omg.CORBA.Object</code>.
+ * reference, and inherit from {@code org.omg.CORBA.Object}.
* Servants created by the user can start receiving remote invocations
- * after the method <code>connect</code> has been called. A servant may also be
+ * after the method {@code connect} has been called. A servant may also be
* automatically and implicitly connected to the ORB if it is passed as
* an IDL parameter in an IDL method invocation on a non-local object,
* that is, if the servant object has to be marshalled and sent outside of the
* process address space.
* <P>
- * Calling the method <code>connect</code> has no effect
+ * Calling the method {@code connect} has no effect
* when the servant object is already connected to the ORB.
* <P>
* Deprecated by the OMG in favor of the Portable Object Adapter APIs.
@@ -477,17 +477,17 @@
/**
* Destroys the ORB so that its resources can be reclaimed.
* Any operation invoked on a destroyed ORB reference will throw the
- * <code>OBJECT_NOT_EXIST</code> exception.
- * Once an ORB has been destroyed, another call to <code>init</code>
+ * {@code OBJECT_NOT_EXIST} exception.
+ * Once an ORB has been destroyed, another call to {@code init}
* with the same ORBid will return a reference to a newly constructed ORB.<p>
- * If <code>destroy</code> is called on an ORB that has not been shut down,
+ * If {@code destroy} is called on an ORB that has not been shut down,
* it will start the shut down process and block until the ORB has shut down
* before it destroys the ORB.<br>
- * If an application calls <code>destroy</code> in a thread that is currently servicing
- * an invocation, the <code>BAD_INV_ORDER</code> system exception will be thrown
+ * If an application calls {@code destroy} in a thread that is currently servicing
+ * an invocation, the {@code BAD_INV_ORDER} system exception will be thrown
* with the OMG minor code 3, since blocking would result in a deadlock.<p>
* For maximum portability and to avoid resource leaks, an application should
- * always call <code>shutdown</code> and <code>destroy</code>
+ * always call {@code shutdown} and {@code destroy}
* on all ORB instances before exiting.
*
* @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing an invocation
@@ -500,14 +500,14 @@
* Disconnects the given servant object from the ORB. After this method returns,
* the ORB will reject incoming remote requests for the disconnected
* servant and will send the exception
- * <code>org.omg.CORBA.OBJECT_NOT_EXIST</code> back to the
+ * {@code org.omg.CORBA.OBJECT_NOT_EXIST} back to the
* remote client. Thus the object appears to be destroyed from the
* point of view of remote clients. Note, however, that local requests issued
* using the servant directly do not
* pass through the ORB; hence, they will continue to be processed by the
* servant.
* <P>
- * Calling the method <code>disconnect</code> has no effect
+ * Calling the method {@code disconnect} has no effect
* if the servant is not connected to the ORB.
* <P>
* Deprecated by the OMG in favor of the Portable Object Adapter APIs.
@@ -535,7 +535,7 @@
* Returns a list of the initially available CORBA object references,
* such as "NameService" and "InterfaceRepository".
*
- * @return an array of <code>String</code> objects that represent
+ * @return an array of {@code String} objects that represent
* the object references for CORBA services
* that are initially available with this ORB
*/
@@ -559,8 +559,8 @@
* strings generated by a different ORB to be converted back into an object
* reference.
* <P>
- * The resulting <code>String</code> object may be stored or communicated
- * in any way that a <code>String</code> object can be manipulated.
+ * The resulting {@code String} object may be stored or communicated
+ * in any way that a {@code String} object can be manipulated.
*
* @param obj the object reference to stringify
* @return the string representing the object reference
@@ -568,43 +568,43 @@
abstract public String object_to_string(org.omg.CORBA.Object obj);
/**
- * Converts a string produced by the method <code>object_to_string</code>
+ * Converts a string produced by the method {@code object_to_string}
* back to a CORBA object reference.
*
* @param str the string to be converted back to an object reference. It must
* be the result of converting an object reference to a string using the
- * method <code>object_to_string</code>.
+ * method {@code object_to_string}.
* @return the object reference
*/
abstract public org.omg.CORBA.Object string_to_object(String str);
/**
- * Allocates an <code>NVList</code> with (probably) enough
- * space for the specified number of <code>NamedValue</code> objects.
+ * Allocates an {@code NVList} with (probably) enough
+ * space for the specified number of {@code NamedValue} objects.
* Note that the specified size is only a hint to help with
* storage allocation and does not imply the maximum size of the list.
*
- * @param count suggested number of <code>NamedValue</code> objects for
+ * @param count suggested number of {@code NamedValue} objects for
* which to allocate space
- * @return the newly-created <code>NVList</code>
+ * @return the newly-created {@code NVList}
*
* @see NVList
*/
abstract public NVList create_list(int count);
/**
- * Creates an <code>NVList</code> initialized with argument
+ * Creates an {@code NVList} initialized with argument
* descriptions for the operation described in the given
- * <code>OperationDef</code> object. This <code>OperationDef</code> object
+ * {@code OperationDef} object. This {@code OperationDef} object
* is obtained from an Interface Repository. The arguments in the
- * returned <code>NVList</code> object are in the same order as in the
+ * returned {@code NVList} object are in the same order as in the
* original IDL operation definition, which makes it possible for the list
* to be used in dynamic invocation requests.
*
- * @param oper the <code>OperationDef</code> object to use to create the list
- * @return a newly-created <code>NVList</code> object containing
+ * @param oper the {@code OperationDef} object to use to create the list
+ * @return a newly-created {@code NVList} object containing
* descriptions of the arguments to the method described in the given
- * <code>OperationDef</code> object
+ * {@code OperationDef} object
*
* @see NVList
*/
@@ -657,63 +657,63 @@
/**
- * Creates a <code>NamedValue</code> object
+ * Creates a {@code NamedValue} object
* using the given name, value, and argument mode flags.
* <P>
- * A <code>NamedValue</code> object serves as (1) a parameter or return
+ * A {@code NamedValue} object serves as (1) a parameter or return
* value or (2) a context property.
* It may be used by itself or
- * as an element in an <code>NVList</code> object.
+ * as an element in an {@code NVList} object.
*
- * @param s the name of the <code>NamedValue</code> object
- * @param any the <code>Any</code> value to be inserted into the
- * <code>NamedValue</code> object
- * @param flags the argument mode flags for the <code>NamedValue</code>: one of
- * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>,
- * or <code>ARG_INOUT.value</code>.
+ * @param s the name of the {@code NamedValue} object
+ * @param any the {@code Any} value to be inserted into the
+ * {@code NamedValue} object
+ * @param flags the argument mode flags for the {@code NamedValue}: one of
+ * {@code ARG_IN.value}, {@code ARG_OUT.value},
+ * or {@code ARG_INOUT.value}.
*
- * @return the newly-created <code>NamedValue</code> object
+ * @return the newly-created {@code NamedValue} object
* @see NamedValue
*/
abstract public NamedValue create_named_value(String s, Any any, int flags);
/**
- * Creates an empty <code>ExceptionList</code> object.
+ * Creates an empty {@code ExceptionList} object.
*
- * @return the newly-created <code>ExceptionList</code> object
+ * @return the newly-created {@code ExceptionList} object
*/
abstract public ExceptionList create_exception_list();
/**
- * Creates an empty <code>ContextList</code> object.
+ * Creates an empty {@code ContextList} object.
*
- * @return the newly-created <code>ContextList</code> object
+ * @return the newly-created {@code ContextList} object
* @see ContextList
* @see Context
*/
abstract public ContextList create_context_list();
/**
- * Gets the default <code>Context</code> object.
+ * Gets the default {@code Context} object.
*
- * @return the default <code>Context</code> object
+ * @return the default {@code Context} object
* @see Context
*/
abstract public Context get_default_context();
/**
- * Creates an <code>Environment</code> object.
+ * Creates an {@code Environment} object.
*
- * @return the newly-created <code>Environment</code> object
+ * @return the newly-created {@code Environment} object
* @see Environment
*/
abstract public Environment create_environment();
/**
- * Creates a new <code>org.omg.CORBA.portable.OutputStream</code> into which
+ * Creates a new {@code org.omg.CORBA.portable.OutputStream} into which
* IDL method parameters can be marshalled during method invocation.
- * @return the newly-created
- * <code>org.omg.CORBA.portable.OutputStream</code> object
+ * @return the newly-created
+ * {@code org.omg.CORBA.portable.OutputStream} object
*/
abstract public org.omg.CORBA.portable.OutputStream create_output_stream();
@@ -722,31 +722,31 @@
* any responses. Note that oneway invocations are not guaranteed to
* reach the server.
*
- * @param req an array of request objects
+ * @param req an array of request objects
*/
abstract public void send_multiple_requests_oneway(Request[] req);
/**
* Sends multiple dynamic (DII) requests asynchronously.
*
- * @param req an array of <code>Request</code> objects
+ * @param req an array of {@code Request} objects
*/
abstract public void send_multiple_requests_deferred(Request[] req);
/**
* Finds out if any of the deferred (asynchronous) invocations have
* a response yet.
- * @return <code>true</code> if there is a response available;
- * <code> false</code> otherwise
+ * @return {@code true} if there is a response available;
+ * {@code false} otherwise
*/
abstract public boolean poll_next_response();
/**
- * Gets the next <code>Request</code> instance for which a response
+ * Gets the next {@code Request} instance for which a response
* has been received.
*
- * @return the next <code>Request</code> object ready with a response
- * @exception WrongTransaction if the method <code>get_next_response</code>
+ * @return the next {@code Request} object ready with a response
+ * @exception WrongTransaction if the method {@code get_next_response}
* is called from a transaction scope different
* from the one from which the original request was sent. See the
* OMG Transaction Service specification for details.
@@ -754,150 +754,150 @@
abstract public Request get_next_response() throws WrongTransaction;
/**
- * Retrieves the <code>TypeCode</code> object that represents
+ * Retrieves the {@code TypeCode} object that represents
* the given primitive IDL type.
*
- * @param tcKind the <code>TCKind</code> instance corresponding to the
+ * @param tcKind the {@code TCKind} instance corresponding to the
* desired primitive type
- * @return the requested <code>TypeCode</code> object
+ * @return the requested {@code TypeCode} object
*/
abstract public TypeCode get_primitive_tc(TCKind tcKind);
/**
- * Creates a <code>TypeCode</code> object representing an IDL <code>struct</code>.
- * The <code>TypeCode</code> object is initialized with the given id,
+ * Creates a {@code TypeCode} object representing an IDL {@code struct}.
+ * The {@code TypeCode} object is initialized with the given id,
* name, and members.
*
- * @param id the repository id for the <code>struct</code>
- * @param name the name of the <code>struct</code>
- * @param members an array describing the members of the <code>struct</code>
- * @return a newly-created <code>TypeCode</code> object describing
- * an IDL <code>struct</code>
+ * @param id the repository id for the {@code struct}
+ * @param name the name of the {@code struct}
+ * @param members an array describing the members of the {@code struct}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code struct}
*/
abstract public TypeCode create_struct_tc(String id, String name,
StructMember[] members);
/**
- * Creates a <code>TypeCode</code> object representing an IDL <code>union</code>.
- * The <code>TypeCode</code> object is initialized with the given id,
+ * Creates a {@code TypeCode} object representing an IDL {@code union}.
+ * The {@code TypeCode} object is initialized with the given id,
* name, discriminator type, and members.
*
- * @param id the repository id of the <code>union</code>
- * @param name the name of the <code>union</code>
- * @param discriminator_type the type of the <code>union</code> discriminator
- * @param members an array describing the members of the <code>union</code>
- * @return a newly-created <code>TypeCode</code> object describing
- * an IDL <code>union</code>
+ * @param id the repository id of the {@code union}
+ * @param name the name of the {@code union}
+ * @param discriminator_type the type of the {@code union} discriminator
+ * @param members an array describing the members of the {@code union}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code union}
*/
abstract public TypeCode create_union_tc(String id, String name,
TypeCode discriminator_type,
UnionMember[] members);
/**
- * Creates a <code>TypeCode</code> object representing an IDL <code>enum</code>.
- * The <code>TypeCode</code> object is initialized with the given id,
+ * Creates a {@code TypeCode} object representing an IDL {@code enum}.
+ * The {@code TypeCode} object is initialized with the given id,
* name, and members.
*
- * @param id the repository id for the <code>enum</code>
- * @param name the name for the <code>enum</code>
- * @param members an array describing the members of the <code>enum</code>
- * @return a newly-created <code>TypeCode</code> object describing
- * an IDL <code>enum</code>
+ * @param id the repository id for the {@code enum}
+ * @param name the name for the {@code enum}
+ * @param members an array describing the members of the {@code enum}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code enum}
*/
abstract public TypeCode create_enum_tc(String id, String name, String[] members);
/**
- * Creates a <code>TypeCode</code> object representing an IDL <code>alias</code>
- * (<code>typedef</code>).
- * The <code>TypeCode</code> object is initialized with the given id,
+ * Creates a {@code TypeCode} object representing an IDL {@code alias}
+ * ({@code typedef}).
+ * The {@code TypeCode} object is initialized with the given id,
* name, and original type.
*
* @param id the repository id for the alias
* @param name the name for the alias
* @param original_type
- * the <code>TypeCode</code> object describing the original type
- * for which this is an alias
- * @return a newly-created <code>TypeCode</code> object describing
- * an IDL <code>alias</code>
+ * the {@code TypeCode} object describing the original type
+ * for which this is an alias
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code alias}
*/
abstract public TypeCode create_alias_tc(String id, String name,
TypeCode original_type);
/**
- * Creates a <code>TypeCode</code> object representing an IDL <code>exception</code>.
- * The <code>TypeCode</code> object is initialized with the given id,
+ * Creates a {@code TypeCode} object representing an IDL {@code exception}.
+ * The {@code TypeCode} object is initialized with the given id,
* name, and members.
*
- * @param id the repository id for the <code>exception</code>
- * @param name the name for the <code>exception</code>
- * @param members an array describing the members of the <code>exception</code>
- * @return a newly-created <code>TypeCode</code> object describing
- * an IDL <code>exception</code>
+ * @param id the repository id for the {@code exception}
+ * @param name the name for the {@code exception}
+ * @param members an array describing the members of the {@code exception}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code exception}
*/
abstract public TypeCode create_exception_tc(String id, String name,
StructMember[] members);
/**
- * Creates a <code>TypeCode</code> object representing an IDL <code>interface</code>.
- * The <code>TypeCode</code> object is initialized with the given id
+ * Creates a {@code TypeCode} object representing an IDL {@code interface}.
+ * The {@code TypeCode} object is initialized with the given id
* and name.
*
- * @param id the repository id for the interface
- * @param name the name for the interface
- * @return a newly-created <code>TypeCode</code> object describing
- * an IDL <code>interface</code>
+ * @param id the repository id for the interface
+ * @param name the name for the interface
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code interface}
*/
abstract public TypeCode create_interface_tc(String id, String name);
/**
- * Creates a <code>TypeCode</code> object representing a bounded IDL
- * <code>string</code>.
- * The <code>TypeCode</code> object is initialized with the given bound,
+ * Creates a {@code TypeCode} object representing a bounded IDL
+ * {@code string}.
+ * The {@code TypeCode} object is initialized with the given bound,
* which represents the maximum length of the string. Zero indicates
* that the string described by this type code is unbounded.
*
- * @param bound the bound for the <code>string</code>; cannot be negative
- * @return a newly-created <code>TypeCode</code> object describing
- * a bounded IDL <code>string</code>
+ * @param bound the bound for the {@code string}; cannot be negative
+ * @return a newly-created {@code TypeCode} object describing
+ * a bounded IDL {@code string}
* @exception BAD_PARAM if bound is a negative value
*/
abstract public TypeCode create_string_tc(int bound);
/**
- * Creates a <code>TypeCode</code> object representing a bounded IDL
- * <code>wstring</code> (wide string).
- * The <code>TypeCode</code> object is initialized with the given bound,
+ * Creates a {@code TypeCode} object representing a bounded IDL
+ * {@code wstring} (wide string).
+ * The {@code TypeCode} object is initialized with the given bound,
* which represents the maximum length of the wide string. Zero indicates
* that the string described by this type code is unbounded.
*
- * @param bound the bound for the <code>wstring</code>; cannot be negative
- * @return a newly-created <code>TypeCode</code> object describing
- * a bounded IDL <code>wstring</code>
+ * @param bound the bound for the {@code wstring}; cannot be negative
+ * @return a newly-created {@code TypeCode} object describing
+ * a bounded IDL {@code wstring}
* @exception BAD_PARAM if bound is a negative value
*/
abstract public TypeCode create_wstring_tc(int bound);
/**
- * Creates a <code>TypeCode</code> object representing an IDL <code>sequence</code>.
- * The <code>TypeCode</code> object is initialized with the given bound and
+ * Creates a {@code TypeCode} object representing an IDL {@code sequence}.
+ * The {@code TypeCode} object is initialized with the given bound and
* element type.
*
- * @param bound the bound for the <code>sequence</code>, 0 if unbounded
- * @param element_type
- * the <code>TypeCode</code> object describing the elements
- * contained in the <code>sequence</code>
- * @return a newly-created <code>TypeCode</code> object describing
- * an IDL <code>sequence</code>
+ * @param bound the bound for the {@code sequence}, 0 if unbounded
+ * @param element_type the {@code TypeCode} object describing
+ * the elements contained in the {@code sequence}
+ *
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code sequence}
*/
abstract public TypeCode create_sequence_tc(int bound, TypeCode element_type);
/**
- * Creates a <code>TypeCode</code> object representing a
- * a recursive IDL <code>sequence</code>.
+ * Creates a {@code TypeCode} object representing a
+ * a recursive IDL {@code sequence}.
* <P>
- * For the IDL <code>struct</code> Node in following code fragment,
+ * For the IDL {@code struct} Node in following code fragment,
* the offset parameter for creating its sequence would be 1:
* <PRE>
* Struct Node {
@@ -907,10 +907,10 @@
* </PRE>
*
* @param bound the bound for the sequence, 0 if unbounded
- * @param offset the index to the enclosing <code>TypeCode</code> object
+ * @param offset the index to the enclosing {@code TypeCode} object
* that describes the elements of this sequence
- * @return a newly-created <code>TypeCode</code> object describing
- * a recursive sequence
+ * @return a newly-created {@code TypeCode} object describing
+ * a recursive sequence
* @deprecated Use a combination of create_recursive_tc and create_sequence_tc instead
* @see #create_recursive_tc(String) create_recursive_tc
* @see #create_sequence_tc(int, TypeCode) create_sequence_tc
@@ -919,20 +919,20 @@
abstract public TypeCode create_recursive_sequence_tc(int bound, int offset);
/**
- * Creates a <code>TypeCode</code> object representing an IDL <code>array</code>.
- * The <code>TypeCode</code> object is initialized with the given length and
+ * Creates a {@code TypeCode} object representing an IDL {@code array}.
+ * The {@code TypeCode} object is initialized with the given length and
* element type.
*
- * @param length the length of the <code>array</code>
- * @param element_type a <code>TypeCode</code> object describing the type
- * of element contained in the <code>array</code>
- * @return a newly-created <code>TypeCode</code> object describing
- * an IDL <code>array</code>
+ * @param length the length of the {@code array}
+ * @param element_type a {@code TypeCode} object describing the type
+ * of element contained in the {@code array}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code array}
*/
abstract public TypeCode create_array_tc(int length, TypeCode element_type);
/**
- * Create a <code>TypeCode</code> object for an IDL native type.
+ * Create a {@code TypeCode} object for an IDL native type.
*
* @param id the logical id for the native type.
* @param name the name of the native type.
@@ -945,7 +945,7 @@
}
/**
- * Create a <code>TypeCode</code> object for an IDL abstract interface.
+ * Create a {@code TypeCode} object for an IDL abstract interface.
*
* @param id the logical id for the abstract interface type.
* @param name the name of the abstract interface type.
@@ -960,7 +960,7 @@
/**
- * Create a <code>TypeCode</code> object for an IDL fixed type.
+ * Create a {@code TypeCode} object for an IDL fixed type.
*
* @param digits specifies the total number of decimal digits in the number
* and must be from 1 to 31 inclusive.
@@ -977,7 +977,7 @@
/**
- * Create a <code>TypeCode</code> object for an IDL value type.
+ * Create a {@code TypeCode} object for an IDL value type.
* The concrete_base parameter is the TypeCode for the immediate
* concrete valuetype base of the valuetype for which the TypeCode
* is being created.
@@ -987,7 +987,7 @@
* @param name the name of the value type.
* @param type_modifier one of the value type modifier constants:
* VM_NONE, VM_CUSTOM, VM_ABSTRACT or VM_TRUNCATABLE
- * @param concrete_base a <code>TypeCode</code> object
+ * @param concrete_base a {@code TypeCode} object
* describing the concrete valuetype base
* @param members an array containing the members of the value type
* @return the requested TypeCode
@@ -1002,14 +1002,14 @@
}
/**
- * Create a recursive <code>TypeCode</code> object which
+ * Create a recursive {@code TypeCode} object which
* serves as a placeholder for a concrete TypeCode during the process of creating
* TypeCodes which contain recursion. The id parameter specifies the repository id of
* the type for which the recursive TypeCode is serving as a placeholder. Once the
* recursive TypeCode has been properly embedded in the enclosing TypeCode which
* corresponds to the specified repository id, it will function as a normal TypeCode.
* Invoking operations on the recursive TypeCode before it has been embedded in the
- * enclosing TypeCode will result in a <code>BAD_TYPECODE</code> exception.
+ * enclosing TypeCode will result in a {@code BAD_TYPECODE} exception.
* <P>
* For example, the following IDL type declaration contains recursion:
* <PRE>
@@ -1046,7 +1046,7 @@
}
/**
- * Creates a <code>TypeCode</code> object for an IDL value box.
+ * Creates a {@code TypeCode} object for an IDL value box.
*
* @param id the logical id for the value type
* @param name the name of the value type
@@ -1064,11 +1064,11 @@
// orbos 98-01-18: Objects By Value -- end
/**
- * Creates an IDL <code>Any</code> object initialized to
- * contain a <code>Typecode</code> object whose <code>kind</code> field
- * is set to <code>TCKind.tc_null</code>.
+ * Creates an IDL {@code Any} object initialized to
+ * contain a {@code Typecode} object whose {@code kind} field
+ * is set to {@code TCKind.tc_null}.
*
- * @return a newly-created <code>Any</code> object
+ * @return a newly-created {@code Any} object
*/
abstract public Any create_any();
@@ -1076,15 +1076,15 @@
/**
- * Retrieves a <code>Current</code> object.
- * The <code>Current</code> interface is used to manage thread-specific
+ * Retrieves a {@code Current} object.
+ * The {@code Current} interface is used to manage thread-specific
* information for use by services such as transactions and security.
*
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
*
- * @return a newly-created <code>Current</code> object
- * @deprecated use <code>resolve_initial_references</code>.
+ * @return a newly-created {@code Current} object
+ * @deprecated use {@code resolve_initial_references}.
*/
@Deprecated
public org.omg.CORBA.Current get_current()
@@ -1095,7 +1095,7 @@
/**
* This operation blocks the current thread until the ORB has
* completed the shutdown process, initiated when some thread calls
- * <code>shutdown</code>. It may be used by multiple threads which
+ * {@code shutdown}. It may be used by multiple threads which
* get all notified when the ORB shuts down.
*
*/
@@ -1107,29 +1107,29 @@
/**
* Instructs the ORB to shut down, which causes all
* object adapters to shut down, in preparation for destruction.<br>
- * If the <code>wait_for_completion</code> parameter
+ * If the {@code wait_for_completion} parameter
* is true, this operation blocks until all ORB processing (including
* processing of currently executing requests, object deactivation,
* and other object adapter operations) has completed.
* If an application does this in a thread that is currently servicing
- * an invocation, the <code>BAD_INV_ORDER</code> system exception
+ * an invocation, the {@code BAD_INV_ORDER} system exception
* will be thrown with the OMG minor code 3,
* since blocking would result in a deadlock.<br>
- * If the <code>wait_for_completion</code> parameter is <code>FALSE</code>,
+ * If the {@code wait_for_completion} parameter is {@code FALSE},
* then shutdown may not have completed upon return.<p>
* While the ORB is in the process of shutting down, the ORB operates as normal,
* servicing incoming and outgoing requests until all requests have been completed.
* Once an ORB has shutdown, only object reference management operations
* may be invoked on the ORB or any object reference obtained from it.
- * An application may also invoke the <code>destroy</code> operation on the ORB itself.
- * Invoking any other operation will throw the <code>BAD_INV_ORDER</code>
+ * An application may also invoke the {@code destroy} operation on the ORB itself.
+ * Invoking any other operation will throw the {@code BAD_INV_ORDER}
* system exception with the OMG minor code 4.<p>
- * The <code>ORB.run</code> method will return after
- * <code>shutdown</code> has been called.
+ * The {@code ORB.run} method will return after
+ * {@code shutdown} has been called.
*
- * @param wait_for_completion <code>true</code> if the call
+ * @param wait_for_completion {@code true} if the call
* should block until the shutdown is complete;
- * <code>false</code> if it should return immediately
+ * {@code false} if it should return immediately
* @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing
* an invocation
*/
@@ -1139,12 +1139,12 @@
}
/**
- * Returns <code>true</code> if the ORB needs the main thread to
- * perform some work, and <code>false</code> if the ORB does not
+ * Returns {@code true} if the ORB needs the main thread to
+ * perform some work, and {@code false} if the ORB does not
* need the main thread.
*
- * @return <code>true</code> if there is work pending, meaning that the ORB
- * needs the main thread to perform some work; <code>false</code>
+ * @return {@code true} if there is work pending, meaning that the ORB
+ * needs the main thread to perform some work; {@code false}
* if there is no work pending and thus the ORB does not need the
* main thread
*
@@ -1157,7 +1157,7 @@
/**
* Performs an implementation-dependent unit of work if called
* by the main thread. Otherwise it does nothing.
- * The methods <code>work_pending</code> and <code>perform_work</code>
+ * The methods {@code work_pending} and {@code perform_work}
* can be used in
* conjunction to implement a simple polling loop that multiplexes
* the main thread among the ORB and other activities.
@@ -1172,23 +1172,23 @@
* Used to obtain information about CORBA facilities and services
* that are supported by this ORB. The service type for which
* information is being requested is passed in as the in
- * parameter <tt>service_type</tt>, the values defined by
+ * parameter {@code service_type}, the values defined by
* constants in the CORBA module. If service information is
* available for that type, that is returned in the out parameter
- * <tt>service_info</tt>, and the operation returns the
- * value <tt>true</tt>. If no information for the requested
- * services type is available, the operation returns <tt>false</tt>
+ * {@code service_info}, and the operation returns the
+ * value {@code true}. If no information for the requested
+ * services type is available, the operation returns {@code false}
* (i.e., the service is not supported by this ORB).
*
- * @param service_type a <code>short</code> indicating the
+ * @param service_type a {@code short} indicating the
* service type for which information is being requested
- * @param service_info a <code>ServiceInformationHolder</code> object
- * that will hold the <code>ServiceInformation</code> object
+ * @param service_info a {@code ServiceInformationHolder} object
+ * that will hold the {@code ServiceInformation} object
* produced by this method
- * @return <code>true</code> if service information is available
- * for the <tt>service_type</tt>;
- * <tt>false</tt> if no information for the
- * requested services type is available
+ * @return {@code true} if service information is available
+ * for the {@code service_type};
+ * {@code false} if no information for the
+ * requested services type is available
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
*/
@@ -1201,13 +1201,13 @@
// orbos 98-01-18: Objects By Value -- begin
/**
- * Creates a new <code>DynAny</code> object from the given
- * <code>Any</code> object.
+ * Creates a new {@code DynAny} object from the given
+ * {@code Any} object.
*
- * @param value the <code>Any</code> object from which to create a new
- * <code>DynAny</code> object
- * @return the new <code>DynAny</code> object created from the given
- * <code>Any</code> object
+ * @param value the {@code Any} object from which to create a new
+ * {@code DynAny} object
+ * @return the new {@code DynAny} object created from the given
+ * {@code Any} object
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
* @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
@@ -1219,15 +1219,15 @@
}
/**
- * Creates a basic <code>DynAny</code> object from the given
- * <code>TypeCode</code> object.
+ * Creates a basic {@code DynAny} object from the given
+ * {@code TypeCode} object.
*
- * @param type the <code>TypeCode</code> object from which to create a new
- * <code>DynAny</code> object
- * @return the new <code>DynAny</code> object created from the given
- * <code>TypeCode</code> object
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynAny} object
+ * @return the new {@code DynAny} object created from the given
+ * {@code TypeCode} object
* @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
- * <code>TypeCode</code> object is not consistent with the operation.
+ * {@code TypeCode} object is not consistent with the operation.
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
* @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
@@ -1239,15 +1239,15 @@
}
/**
- * Creates a new <code>DynStruct</code> object from the given
- * <code>TypeCode</code> object.
+ * Creates a new {@code DynStruct} object from the given
+ * {@code TypeCode} object.
*
- * @param type the <code>TypeCode</code> object from which to create a new
- * <code>DynStruct</code> object
- * @return the new <code>DynStruct</code> object created from the given
- * <code>TypeCode</code> object
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynStruct} object
+ * @return the new {@code DynStruct} object created from the given
+ * {@code TypeCode} object
* @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
- * <code>TypeCode</code> object is not consistent with the operation.
+ * {@code TypeCode} object is not consistent with the operation.
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
* @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
@@ -1259,15 +1259,15 @@
}
/**
- * Creates a new <code>DynSequence</code> object from the given
- * <code>TypeCode</code> object.
+ * Creates a new {@code DynSequence} object from the given
+ * {@code TypeCode} object.
*
- * @param type the <code>TypeCode</code> object from which to create a new
- * <code>DynSequence</code> object
- * @return the new <code>DynSequence</code> object created from the given
- * <code>TypeCode</code> object
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynSequence} object
+ * @return the new {@code DynSequence} object created from the given
+ * {@code TypeCode} object
* @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
- * <code>TypeCode</code> object is not consistent with the operation.
+ * {@code TypeCode} object is not consistent with the operation.
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
* @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
@@ -1280,15 +1280,15 @@
/**
- * Creates a new <code>DynArray</code> object from the given
- * <code>TypeCode</code> object.
+ * Creates a new {@code DynArray} object from the given
+ * {@code TypeCode} object.
*
- * @param type the <code>TypeCode</code> object from which to create a new
- * <code>DynArray</code> object
- * @return the new <code>DynArray</code> object created from the given
- * <code>TypeCode</code> object
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynArray} object
+ * @return the new {@code DynArray} object created from the given
+ * {@code TypeCode} object
* @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
- * <code>TypeCode</code> object is not consistent with the operation.
+ * {@code TypeCode} object is not consistent with the operation.
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
* @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
@@ -1300,15 +1300,15 @@
}
/**
- * Creates a new <code>DynUnion</code> object from the given
- * <code>TypeCode</code> object.
+ * Creates a new {@code DynUnion} object from the given
+ * {@code TypeCode} object.
*
- * @param type the <code>TypeCode</code> object from which to create a new
- * <code>DynUnion</code> object
- * @return the new <code>DynUnion</code> object created from the given
- * <code>TypeCode</code> object
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynUnion} object
+ * @return the new {@code DynUnion} object created from the given
+ * {@code TypeCode} object
* @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
- * <code>TypeCode</code> object is not consistent with the operation.
+ * {@code TypeCode} object is not consistent with the operation.
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
* @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
@@ -1320,15 +1320,15 @@
}
/**
- * Creates a new <code>DynEnum</code> object from the given
- * <code>TypeCode</code> object.
+ * Creates a new {@code DynEnum} object from the given
+ * {@code TypeCode} object.
*
- * @param type the <code>TypeCode</code> object from which to create a new
- * <code>DynEnum</code> object
- * @return the new <code>DynEnum</code> object created from the given
- * <code>TypeCode</code> object
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynEnum} object
+ * @return the new {@code DynEnum} object created from the given
+ * {@code TypeCode} object
* @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
- * <code>TypeCode</code> object is not consistent with the operation.
+ * {@code TypeCode} object is not consistent with the operation.
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
* @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
@@ -1342,19 +1342,19 @@
/**
* Can be invoked to create new instances of policy objects
* of a specific type with specified initial state. If
- * <tt>create_policy</tt> fails to instantiate a new Policy
+ * {@code create_policy} fails to instantiate a new Policy
* object due to its inability to interpret the requested type
- * and content of the policy, it raises the <tt>PolicyError</tt>
+ * and content of the policy, it raises the {@code PolicyError}
* exception with the appropriate reason.
- * @param type the <tt>PolicyType</tt> of the policy object to
+ * @param type the {@code PolicyType} of the policy object to
* be created
* @param val the value that will be used to set the initial
- * state of the <tt>Policy</tt> object that is created
- * @return Reference to a newly created <tt>Policy</tt> object
- * of type specified by the <tt>type</tt> parameter and
- * initialized to a state specified by the <tt>val</tt>
+ * state of the {@code Policy} object that is created
+ * @return Reference to a newly created {@code Policy} object
+ * of type specified by the {@code type} parameter and
+ * initialized to a state specified by the {@code val}
* parameter
- * @throws <tt>org.omg.CORBA.PolicyError</tt> when the requested
+ * @throws org.omg.CORBA.PolicyError when the requested
* policy is not supported or a requested initial state
* for the policy is not supported.
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ObjectHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ObjectHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -24,10 +24,10 @@
*/
/**
-* The Helper for <tt>Object</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-*/
+ * The Helper for {@code Object}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ */
/*
* Licensed Materials - Property of IBM
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ObjectHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ObjectHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,55 +31,55 @@
/**
- * The Holder for <tt>Object</tt>. For more information on
+ * The Holder for {@code Object}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* A Holder class for a CORBA object reference (a value of type
- * <code>org.omg.CORBA.Object</code>). It is usually
+ * {@code org.omg.CORBA.Object}). It is usually
* used to store "out" and "inout" parameters in IDL methods.
* If an IDL method signature has a CORBA Object reference as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>ObjectHolder</code> as the corresponding
+ * {@code ObjectHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myObjectHolder</code> is an instance of <code>ObjectHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myObjectHolder.value</code>.
+ * If {@code myObjectHolder} is an instance of {@code ObjectHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myObjectHolder.value}.
*
* @since JDK1.2
*/
public final class ObjectHolder implements Streamable {
/**
- * The <code>Object</code> value held by this <code>ObjectHolder</code>
+ * The {@code Object} value held by this {@code ObjectHolder}
* object.
*/
public Object value;
/**
- * Constructs a new <code>ObjectHolder</code> object with its
- * <code>value</code> field initialized to <code>null</code>.
+ * Constructs a new {@code ObjectHolder} object with its
+ * {@code value} field initialized to {@code null}.
*/
public ObjectHolder() {
}
/**
- * Constructs a new <code>ObjectHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>Object</code>.
- * @param initial the <code>Object</code> with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>ObjectHolder</code> object
+ * Constructs a new {@code ObjectHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code Object}.
+ * @param initial the {@code Object} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code ObjectHolder} object
*/
public ObjectHolder(Object initial) {
value = initial;
}
/**
- * Reads from <code>input</code> and initalizes the value in
- * this <code>ObjectHolder</code> object
+ * Reads from {@code input} and initalizes the value in
+ * this {@code ObjectHolder} object
* with the unmarshalled data.
*
* @param input the InputStream containing CDR formatted data from the wire.
@@ -89,8 +89,8 @@
}
/**
- * Marshals to <code>output</code> the value in
- * this <code>ObjectHolder</code> object.
+ * Marshals to {@code output} the value in
+ * this {@code ObjectHolder} object.
*
* @param output the OutputStream which will contain the CDR formatted data.
*/
@@ -100,10 +100,10 @@
/**
* Returns the TypeCode corresponding to the value held in
- * this <code>ObjectHolder</code> object
+ * this {@code ObjectHolder} object
*
* @return the TypeCode of the value held in
- * this <code>ObjectHolder</code> object
+ * this {@code ObjectHolder} object
*/
public org.omg.CORBA.TypeCode _type() {
return org.omg.CORBA.ORB.init().get_primitive_tc(TCKind.tk_objref);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,26 +26,26 @@
/**
-* The Helper for <tt>OctetSeq</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/OctetSeqHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*
-* The class definition has been modified to conform to the following
-* OMG specifications :
-* <ul>
-* <li> ORB core as defined by CORBA 2.3.1
-* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
-* </li>
-*
-* <li> IDL/Java Language Mapping as defined in
-* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
-* </li>
-* </ul>
-*/
+ * The Helper for {@code OctetSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/OctetSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
public abstract class OctetSeqHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>OctetSeq</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/OctetSeqHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from streams.idl
-* 13 May 1999 22:41:36 o'clock GMT+00:00
-*/
+ * The Holder for {@code OctetSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/OctetSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
public final class OctetSeqHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/Policy.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/Policy.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,21 +26,21 @@
/**
-* Interfaces derived from the <tt>Policy</tt> interface allow an
-* ORB or CORBA service access to certain choices that affect
-* its operation. This information is accessed in a structured
-* manner using interfaces derived from the <tt>Policy</tt>
-* interface defined in the CORBA module. A CORBA service does not
-* have to use this method of accessing operating options, but
-* may choose to do so. The Security Service in particular uses
-* this technique for associating Security Policy with objects
-* in the system.
-* An interface generated by the IDL-to-Java compiler.
-* org/omg/CORBA/Policy.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:20 AM PDT
-*/
+ * Interfaces derived from the {@code Policy} interface allow an
+ * ORB or CORBA service access to certain choices that affect
+ * its operation. This information is accessed in a structured
+ * manner using interfaces derived from the {@code Policy}
+ * interface defined in the CORBA module. A CORBA service does not
+ * have to use this method of accessing operating options, but
+ * may choose to do so. The Security Service in particular uses
+ * this technique for associating Security Policy with objects
+ * in the system.
+ * An interface generated by the IDL-to-Java compiler.
+ * org/omg/CORBA/Policy.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
public interface Policy extends PolicyOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Helper for <tt>Policy</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/PolicyHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:20 AM PDT
-*/
+ * The Helper for {@code Policy}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/PolicyHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
abstract public class PolicyHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,14 +25,14 @@
package org.omg.CORBA;
/**
-* The Holder for <tt>Policy</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/PolicyHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:20 AM PDT
-*/
+ * The Holder for {@code Policy}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/PolicyHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
public final class PolicyHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyListHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyListHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Helper for <tt>PolicyList</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/PolicyListHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:21 AM PDT
-*/
+ * The Helper for {@code PolicyList}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/PolicyListHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT
+ */
abstract public class PolicyListHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyListHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyListHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Holder for <tt>PolicyList</tt>. For more information on
-* Holder files, see <a href="doc-files/generatedfiles.html#holder">
-* "Generated Files: Holder Files"</a>.<P>
-* org/omg/CORBA/PolicyListHolder.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:21 AM PDT
-*/
+ * The Holder for {@code PolicyList}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/PolicyListHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT
+ */
public final class PolicyListHolder implements org.omg.CORBA.portable.Streamable
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyOperations.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyOperations.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,18 +26,18 @@
/**
-* The interface for <tt>Policy</tt>. For more information on
-* Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
-* "Generated Files: Operations files"</a>.
-*<P>
-* org/omg/CORBA/PolicyOperations.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:20 AM PDT
-*/
+ * The interface for {@code Policy}. For more information on
+ * Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
+ * "Generated Files: Operations files"</a>.
+ * <P>
+ * org/omg/CORBA/PolicyOperations.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
/**
- * Provides the operations for a <code>Policy</code> object.
+ * Provides the operations for a {@code Policy} object.
*/
public interface PolicyOperations
{
@@ -57,16 +57,16 @@
int policy_type ();
/**
- * Returns a copy of the <code>Policy</code> object. The copy does not retain
+ * Returns a copy of the {@code Policy} object. The copy does not retain
* any relationships that the policy had with any domain or object.
*
- * @return a copy of the <code>Policy</code> object
+ * @return a copy of the {@code Policy} object
*/
org.omg.CORBA.Policy copy ();
/**
- * Destroys the <code>Policy</code> object. It is the responsibility of
- * the <code>Policy</code> object to determine whether it can be destroyed.
+ * Destroys the {@code Policy} object. It is the responsibility of
+ * the {@code Policy} object to determine whether it can be destroyed.
*/
void destroy ();
} // interface PolicyOperations
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyTypeHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/PolicyTypeHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,14 +26,14 @@
/**
-* The Helper for <tt>PolicyType</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-* org/omg/CORBA/PolicyTypeHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
-* Saturday, July 17, 1999 12:26:20 AM PDT
-*/
+ * The Helper for {@code PolicyType}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/PolicyTypeHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
// basic Policy definition
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/PrincipalHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/PrincipalHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,22 +31,22 @@
/**
- * The Holder for <tt>Principal</tt>. For more information on
+ * The Holder for {@code Principal}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A container class for values of type <code>Principal</code>
+ * A container class for values of type {@code Principal}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>Principal</code> as an "out"
+ * If an IDL method signature has an IDL {@code Principal} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>PrincipalHolder</code> as the corresponding
+ * {@code PrincipalHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myPrincipalHolder</code> is an instance of <code>PrincipalHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myPrincipalHolder.value</code>.
+ * If {@code myPrincipalHolder} is an instance of {@code PrincipalHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myPrincipalHolder.value}.
*
* @since JDK1.2
* @deprecated Deprecated by CORBA 2.2.
@@ -54,25 +54,25 @@
@Deprecated
public final class PrincipalHolder implements Streamable {
/**
- * The <code>Principal</code> value held by this <code>PrincipalHolder</code>
+ * The {@code Principal} value held by this {@code PrincipalHolder}
* object.
*/
public Principal value;
/**
- * Constructs a new <code>PrincipalHolder</code> object with its
- * <code>value</code> field initialized to <code>null</code>.
+ * Constructs a new {@code PrincipalHolder} object with its
+ * {@code value} field initialized to {@code null}.
*/
public PrincipalHolder() {
}
/**
- * Constructs a new <code>PrincipalHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>Principal</code> object.
- * @param initial the <code>Principal</code> with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>PrincipalHolder</code> object
+ * Constructs a new {@code PrincipalHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code Principal} object.
+ * @param initial the {@code Principal} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code PrincipalHolder} object
*/
public PrincipalHolder(Principal initial) {
value = initial;
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/RepositoryIdHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/RepositoryIdHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,15 +26,15 @@
/**
-* The Helper for <tt>RepositoryId</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-
-* org/omg/CORBA/RepositoryIdHelper.java
-* Generated by the IDL-to-Java compiler (portable), version "3.0"
-* from ir.idl
-* 03 June 1999 11:33:43 o'clock GMT+00:00
-*/
+ * The Helper for {@code RepositoryId}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ *
+ * org/omg/CORBA/RepositoryIdHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ir.idl
+ * 03 June 1999 11:33:43 o'clock GMT+00:00
+ */
abstract public class RepositoryIdHelper
{
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ServiceDetailHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ServiceDetailHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -24,10 +24,10 @@
*/
/**
- * The Helper for <tt>ServiceDetail</tt>. For more information on
- * Helper files, see <a href="doc-files/generatedfiles.html#helper">
- * "Generated Files: Helper Files"</a>.<P>
- */
+ * The Helper for {@code ServiceDetail}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ */
package org.omg.CORBA;
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ServiceInformation.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ServiceInformation.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,9 +26,10 @@
package org.omg.CORBA;
-/** An IDL struct in the CORBA module that
+/**
+ * An IDL struct in the CORBA module that
* stores information about a CORBA service available in the
- * ORB implementation and is obtained from the <tt>ORB.get_service_information</tt>
+ * ORB implementation and is obtained from the {@code ORB.get_service_information}
* method.
*/
public final class ServiceInformation implements org.omg.CORBA.portable.IDLEntity
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -24,10 +24,10 @@
*/
/**
- * The Helper for <tt>ServiceInformation</tt>. For more information on
-* Helper files, see <a href="doc-files/generatedfiles.html#helper">
-* "Generated Files: Helper Files"</a>.<P>
-*/
+ * The Helper for {@code ServiceInformation}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ */
package org.omg.CORBA;
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,48 +26,48 @@
package org.omg.CORBA;
/**
- * The Holder for <tt>ServiceInformation</tt>. For more information on
+ * The Holder for {@code ServiceInformation}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>ServiceInformation</code> object
+ * A Holder class for a {@code ServiceInformation} object
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>xxx</code> as an "out"
+ * If an IDL method signature has an IDL {@code xxx} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>ServiceInformationHolder</code> as the corresponding
+ * {@code ServiceInformationHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myServiceInformationHolder</code> is an instance of <code>ServiceInformationHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myServiceInformationHolder.value</code>.
+ * If {@code myServiceInformationHolder} is an instance of {@code ServiceInformationHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myServiceInformationHolder.value}.
*/
public final class ServiceInformationHolder
implements org.omg.CORBA.portable.Streamable {
/**
- * The <code>ServiceInformation</code> value held by this
- * <code>ServiceInformationHolder</code> object in its <code>value</code> field.
+ * The {@code ServiceInformation} value held by this
+ * {@code ServiceInformationHolder} object in its {@code value} field.
*/
public ServiceInformation value;
/**
- * Constructs a new <code>ServiceInformationHolder</code> object with its
- * <code>value</code> field initialized to null.
+ * Constructs a new {@code ServiceInformationHolder} object with its
+ * {@code value} field initialized to null.
*/
public ServiceInformationHolder() {
this(null);
}
/**
- * Constructs a new <code>ServiceInformationHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>ServiceInformation</code> object.
+ * Constructs a new {@code ServiceInformationHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code ServiceInformation} object.
*
- * @param arg the <code>ServiceInformation</code> object with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>ServiceInformationHolder</code> object
+ * @param arg the {@code ServiceInformation} object with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code ServiceInformationHolder} object
*/
public ServiceInformationHolder(org.omg.CORBA.ServiceInformation arg) {
value = arg;
@@ -75,10 +75,10 @@
/**
- * Marshals the value in this <code>ServiceInformationHolder</code> object's
- * <code>value</code> field to the output stream <code>out</code>.
+ * Marshals the value in this {@code ServiceInformationHolder} object's
+ * {@code value} field to the output stream {@code out}.
*
- * @param out the <code>OutputStream</code> object that will contain
+ * @param out the {@code OutputStream} object that will contain
* the CDR formatted data
*/
public void _write(org.omg.CORBA.portable.OutputStream out) {
@@ -86,10 +86,10 @@
}
/**
- * Reads unmarshalled data from the input stream <code>in</code> and assigns it to
- * the <code>value</code> field in this <code>ServiceInformationHolder</code> object.
+ * Reads unmarshalled data from the input stream {@code in} and assigns it to
+ * the {@code value} field in this {@code ServiceInformationHolder} object.
*
- * @param in the <code>InputStream</code> object containing CDR
+ * @param in the {@code InputStream} object containing CDR
* formatted data from the wire
*/
public void _read(org.omg.CORBA.portable.InputStream in) {
@@ -97,11 +97,11 @@
}
/**
- * Retrieves the <code>TypeCode</code> object that corresponds
- * to the value held in this <code>ServiceInformationHolder</code> object's
- * <code>value</code> field.
+ * Retrieves the {@code TypeCode} object that corresponds
+ * to the value held in this {@code ServiceInformationHolder} object's
+ * {@code value} field.
*
- * @return the type code for the value held in this <code>ServiceInformationHolder</code>
+ * @return the type code for the value held in this {@code ServiceInformationHolder}
* object
*/
public org.omg.CORBA.TypeCode _type() {
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/SetOverrideTypeHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/SetOverrideTypeHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>SetOverrideType</tt>. For more information on
+* The Helper for {@code SetOverrideType}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/SetOverrideTypeHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,55 +30,55 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>Short</tt>. For more information on
+ * The Holder for {@code Short}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.
- * <P>A Holder class for a <code>short</code>
+ * <P>A Holder class for a {@code short}
* that is used to store "out" and "inout" parameters in IDL operations.
- * If an IDL operation signature has an IDL <code>short</code> as an "out"
+ * If an IDL operation signature has an IDL {@code short} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>ShortHolder</code> as the corresponding
+ * {@code ShortHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myShortHolder</code> is an instance of <code>ShortHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myShortHolder.value</code>.
+ * If {@code myShortHolder} is an instance of {@code ShortHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myShortHolder.value}.
*
* @since JDK1.2
*/
public final class ShortHolder implements Streamable {
/**
- * The <code>short</code> value held by this <code>ShortHolder</code>
+ * The {@code short} value held by this {@code ShortHolder}
* object.
*/
public short value;
/**
- * Constructs a new <code>ShortHolder</code> object with its
- * <code>value</code> field initialized to <code>0</code>.
+ * Constructs a new {@code ShortHolder} object with its
+ * {@code value} field initialized to {@code 0}.
*/
public ShortHolder() {
}
/**
- * Constructs a new <code>ShortHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>short</code>.
- * @param initial the <code>short</code> with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>ShortHolder</code> object
+ * Constructs a new {@code ShortHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code short}.
+ * @param initial the {@code short} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code ShortHolder} object
*/
public ShortHolder(short initial) {
value = initial;
}
/**
- * Reads from <code>input</code> and initalizes the value in
- * this <code>ShortHolder</code> object
+ * Reads from {@code input} and initalizes the value in
+ * this {@code ShortHolder} object
* with the unmarshalled data.
*
* @param input the InputStream containing CDR formatted data from the wire.
@@ -88,8 +88,8 @@
}
/**
- * Marshals to <code>output</code> the value in
- * this <code>ShortHolder</code> object.
+ * Marshals to {@code output} the value in
+ * this {@code ShortHolder} object.
*
* @param output the OutputStream which will contain the CDR formatted data.
*/
@@ -99,10 +99,10 @@
/**
* Returns the TypeCode corresponding to the value held in
- * this <code>ShortHolder</code> object.
+ * this {@code ShortHolder} object.
*
* @return the TypeCode of the value held in
- * this <code>ShortHolder</code> object
+ * this {@code ShortHolder} object
*/
public org.omg.CORBA.TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_short);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>ShortSeqHelper</tt>. For more information on
+* The Helper for {@code ShortSeqHelper}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/ShortSeqHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Holder for <tt>ShortSeq</tt>. For more information on
+* The Holder for {@code ShortSeq}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* org/omg/CORBA/ShortSeqHolder.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/StringHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/StringHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,55 +30,55 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>String</tt>. For more information on
+ * The Holder for {@code String}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>String</code>
+ * A Holder class for a {@code String}
* that is used to store "out" and "inout" parameters in IDL operations.
- * If an IDL operation signature has an IDL <code>string</code> as an "out"
+ * If an IDL operation signature has an IDL {@code string} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>StringHolder</code> as the corresponding
+ * {@code StringHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myStringHolder</code> is an instance of <code>StringHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myStringHolder.value</code>.
+ * If {@code myStringHolder} is an instance of {@code StringHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myStringHolder.value}.
*
* @since JDK1.2
*/
public final class StringHolder implements Streamable {
/**
- * The <code>String</code> value held by this <code>StringHolder</code>
+ * The {@code String} value held by this {@code StringHolder}
* object.
*/
public String value;
/**
- * Constructs a new <code>StringHolder</code> object with its
- * <code>value</code> field initialized to <code>null</code>.
+ * Constructs a new {@code StringHolder} object with its
+ * {@code value} field initialized to {@code null}.
*/
public StringHolder() {
}
/**
- * Constructs a new <code>StringHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>String</code>.
- * @param initial the <code>String</code> with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>StringHolder</code> object
+ * Constructs a new {@code StringHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code String}.
+ * @param initial the {@code String} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code StringHolder} object
*/
public StringHolder(String initial) {
value = initial;
}
/**
- * Reads the unmarshalled data from <code>input</code> and assigns it to
- * the <code>value</code> field of this <code>StringHolder</code> object.
+ * Reads the unmarshalled data from {@code input} and assigns it to
+ * the {@code value} field of this {@code StringHolder} object.
*
* @param input the InputStream containing CDR formatted data from the wire.
*/
@@ -87,8 +87,8 @@
}
/**
- * Marshals the value held by this <code>StringHolder</code> object
- * to the output stream <code>output</code>.
+ * Marshals the value held by this {@code StringHolder} object
+ * to the output stream {@code output}.
*
* @param output the OutputStream which will contain the CDR formatted data.
*/
@@ -97,10 +97,10 @@
}
/**
- * Retrieves the <code>TypeCode</code> object that corresponds to
- * the value held in this <code>StringHolder</code> object.
+ * Retrieves the {@code TypeCode} object that corresponds to
+ * the value held in this {@code StringHolder} object.
*
- * @return the type code of the value held in this <code>StringHolder</code>
+ * @return the type code of the value held in this {@code StringHolder}
* object
*/
public org.omg.CORBA.TypeCode _type() {
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/StringValueHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/StringValueHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -32,7 +32,7 @@
package org.omg.CORBA;
/**
-* The Helper for <tt>StringValue</tt>. For more information on
+* The Helper for {@code StringValue}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/StringValueHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/StructMemberHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/StructMemberHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>StructMember</tt>. For more information on
+* The Helper for {@code StructMember}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/StructMemberHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCodeHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TypeCodeHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,55 +30,55 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>TypeCode</tt>. For more information on
+ * The Holder for {@code TypeCode}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>TypeCode</code> object
+ * A Holder class for a {@code TypeCode} object
* that is used to store "out" and "inout" parameters in IDL operations.
- * If an IDL operation signature has an IDL <code>TypeCode</code> as an "out"
+ * If an IDL operation signature has an IDL {@code TypeCode} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>TypeCodeHolder</code> as the corresponding
+ * {@code TypeCodeHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myTypeCodeHolder</code> is an instance of <code>TypeCodeHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myTypeCodeHolder.value</code>.
+ * If {@code myTypeCodeHolder} is an instance of {@code TypeCodeHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myTypeCodeHolder.value}.
*
* @since JDK1.2
*/
public final class TypeCodeHolder implements Streamable {
/**
- * The <code>TypeCode</code> value held by
- * this <code>TypeCodeHolder</code> object.
+ * The {@code TypeCode} value held by
+ * this {@code TypeCodeHolder} object.
*/
public TypeCode value;
/**
- * Constructs a new <code>TypeCodeHolder</code> object with its
- * <code>value</code> field initialized to <code>null</code>.
+ * Constructs a new {@code TypeCodeHolder} object with its
+ * {@code value} field initialized to {@code null}.
*/
public TypeCodeHolder() {
}
/**
- * Constructs a new <code>TypeCodeHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>TypeCode</code> object.
- * @param initial the <code>TypeCode</code> object with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>TypeCodeHolder</code> object
+ * Constructs a new {@code TypeCodeHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code TypeCode} object.
+ * @param initial the {@code TypeCode} object with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code TypeCodeHolder} object
*/
public TypeCodeHolder(TypeCode initial) {
value = initial;
}
/**
- * Reads from <code>input</code> and initalizes the value in
- * this <code>TypeCodeHolder</code> object
+ * Reads from {@code input} and initalizes the value in
+ * this {@code TypeCodeHolder} object
* with the unmarshalled data.
*
* @param input the InputStream containing CDR formatted data from the wire
@@ -88,8 +88,8 @@
}
/**
- * Marshals to <code>output</code> the value in
- * this <code>TypeCodeHolder</code> object.
+ * Marshals to {@code output} the value in
+ * this {@code TypeCodeHolder} object.
*
* @param output the OutputStream which will contain the CDR formatted data
*/
@@ -99,10 +99,10 @@
/**
* Returns the TypeCode corresponding to the value held in
- * this <code>TypeCodeHolder</code> object.
+ * this {@code TypeCodeHolder} object.
*
* @return the TypeCode of the value held in
- * this <code>TypeCodeHolder</code> object
+ * this {@code TypeCodeHolder} object
*/
public org.omg.CORBA.TypeCode _type() {
return ORB.init().get_primitive_tc(TCKind.tk_TypeCode);
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>ULongLongSeq</tt>. For more information on
+* The Helper for {@code ULongLongSeq}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/ULongLongSeqHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Holder for <tt>ULongLongSeq</tt>. For more information on
+* The Holder for {@code ULongLongSeq}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* org/omg/CORBA/ULongLongSeqHolder.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>ULongSeq</tt>. For more information on
+* The Helper for {@code ULongSeq}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/ULongSeqHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Holder for <tt>ULongSeq</tt>. For more information on
+* The Holder for {@code ULongSeq}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* org/omg/CORBA/ULongSeqHolder.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,8 +26,8 @@
package org.omg.CORBA;
/**
- * One of the <tt>PolicyErrorCode</tt>s which would be filled if
- * the requested <tt>Policy</tt> is understood to be valid by the
+ * One of the {@code PolicyErrorCode}s which would be filled if
+ * the requested {@code Policy} is understood to be valid by the
* ORB, but is not currently supported.
*
* @author rip-dev
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,8 +26,8 @@
package org.omg.CORBA;
/**
- * A <tt>PolicyErrorCode</tt> which would be filled if the value
- * requested for the <tt>Policy</tt> is of a
+ * A {@code PolicyErrorCode} which would be filled if the value
+ * requested for the {@code Policy} is of a
* valid type and within the valid range for that type, but this valid value
* is not currently supported.
*
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>UShortSeq</tt>. For more information on
+* The Helper for {@code UShortSeq}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/UShortSeqHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Holder for <tt>UShortSeq</tt>. For more information on
+* The Holder for {@code UShortSeq}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* org/omg/CORBA/UShortSeqHolder.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/UnionMemberHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UnionMemberHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>UnionMember</tt>. For more information on
+* The Helper for {@code UnionMember}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/UnionMemberHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>UnknownUserException</tt>. For more information on
+* The Helper for {@code UnknownUserException}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/UnknownUserExceptionHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,7 +25,7 @@
package org.omg.CORBA;
/**
-* The Holder for <tt>UnknownUserException</tt>. For more information on
+* The Holder for {@code UnknownUserException}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* org/omg/CORBA/UnknownUserExceptionHolder.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -24,7 +24,7 @@
*/
/**
- * The Helper for <tt>ValueBase</tt>. For more information on
+ * The Helper for {@code ValueBase}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -30,53 +30,53 @@
import org.omg.CORBA.portable.OutputStream;
/**
- * The Holder for <tt>ValueBase</tt>. For more information on
+ * The Holder for {@code ValueBase}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
- * A Holder class for a <code>java.io.Serializable</code>
+ * A Holder class for a {@code java.io.Serializable}
* that is used to store "out" and "inout" parameters in IDL methods.
- * If an IDL method signature has an IDL <code>ValueBase</code> as an "out"
+ * If an IDL method signature has an IDL {@code ValueBase} as an "out"
* or "inout" parameter, the programmer must pass an instance of
- * <code>ValueBaseHolder</code> as the corresponding
+ * {@code ValueBaseHolder} as the corresponding
* parameter in the method invocation; for "inout" parameters, the programmer
* must also fill the "in" value to be sent to the server.
* Before the method invocation returns, the ORB will fill in the
* value corresponding to the "out" value returned from the server.
* <P>
- * If <code>myValueBaseHolder</code> is an instance of <code>ValueBaseHolder</code>,
- * the value stored in its <code>value</code> field can be accessed with
- * <code>myValueBaseHolder.value</code>.
+ * If {@code myValueBaseHolder} is an instance of {@code ValueBaseHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myValueBaseHolder.value}.
*
*/
public final class ValueBaseHolder implements Streamable {
/**
- * The <code>java.io.Serializable</code> value held by this
- * <code>ValueBaseHolder</code> object.
+ * The {@code java.io.Serializable} value held by this
+ * {@code ValueBaseHolder} object.
*/
public java.io.Serializable value;
/**
- * Constructs a new <code>ValueBaseHolder</code> object with its
- * <code>value</code> field initialized to <code>0</code>.
+ * Constructs a new {@code ValueBaseHolder} object with its
+ * {@code value} field initialized to {@code 0}.
*/
public ValueBaseHolder() {
}
/**
- * Constructs a new <code>ValueBaseHolder</code> object with its
- * <code>value</code> field initialized to the given
- * <code>java.io.Serializable</code>.
- * @param initial the <code>java.io.Serializable</code> with which to initialize
- * the <code>value</code> field of the newly-created
- * <code>ValueBaseHolder</code> object
+ * Constructs a new {@code ValueBaseHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code java.io.Serializable}.
+ * @param initial the {@code java.io.Serializable} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code ValueBaseHolder} object
*/
public ValueBaseHolder(java.io.Serializable initial) {
value = initial;
}
/**
- * Reads from <code>input</code> and initalizes the value in the Holder
+ * Reads from {@code input} and initalizes the value in the Holder
* with the unmarshalled data.
*
* @param input the InputStream containing CDR formatted data from the wire
@@ -86,7 +86,7 @@
}
/**
- * Marshals to <code>output</code> the value in the Holder.
+ * Marshals to {@code output} the value in the Holder.
*
* @param output the OutputStream which will contain the CDR formatted data
*/
@@ -95,7 +95,7 @@
}
/**
- * Returns the <code>TypeCode</code> object
+ * Returns the {@code TypeCode} object
* corresponding to the value held in the Holder.
*
* @return the TypeCode of the value held in the holder
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ValueMemberHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ValueMemberHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>ValueMember</tt>. For more information on
+* The Helper for {@code ValueMember}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/ValueMemberHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/VersionSpecHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/VersionSpecHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>VersionSpec</tt>. For more information on
+* The Helper for {@code VersionSpec}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/VersionSpecHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/VisibilityHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/VisibilityHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>Visibility</tt>. For more information on
+* The Helper for {@code Visibility}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/VisibilityHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Helper for <tt>WCharSeq</tt>. For more information on
+* The Helper for {@code WCharSeq}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/WCharSeqHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Holder for <tt>WCharSeq</tt>. For more information on
+* The Holder for {@code WCharSeq}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* org/omg/CORBA/WCharSeqHolder.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/WStringValueHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/WStringValueHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -24,7 +24,7 @@
*/
/**
-* The Helper for <tt>WStringValue</tt>. For more information on
+* The Helper for {@code WStringValue}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHelper.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,7 +25,7 @@
package org.omg.CORBA;
/**
-* The Helper for <tt>WrongTransaction</tt>. For more information on
+* The Helper for {@code WrongTransaction}. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/WrongTransactionHelper.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHolder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHolder.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,7 +25,7 @@
package org.omg.CORBA;
/**
-* The Holder for <tt>WrongTransaction</tt>. For more information on
+* The Holder for {@code WrongTransaction}. For more information on
* Holder files, see <a href="doc-files/generatedfiles.html#holder">
* "Generated Files: Holder Files"</a>.<P>
* org/omg/CORBA/WrongTransactionHolder.java
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/_IDLTypeStub.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/_IDLTypeStub.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Stub for <tt>IDLType</tt>. For more information on
+* The Stub for {@code IDLType}. For more information on
* Stub files, see <a href="doc-files/generatedfiles.html#stub">
* "Generated Files: Stubs"</a>.<P>
* org/omg/CORBA/_IDLTypeStub.java
@@ -38,9 +38,9 @@
public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.IDLType
{
/**
- * Constructs a default <code>_IDLTypeStub</code> object.
+ * Constructs a default {@code _IDLTypeStub} object.
* NOTE: If the default constructor is used, the
- * object is useless until the method <code>_set_delegate</code>
+ * object is useless until the method {@code _set_delegate}
* has been called.
*/
// NOTE: This constructor is not required according to the spec. Only JCK expects it now.
@@ -50,8 +50,8 @@
}
/**
- * Constructs an <code>_IDLTypeStub</code> object initialized
- * with the given <code>Delegate</code> object.
+ * Constructs an {@code _IDLTypeStub} object initialized
+ * with the given {@code Delegate} object.
*
* @param delegate a Delegate object
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/_PolicyStub.java Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/_PolicyStub.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,7 @@
/**
-* The Stub for <tt>Policy</tt>. For more information on
+* The Stub for {@code Policy}. For more information on
* Stub files, see <a href="doc-files/generatedfiles.html#stub">
* "Generated Files: Stubs"</a>.<P>
* org/omg/CORBA/_PolicyStub.java
@@ -47,8 +47,8 @@
super ();
}
- /** Constructs a <code>_PolicyStub</code> object initialized
- * with the given <code>Delegate</code> object.
+ /** Constructs a {@code _PolicyStub} object initialized
+ * with the given {@code Delegate} object.
*
* @param delegate a Delegate Object
*/
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html Tue Sep 22 11:01:54 2015 -0700
@@ -50,16 +50,16 @@
<li>
CORBA 2.3.1 chapters 1-3 and 6-9</li>
-<li>Revised IDL to Java language mapping, section 1.21.8.2, the <tt>orb.properties</tt>
+<li>Revised IDL to Java language mapping, section 1.21.8.2, the <code>orb.properties</code>
file.</li>
<li>
CORBA 2.3.1 chapter 4 with the following replacements from the Portable
Interceptors specification:
<ul>
- <li>section 4.2.3.5 <TT>destroy</TT></li>
- <li>section 4.5.2 <TT>CodeFactory</TT> and <TT>PICurrent</TT> are required</li>
- <li>Section 4.5.3.4 as updated for <TT>register_initial_reference</TT></li>
+ <li>section 4.2.3.5 <code>destroy</code></li>
+ <li>section 4.5.2 <code>CodeFactory</code> and <code>PICurrent</code> are required</li>
+ <li>Section 4.5.3.4 as updated for <code>register_initial_reference</code></li>
</ul>
</li>
@@ -68,13 +68,13 @@
specification:
<ul>
<li>
- 5.5.2 <TT>StringSeq</TT> and <TT>WStringSeq</TT> are required.
- This adds the following classes to <TT>org.omg.CORBA</TT>:
+ 5.5.2 <code>StringSeq</code> and <code>WStringSeq</code> are required.
+ This adds the following classes to <code>org.omg.CORBA</code>:
<ul>
- <li><TT>StringSeqHolder</TT></li>
- <li><TT>StringSeqHelper</TT></li>
- <li><TT>WStringSeqHolder</TT></li>
- <li><TT>WStringSeqHelper</TT></li>
+ <li><code>StringSeqHolder</code></li>
+ <li><code>StringSeqHelper</code></li>
+ <li><code>WStringSeqHolder</code></li>
+ <li><code>WStringSeqHelper</code></li>
</ul>
</li>
</ul>
@@ -84,14 +84,15 @@
CORBA 2.3.1 sections 10.6.1 and 10.6.2 are supported for repository IDs.</li>
<li>
-CORBA 2.3.1 section 10.7 for <TT>TypeCode</TT> APIs.</li>
+CORBA 2.3.1 section 10.7 for <code>TypeCode</code> APIs.</li>
<li>
-CORBA 2.3.1 chapter 11, Portable Object Adapter (POA), with the following updates from the Portable Interceptors specification:
+CORBA 2.3.1 chapter 11, Portable Object Adapter (POA),
+with the following updates from the Portable Interceptors specification:
<ul>
<li>Section 11.3.7 POAs must preserve all policies</li>
<li>Section 11.3.8.2 again states that POAs must preserve all policies</li>
- <li>Section 11.3.8.26 <tt>POA::id</tt> is required.</li>
+ <li>Section 11.3.8.26 <code>POA::id</code> is required.</li>
</ul>
</li>
@@ -104,18 +105,21 @@
All of the Interoperable Naming Service is supported.</li>
<li>
-Portable Interceptors section 13.8 (the new <TT>Coder</TT>/<TT>Decoder</TT> interfaces)
+Portable Interceptors section 13.8 (the new
+<code>Coder</code>/<code>Decoder</code> interfaces)
and all of chapter 21 (the interceptor specification).</li>
-<li>Section 1.21.8 of the Revised IDL to Java Language Mapping Specification (ptc/00-11-03)
-has been changed from the version in the IDL to Java Language Mapping Specification (ptc/00-01-08).</li>
+<li>Section 1.21.8 of the Revised IDL to Java Language
+Mapping Specification (ptc/00-11-03)
+has been changed from the version in the
+IDL to Java Language Mapping Specification (ptc/00-01-08).</li>
</ul>
<h2>
Tools</h2>
<ul>
-<li>The IDL to Java compiler (<TT>idlj</TT>) complies with:
+<li>The IDL to Java compiler (<code>idlj</code>) complies with:
<ul>
<li>CORBA 2.3.1 chapter 3 (IDL definition)</li>
<li>CORBA 2.3.1 chapters 5 and 6 (semantics of Value types)</li>
@@ -125,12 +129,12 @@
</ul>
</li>
-<li>The Java to IDL compiler (the IIOP backend for <tt>rmic</tt>) complies with:
+<li>The Java to IDL compiler (the IIOP backend for <code>rmic</code>) complies with:
<ul>
<li>CORBA 2.3.1 chapters 5 and 6 (value types)</li>
<li>The Java to IDL language mapping. Note that this implicitly references
section 1.21 of the IDL to Java language mapping</li>
- <li>IDL generated by the <tt>-idl</tt> flag complies with CORBA 2.3.1 chapter 3.</li>
+ <li>IDL generated by the <code>-idl</code> flag complies with CORBA 2.3.1 chapter 3.</li>
</ul>
</li>
</ul>
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html Tue Sep 22 11:01:54 2015 -0700
@@ -9,7 +9,8 @@
<H1>IDL-to-Java Generated Files</H1>
<P>The files that are generated by the IDL-to-Java compiler, in accordance with
-the <em><a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">IDL-to-Java Language Mapping Specification</a></em>,
+the <em><a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">
+IDL-to-Java Language Mapping Specification</a></em>,
which is implemented in Java<sup><font size="-2">TM</font></sup> SE 6
according the <a href="compliance.html">compliance</a> document.
@@ -18,23 +19,25 @@
and identifiers with no change. Because of the nature of the Java language,
a single IDL construct may be mapped to several (differently named) Java constructs.
The additional names are constructed by appending a descriptive suffix.
-For example, the IDL interface <tt>foo</tt> is mapped to the Java
-interfaces <tt>foo</tt> and <tt>fooOperations</tt>, and additional
-Java classes <tt>fooHelper</tt>, <tt>fooHolder</tt>, <tt>fooPOA</tt>,
-and optionally <tt>fooPOATie</tt>.
+For example, the IDL interface <code>foo</code> is mapped to the Java
+interfaces <code>foo</code> and <code>fooOperations</code>, and additional
+Java classes <code>fooHelper</code>, <code>fooHolder</code>, <code>fooPOA</code>,
+and optionally <code>fooPOATie</code>.
<P>The mapping in effect reserves the use of several names for its own purposes. These are:
<UL>
-<LI>The Java class <a href="#helper"><tt><type>Helper</tt></a>, where <tt><type></tt> is the name of an IDL defined type.
-<LI>The Java class <a href="#holder"><tt><type>Holder</tt></a>, where <tt><type></tt>
-is the name of an IDL defined type (with certain exceptions such as <tt>typedef</tt> aliases).
-<LI>The Java classes <tt><basicJavaType>Holder</tt>, where <tt><basicJavaType></tt>
+<LI>The Java class <a href="#helper"><code><type>Helper</code></a>,
+where <code><type></code> is the name of an IDL defined type.
+<LI>The Java class <a href="#holder"><code><type>Holder</code></a>,
+where <code><type></code>
+is the name of an IDL defined type (with certain exceptions such as <code>typedef</code> aliases).
+<LI>The Java classes <code><basicJavaType>Holder</code>, where <code><basicJavaType></code>
is one of the Java primitive datatypes that is used by one of the IDL basic datatypes.
-<LI>The Java classes <a href="#operations"><tt><interface>Operations</tt></a>, <tt><interface>POA</tt>,
-and <tt><interface>POATie</tt>, where <tt><interface></tt> is the name of an IDL interface type.
-<LI>The nested scope Java package name <tt><interface>Package</tt>, where <tt><interface></tt>
+<LI>The Java classes <a href="#operations"><code><interface>Operations</code></a>, <code><interface>POA</code>,
+and <code><interface>POATie</code>, where <code><interface></code> is the name of an IDL interface type.
+<LI>The nested scope Java package name <code><interface>Package</code>, where <code><interface></code>
is the name of an IDL interface.
</UL>
@@ -42,50 +45,55 @@
<H2><a name="helper">Helper Files</a></H2>
<P>Helper files supply several static methods needed to manipulate the type.
-These include <tt>Any</tt> insert and extract operations for the type,
+These include <code>Any</code> insert and extract operations for the type,
getting the repository id, getting the typecode, and reading
and writing the type from and to a stream.
<P>The helper class for a mapped IDL interface or abstract interface also
-include narrow operation(s). The static narrow method allows an <tt>org.omg.CORBA.Object</tt>
+include narrow operation(s). The static narrow method allows an <code>org.omg.CORBA.Object</code>
to be narrowed to the object reference of a more specific type.
-The IDL exception <tt>CORBA::BAD_PARAM</tt> is thrown if the narrow fails because
+The IDL exception <code>CORBA::BAD_PARAM</code> is thrown if the narrow fails because
the object reference does not support the requested type. A different system exception
-is raised to indicate other kinds of errors. Trying to narrow a null will always succeed with a return value of null.
+is raised to indicate other kinds of errors. Trying to narrow
+a null will always succeed with a return value of null.
<H2><a name="holder">Holder Files</a></H2>
<P>Support for out and inout parameter passing modes requires the use of additional holder classes.
-These classes are available for all of the basic IDL datatypes in the <tt>org.omg.CORBA</tt> package
+These classes are available for all of the basic IDL datatypes in the <code>org.omg.CORBA</code> package
and are generated for all named user defined IDL types except those defined by typedefs.
(Note that in this context user defined includes types that are defined in OMG specifications
such as those for the Interface Repository, and other OMG services.)
<P>Each holder class has a constructor from an instance, a default constructor, and has
-a public instance member, <tt>value</tt> which is the typed value. The default constructor
+a public instance member, <code>value</code> which is the typed value. The default constructor
sets the value field to the default value for the type as defined by the Java language:
false for boolean, 0 for numeric and char types, null for strings, null for object references.
<P>To support portable stubs and skeletons, holder classes also implement
-the <tt>org.omg.CORBA.portable.Streamable</tt> interface.
+the <code>org.omg.CORBA.portable.Streamable</code> interface.
<H2><a name="operations">Operations Files</a></H2>
<P>A non abstract IDL interface is mapped to two public Java interfaces:
a <em>signature</em> interface and an <em>operations</em> interface.
-The signature interface, which extends <tt>IDLEntity</tt>, has the same
-name as the IDL interface name and is used as the signature type in method declarations
+The signature interface, which extends <code>IDLEntity</code>, has the same
+name as the IDL interface name and is used
+as the signature type in method declarations
when interfaces of the specified type are used in other interfaces.
-The operations interface has the same name as the IDL interface with the suffix <tt>Operations</tt>
+The operations interface has the same name as the IDL interface
+with the suffix <code>Operations</code>
appended to the end and is used in the server-side mapping and as a mechanism
for providing optimized calls for collocated client and servers.
<P>The Java operations interface contains the mapped operation signatures.
The Java signature interface extends the operations interface,
-the (mapped) base <tt>org.omg.CORBA.Object</tt>, as well as <tt>org.omg.portable.IDLEntity</tt>.
+the (mapped) base <code>org.omg.CORBA.Object</code>,
+as well as <code>org.omg.portable.IDLEntity</code>.
Methods can be invoked on the signature interface. Interface inheritance
-expressed in IDL is reflected in both the Java signature interface and operations interface hierarchies.
+expressed in IDL is reflected in both the Java signature
+interface and operations interface hierarchies.
<H2><a name="stub">Stubs</a></H2>
@@ -96,11 +104,13 @@
for programmers to predict once they are familiar with OMG IDL and the language mapping
for the particular programming language. The stubs make calls on the rest of the ORB
using interfaces that are private to, and presumably optimized for, the particular ORB Core.
-If more than one ORB is available, there may be different stubs corresponding to the different ORBs.
-In this case, it is necessary for the ORB and language mapping to cooperate to associate
+If more than one ORB is available, there may be different stubs
+corresponding to the different ORBs. In this case, it is necessary for
+the ORB and language mapping to cooperate to associate
the correct stubs with the particular object reference.
-<P>Object-oriented programming languages, such as Java, C++, and Smalltalk, do not require stub interfaces.
+<P>Object-oriented programming languages, such as Java,
+C++, and Smalltalk, do not require stub interfaces.
<BR><BR>
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -34,27 +34,27 @@
<BODY BGCOLOR="#FFFFFF">
Provides the mapping of the OMG CORBA APIs to the Java<SUP><FONT
SIZE=-2>TM</FONT></SUP>
-programming language, including the class <TT>ORB</TT>, which is implemented
+programming language, including the class <code>ORB</code>, which is implemented
so that a programmer can use it as a fully-functional Object Request Broker
(ORB).
-<P>For a precise list of supported sections of official CORBA specifications with which
-the Java[TM] Platform, Standard Edition 6 complies, see <A
-HREF="doc-files/compliance.html"><em>Official Specifications for CORBA support in
+<P>For a precise list of supported sections of official CORBA specifications with which
+the Java[TM] Platform, Standard Edition 6 complies, see <A
+HREF="doc-files/compliance.html"><em>Official Specifications for CORBA support in
Java[TM] SE 6</em></A>.
<H1>General Information</H1>
-The information in this section is information relevant to someone who
+The information in this section is information relevant to someone who
compiles Interface Definition Language (IDL) files and uses the
ORB to write clients and servers.
-<P>The classes and interfaces described in this section can be put into
-four groups: <tt>ORB classes</tt>, Exceptions, <tt>Helper</tt> classes,
-and <tt>Holder</tt> classes.
+<P>The classes and interfaces described in this section can be put into
+four groups: <code>ORB classes</code>, Exceptions, <code>Helper</code> classes,
+and <code>Holder</code> classes.
<H2>
-The <tt>ORB</tt> Class</H2>
+The <code>ORB</code> Class</H2>
<P>An ORB handles (or brokers) method invocations between a client and
the method's implementation on a server. Because the client and server
@@ -63,92 +63,91 @@
deal of work behind the scenes to accomplish this communication.
<P>Most of what an ORB does is completely transparent to the user, and a major
-portion of the <TT>CORBA</TT> package consists of classes used by the ORB
+portion of the <code>CORBA</code> package consists of classes used by the ORB
behind the scenes. The result is that most programmers will use only a
small part of this package directly. In fact, most programmers will use
-only a few methods from the <TT>ORB</TT> class, some exceptions, and
+only a few methods from the <code>ORB</code> class, some exceptions, and
occasionally,
-a holder class.
+a holder class.
<H3>
-<TT>ORB</TT> Methods</H3>
+<code>ORB</code> Methods</H3>
-<P>Before an application can enter the CORBA environment, it must first:
+<P>Before an application can enter the CORBA environment, it must first:
<UL>
<LI>Be initialized into the ORB and possibly the object adapter (POA) environments.
-<LI>Get references to ORB object (for use in future ORB operations)
-and perhaps other objects (including the root POA or some Object Adapter objects).
+<LI>Get references to ORB object (for use in future ORB operations)
+and perhaps other objects (including the root POA or some Object Adapter objects).
</UL>
<P>The following operations are provided to initialize applications and obtain
the appropriate object references:
<UL>
<LI>Operations providing access to the ORB, which are discussed in this
section.
- <LI>Operations providing access to Object Adapters, Interface Repository,
- Naming Service, and other Object Services. These operations are described
+ <LI>Operations providing access to Object Adapters, Interface Repository,
+ Naming Service, and other Object Services. These operations are described
in <a href="#adv"><em>Other Classes</em></a>.
</UL>
<P>
-When an application requires a CORBA environment it needs a mechanism to
-get an ORB object reference and possibly an OA object reference
-(such as the root POA). This serves two purposes. First, it initializes
-an application into the ORB and OA environments. Second, it returns the
-ORB object reference and the OA object reference to the application
-for use in future ORB and OA operations.
+When an application requires a CORBA environment it needs a mechanism to
+get an ORB object reference and possibly an OA object reference
+(such as the root POA). This serves two purposes. First, it initializes
+an application into the ORB and OA environments. Second, it returns the
+ORB object reference and the OA object reference to the application
+for use in future ORB and OA operations.
-<P>In order to obtain an ORB object reference, applications call
-the <tt>ORB.init</tt> operation. The parameters to the call can comprise an
+<P>In order to obtain an ORB object reference, applications call
+the <code>ORB.init</code> operation. The parameters to the call can comprise an
identifier for the ORB for which the object reference is required,
- and an arg_list, which is used to allow environment-specific data to be
- passed into the call.
+ and an arg_list, which is used to allow environment-specific data to be
+ passed into the call.
-<P>These are the <TT>ORB</TT> methods
+<P>These are the <code>ORB</code> methods
that provide access to the ORB:
<UL>
<LI>
-<TT><b>init</b>()</TT>
+<code><b>init</b>()</code>
<LI>
-<TT><b>init</b>(String [] args, Properties props)</TT>
+<code><b>init</b>(String [] args, Properties props)</code>
<LI>
-<TT><b>init</b>(Applet app, Properties props)</TT>
+<code><b>init</b>(Applet app, Properties props)</code>
</UL>
-<P>Using the <tt>init()</tt> method without parameters initiates
+<P>Using the <code>init()</code> method without parameters initiates
a singleton ORB, which can only
-give typecode creation <tt>any</tt>s needed in code generated
-in Helper classes by <tt>idlj</tt>.
+give typecode creation <code>any</code>s needed in code generated
+in Helper classes by <code>idlj</code>.
-<P>Applications require a portable means by which to obtain their
-initial object references. References are required for the root
-POA, POA Current, Interface Repository, and various Object Services
+<P>Applications require a portable means by which to obtain their
+initial object references. References are required for the root
+POA, POA Current, Interface Repository, and various Object Services
instances. The functionality required by the application is similar
- to that provided by the Naming Service. However, the OMG does not
- want to mandate that the Naming Service be made available to all
- applications in order that they may be portably initialized.
- Consequently, the operations shown in this section provide a
- simplified, local version of the Naming Service that applications
- can use to obtain a small, defined set of object references which
- are essential to its operation. Because only a small well-defined
+ to that provided by the Naming Service. However, the OMG does not
+ want to mandate that the Naming Service be made available to all
+ applications in order that they may be portably initialized.
+ Consequently, the operations shown in this section provide a
+ simplified, local version of the Naming Service that applications
+ can use to obtain a small, defined set of object references which
+ are essential to its operation. Because only a small well-defined
set of objects are expected with this mechanism, the naming context
can be flattened to be a single-level name space. This simplification
results in only two operations being defined to achieve the functionality
required.
-<P>Initial references are obtained via two operations provided in
-the ORB object interface, providing facilities to list and
+<P>Initial references are obtained via two operations provided in
+the ORB object interface, providing facilities to list and
resolve initial object references. These are:
<UL>
<LI>
-<TT><b>resolve_initial_references</b>(String name)</TT>
+<code><b>resolve_initial_references</b>(String name)</code>
<LI>
-<TT><b>list_initial_services</b>()</TT>
+<code><b>list_initial_services</b>()</code>
<LI>
-<TT><b>register_initial_reference</b>(String id,
-org.omg.CORBA.Object obj)</TT>
+<code><b>register_initial_reference</b>(String id, org.omg.CORBA.Object obj)</code>
</UL>
-<P>An example that uses some of these methods is <A
+<P>An example that uses some of these methods is <A
HREF="{@docRoot}/../technotes/guides/idl/GShome.html">
<em>Getting Started with Java IDL</em></A>.
@@ -156,7 +155,7 @@
Exceptions</H2>
Exceptions in Java IDL are similar to those in any code written in the
Java programming language. If a method is defined to throw an exception,
-then any code using that method must have a <TT>try</TT>/<TT>catch</TT>
+then any code using that method must have a <code>try</code>/<code>catch</code>
block and handle that exception when it is thrown.
<P>The documentation on <A
@@ -165,10 +164,10 @@
system exceptions and user-defined exceptions.
<P>The following is a list of the system exceptions (which are unchecked
-exceptions inheriting through <TT><a href="SystemException.html">
-org.omg.CORBA.SystemException</a></TT> from
-<TT>java.lang.RuntimeException</TT>) that are defined in the package
-<TT>org.omg.CORBA</TT>:
+exceptions inheriting through <code><a href="SystemException.html">
+org.omg.CORBA.SystemException</a></code> from
+<code>java.lang.RuntimeException</code>) that are defined in the package
+<code>org.omg.CORBA</code>:
<PRE><code>
BAD_CONTEXT
BAD_INV_ORDER
@@ -203,7 +202,7 @@
</code></PRE>
<P>
The following is a list of user-defined exceptions defined in the package
-<TT>org.omg.CORBA</TT>.
+<code>org.omg.CORBA</code>.
<PRE><code>
Bounds
UnknownUserException
@@ -212,37 +211,37 @@
</code></PRE>
<H2>Subpackages</H2>
-There are some packages inside the <TT>CORBA</TT> package with
+There are some packages inside the <code>CORBA</code> package with
"Package" as part of their names. These packages are generally quite small
because all they do is provide exceptions or classes for use by interfaces
-and classes in the <TT>CORBA</TT> package.
+and classes in the <code>CORBA</code> package.
-<P>For example, the package <TT><a href="TypeCodePackage/package-summary.html">
-org.omg.CORBA.TypeCodePackage</a></TT> contains
-two exceptions thrown by methods in the class <TT>TypeCode</TT>. These
+<P>For example, the package <code><a href="TypeCodePackage/package-summary.html">
+org.omg.CORBA.TypeCodePackage</a></code> contains
+two exceptions thrown by methods in the class <code>TypeCode</code>. These
exceptions are:
<UL>
<LI>
-<TT>BadKind</TT>
+<code>BadKind</code>
<LI>
-<TT>Bounds</TT>
+<code>Bounds</code>
</UL>
-The package <TT><a href="ORBPackage/package-summary.html">
-org.omg.CORBA.ORBPackage</a></TT> contains two exceptions:
+The package <code><a href="ORBPackage/package-summary.html">
+org.omg.CORBA.ORBPackage</a></code> contains two exceptions:
<UL>
<LI>
-<TT>InvalidName</TT>
+<code>InvalidName</code>
<LI>
-<TT>InconsistentTypeCode</TT>
+<code>InconsistentTypeCode</code>
</UL>
-<P>Another package that is a subpackage of <tt>CORBA</tt> is the <tt>
-<a href="portable/package-summary.html">portable</a></tt> package. It
-provides a set of ORB APIs that makes it
+<P>Another package that is a subpackage of <code>CORBA</code> is the
+<code><a href="portable/package-summary.html">portable</a></code>
+package. It provides a set of ORB APIs that makes it
possible for code generated by one vendor's IDL compiler to run
-on another vendor's ORB.
+on another vendor's ORB.
@@ -251,47 +250,49 @@
Holder classes</H2>
-<P>Support for out and inout parameter passing modes requires the use of
-additional <em><a href="doc-files/generatedfiles.html#holder">holder
-classes</a></em>. Because the Java programming language does not support out or
+<P>Support for out and inout parameter passing modes requires the use of
+additional <em><a href="doc-files/generatedfiles.html#holder">holder
+classes</a></em>. Because the Java programming language does not support out or
inout parameters, holder classes are needed as a means of passing a parameter
-that can be modified. To support portable stubs and skeletons, holder classes also implement
- the <tt><a href="portable/Streamable.html">org.omg.CORBA.portable.Streamable</a>
- </tt> interface.
+that can be modified. To support portable stubs and skeletons,
+holder classes also implement the
+<code><a href="portable/Streamable.html">org.omg.CORBA.portable.Streamable</a></code>
+interface.
<P>Holder classes are named by appending "Holder" to the name of the type.
The name of the type refers to its name in the Java programming language. For
- example, a holder class for the interface named <tt>Account</tt> in the Java programming
- language would be named <tt>AccountHolder</tt>.
+ example, a holder class for the interface named <code>Account</code>
+ in the Java programming
+ language would be named <code>AccountHolder</code>.
<P>Holder classes are available for all of the basic IDL
- datatypes in the <tt>org.omg.CORBA</tt> package. So, for example,
- there are already-defined classes for <tt>LongHolder</tt>, <tt>ShortHolder</tt>,
- <tt>FloatHolder</tt>, and so on. Classes are also generated for
- all named user-defined IDL types except those defined by <tt>typedefs</tt>.
- (Note that in this context user defined includes types that are
+ datatypes in the <code>org.omg.CORBA</code> package. So, for example,
+ there are already-defined classes for <code>LongHolder</code>, <code>ShortHolder</code>,
+ <code>FloatHolder</code>, and so on. Classes are also generated for
+ all named user-defined IDL types except those defined by <code>typedefs</code>.
+ (Note that in this context user defined includes types that are
defined in OMG specifications such as those for the Interface
- Repository, and other OMG services.)
+ Repository, and other OMG services.)
<P>Each holder class has:
<UL>
<LI>a constructor from an instance
<LI>a default constructor
-<LI>a public instance member, <tt>value</tt> which is the typed value.
-<LI>a method for reading an input stream and assigning the contents to the
-type's <tt>value</tt> field
-<LI>a method for writing the value of the <tt>value</tt> field to an output stream
+<LI>a public instance member, <code>value</code> which is the typed value.
+<LI>a method for reading an input stream and assigning the contents to the
+type's <code>value</code> field
+<LI>a method for writing the value of the <code>value</code> field to an output stream
<LI>a method for getting the typecode of the type
</UL>
-<P>The default constructor sets the value field to the default value for the
-type as defined by the Java language:
+<P>The default constructor sets the value field to the default value for the
+type as defined by the Java language:
<UL>
-<LI><tt>false</tt> for boolean
-<LI><tt>0</tt> for numeric and char types
-<LI><tt>null</tt> for strings and object references
+<LI><code>false</code> for boolean
+<LI><code>0</code> for numeric and char types
+<LI><code>null</code> for strings and object references
</UL>
@@ -301,7 +302,7 @@
were mapped to the Java programming language, the following holder class
would be generated:
<PRE>
-public final class AccountHolder implements
+public final class AccountHolder implements
org.omg.CORBA.portable.Streamable
{
// field that holds an Account object
@@ -342,53 +343,52 @@
<P>For more information on Holder classes, see Chapter 1.4, <em>Mapping for
Basic Types</em> in the <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">
<em>OMG IDL to Java Language Mapping</em></a>. The Holder classes defined
-in the package <TT>org.omg.CORBA</TT> are:
-<PRE>
- <TT>AnyHolder
-</TT> <TT>AnySeqHolder
-</TT> <TT>BooleanHolder
-</TT> <TT>BooleanSeqHolder
-</TT> <TT>ByteHolder
-</TT> <TT>CharHolder
-</TT> <TT>CharSeqHolder
-</TT> <TT>CurrentHolder
-</TT> <TT>DoubleHolder
-</TT> <TT>DoubleSeqHolder
-</TT> <TT>FixedHolder
-</TT> <TT>FloatHolder
-</TT> <TT>FloatSeqHolder
-</TT> <TT>IntHolder
-</TT> <TT>LongHolder
-</TT> <TT>LongLongSeqHolder
-</TT> <TT>LongSeqHolder
-</TT> <TT>ObjectHolder
-</TT> <TT>OctetSeqHolder
-</TT> <TT>ParameterModeHolder
-</TT> <TT>PolicyErrorHolder
-</TT> <TT>PolicyListHolder
-</TT> <TT>PrincipalHolder
-</TT> <TT>ServiceInformationHolder
-</TT> <TT>ShortHolder
-</TT> <TT>ShortSeqHolder
-</TT> <TT>StringHolder
-</TT> <TT>StringSeqHolder
-</TT> <TT>TypeCodeHolder
-</TT> <TT>ULongLongSeqHolder
-</TT> <TT>ULongSeqHolder
-</TT> <TT>UnknownUserExceptionHolder
-</TT> <TT>UShortSeqHolder
-</TT> <TT>ValueBaseHolder
-</TT> <TT>WCharSeqHolder
-</TT> <TT>WrongTransactionHolder
-</TT> <TT>WStringSeqHolder</TT>
-
-</PRE>
+in the package <code>org.omg.CORBA</code> are:
+<PRE><code>
+ AnyHolder
+ AnySeqHolder
+ BooleanHolder
+ BooleanSeqHolder
+ ByteHolder
+ CharHolder
+ CharSeqHolder
+ CurrentHolder
+ DoubleHolder
+ DoubleSeqHolder
+ FixedHolder
+ FloatHolder
+ FloatSeqHolder
+ IntHolder
+ LongHolder
+ LongLongSeqHolder
+ LongSeqHolder
+ ObjectHolder
+ OctetSeqHolder
+ ParameterModeHolder
+ PolicyErrorHolder
+ PolicyListHolder
+ PrincipalHolder
+ ServiceInformationHolder
+ ShortHolder
+ ShortSeqHolder
+ StringHolder
+ StringSeqHolder
+ TypeCodeHolder
+ ULongLongSeqHolder
+ ULongSeqHolder
+ UnknownUserExceptionHolder
+ UShortSeqHolder
+ ValueBaseHolder
+ WCharSeqHolder
+ WrongTransactionHolder
+ WStringSeqHolder
+</code></PRE>
<h2>Helper Classes </h2>
<P>Helper files supply several static methods needed to manipulate the type.
These include:
<UL>
- <LI><tt>Any</tt> insert and extract operations for the type
+ <LI><code>Any</code> insert and extract operations for the type
<LI>getting the repository id
<LI>getting the typecode
<LI>reading and writing the type from and to a stream
@@ -397,25 +397,26 @@
</UL>
<P>The helper class for a mapped IDL interface or abstract interface
- also include narrow operation(s). The static narrow method allows
- an <tt>org.omg.CORBA.Object</tt> to be narrowed to the object reference
- of a more specific type. The IDL exception <tt>CORBA.BAD_PARAM</tt>
- is thrown if the narrow fails because the object reference does not
- support the requested type. A different system exception is raised
- to indicate other kinds of errors. Trying to narrow a <tt>null</tt> will always
- succeed with a return value of <tt>null</tt>. Generally, the only helper method an application programmer uses is
+also include narrow operation(s). The static narrow method allows
+an <code>org.omg.CORBA.Object</code> to be narrowed to the object reference
+of a more specific type. The IDL exception <code>CORBA.BAD_PARAM</code>
+is thrown if the narrow fails because the object reference does not
+support the requested type. A different system exception is raised
+to indicate other kinds of errors. Trying to narrow a <code>null</code> will always
+succeed with a return value of <code>null</code>.
+Generally, the only helper method an application programmer uses is
the <code>narrow</code> method. The other methods are normally used behind
the scenes and are transparent to the programmer.
<P>Helper classes
fall into two broad categories, <a href="#value">helpers for value types</a> and
-<a href="#basic">helpers for non value types</a>. Because all of the helper
+<a href="#basic">helpers for non value types</a>. Because all of the helper
classes in one category
-provide the same methods, one generic explanation of each
+provide the same methods, one generic explanation of each
category of helper classes is presented here.
<P>
-When OMG IDL is mapped to the Java programming language,
+When OMG IDL is mapped to the Java programming language,
a "helper" class is generated for each user-defined type.
This generated class will have the name of the user-defined type with
the suffix <code>Helper</code> appended. For example, if the
@@ -423,7 +424,7 @@
<code>idlj</code> compiler will automatically generate a class named
<code>AccountHelper</code>. The <code>AccountHelper</code> class
will contain the static methods needed for manipulating instances of the type,
-in this case, <code>Account</code> objects.
+in this case, <code>Account</code> objects.
<a name="narrow"></a>
@@ -442,14 +443,12 @@
not determines which <code>narrow</code> method its helper class will provide.
The helper class for an interface
that is not abstract will have a <code>narrow</code> method that takes a CORBA
-object, whereas the <code>narrow</code> method for an interface that is abstract
-will
-take an object in the Java programming language. The helper class for a
+object, whereas the <code>narrow</code> method for an interface that is abstract
+will take an object in the Java programming language. The helper class for a
non-abstract interface that has at least one abstract base interface will provide
both versions of the <code>narrow</code> method.
-<P>The <A HREF="{@docRoot}/../technotes/guides/idl/jidlExample.html"><em>Hello World</em></A>
-tutorial uses a <tt>narrow</tt> method that looks
-like this:
+<P>The <A HREF="{@docRoot}/../technotes/guides/idl/jidlExample.html"><em>Hello World</em></A>
+tutorial uses a <code>narrow</code> method that looks like this:
<PRE>
// create and initialize the ORB
ORB orb = ORB.init(args, null);
@@ -469,7 +468,7 @@
<a name="basic"></a>
<h3>Example of a Basic Helper Class</h3>
A basic helper class, for purposes of this explanation, is one with
-the methods that are provided by every helper class, plus a <code>narrow</code>
+the methods that are provided by every helper class, plus a <code>narrow</code>
method if the type defined in OMG IDL maps to an interface in the Java
programming language. Types that are not value types will have a basic
helper class generated for them.
@@ -626,57 +625,56 @@
}
</pre>
-<P>The Helper classes defined in the package <TT>org.omg.CORBA</TT> are:
+<P>The Helper classes defined in the package <code>org.omg.CORBA</code> are:
<PRE><code>
- <TT>AnySeqHelper
-</TT> <TT>BooleanSeqHelper
-</TT> <TT>CharSeqHelper
-</TT> <TT>CompletionStatusHelper
-</TT> <TT>CurrentHelper
-</TT> <TT>DefinitionKindHelper
-</TT> <TT>DoubleSeqHelper
-</TT> <TT>FieldNameHelper
-</TT> <TT>FloatSeqHelper
-</TT> <TT>IdentifierHelper
-</TT> <TT>IDLTypeHelper
-</TT> <TT>LongLongSeqHelper
-</TT> <TT>LongSeqHelper
-</TT> <TT>NameValuePairHelper
-</TT> <TT>ObjectHelper
-</TT> <TT>OctetSeqHelper
-</TT> <TT>ParameterModeHelper
-</TT> <TT>PolicyErrorCodeHelper
-</TT> <TT>PolicyErrorHelper
-</TT> <TT>PolicyHelper
-</TT> <TT>PolicyListHelper
-</TT> <TT>PolicyTypeHelper
-</TT> <TT>RepositoryIdHelper
-</TT> <TT>ServiceDetailHelper
-</TT> <TT>ServiceInformationHelper
-</TT> <TT>SetOverrideTypeHelper
-</TT> <TT>ShortSeqHelper
-</TT> <TT>StringSeqHelper
-</TT> <TT>StringValueHelper
-</TT> <TT>StructMemberHelper
-</TT> <TT>ULongLongSeqHelper
-</TT> <TT>ULongSeqHelper
-</TT> <TT>UnionMemberHelper
-</TT> <TT>UnknownUserExceptionHelper
-</TT> <TT>UShortSeqHelper
-</TT> <TT>ValueBaseHelper
-</TT> <TT>ValueMemberHelper
-</TT> <TT>VersionSpecHelper
-</TT> <TT>VisibilityHelper
-</TT> <TT>WCharSeqHelper
-</TT> <TT>WrongTransactionHelper
-</TT> <TT>WStringSeqHelper
-</TT> <TT>WStringValueHelper</TT>
-
+ AnySeqHelper
+ BooleanSeqHelper
+ CharSeqHelper
+ CompletionStatusHelper
+ CurrentHelper
+ DefinitionKindHelper
+ DoubleSeqHelper
+ FieldNameHelper
+ FloatSeqHelper
+ IdentifierHelper
+ IDLTypeHelper
+ LongLongSeqHelper
+ LongSeqHelper
+ NameValuePairHelper
+ ObjectHelper
+ OctetSeqHelper
+ ParameterModeHelper
+ PolicyErrorCodeHelper
+ PolicyErrorHelper
+ PolicyHelper
+ PolicyListHelper
+ PolicyTypeHelper
+ RepositoryIdHelper
+ ServiceDetailHelper
+ ServiceInformationHelper
+ SetOverrideTypeHelper
+ ShortSeqHelper
+ StringSeqHelper
+ StringValueHelper
+ StructMemberHelper
+ ULongLongSeqHelper
+ ULongSeqHelper
+ UnionMemberHelper
+ UnknownUserExceptionHelper
+ UShortSeqHelper
+ ValueBaseHelper
+ ValueMemberHelper
+ VersionSpecHelper
+ VisibilityHelper
+ WCharSeqHelper
+ WrongTransactionHelper
+ WStringSeqHelper
+ WStringValueHelper
</code></PRE>
<a name="adv"></a>
<H1>
Other Classes</H1>
-The other classes and interfaces in the <TT>CORBA</TT> package, which are
+The other classes and interfaces in the <code>CORBA</code> package, which are
used behind the scenes, can be put into four groups. Three of the groups
are used with requests in some capacity, and the fourth group, concerning
the Interface Repository, is a category by itself.
@@ -686,38 +684,38 @@
information used in request operations.
<UL>
<LI>
-<TT>TCKind</TT> -- indicates the kind (datatype) for a <TT>TypeCode</TT>
+<code>TCKind</code> -- indicates the kind (datatype) for a <code>TypeCode</code>
object
<LI>
-<TT>TypeCode</TT> -- indicates a datatype and possibly other information
+<code>TypeCode</code> -- indicates a datatype and possibly other information
<LI>
-<TT>Any</TT> -- contains a value and its typecode
+<code>Any</code> -- contains a value and its typecode
<LI>
-<TT>NamedValue</TT> -- contains a name, an <TT>Any</TT> object, and an
-argument mode flag. <TT>NamedValue</TT> objects contain information about
+<code>NamedValue</code> -- contains a name, an <code>Any</code> object, and an
+argument mode flag. <code>NamedValue</code> objects contain information about
method arguments, method return values, or a context.
<LI>
-<TT>ContextList</TT> -- a list of strings that describe the contexts that
+<code>ContextList</code> -- a list of strings that describe the contexts that
need to be resolved and sent with an invocation
<LI>
-<TT>ExceptionList</TT> -- a list of <TT>TypeCode</TT>s for exceptions that
+<code>ExceptionList</code> -- a list of <code>TypeCode</code>s for exceptions that
may be thrown by a method
<LI>
-<TT>Environment</TT> -- a container for the exception thrown during a method
+<code>Environment</code> -- a container for the exception thrown during a method
invocation
<LI>
-<TT>Context</TT> -- a list of <TT>NamedValue</TT> objects used to pass
+<code>Context</code> -- a list of <code>NamedValue</code> objects used to pass
auxiliary information from client to server
<LI>
-<TT>NVList</TT> -- a list of <TT>NamedValue</TT> objects, used to pass
+<code>NVList</code> -- a list of <code>NamedValue</code> objects, used to pass
arguments or get results
</UL>
@@ -726,23 +724,23 @@
The second group of classes deals with requests:
<UL>
<LI>
-<TT>Object</TT> -- the base class for all CORBA object references
+<code>Object</code> -- the base class for all CORBA object references
<LI>
-<TT>Request</TT> -- the main class in the DII, which contains methods for
+<code>Request</code> -- the main class in the DII, which contains methods for
adding arguments to the request, for accessing information about the method
being invoked (the method name, its arguments, exceptions it throws, and
so on), and for making invocations on the request
<LI>
-<TT>DynamicImplementation</TT> -- the base class for server implementations
-using the DSI. It has the method <TT>invoke</TT>, which is used by an
+<code>DynamicImplementation</code> -- the base class for server implementations
+using the DSI. It has the method <code>invoke</code>, which is used by an
implementation
-of this class to determine the state of a <TT>ServerRequest</TT> object
+of this class to determine the state of a <code>ServerRequest</code> object
and to set its result or exception
<LI>
-<TT>ServerRequest</TT> -- captures the explicit state of a request for
+<code>ServerRequest</code> -- captures the explicit state of a request for
the Dynamic Skeleton Interface
</UL>
@@ -750,82 +748,82 @@
Interfaces That Serve as Constants</H2>
The third group contains interfaces that serve as constants. The IDL-to-Java
mapping mandates that IDL enums are mapped to a Java class with the enumerated
-values represented as public static final fields in that class (e.g.
+values represented as public static final fields in that class (e.g.
DefinitionKind).
On the other hand IDL constants defined outside of an IDL interface are
mapped to a Java interface for each constant.
-<P>This is why several interfaces in the <TT>org.omg.CORBA</TT> package
-consist of a single field, <TT>value</TT>, which is a <TT>short</TT>. This
+<P>This is why several interfaces in the <code>org.omg.CORBA</code> package
+consist of a single field, <code>value</code>, which is a <code>short</code>. This
field is a constant used for such things as an error code or value modifier.
-For example, the <TT>value</TT> field of the interface <TT>BAD_POLICY</TT>
-is one of the possible reasons for the exception <TT>PolicyError</TT> to
-be thrown. To specify this error code, you would use <TT>BAD_POLICY.value</TT>.
+For example, the <code>value</code> field of the interface <code>BAD_POLICY</code>
+is one of the possible reasons for the exception <code>PolicyError</code> to
+be thrown. To specify this error code, you would use <code>BAD_POLICY.value</code>.
-<P>The exception <TT>PolicyError</TT> uses the <TT>value</TT> field of
+<P>The exception <code>PolicyError</code> uses the <code>value</code> field of
the following interfaces as its possible error codes.
<UL>
<LI>
-<TT>BAD_POLICY</TT>
+<code>BAD_POLICY</code>
<LI>
-<TT>BAD_POLICY_TYPE</TT>
+<code>BAD_POLICY_TYPE</code>
<LI>
-<TT>BAD_POLICY_VALUE</TT>
+<code>BAD_POLICY_VALUE</code>
<LI>
-<TT>UNSUPPORTED_POLICY</TT>
+<code>UNSUPPORTED_POLICY</code>
<LI>
-<TT>UNSUPPORTED_POLICY_VALUE</TT>
+<code>UNSUPPORTED_POLICY_VALUE</code>
</UL>
-The method <TT>TypeCode.type_modifier</TT> returns the <TT>value</TT> field
-of one of the following interfaces. The <TT>VM</TT> in the names of these
+The method <code>TypeCode.type_modifier</code> returns the <code>value</code> field
+of one of the following interfaces. The <code>VM</code> in the names of these
interfaces stands for "value modifier."
<UL>
<LI>
-<TT>VM_NONE</TT>
+<code>VM_NONE</code>
<LI>
-<TT>VM_ABSTRACT</TT>
+<code>VM_ABSTRACT</code>
<LI>
-<TT>VM_CUSTOM</TT>
+<code>VM_CUSTOM</code>
<LI>
-<TT>VM_TRUNCATABLE</TT>
+<code>VM_TRUNCATABLE</code>
</UL>
The following constants are returned by a <code>ValueMember</code> object's
access method to denote the visibility of the <code>ValueMember</code> object.
<UL>
<LI>
-<TT>PRIVATE_MEMBER</TT>
+<code>PRIVATE_MEMBER</code>
<LI>
-<TT>PUBLIC_MEMBER</TT>
+<code>PUBLIC_MEMBER</code>
</UL>
-These flags, used in <TT>NamedValue</TT> objects or as parameters to methods,
+These flags, used in <code>NamedValue</code> objects or as parameters to methods,
are defined in the following interfaces:
<UL>
<LI>
-<TT>ARG_IN</TT>
+<code>ARG_IN</code>
<LI>
-<TT>ARG_INOUT</TT>
+<code>ARG_INOUT</code>
<LI>
-<TT>ARG_OUT</TT>
+<code>ARG_OUT</code>
<LI>
-<TT>CTX_RESTRICT_SCOPE</TT>
+<code>CTX_RESTRICT_SCOPE</code>
</UL>
<H2>
Interface Repository Interfaces and Classes</H2>
A fourth group contains the Interface Repository interfaces and classes,
-which are generated by the <TT>idlj</TT> compiler from the OMG IDL
-interface <TT>ir.idl</TT>. The purpose of the Interface Repository is to
+which are generated by the <code>idlj</code> compiler from the OMG IDL
+interface <code>ir.idl</code>. The purpose of the Interface Repository is to
identify the interfaces stored in it so that they can be accessed by an
ORB. Each module, type, interface, attribute, operation, parameter, exception,
constant, and so on is described completely by the Interface Repository
@@ -874,7 +872,7 @@
<H1>
CORBA Features Not Implemented in Java IDL</H1>
-<P>Some of the API included in <TT>org.omg</TT> subpackages is provided for
+<P>Some of the API included in <code>org.omg</code> subpackages is provided for
conformance with the current OMG CORBA specification but is not implemented
in Sun's release of the JDK<SUP><FONT SIZE=-2>TM</FONT></SUP>. This enables
other JDK licensees to provide implementations of this API in standard
@@ -883,21 +881,21 @@
<P><A NAME="NO_IMPLEMENT"></A>
<h2>Features That Throw NO_IMPLEMENT</h2>
-<P>Some of the API included in <TT>org.omg</TT> subpackages throw
-<tt>NO_IMPLEMENT</tt> exceptions for various reasons. Among these reasons
+<P>Some of the API included in <code>org.omg</code> subpackages throw
+<code>NO_IMPLEMENT</code> exceptions for various reasons. Among these reasons
are:
<UL>
- <LI>In some cases, for example <tt>LocalObject</tt>, the complete
- implementation according to the specification indicates that
- these API should throw <tt>NO_IMPLEMENT</tt>.
+ <LI>In some cases, for example <code>LocalObject</code>, the complete
+ implementation according to the specification indicates that
+ these API should throw <code>NO_IMPLEMENT</code>.
- <LI>In most cases, for example methods in <tt>ORB.java</tt>,
- methods that throw
- <tt>NO_IMPLEMENT</tt> are actually implemented in subclasses
+ <LI>In most cases, for example methods in <code>ORB.java</code>,
+ methods that throw
+ <code>NO_IMPLEMENT</code> are actually implemented in subclasses
elsewhere in the ORB code.
- <LI>In some cases, for example <tt>_get_interface_def()</tt>
- and <tt>_get_interface</tt>, API are really not yet implemented.
+ <LI>In some cases, for example <code>_get_interface_def()</code>
+ and <code>_get_interface</code>, API are really not yet implemented.
</UL>
@@ -912,65 +910,67 @@
operation of Java IDL.
<LI>
-Java IDL does not support <TT>long double</TT>.
+Java IDL does not support <code>long double</code>.
<LI>
-Policies (<TT><a href="Policy.html">org.omg.CORBA.Policy</a></TT>) and methods for getting them are not implemented.
+Policies (<code><a href="Policy.html">org.omg.CORBA.Policy</a></code>)
+and methods for getting them are not implemented.
<LI>
-Domain managers (<TT><a href="DomainManager.html">org.omg.CORBA.DomainManager</a></TT>) and methods for
+Domain managers (<code><a href="DomainManager.html">org.omg.CORBA.DomainManager</a></code>) and methods for
getting them are not implemented.
<LI>
-Service Information <TT><a href="ServiceInformation.html">org.omg.CORBA.ServiceInformation</a></TT> and ORB method <TT>public boolean get_service_information(short service_type,
-ServiceInformationHolder
-service_info)</TT> are not implemented.
+Service Information <code><a href="ServiceInformation.html">org.omg.CORBA.ServiceInformation</a></code>
+and ORB method
+<code>public boolean get_service_information(short service_type, ServiceInformationHolder service_info)</code>
+are not implemented.
-<LI>ORB methods for supporting single-threading (<tt>perform_work</tt>, <tt>work_pending</tt>) are not implemented.
+<LI>ORB methods for supporting single-threading
+(<code>perform_work</code>, <code>work_pending</code>) are not implemented.
<LI>IDL contexts.
</UL>
<HR>
<H2>
-Specific List of Unimplemented Features in Package <TT>org.omg.CORBA</TT></H2>
+Specific List of Unimplemented Features in Package <code>org.omg.CORBA</code></H2>
<H3>
-Unimplemented Methods in package <TT>org.omg.CORBA</TT>:</H3>
+Unimplemented Methods in package <code>org.omg.CORBA</code>:</H3>
<UL>
<LI>
-<TT>ORB</TT>
+<code>ORB</code>
<UL>
<LI>
-<TT>public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any
-val)</TT>
+<code>public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val)</code>
<LI>
-<TT>public void perform_work()</TT>
+<code>public void perform_work()</code>
<LI>
-<TT>public boolean work_pending()</TT>
+<code>public boolean work_pending()</code>
<LI>
-<TT>public org.omg.CORBA.Current get_current()</TT>
+<code>public org.omg.CORBA.Current get_current()</code>
<LI>
-<TT>create_operation_list</TT>
+<code>create_operation_list</code>
<LI>
-<TT>get_default_context</TT>
+<code>get_default_context</code>
<LI>
-<TT>get_service_information</TT>
+<code>get_service_information</code>
<LI>
-obsolete <TT>DynAnys</TT> (deprecated in favor of <tt>DynamicAny</tt> package)
+obsolete <code>DynAnys</code> (deprecated in favor of <code>DynamicAny</code> package)
</UL>
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -30,20 +30,20 @@
</head>
<body bgcolor="white">
-<P>This package contains the following classes, which are used in
-<tt>org.omg.CosNaming.NamingContextExt</tt>:
+<P>This package contains the following classes, which are used in
+<code>org.omg.CosNaming.NamingContextExt</code>:
<UL>
- <LI><tt>AddressHelper</tt>
- <LI><tt>StringNameHelper</tt>
- <LI><tt>URLStringHelper</tt>
- <LI><tt>InvalidAddress</tt>
+ <LI><code>AddressHelper</code>
+ <LI><code>StringNameHelper</code>
+ <LI><code>URLStringHelper</code>
+ <LI><code>InvalidAddress</code>
</UL>
<H3>Package Specification</H3>
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -30,23 +30,23 @@
</head>
<body bgcolor="white">
-<P>This package contains Exception classes for the <tt>org.omg.CosNaming</tt>
+<P>This package contains Exception classes for the <code>org.omg.CosNaming</code>
package. The list of exception classes are:
<UL>
- <LI><tt>AlreadyBound</tt>
- <LI><tt>CannotProceed</tt>
- <LI><tt>InvalidName</tt>
- <LI><tt>NotEmpty</tt>
- <LI><tt>NotFound</tt>
- <LI><tt>NotFoundReason</tt>
+ <LI><code>AlreadyBound</code>
+ <LI><code>CannotProceed</code>
+ <LI><code>InvalidName</code>
+ <LI><code>NotEmpty</code>
+ <LI><code>NotFound</code>
+ <LI><code>NotFoundReason</code>
</UL>
<H3>Package Specification</H3>
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl Tue Sep 22 11:01:54 2015 -0700
@@ -99,8 +99,8 @@
* The BindingIterator interface allows a client to iterate through
* the bindings using the next_one or next_n operations.
*
- * The bindings iterator is obtained by using the <tt>list</tt>
- * method on the <tt>NamingContext</tt>.
+ * The bindings iterator is obtained by using the <code>list</code>
+ * method on the <code>NamingContext</code>.
* @see org.omg.CosNaming.NamingContext#list
*/
interface BindingIterator
@@ -412,7 +412,7 @@
* contains a set of name bindings in which each name is unique and is
* part of Interoperable Naming Service.
* Different names can be bound to an object in the same or different
- * contexts at the same time. Using <tt>NamingContextExt</tt>, you can use
+ * contexts at the same time. Using <code>NamingContextExt</code>, you can use
* URL-based names to bind and resolve.
*
* See <a href="http://www.omg.org/technology/documents/formal/naming_service.htm">
--- a/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -35,25 +35,25 @@
<P>
- The package and all its classes and interfaces
+ The package and all its classes and interfaces
were generated by running the tool <code>idlj</code> on the file
<code>nameservice.idl</code>, which is a module written in OMG IDL.
<H3>Package Specification</H3>
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6, ORB complies, see <A
-HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6, ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
<H2>Interfaces</H2>
- The package <tt>org.omg.CosNaming</tt> contains two public interfaces
- and several auxiliary classes.
+ The package <code>org.omg.CosNaming</code> contains two public interfaces
+ and several auxiliary classes.
<P>
The interfaces are:
<UL>
- <LI><TT>NamingContext</TT>
- <LI><TT>BindingIterator</TT>
+ <LI><code>NamingContext</code>
+ <LI><code>BindingIterator</code>
</UL>
<P>
These two interfaces provide the means to bind/unbind names and object
@@ -68,7 +68,7 @@
the idlj compiler creates Java classes that can be thought of
as auxiliary classes.
Comments for the generated auxiliary classes
- used by the interfaces <code>NamingContext</code> and
+ used by the interfaces <code>NamingContext</code> and
<code>BindingIterator</code> are included here.
<H3>Classes Used by <code>NamingContext</code> and
@@ -78,7 +78,7 @@
generated for each of the classes listed here, are discussed below.)
<UL>
- <LI><code>public final class <B>NameComponent</B></code> --
+ <LI><code>public final class <B>NameComponent</B></code> --
a building block for names. (Names are bound to object references
in a naming context.)
<P>A name is an array of one or more <code>NameComponent</code> objects.
@@ -99,7 +99,7 @@
rather than a file extension or some other syntactic convention.
Examples of the value of the <code>kind</code> field include the strings
<code>"c_source"</code>, <code>"object_code"</code>,
- <code>"executable"</code>,
+ <code>"executable"</code>,
<code>"postscript"</code>, and <code>""</code>. It is not unusual
for the <code>kind</code> field to be the empty string.
</OL>
@@ -110,7 +110,7 @@
This is similar to a path name, in which the last name is the
file name, and all names before it are directory names.
- <LI><code>public final class <B>Binding</B></code> --
+ <LI><code>public final class <B>Binding</B></code> --
an object that associates a name with an object reference or a
naming context.
A <code>Binding</code> object has two fields:
@@ -142,9 +142,9 @@
<code>Binding</code> or used as parameters or return values. These
<code>BindingType</code> objects are:
<UL>
- <LI><code>public static final BindingType <B>nobject</B></code> --
+ <LI><code>public static final BindingType <B>nobject</B></code> --
to indicate that the binding is with an object reference
- <LI><code>public static final BindingType <B>ncontext</B></code> --
+ <LI><code>public static final BindingType <B>ncontext</B></code> --
to indicate that the binding is with a naming context
</UL>
<P>
@@ -159,7 +159,7 @@
If the method <code>from_int</code> is supplied with anything other
than <code>_nobject</code>
or <code>_ncontext</code>, it will throw
- the exception <code>org.omg.CORBA.BAD_PARAM</code>.
+ the exception <code>org.omg.CORBA.BAD_PARAM</code>.
<P>Usage is as follows:
<PRE>
BindingType btObject = from_int(_nobject);
@@ -189,7 +189,7 @@
An instance of a holder class can be passed to a
Java method as a parameter, and
a value can be assigned to its <code>value</code> field. This allows
- it to perform the function of an OUT or INOUT parameter.
+ it to perform the function of an OUT or INOUT parameter.
<P>The following holder classes are generated for the package
<code>org.omg.CosNaming</code>:
<UL>
@@ -202,17 +202,17 @@
<LI><code>NameHolder</code>
</UL>
<P>
- Note that in the <code>org.omg.CORBA</code> package,
+ Note that in the <code>org.omg.CORBA</code> package,
there is a holder class for each of the basic Java types:
- <code>IntHolder</code>, <code>ShortHolder</code>,
+ <code>IntHolder</code>, <code>ShortHolder</code>,
<code>StringHolder</code>, and so on.
<P>
Note also that there is a <code>NameHolder</code> class even though
there is no <code>Name</code> class; similarly, there is a
<code>BindingListHolder</code> class even though there is no
<code>BindingList</code> class. This is true because in the OMG IDL
- interface, <code>Name</code> and <code>BindingList</code> are
- <code>typedef</code>s. There is no mapping from an IDL
+ interface, <code>Name</code> and <code>BindingList</code> are
+ <code>typedef</code>s. There is no mapping from an IDL
<code>typedef</code> to a Java construct, but holder classes
are generated if the <code>typedef</code> is for a sequence or
an array. As mapped to the
@@ -245,7 +245,7 @@
<H3>Helper Classes</H3>
Helper classes, which are generated for all user-defined types
in an OMG IDL interface, supply static methods needed to manipulate
- those types.
+ those types.
<P>
There is only one method in a helper class that an
application programmer uses: the
@@ -282,7 +282,7 @@
Sun's implementation of the <code>CosNaming</code> package complies
with the OMG <code>COSNaming</code> specification. In other words,
the APIs in Sun's naming service are implemented according to the
-guidelines for a naming service provided by OMG. Therefore, if a
+guidelines for a naming service provided by OMG. Therefore, if a
third-party vendor has implemented a naming service that is OMG
compliant, it is possible to switch between Sun's implementation of
<code>CosNaming</code> and the third-party vendor's implementation.
@@ -292,18 +292,17 @@
<h3>Instructions for Using a Third Party's Naming Service</h3>
Although we encourage using an ORB and ORB services that are both
-from one vendor, it is possible to plug in a third party's
+from one vendor, it is possible to plug in a third party's
<code>COSNaming</code> implementation with Sun's RMI-IIOP ORB.
Here are the steps to follow:
<OL>
<LI>Create a properties file for the Bootstrap server and give it
- two entries. For example, you could call this properties file
+ two entries. For example, you could call this properties file
<code>/tmp/services</code> and put the following in it:
- <code>NameService, <Stringified IOR of the Root Naming
-Context></code>.
+ <code>NameService, <Stringified IOR of the Root Naming Context></code>.
<P>
This associates <code>NameService</code> with the Root Naming
- Context of the <code>CosNaming</code> implementation that you
+ Context of the <code>CosNaming</code> implementation that you
want to use.
<LI>Start the standalone Bootstrap server using the following command:
<pre>
@@ -318,7 +317,7 @@
specifying a port number is optional.
</OL>
<P>
-Now when an application calls the method
+Now when an application calls the method
<code>org.omg.CORBA.ORB.resolve_initial_references</code>, CORBA
processes will contact the Bootstrap Server to get the Root Naming
Context.
@@ -326,13 +325,13 @@
<h2>Package Specification</h2>
<ul>
- <li>Interoperable Naming Service (<a
+ <li>Interoperable Naming Service (<a
href="http://www.omg.org/cgi-bin/doc?ptc/00-08-07">ptc/00-08-07</a>)
</ul>
<h2>Related Documentation</h2>
-For an overview and examples of how to use the
+For an overview and examples of how to use the
<code>CosNaming</code> API, please see:
<ul>
<li><a href="../../../../technotes/guides/idl/tnameserv.html">
--- a/corba/src/java.corba/share/classes/org/omg/Dynamic/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/Dynamic/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -31,7 +31,7 @@
</head>
<body bgcolor="white">
-<P>This package contains the <tt>Dynamic</tt> module specified in the OMG Portable
+<P>This package contains the <code>Dynamic</code> module specified in the OMG Portable
Interceptor specification,
<a href="http://www.omg.org/cgi-bin/doc?ptc/2000-08-06">
ptc/2000-08-06</a>, section 21.9. Please
@@ -40,10 +40,10 @@
<H3>Package Specification</H3>
-
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -33,9 +33,9 @@
<body bgcolor="white">
<P>
-This package contains classes and exceptions from the <tt>DynAnyFactory</tt>
+This package contains classes and exceptions from the <code>DynAnyFactory</code>
interface of the
-<tt>DynamicAny</tt> module
+<code>DynamicAny</code> module
specified in the OMG <em>The Common Object Request Broker: Architecture and
Specification</em>,
<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">
@@ -43,10 +43,10 @@
refer to that OMG specification for further details.
<H3>Package Specification</H3>
-
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -30,8 +30,8 @@
</head>
<body bgcolor="white">
-<P>This package contains classes and exceptions from the <tt>DynAny</tt>
- interface of the <tt>DynamicAny</tt> module
+<P>This package contains classes and exceptions from the <code>DynAny</code>
+ interface of the <code>DynamicAny</code> module
specified in the OMG <em>The Common Object Request Broker: Architecture and
Specification</em>,
<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">
@@ -42,9 +42,9 @@
<H3>Package Specification</H3>
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/DynamicAny/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/DynamicAny/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -48,15 +48,15 @@
helpful for writing generic clients (bridges, browsers, debuggers, user interface tools).
<P><code>Any</code> values can be dynamically interpreted (traversed) and constructed through
-<tt>DynAny</tt> objects. A <tt>DynAny</tt> object is associated with a data
-value which corresponds to a copy of the value inserted into an <tt>Any</tt>. A
-<tt>DynAny</tt> object may be viewed as an ordered collection of component
-<tt>DynAny</tt>s. For <tt>DynAny</tt>s representing a basic type, such as <code>long</code>,
+<code>DynAny</code> objects. A <code>DynAny</code> object is associated with a data
+value which corresponds to a copy of the value inserted into an <code>Any</code>. A
+<code>DynAny</code> object may be viewed as an ordered collection of component
+<code>DynAny</code>s. For <code>DynAny</code>s representing a basic type, such as <code>long</code>,
or a type without components, such as an empty exception, the ordered collection of
components is empty.
-<P>Each <tt>DynAny</tt> object maintains the notion of a current position into its collection
-of component <tt>DynAny</tt>s. The current position is identified by an index value that runs
+<P>Each <code>DynAny</code> object maintains the notion of a current position into its collection
+of component <code>DynAny</code>s. The current position is identified by an index value that runs
from 0 to n-1, where <em>n</em> is the number of components. The special index value -1
indicates a current position that points nowhere.
For values that cannot have a current position (such as an empty exception),
--- a/corba/src/java.corba/share/classes/org/omg/IOP/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/IOP/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -30,14 +30,14 @@
</head>
<body bgcolor="white">
-<P>This package contains the <TT>IOP</tt> module specified in the OMG document
+<P>This package contains the <code>IOP</code> module specified in the OMG document
<em>The Common
Object Request Broker: Architecture and Specification</em>,
<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">
formal/99-10-07</a>, section 13.6. Please
refer to that OMG specification for further details.
-<P>Please note that we do not provide all parts of the <tt>IOP</tt> module from
+<P>Please note that we do not provide all parts of the <code>IOP</code> module from
the specification. We only provide those parts that are referenced as
return values or parameter types in public APIs, most notably,
Portable Interceptors.
@@ -47,10 +47,10 @@
<H3>Package Specification</H3>
-
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/Messaging/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/Messaging/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -30,22 +30,22 @@
</head>
<body bgcolor="white">
-<P>This package contains the <tt>Messaging</tt> module specified in the OMG CORBA
+<P>This package contains the <code>Messaging</code> module specified in the OMG CORBA
Messaging specification,
<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">
formal/99-10-07</a>. Please refer to that OMG
specification for further details.
-<P>Please note that we do not provide all parts of the <tt>Messaging</tt> module from
+<P>Please note that we do not provide all parts of the <code>Messaging</code> module from
the specification. We only provide those parts that are referenced as
return values or parameter types in public APIs, most notably,
Portable Interceptors.
<H3>Package Specification</H3>
-
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -30,19 +30,19 @@
</head>
<body bgcolor="white">
-<P>This package contains the exceptions and typedefs from the <tt>ORBInitInfo</tt>
-local interface of the <tt>PortableInterceptor</tt> module specified in the OMG
+<P>This package contains the exceptions and typedefs from the <code>ORBInitInfo</code>
+local interface of the <code>PortableInterceptor</code> module specified in the OMG
Portable Interceptor specification,
<a href="http://www.omg.org/cgi-bin/doc?ptc/2000-08-06">
ptc/2000-08-06</a>, section 21.7.2. Please
refer to that OMG specification for further details.
-
+
<H3>Package Specification</H3>
-
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
-HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -45,25 +45,34 @@
-<P>Given an interface <tt>My</tt> defined in <tt>My.idl</tt>, the file <tt>MyPOA.java</tt> is generated by the <tt>idlj</tt> compiler. You must provide the implementation for <tt>My</tt> and it must inherit from <tt>MyPOA</tt>.
+<P>Given an interface <code>My</code> defined in <code>My.idl</code>, the file <code>MyPOA.java</code>
+is generated by the <code>idlj</code> compiler. You must provide
+the implementation for <code>My</code> and it must inherit from <code>MyPOA</code>.
-<P><TT>MyPOA.java</TT> is a stream-based skeleton that extends <tt>org.omg.PortableServer.Servant</tt> and implements the <tt>InvokeHandler</tt> interface and the operations interface associated with the IDL interface the skeleton implements.
+<P><code>MyPOA.java</code> is a stream-based skeleton that extends
+<code>org.omg.PortableServer.Servant</code> and implements the <code>InvokeHandler</code>
+interface and the operations interface associated with the IDL interface the skeleton implements.
-<P>The <TT>PortableServer</TT> module for the Portable Object Adapter (POA) defines the native <tt>Servant</tt> type. In the Java programming language, the <tt>Servant</tt> type is mapped to the Java <TT>org.omg.PortableServer.Servant</TT> class. It serves as the base class for all POA servant implementations and provides a number of methods that may
-be invoked by the application programmer, as well as methods which are invoked by the POA itself and may be overridden by the user to control aspects of servant behavior.
-
+<P>The <code>PortableServer</code> module for the Portable Object Adapter (POA)
+defines the native <code>Servant</code> type. In the Java programming language,
+the <code>Servant</code> type is mapped to the Java <code>org.omg.PortableServer.Servant</code> class.
+It serves as the base class for all POA servant implementations
+and provides a number of methods that may be invoked by the application programmer,
+as well as methods which are invoked by the POA itself
+and may be overridden by the user to control aspects of servant behavior.
-<P>All Mapping corresponds to the Chapter 11 of
+
+<P>All Mapping corresponds to the Chapter 11 of
CORBA V2.3.1 specified by OMG document formal/99-10-07.pdf.
- The exception to this is the <code>id</code> attribute, which is added in ptc/00-08-06,
+ The exception to this is the <code>id</code> attribute, which is added in ptc/00-08-06,
section 11.3.8.26.
<H3>Package Specification</H3>
-<P>For a precise list of supported sections of official specifications with which
-the Java[tm] Platform, Standard Edition 6, ORB complies, see <A
-HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6, ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -33,15 +33,15 @@
<body bgcolor="white">
Provides classes and interfaces for locating the servant.
-<P>This package supplies a <TT>CookieHolder</TT> class for passing
-the <TT>Cookie</TT> type as an <code>out</code> parameter. The <code>CookieHolder</code> class
+<P>This package supplies a <code>CookieHolder</code> class for passing
+the <code>Cookie</code> type as an <code>out</code> parameter. The <code>CookieHolder</code> class
follows exactly the same pattern as the other holder classes for basic types.
-
+
<H2>Package Specification</H2>
-
-<P>For a precise list of supported sections of official OMG specifications with which
-the Java[tm] Platform, Standard Edition 6 complies, see <A
-HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+
+<P>For a precise list of supported sections of official OMG specifications with which
+the Java[tm] Platform, Standard Edition 6 complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -2,7 +2,7 @@
<html>
<head>
<!--
-
+
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,46 +34,46 @@
Provides classes and interfaces for making the server side of your applications
portable across multivendor ORBs.
-<P>In Java, Portable Object Adaptor (POA)-based Dynamic Skeleton Interface (DSI)
-servants inherit from the standard <TT>DynamicImplementation</TT> class, which
-inherits from the <TT>Servant</TT> class. The native <TT>Servant</TT> type is
-defined by the <TT>PortableServer</TT> module for the POA. In Java, the
- <TT>Servant</TT> type is mapped to the Java
- <TT>org.omg.PortableServer.Servant</TT> class.
- It serves as the base class for all POA servant
- implementations and provides a number of methods that may
- be invoked by the application programmer, as well as methods
- which are invoked by the POA itself and may be overridden by
- the user to control aspects of servant behavior.
+<P>In Java, Portable Object Adaptor (POA)-based Dynamic Skeleton Interface (DSI)
+servants inherit from the standard <code>DynamicImplementation</code> class, which
+inherits from the <code>Servant</code> class. The native <code>Servant</code> type is
+defined by the <code>PortableServer</code> module for the POA. In Java, the
+ <code>Servant</code> type is mapped to the Java
+ <code>org.omg.PortableServer.Servant</code> class.
+ It serves as the base class for all POA servant
+ implementations and provides a number of methods that may
+ be invoked by the application programmer, as well as methods
+ which are invoked by the POA itself and may be overridden by
+ the user to control aspects of servant behavior.
<H2>Package Specification</H2>
-<P>For a precise list of supported sections of official OMG specifications with which
-the Java[tm] Platform, Standard Edition 6 complies, see <A
-HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+<P>For a precise list of supported sections of official OMG specifications with which
+the Java[tm] Platform, Standard Edition 6 complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
support in Java[tm] SE 6</A>.
<H2>POA-related Interfaces</H2>
-<P>The <TT>PortableServer</TT> module defines the following POA-related interfaces:
+<P>The <code>PortableServer</code> module defines the following POA-related interfaces:
<UL>
- <LI><TT>POA</TT>
- <LI><TT>POAManager</TT>
- <LI><TT>ServantManager</TT>
- <LI><TT>ServantActivator</TT>
- <LI><TT>ServantLocator</TT>
- <LI><TT>AdapterActivator</TT>
- <LI><TT>ThreadPolicy</TT>
- <LI><TT>LifespanPolicy</TT>
- <LI><TT>IdUniquenessPolicy</TT>
- <LI><TT>IdAssignmentPolicy</TT>
- <LI><TT>ImplicitActivationPolicy</TT>
- <LI><TT>ServantRetentionPolicy</TT>
- <LI><TT>RequestProcessingPolicy</TT>
- <LI><TT>Current</TT>
+ <LI><code>POA</code>
+ <LI><code>POAManager</code>
+ <LI><code>ServantManager</code>
+ <LI><code>ServantActivator</code>
+ <LI><code>ServantLocator</code>
+ <LI><code>AdapterActivator</code>
+ <LI><code>ThreadPolicy</code>
+ <LI><code>LifespanPolicy</code>
+ <LI><code>IdUniquenessPolicy</code>
+ <LI><code>IdAssignmentPolicy</code>
+ <LI><code>ImplicitActivationPolicy</code>
+ <LI><code>ServantRetentionPolicy</code>
+ <LI><code>RequestProcessingPolicy</code>
+ <LI><code>Current</code>
</UL>
-<P>In addition, the POA defines the <TT>Servant</TT> native type.
+<P>In addition, the POA defines the <code>Servant</code> native type.
<H3>Operations classes</H3>
@@ -87,10 +87,10 @@
Classes ending in the suffix <code>PolicyValue</code> provide the values used
for the <code>create_POA</code> call, which sets the policy for the POA. See
-the <a href="#sampleserver">sample code</a> below for a demonstration.
+the <a href="#sampleserver">sample code</a> below for a demonstration.
<code>PolicyValue</code> files include the following:
<UL>
-<LI><code>IdAssignmentPolicyValue</code>
+<LI><code>IdAssignmentPolicyValue</code>
<LI><code>IdUniquenessPolicyValue</code>
<LI><code>ImplicitActivationPolicyValue</code>
<LI><code>LifespanPolicyValue</code>
@@ -101,10 +101,10 @@
<H3>Helper Classes</H3>
-<P>Helper classes, which are generated for all user-defined types in an OMG IDL
+<P>Helper classes, which are generated for all user-defined types in an OMG IDL
interface, supply static methods needed to manipulate those types.
-There is only one method in a helper class that an application programmer uses:
-the <code>narrow</code> method. Only Java interfaces mapped from IDL interfaces
+There is only one method in a helper class that an application programmer uses:
+the <code>narrow</code> method. Only Java interfaces mapped from IDL interfaces
will have a helper class that includes a <code>narrow</code> method, so in
the <code>PortableServer</code> package, only the following classes have a <code>narrow</code> method:
<UL>
@@ -119,7 +119,7 @@
<H3>Exceptions</H3>
-<P>The <code>ForwardRequest</code> exception indicates to the ORB
+<P>The <code>ForwardRequest</code> exception indicates to the ORB
that it is responsible for delivering the current request and
subsequent <code>ForwardRequest</code> requests to the object denoted in the
<code>forward_reference</code> member of the exception.
@@ -132,7 +132,7 @@
The interfaces of interest to application programmers are the following:
<ul>
<LI><code>AdapterActivator</code>
- <P>Adapter activators are associated with POAs.
+ <P>Adapter activators are associated with POAs.
An adapter activator supplies a POA with the ability to create child POAs on demand,
as a side-effect of receiving a request that names the child POA (or one of its children),
or when <code>find_POA</code> is called with an activate parameter value of <code>TRUE</code>.
@@ -148,10 +148,10 @@
</ul>
-<H2>Package <TT>org.omg.PortableServer.ServantLocatorPackage</TT></H2>
+<H2>Package <code>org.omg.PortableServer.ServantLocatorPackage</code></H2>
-<P>This package supplies a <TT>CookieHolder</TT> class for passing
-the <TT>Cookie</TT> type as an <code>out</code> parameter. The <code>CookieHolder</code> class
+<P>This package supplies a <code>CookieHolder</code> class for passing
+the <code>Cookie</code> type as an <code>out</code> parameter. The <code>CookieHolder</code> class
follows exactly the same pattern as the other holder classes for basic types.
<H2>Related Documentation</H2>
--- a/corba/src/java.corba/share/classes/org/omg/PortableServer/portable/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/PortableServer/portable/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -31,15 +31,15 @@
</head>
<body bgcolor="white">
-Provides classes and interfaces for making the server side of your applications
+Provides classes and interfaces for making the server side of your applications
portable across multivendor ORBs.
-<P>The <tt>portable</tt> package contains interfaces and classes
- that are designed for and intended to be used by an ORB
-implementor. It exposes the publicly defined APIs that
+<P>The <code>portable</code> package contains interfaces and classes
+ that are designed for and intended to be used by an ORB
+implementor. It exposes the publicly defined APIs that
are used to connect stubs and skeletons to the ORB.
- The <tt>Delegate</tt> interface provides the ORB-vendor-specific
- implementation of <tt>PortableServer::Servant</TT>.
+ The <code>Delegate</code> interface provides the ORB-vendor-specific
+ implementation of <code>PortableServer::Servant</code>.
This package conforms CORBA Specification V2.3.1, ptc/00-01-08.
@since 1.4
--- a/corba/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html Thu Sep 17 09:19:40 2015 -0700
+++ b/corba/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html Tue Sep 22 11:01:54 2015 -0700
@@ -30,8 +30,8 @@
-->
</head>
<body bgcolor="white">
- Contains RMI-IIOP Stubs for the Remote types that occur in the
- <tt>java.rmi</tt> package.
+ Contains RMI-IIOP Stubs for the Remote types that occur in the
+ <code>java.rmi</code> package.
@since 1.3
<br>
--- a/hotspot/.hgtags Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/.hgtags Tue Sep 22 11:01:54 2015 -0700
@@ -484,3 +484,4 @@
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
8e8377739c06b99b9011c003c77e0bef84c91e09 jdk9-b80
4142c190cd5ca4fb70ec367b4f97ef936272d8ef jdk9-b81
+1c453a12be3036d482abef1dd470f8aff536b6b9 jdk9-b82
--- a/hotspot/make/Makefile Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/Makefile Tue Sep 22 11:01:54 2015 -0700
@@ -633,9 +633,9 @@
update_jdk: export_product_jdk export_fastdebug_jdk test_jdk
-copy_jdk: $(JDK_IMAGE_DIR)/jre/lib/rt.jar
+copy_jdk: $(JDK_IMAGE_DIR)/bin/java
-$(JDK_IMAGE_DIR)/jre/lib/rt.jar:
+$(JDK_IMAGE_DIR)/bin/java:
$(RM) -r $(JDK_IMAGE_DIR)
$(MKDIR) -p $(JDK_IMAGE_DIR)
($(CD) $(JDK_IMPORT_PATH) && \
--- a/hotspot/make/aix/makefiles/mapfile-vers-debug Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/aix/makefiles/mapfile-vers-debug Tue Sep 22 11:01:54 2015 -0700
@@ -141,18 +141,6 @@
JVM_Halt;
JVM_HoldsLock;
JVM_IHashCode;
- JVM_ImageAttributeOffsets;
- JVM_ImageAttributeOffsetsLength;
- JVM_ImageClose;
- JVM_ImageFindAttributes;
- JVM_ImageGetAttributes;
- JVM_ImageGetAttributesCount;
- JVM_ImageGetDataAddress;
- JVM_ImageGetIndexAddress;
- JVM_ImageGetStringBytes;
- JVM_ImageOpen;
- JVM_ImageRead;
- JVM_ImageReadCompressed;
JVM_InitAgentProperties;
JVM_InitProperties;
JVM_InternString;
--- a/hotspot/make/aix/makefiles/mapfile-vers-product Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/aix/makefiles/mapfile-vers-product Tue Sep 22 11:01:54 2015 -0700
@@ -139,18 +139,6 @@
JVM_Halt;
JVM_HoldsLock;
JVM_IHashCode;
- JVM_ImageAttributeOffsets;
- JVM_ImageAttributeOffsetsLength;
- JVM_ImageClose;
- JVM_ImageFindAttributes;
- JVM_ImageGetAttributes;
- JVM_ImageGetAttributesCount;
- JVM_ImageGetDataAddress;
- JVM_ImageGetIndexAddress;
- JVM_ImageGetStringBytes;
- JVM_ImageOpen;
- JVM_ImageRead;
- JVM_ImageReadCompressed;
JVM_InitAgentProperties;
JVM_InitProperties;
JVM_InternString;
--- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug Tue Sep 22 11:01:54 2015 -0700
@@ -139,18 +139,6 @@
_JVM_Halt
_JVM_HoldsLock
_JVM_IHashCode
- _JVM_ImageAttributeOffsets
- _JVM_ImageAttributeOffsetsLength
- _JVM_ImageClose
- _JVM_ImageFindAttributes
- _JVM_ImageGetAttributes
- _JVM_ImageGetAttributesCount
- _JVM_ImageGetDataAddress
- _JVM_ImageGetIndexAddress
- _JVM_ImageGetStringBytes
- _JVM_ImageOpen
- _JVM_ImageRead
- _JVM_ImageReadCompressed
_JVM_InitAgentProperties
_JVM_InitProperties
_JVM_InternString
--- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product Tue Sep 22 11:01:54 2015 -0700
@@ -139,18 +139,6 @@
_JVM_Halt
_JVM_HoldsLock
_JVM_IHashCode
- _JVM_ImageAttributeOffsets
- _JVM_ImageAttributeOffsetsLength
- _JVM_ImageClose
- _JVM_ImageFindAttributes
- _JVM_ImageGetAttributes
- _JVM_ImageGetAttributesCount
- _JVM_ImageGetDataAddress
- _JVM_ImageGetIndexAddress
- _JVM_ImageGetStringBytes
- _JVM_ImageOpen
- _JVM_ImageRead
- _JVM_ImageReadCompressed
_JVM_InitAgentProperties
_JVM_InitProperties
_JVM_InternString
--- a/hotspot/make/bsd/makefiles/mapfile-vers-debug Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug Tue Sep 22 11:01:54 2015 -0700
@@ -141,18 +141,6 @@
JVM_Halt;
JVM_HoldsLock;
JVM_IHashCode;
- JVM_ImageAttributeOffsets;
- JVM_ImageAttributeOffsetsLength;
- JVM_ImageClose;
- JVM_ImageFindAttributes;
- JVM_ImageGetAttributes;
- JVM_ImageGetAttributesCount;
- JVM_ImageGetDataAddress;
- JVM_ImageGetIndexAddress;
- JVM_ImageGetStringBytes;
- JVM_ImageOpen;
- JVM_ImageRead;
- JVM_ImageReadCompressed;
JVM_InitAgentProperties;
JVM_InitProperties;
JVM_InternString;
--- a/hotspot/make/bsd/makefiles/mapfile-vers-product Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/bsd/makefiles/mapfile-vers-product Tue Sep 22 11:01:54 2015 -0700
@@ -141,18 +141,6 @@
JVM_Halt;
JVM_HoldsLock;
JVM_IHashCode;
- JVM_ImageAttributeOffsets;
- JVM_ImageAttributeOffsetsLength;
- JVM_ImageClose;
- JVM_ImageFindAttributes;
- JVM_ImageGetAttributes;
- JVM_ImageGetAttributesCount;
- JVM_ImageGetDataAddress;
- JVM_ImageGetIndexAddress;
- JVM_ImageGetStringBytes;
- JVM_ImageOpen;
- JVM_ImageRead;
- JVM_ImageReadCompressed;
JVM_InitAgentProperties;
JVM_InitProperties;
JVM_InternString;
--- a/hotspot/make/bsd/makefiles/vm.make Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/bsd/makefiles/vm.make Tue Sep 22 11:01:54 2015 -0700
@@ -131,7 +131,7 @@
# By default, link the *.o into the library, not the executable.
LINK_INTO$(LINK_INTO) = LIBJVM
-JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
+JDK_LIBDIR = $(JAVA_HOME)/lib/$(LIBARCH)
#----------------------------------------------------------------------
# jvm_db & dtrace
--- a/hotspot/make/build.sh Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/build.sh Tue Sep 22 11:01:54 2015 -0700
@@ -49,7 +49,7 @@
# Just in case:
JAVA_HOME=`( cd $JAVA_HOME; pwd )`
-if [ "${ALT_BOOTDIR-}" = "" -o ! -d "${ALT_BOOTDIR-}" -o ! -d ${ALT_BOOTDIR-}/jre/lib/ ]; then
+if [ "${ALT_BOOTDIR-}" = "" -o ! -d "${ALT_BOOTDIR-}" -o ! -d ${ALT_BOOTDIR-}/lib/ ]; then
ALT_BOOTDIR=${JAVA_HOME}
fi
--- a/hotspot/make/hotspot.script Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/hotspot.script Tue Sep 22 11:01:54 2015 -0700
@@ -127,7 +127,7 @@
# o $JRE/lib/$ARCH
# followed by the user's previous effective LD_LIBRARY_PATH, if
# any.
-JRE=$JDK/jre
+JRE=$JDK
JAVA_HOME=$JDK
export JAVA_HOME
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug Tue Sep 22 11:01:54 2015 -0700
@@ -141,18 +141,6 @@
JVM_Halt;
JVM_HoldsLock;
JVM_IHashCode;
- JVM_ImageAttributeOffsets;
- JVM_ImageAttributeOffsetsLength;
- JVM_ImageClose;
- JVM_ImageFindAttributes;
- JVM_ImageGetAttributes;
- JVM_ImageGetAttributesCount;
- JVM_ImageGetDataAddress;
- JVM_ImageGetIndexAddress;
- JVM_ImageGetStringBytes;
- JVM_ImageOpen;
- JVM_ImageRead;
- JVM_ImageReadCompressed;
JVM_InitAgentProperties;
JVM_InitProperties;
JVM_InternString;
--- a/hotspot/make/linux/makefiles/mapfile-vers-product Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product Tue Sep 22 11:01:54 2015 -0700
@@ -141,18 +141,6 @@
JVM_Halt;
JVM_HoldsLock;
JVM_IHashCode;
- JVM_ImageAttributeOffsets;
- JVM_ImageAttributeOffsetsLength;
- JVM_ImageClose;
- JVM_ImageFindAttributes;
- JVM_ImageGetAttributes;
- JVM_ImageGetAttributesCount;
- JVM_ImageGetDataAddress;
- JVM_ImageGetIndexAddress;
- JVM_ImageGetStringBytes;
- JVM_ImageOpen;
- JVM_ImageRead;
- JVM_ImageReadCompressed;
JVM_InitAgentProperties;
JVM_InitProperties;
JVM_InternString;
--- a/hotspot/make/solaris/makefiles/adlc.make Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/solaris/makefiles/adlc.make Tue Sep 22 11:01:54 2015 -0700
@@ -76,6 +76,11 @@
ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
CFLAGS_WARN = +w -errwarn
endif
+# When using compiler version 5.13 (Solaris Studio 12.4), calls to explicitly
+# instantiated template functions trigger this warning when +w is active.
+ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 513), 1)
+ CFLAGS_WARN += -erroff=notemsource
+endif
CFLAGS += $(CFLAGS_WARN)
ifeq ("${Platform_compiler}", "sparcWorks")
--- a/hotspot/make/solaris/makefiles/buildtree.make Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/solaris/makefiles/buildtree.make Tue Sep 22 11:01:54 2015 -0700
@@ -270,6 +270,7 @@
echo "CP ?= cp"; \
echo "MV ?= mv"; \
echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \
+ echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \
echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
) > $@
--- a/hotspot/make/solaris/makefiles/mapfile-vers Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/solaris/makefiles/mapfile-vers Tue Sep 22 11:01:54 2015 -0700
@@ -141,18 +141,6 @@
JVM_Halt;
JVM_HoldsLock;
JVM_IHashCode;
- JVM_ImageAttributeOffsets;
- JVM_ImageAttributeOffsetsLength;
- JVM_ImageClose;
- JVM_ImageFindAttributes;
- JVM_ImageGetAttributes;
- JVM_ImageGetAttributesCount;
- JVM_ImageGetDataAddress;
- JVM_ImageGetIndexAddress;
- JVM_ImageGetStringBytes;
- JVM_ImageOpen;
- JVM_ImageRead;
- JVM_ImageReadCompressed;
JVM_InitAgentProperties;
JVM_InitProperties;
JVM_InternString;
--- a/hotspot/make/solaris/makefiles/vm.make Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/make/solaris/makefiles/vm.make Tue Sep 22 11:01:54 2015 -0700
@@ -197,7 +197,7 @@
Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS)
Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS)
Src_Dirs/ZERO := $(CORE_PATHS)
-Src_Dirs/SHARK := $(CORE_PATHS)
+Src_Dirs/SHARK := $(CORE_PATHS) $(SHARK_PATHS)
Src_Dirs := $(Src_Dirs/$(TYPE))
COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\*
@@ -206,7 +206,7 @@
ZERO_SPECIFIC_FILES := zero
# Always exclude these.
-Src_Files_EXCLUDE := dtrace jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
+Src_Files_EXCLUDE += dtrace jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
# Exclude per type.
Src_Files_EXCLUDE/CORE := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad Tue Sep 22 11:01:54 2015 -0700
@@ -4373,12 +4373,12 @@
return;
}
- if (UseBiasedLocking) {
- __ biased_locking_enter(disp_hdr, oop, box, tmp, true, cont);
+ if (UseBiasedLocking && !UseOptoBiasInlining) {
+ __ biased_locking_enter(box, oop, disp_hdr, tmp, true, cont);
}
// Handle existing monitor
- if (EmitSync & 0x02) {
+ if ((EmitSync & 0x02) == 0) {
// we can use AArch64's bit test and branch here but
// markoopDesc does not define a bit index just the bit value
// so assert in case the bit pos changes
@@ -4518,7 +4518,7 @@
return;
}
- if (UseBiasedLocking) {
+ if (UseBiasedLocking && !UseOptoBiasInlining) {
__ biased_locking_exit(oop, tmp, cont);
}
--- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -1210,7 +1210,7 @@
INSN(ldrs, 0b00, 1);
INSN(ldrd, 0b01, 1);
- INSN(ldrq, 0x10, 1);
+ INSN(ldrq, 0b10, 1);
#undef INSN
@@ -2285,13 +2285,13 @@
#undef INSN
// Table vector lookup
-#define INSN(NAME, op) \
- void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, unsigned registers, FloatRegister Vm) { \
- starti; \
- assert(T == T8B || T == T16B, "invalid arrangement"); \
- assert(0 < registers && registers <= 4, "invalid number of registers"); \
- f(0, 31), f((int)T & 1, 30), f(0b001110000, 29, 21), rf(Vm, 16), f(0, 15); \
- f(registers - 1, 14, 13), f(op, 12),f(0b00, 11, 10), rf(Vn, 5), rf(Vd, 0); \
+#define INSN(NAME, op) \
+ void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, unsigned registers, FloatRegister Vm) { \
+ starti; \
+ assert(T == T8B || T == T16B, "invalid arrangement"); \
+ assert(0 < registers && registers <= 4, "invalid number of registers"); \
+ f(0, 31), f((int)T & 1, 30), f(0b001110000, 29, 21), rf(Vm, 16), f(0, 15); \
+ f(registers - 1, 14, 13), f(op, 12),f(0b00, 11, 10), rf(Vn, 5), rf(Vd, 0); \
}
INSN(tbl, 0);
@@ -2299,6 +2299,7 @@
#undef INSN
+ // AdvSIMD two-reg misc
#define INSN(NAME, U, opcode) \
void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { \
starti; \
@@ -2316,10 +2317,19 @@
#define ASSERTION (T == T8B || T == T16B || T == T4H || T == T8H)
INSN(rev32, 1, 0b00000);
+private:
+ INSN(_rbit, 1, 0b00101);
+public:
+
#undef ASSERTION
#define ASSERTION (T == T8B || T == T16B)
INSN(rev16, 0, 0b00001);
+ // RBIT only allows T8B and T16B but encodes them oddly. Argh...
+ void rbit(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) {
+ assert((ASSERTION), MSG);
+ _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn);
+ }
#undef ASSERTION
#undef MSG
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -3043,7 +3043,9 @@
// register obj is destroyed afterwards.
BarrierSet* bs = Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
+ assert(bs->kind() == BarrierSet::CardTableForRS ||
+ bs->kind() == BarrierSet::CardTableExtension,
+ "Wrong barrier set kind");
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -691,7 +691,7 @@
__ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 2);
__ pop(RegSet::range(r0, r29), sp); // integer registers except lr & sp }
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -731,7 +731,7 @@
__ pop(RegSet::range(r0, r29), sp); // integer registers except lr & sp }
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
CardTableModRefBS* ct = (CardTableModRefBS*)bs;
@@ -2364,7 +2364,7 @@
* c_rarg3 - int* table
*
* Ouput:
- * rax - int crc result
+ * r0 - int crc result
*/
address generate_updateBytesCRC32C() {
assert(UseCRC32CIntrinsics, "what are we doing here?");
@@ -2435,6 +2435,69 @@
return start;
}
+ void ghash_multiply(FloatRegister result_lo, FloatRegister result_hi,
+ FloatRegister a, FloatRegister b, FloatRegister a1_xor_a0,
+ FloatRegister tmp1, FloatRegister tmp2, FloatRegister tmp3, FloatRegister tmp4) {
+ // Karatsuba multiplication performs a 128*128 -> 256-bit
+ // multiplication in three 128-bit multiplications and a few
+ // additions.
+ //
+ // (C1:C0) = A1*B1, (D1:D0) = A0*B0, (E1:E0) = (A0+A1)(B0+B1)
+ // (A1:A0)(B1:B0) = C1:(C0+C1+D1+E1):(D1+C0+D0+E0):D0
+ //
+ // Inputs:
+ //
+ // A0 in a.d[0] (subkey)
+ // A1 in a.d[1]
+ // (A1+A0) in a1_xor_a0.d[0]
+ //
+ // B0 in b.d[0] (state)
+ // B1 in b.d[1]
+
+ __ ext(tmp1, __ T16B, b, b, 0x08);
+ __ pmull2(result_hi, __ T1Q, b, a, __ T2D); // A1*B1
+ __ eor(tmp1, __ T16B, tmp1, b); // (B1+B0)
+ __ pmull(result_lo, __ T1Q, b, a, __ T1D); // A0*B0
+ __ pmull(tmp2, __ T1Q, tmp1, a1_xor_a0, __ T1D); // (A1+A0)(B1+B0)
+
+ __ ext(tmp4, __ T16B, result_lo, result_hi, 0x08);
+ __ eor(tmp3, __ T16B, result_hi, result_lo); // A1*B1+A0*B0
+ __ eor(tmp2, __ T16B, tmp2, tmp4);
+ __ eor(tmp2, __ T16B, tmp2, tmp3);
+
+ // Register pair <result_hi:result_lo> holds the result of carry-less multiplication
+ __ ins(result_hi, __ D, tmp2, 0, 1);
+ __ ins(result_lo, __ D, tmp2, 1, 0);
+ }
+
+ void ghash_reduce(FloatRegister result, FloatRegister lo, FloatRegister hi,
+ FloatRegister p, FloatRegister z, FloatRegister t1) {
+ const FloatRegister t0 = result;
+
+ // The GCM field polynomial f is z^128 + p(z), where p =
+ // z^7+z^2+z+1.
+ //
+ // z^128 === -p(z) (mod (z^128 + p(z)))
+ //
+ // so, given that the product we're reducing is
+ // a == lo + hi * z^128
+ // substituting,
+ // === lo - hi * p(z) (mod (z^128 + p(z)))
+ //
+ // we reduce by multiplying hi by p(z) and subtracting the result
+ // from (i.e. XORing it with) lo. Because p has no nonzero high
+ // bits we can do this with two 64-bit multiplications, lo*p and
+ // hi*p.
+
+ __ pmull2(t0, __ T1Q, hi, p, __ T2D);
+ __ ext(t1, __ T16B, t0, z, 8);
+ __ eor(hi, __ T16B, hi, t1);
+ __ ext(t1, __ T16B, z, t0, 8);
+ __ eor(lo, __ T16B, lo, t1);
+ __ pmull(t0, __ T1Q, hi, p, __ T1D);
+ __ eor(result, __ T16B, lo, t0);
+ }
+
/**
* Arguments:
*
@@ -2448,10 +2511,27 @@
* Updated state at c_rarg0
*/
address generate_ghash_processBlocks() {
- __ align(CodeEntryAlignment);
- Label L_ghash_loop, L_exit;
+ // Bafflingly, GCM uses little-endian for the byte order, but
+ // big-endian for the bit order. For example, the polynomial 1 is
+ // represented as the 16-byte string 80 00 00 00 | 12 bytes of 00.
+ //
+ // So, we must either reverse the bytes in each word and do
+ // everything big-endian or reverse the bits in each byte and do
+ // it little-endian. On AArch64 it's more idiomatic to reverse
+ // the bits in each byte (we have an instruction, RBIT, to do
+ // that) and keep the data in little-endian bit order throught the
+ // calculation, bit-reversing the inputs and outputs.
StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
+ __ align(wordSize * 2);
+ address p = __ pc();
+ __ emit_int64(0x87); // The low-order bits of the field
+ // polynomial (i.e. p = z^7+z^2+z+1)
+ // repeated in the low and high parts of a
+ // 128-bit vector
+ __ emit_int64(0x87);
+
+ __ align(CodeEntryAlignment);
address start = __ pc();
Register state = c_rarg0;
@@ -2462,104 +2542,43 @@
FloatRegister vzr = v30;
__ eor(vzr, __ T16B, vzr, vzr); // zero register
- __ mov(v26, __ T16B, 1);
- __ mov(v27, __ T16B, 63);
- __ mov(v28, __ T16B, 62);
- __ mov(v29, __ T16B, 57);
-
- __ ldrq(v6, Address(state));
- __ ldrq(v16, Address(subkeyH));
-
- __ ext(v0, __ T16B, v6, v6, 0x08);
- __ ext(v1, __ T16B, v16, v16, 0x08);
- __ eor(v16, __ T16B, v16, v1);
-
- __ bind(L_ghash_loop);
-
- __ ldrq(v2, Address(__ post(data, 0x10)));
- __ rev64(v2, __ T16B, v2); // swap data
-
- __ ext(v6, __ T16B, v0, v0, 0x08);
- __ eor(v6, __ T16B, v6, v2);
- __ ext(v2, __ T16B, v6, v6, 0x08);
-
- __ pmull2(v7, __ T1Q, v2, v1, __ T2D); // A1*B1
- __ eor(v6, __ T16B, v6, v2);
- __ pmull(v5, __ T1Q, v2, v1, __ T1D); // A0*B0
- __ pmull(v20, __ T1Q, v6, v16, __ T1D); // (A1 + A0)(B1 + B0)
-
- __ ext(v21, __ T16B, v5, v7, 0x08);
- __ eor(v18, __ T16B, v7, v5); // A1*B1 xor A0*B0
- __ eor(v20, __ T16B, v20, v21);
- __ eor(v20, __ T16B, v20, v18);
-
- // Registers pair <v7:v5> holds the result of carry-less multiplication
- __ ins(v7, __ D, v20, 0, 1);
- __ ins(v5, __ D, v20, 1, 0);
-
- // Result of the multiplication is shifted by one bit position
- // [X3:X2:X1:X0] = [X3:X2:X1:X0] << 1
- __ ushr(v18, __ T2D, v5, -63 & 63);
- __ ins(v25, __ D, v18, 1, 0);
- __ ins(v25, __ D, vzr, 0, 0);
- __ ushl(v5, __ T2D, v5, v26);
- __ orr(v5, __ T16B, v5, v25);
-
- __ ushr(v19, __ T2D, v7, -63 & 63);
- __ ins(v19, __ D, v19, 1, 0);
- __ ins(v19, __ D, v18, 0, 1);
- __ ushl(v7, __ T2D, v7, v26);
- __ orr(v6, __ T16B, v7, v19);
-
- __ ins(v24, __ D, v5, 0, 1);
-
- // A = X0 << 63
- __ ushl(v21, __ T2D, v5, v27);
-
- // A = X0 << 62
- __ ushl(v22, __ T2D, v5, v28);
-
- // A = X0 << 57
- __ ushl(v23, __ T2D, v5, v29);
-
- // D = X1^A^B^C
- __ eor(v21, __ T16B, v21, v22);
- __ eor(v21, __ T16B, v21, v23);
- __ eor(v21, __ T16B, v21, v24);
- __ ins(v5, __ D, v21, 1, 0);
-
- // [E1:E0] = [D:X0] >> 1
- __ ushr(v20, __ T2D, v5, -1 & 63);
- __ ushl(v18, __ T2D, v5, v27);
- __ ext(v25, __ T16B, v18, vzr, 0x08);
- __ orr(v19, __ T16B, v20, v25);
-
- __ eor(v7, __ T16B, v5, v19);
-
- // [F1:F0] = [D:X0] >> 2
- __ ushr(v20, __ T2D, v5, -2 & 63);
- __ ushl(v18, __ T2D, v5, v28);
- __ ins(v25, __ D, v18, 0, 1);
- __ orr(v19, __ T16B, v20, v25);
-
- __ eor(v7, __ T16B, v7, v19);
-
- // [G1:G0] = [D:X0] >> 7
- __ ushr(v20, __ T2D, v5, -7 & 63);
- __ ushl(v18, __ T2D, v5, v29);
- __ ins(v25, __ D, v18, 0, 1);
- __ orr(v19, __ T16B, v20, v25);
-
- // [H1:H0] = [D^E1^F1^G1:X0^E0^F0^G0]
- __ eor(v7, __ T16B, v7, v19);
-
- // Result = [H1:H0]^[X3:X2]
- __ eor(v0, __ T16B, v7, v6);
-
- __ subs(blocks, blocks, 1);
- __ cbnz(blocks, L_ghash_loop);
-
- __ ext(v1, __ T16B, v0, v0, 0x08);
+ __ ldrq(v0, Address(state));
+ __ ldrq(v1, Address(subkeyH));
+
+ __ rev64(v0, __ T16B, v0); // Bit-reverse words in state and subkeyH
+ __ rbit(v0, __ T16B, v0);
+ __ rev64(v1, __ T16B, v1);
+ __ rbit(v1, __ T16B, v1);
+
+ __ ldrq(v26, p);
+
+ __ ext(v16, __ T16B, v1, v1, 0x08); // long-swap subkeyH into v1
+ __ eor(v16, __ T16B, v16, v1); // xor subkeyH into subkeyL (Karatsuba: (A1+A0))
+
+ {
+ Label L_ghash_loop;
+ __ bind(L_ghash_loop);
+
+ __ ldrq(v2, Address(__ post(data, 0x10))); // Load the data, bit
+ // reversing each byte
+ __ rbit(v2, __ T16B, v2);
+ __ eor(v2, __ T16B, v0, v2); // bit-swapped data ^ bit-swapped state
+
+ // Multiply state in v2 by subkey in v1
+ ghash_multiply(/*result_lo*/v5, /*result_hi*/v7,
+ /*a*/v1, /*b*/v2, /*a1_xor_a0*/v16,
+ /*temps*/v6, v20, v18, v21);
+ // Reduce v7:v5 by the field polynomial
+ ghash_reduce(v0, v5, v7, v26, vzr, v20);
+
+ __ sub(blocks, blocks, 1);
+ __ cbnz(blocks, L_ghash_loop);
+ }
+
+ // The bit-reversed result is at this point in v0
+ __ rev64(v1, __ T16B, v0);
+ __ rbit(v1, __ T16B, v1);
+
__ st1(v1, __ T16B, state);
__ ret(lr);
--- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -186,7 +186,7 @@
}
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
if (val == noreg) {
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -177,6 +177,12 @@
if (UseCRC32 && (auxv & HWCAP_CRC32) == 0) {
warning("UseCRC32 specified, but not supported on this CPU");
}
+
+ if (UseAdler32Intrinsics) {
+ warning("Adler32Intrinsics not available on this CPU.");
+ FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
+ }
+
if (auxv & HWCAP_AES) {
UseAES = UseAES || FLAG_IS_DEFAULT(UseAES);
UseAESIntrinsics =
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -2614,7 +2614,7 @@
void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) {
CardTableModRefBS* bs =
barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
- assert(bs->kind() == BarrierSet::CardTableModRef ||
+ assert(bs->kind() == BarrierSet::CardTableForRS ||
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
#ifdef ASSERT
cmpdi(CCR0, Rnew_val, 0);
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -656,7 +656,7 @@
__ bind(filtered);
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -697,7 +697,7 @@
}
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
Label Lskip_loop, Lstore_loop;
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -105,7 +105,7 @@
}
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
Label Lnull, Ldone;
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -200,6 +200,11 @@
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
}
+ if (UseAdler32Intrinsics) {
+ warning("Adler32Intrinsics not available on this CPU.");
+ FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
+ }
+
if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
UseMultiplyToLenIntrinsic = true;
}
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -3958,7 +3958,7 @@
if (new_val == G0) return;
CardTableModRefBS* bs =
barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
- assert(bs->kind() == BarrierSet::CardTableModRef ||
+ assert(bs->kind() == BarrierSet::CardTableForRS ||
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
card_table_write(bs->byte_map_base, tmp, store_addr);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/cpu/sparc/vm/memset_with_concurrent_readers_sparc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+
+#include "gc/shared/memset_with_concurrent_readers.hpp"
+#include "runtime/prefetch.inline.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+
+#if INCLUDE_ALL_GCS
+
+// An implementation of memset, for use when there may be concurrent
+// readers of the region being stored into.
+//
+// We can't use the standard library memset if it is implemented using
+// block initializing stores. Doing so can result in concurrent readers
+// seeing spurious zeros.
+//
+// We can't use the obvious C/C++ for-loop, because the compiler may
+// recognize the idiomatic loop and optimize it into a call to the
+// standard library memset; we've seen exactly this happen with, for
+// example, Solaris Studio 12.3. Hence the use of inline assembly
+// code, hiding loops from the compiler's optimizer.
+//
+// We don't attempt to use the standard library memset when it is safe
+// to do so. We could conservatively do so by detecting the presence
+// of block initializing stores (VM_Version::has_blk_init()), but the
+// implementation provided here should be sufficient.
+
+inline void fill_subword(void* start, void* end, int value) {
+ STATIC_ASSERT(BytesPerWord == 8);
+ assert(pointer_delta(end, start, 1) < BytesPerWord, "precondition");
+ // Dispatch on (end - start).
+ void* pc;
+ __asm__ volatile(
+ // offset := (7 - (end - start)) + 3
+ // 3 instructions from rdpc to DISPATCH
+ " sub %[offset], %[end], %[offset]\n\t" // offset := start - end
+ " sllx %[offset], 2, %[offset]\n\t" // scale offset for instruction size of 4
+ " add %[offset], 40, %[offset]\n\t" // offset += 10 * instruction size
+ " rd %pc, %[pc]\n\t" // dispatch on scaled offset
+ " jmpl %[pc]+%[offset], %g0\n\t"
+ " nop\n\t"
+ // DISPATCH: no direct reference, but without it the store block may be elided.
+ "1:\n\t"
+ " stb %[value], [%[end]-7]\n\t" // end[-7] = value
+ " stb %[value], [%[end]-6]\n\t"
+ " stb %[value], [%[end]-5]\n\t"
+ " stb %[value], [%[end]-4]\n\t"
+ " stb %[value], [%[end]-3]\n\t"
+ " stb %[value], [%[end]-2]\n\t"
+ " stb %[value], [%[end]-1]\n\t" // end[-1] = value
+ : /* no outputs */
+ [pc] "&=r" (pc) // temp
+ : [offset] "&+r" (start),
+ [end] "r" (end),
+ [value] "r" (value)
+ : "memory");
+}
+
+void memset_with_concurrent_readers(void* to, int value, size_t size) {
+ Prefetch::write(to, 0);
+ void* end = static_cast<char*>(to) + size;
+ if (size >= BytesPerWord) {
+ // Fill any partial word prefix.
+ uintx* aligned_to = static_cast<uintx*>(align_ptr_up(to, BytesPerWord));
+ fill_subword(to, aligned_to, value);
+
+ // Compute fill word.
+ STATIC_ASSERT(BitsPerByte == 8);
+ STATIC_ASSERT(BitsPerWord == 64);
+ uintx xvalue = value & 0xff;
+ xvalue |= (xvalue << 8);
+ xvalue |= (xvalue << 16);
+ xvalue |= (xvalue << 32);
+
+ uintx* aligned_end = static_cast<uintx*>(align_ptr_down(end, BytesPerWord));
+ assert(aligned_to <= aligned_end, "invariant");
+
+ // for ( ; aligned_to < aligned_end; ++aligned_to) {
+ // *aligned_to = xvalue;
+ // }
+ uintptr_t temp;
+ __asm__ volatile(
+ // Unroll loop x8.
+ " sub %[aend], %[ato], %[temp]\n\t"
+ " cmp %[temp], 56\n\t" // cc := (aligned_end - aligned_to) > 7 words
+ " ba %xcc, 2f\n\t" // goto TEST always
+ " sub %[aend], 56, %[temp]\n\t" // limit := aligned_end - 7 words
+ // LOOP:
+ "1:\n\t" // unrolled x8 store loop top
+ " cmp %[temp], %[ato]\n\t" // cc := limit > (next) aligned_to
+ " stx %[xvalue], [%[ato]-64]\n\t" // store 8 words, aligned_to pre-incremented
+ " stx %[xvalue], [%[ato]-56]\n\t"
+ " stx %[xvalue], [%[ato]-48]\n\t"
+ " stx %[xvalue], [%[ato]-40]\n\t"
+ " stx %[xvalue], [%[ato]-32]\n\t"
+ " stx %[xvalue], [%[ato]-24]\n\t"
+ " stx %[xvalue], [%[ato]-16]\n\t"
+ " stx %[xvalue], [%[ato]-8]\n\t"
+ // TEST:
+ "2:\n\t"
+ " bgu,a %xcc, 1b\n\t" // goto LOOP if more than 7 words remaining
+ " add %[ato], 64, %[ato]\n\t" // aligned_to += 8, for next iteration
+ // Fill remaining < 8 full words.
+ // Dispatch on (aligned_end - aligned_to).
+ // offset := (7 - (aligned_end - aligned_to)) + 3
+ // 3 instructions from rdpc to DISPATCH
+ " sub %[ato], %[aend], %[ato]\n\t" // offset := aligned_to - aligned_end
+ " srax %[ato], 1, %[ato]\n\t" // scale offset for instruction size of 4
+ " add %[ato], 40, %[ato]\n\t" // offset += 10 * instruction size
+ " rd %pc, %[temp]\n\t" // dispatch on scaled offset
+ " jmpl %[temp]+%[ato], %g0\n\t"
+ " nop\n\t"
+ // DISPATCH: no direct reference, but without it the store block may be elided.
+ "3:\n\t"
+ " stx %[xvalue], [%[aend]-56]\n\t" // aligned_end[-7] = xvalue
+ " stx %[xvalue], [%[aend]-48]\n\t"
+ " stx %[xvalue], [%[aend]-40]\n\t"
+ " stx %[xvalue], [%[aend]-32]\n\t"
+ " stx %[xvalue], [%[aend]-24]\n\t"
+ " stx %[xvalue], [%[aend]-16]\n\t"
+ " stx %[xvalue], [%[aend]-8]\n\t" // aligned_end[-1] = xvalue
+ : /* no outputs */
+ [temp] "&=r" (temp)
+ : [ato] "&+r" (aligned_to),
+ [aend] "r" (aligned_end),
+ [xvalue] "r" (xvalue)
+ : "cc", "memory");
+ to = aligned_end; // setup for suffix
+ }
+ // Fill any partial word suffix. Also the prefix if size < BytesPerWord.
+ fill_subword(to, end, value);
+}
+
+#endif // INCLUDE_ALL_GCS
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -981,7 +981,7 @@
__ restore();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -1014,7 +1014,7 @@
__ restore();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
@@ -5110,6 +5110,188 @@
return start;
}
+#define ADLER32_NUM_TEMPS 16
+
+ /**
+ * Arguments:
+ *
+ * Inputs:
+ * O0 - int adler
+ * O1 - byte* buff
+ * O2 - int len
+ *
+ * Output:
+ * O0 - int adler result
+ */
+ address generate_updateBytesAdler32() {
+ __ align(CodeEntryAlignment);
+ StubCodeMark mark(this, "StubRoutines", "updateBytesAdler32");
+ address start = __ pc();
+
+ Label L_cleanup_loop, L_cleanup_loop_check;
+ Label L_main_loop_check, L_main_loop, L_inner_loop, L_inner_loop_check;
+ Label L_nmax_check_done;
+
+ // Aliases
+ Register s1 = O0;
+ Register s2 = O3;
+ Register buff = O1;
+ Register len = O2;
+ Register temp[ADLER32_NUM_TEMPS] = {L0, L1, L2, L3, L4, L5, L6, L7, I0, I1, I2, I3, I4, I5, G3, I7};
+
+ // Max number of bytes we can process before having to take the mod
+ // 0x15B0 is 5552 in decimal, the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
+ unsigned long NMAX = 0x15B0;
+
+ // Zero-out the upper bits of len
+ __ clruwu(len);
+
+ // Create the mask 0xFFFF
+ __ set64(0x00FFFF, O4, O5); // O5 is the temp register
+
+ // s1 is initialized to the lower 16 bits of adler
+ // s2 is initialized to the upper 16 bits of adler
+ __ srlx(O0, 16, O5); // adler >> 16
+ __ and3(O0, O4, s1); // s1 = (adler & 0xFFFF)
+ __ and3(O5, O4, s2); // s2 = ((adler >> 16) & 0xFFFF)
+
+ // The pipelined loop needs at least 16 elements for 1 iteration
+ // It does check this, but it is more effective to skip to the cleanup loop
+ // Setup the constant for cutoff checking
+ __ mov(15, O4);
+
+ // Check if we are above the cutoff, if not go to the cleanup loop immediately
+ __ cmp_and_br_short(len, O4, Assembler::lessEqualUnsigned, Assembler::pt, L_cleanup_loop_check);
+
+ // Free up some registers for our use
+ for (int i = 0; i < ADLER32_NUM_TEMPS; i++) {
+ __ movxtod(temp[i], as_FloatRegister(2*i));
+ }
+
+ // Loop maintenance stuff is done at the end of the loop, so skip to there
+ __ ba_short(L_main_loop_check);
+
+ __ BIND(L_main_loop);
+
+ // Prologue for inner loop
+ __ ldub(buff, 0, L0);
+ __ dec(O5);
+
+ for (int i = 1; i < 8; i++) {
+ __ ldub(buff, i, temp[i]);
+ }
+
+ __ inc(buff, 8);
+
+ // Inner loop processes 16 elements at a time, might never execute if only 16 elements
+ // to be processed by the outter loop
+ __ ba_short(L_inner_loop_check);
+
+ __ BIND(L_inner_loop);
+
+ for (int i = 0; i < 8; i++) {
+ __ ldub(buff, (2*i), temp[(8+(2*i)) % ADLER32_NUM_TEMPS]);
+ __ add(s1, temp[i], s1);
+ __ ldub(buff, (2*i)+1, temp[(8+(2*i)+1) % ADLER32_NUM_TEMPS]);
+ __ add(s2, s1, s2);
+ }
+
+ // Original temp 0-7 used and new loads to temp 0-7 issued
+ // temp 8-15 ready to be consumed
+ __ add(s1, I0, s1);
+ __ dec(O5);
+ __ add(s2, s1, s2);
+ __ add(s1, I1, s1);
+ __ inc(buff, 16);
+ __ add(s2, s1, s2);
+
+ for (int i = 0; i < 6; i++) {
+ __ add(s1, temp[10+i], s1);
+ __ add(s2, s1, s2);
+ }
+
+ __ BIND(L_inner_loop_check);
+ __ nop();
+ __ cmp_and_br_short(O5, 0, Assembler::notEqual, Assembler::pt, L_inner_loop);
+
+ // Epilogue
+ for (int i = 0; i < 4; i++) {
+ __ ldub(buff, (2*i), temp[8+(2*i)]);
+ __ add(s1, temp[i], s1);
+ __ ldub(buff, (2*i)+1, temp[8+(2*i)+1]);
+ __ add(s2, s1, s2);
+ }
+
+ __ add(s1, temp[4], s1);
+ __ inc(buff, 8);
+
+ for (int i = 0; i < 11; i++) {
+ __ add(s2, s1, s2);
+ __ add(s1, temp[5+i], s1);
+ }
+
+ __ add(s2, s1, s2);
+
+ // Take the mod for s1 and s2
+ __ set64(0xFFF1, L0, L1);
+ __ udivx(s1, L0, L1);
+ __ udivx(s2, L0, L2);
+ __ mulx(L0, L1, L1);
+ __ mulx(L0, L2, L2);
+ __ sub(s1, L1, s1);
+ __ sub(s2, L2, s2);
+
+ // Make sure there is something left to process
+ __ BIND(L_main_loop_check);
+ __ set64(NMAX, L0, L1);
+ // k = len < NMAX ? len : NMAX
+ __ cmp_and_br_short(len, L0, Assembler::greaterEqualUnsigned, Assembler::pt, L_nmax_check_done);
+ __ andn(len, 0x0F, L0); // only loop a multiple of 16 times
+ __ BIND(L_nmax_check_done);
+ __ mov(L0, O5);
+ __ sub(len, L0, len); // len -= k
+
+ __ srlx(O5, 4, O5); // multiplies of 16
+ __ cmp_and_br_short(O5, 0, Assembler::notEqual, Assembler::pt, L_main_loop);
+
+ // Restore anything we used, take the mod one last time, combine and return
+ // Restore any registers we saved
+ for (int i = 0; i < ADLER32_NUM_TEMPS; i++) {
+ __ movdtox(as_FloatRegister(2*i), temp[i]);
+ }
+
+ // There might be nothing left to process
+ __ ba_short(L_cleanup_loop_check);
+
+ __ BIND(L_cleanup_loop);
+ __ ldub(buff, 0, O4); // load single byte form buffer
+ __ inc(buff); // buff++
+ __ add(s1, O4, s1); // s1 += *buff++;
+ __ dec(len); // len--
+ __ add(s1, s2, s2); // s2 += s1;
+ __ BIND(L_cleanup_loop_check);
+ __ nop();
+ __ cmp_and_br_short(len, 0, Assembler::notEqual, Assembler::pt, L_cleanup_loop);
+
+ // Take the mod one last time
+ __ set64(0xFFF1, O1, O2);
+ __ udivx(s1, O1, O2);
+ __ udivx(s2, O1, O5);
+ __ mulx(O1, O2, O2);
+ __ mulx(O1, O5, O5);
+ __ sub(s1, O2, s1);
+ __ sub(s2, O5, s2);
+
+ // Combine lower bits and higher bits
+ __ sllx(s2, 16, s2); // s2 = s2 << 16
+ __ or3(s1, s2, s1); // adler = s2 | s1
+ // Final return value is in O0
+ __ retl();
+ __ delayed()->nop();
+
+ return start;
+ }
+
void generate_initial() {
// Generates all stubs and initializes the entry points
@@ -5206,6 +5388,11 @@
if (UseCRC32CIntrinsics) {
StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C();
}
+
+ // generate Adler32 intrinsics code
+ if (UseAdler32Intrinsics) {
+ StubRoutines::_updateBytesAdler32 = generate_updateBytesAdler32();
+ }
}
--- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -41,7 +41,7 @@
enum /* platform_dependent_constants */ {
// %%%%%%%% May be able to shrink this a lot
code_size1 = 20000, // simply increase if too small (assembler will crash if too small)
- code_size2 = 24000 // simply increase if too small (assembler will crash if too small)
+ code_size2 = 27000 // simply increase if too small (assembler will crash if too small)
};
class Sparc {
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -91,7 +91,7 @@
}
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
if (index == noreg ) {
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -85,27 +85,6 @@
_supports_cx8 = has_v9();
_supports_atomic_getset4 = true; // swap instruction
- // There are Fujitsu Sparc64 CPUs which support blk_init as well so
- // we have to take this check out of the 'is_niagara()' block below.
- if (has_blk_init()) {
- // When using CMS or G1, we cannot use memset() in BOT updates
- // because the sun4v/CMT version in libc_psr uses BIS which
- // exposes "phantom zeros" to concurrent readers. See 6948537.
- if (FLAG_IS_DEFAULT(UseMemSetInBOT) && (UseConcMarkSweepGC || UseG1GC)) {
- FLAG_SET_DEFAULT(UseMemSetInBOT, false);
- }
- // Issue a stern warning if the user has explicitly set
- // UseMemSetInBOT (it is known to cause issues), but allow
- // use for experimentation and debugging.
- if (UseConcMarkSweepGC || UseG1GC) {
- if (UseMemSetInBOT) {
- assert(!FLAG_IS_DEFAULT(UseMemSetInBOT), "Error");
- warning("Experimental flag -XX:+UseMemSetInBOT is known to cause instability"
- " on sun4v; please understand that you are using at your own risk!");
- }
- }
- }
-
if (is_niagara()) {
// Indirect branch is the same cost as direct
if (FLAG_IS_DEFAULT(UseInlineCaches)) {
@@ -377,6 +356,15 @@
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
}
+ if (UseVIS > 2) {
+ if (FLAG_IS_DEFAULT(UseAdler32Intrinsics)) {
+ FLAG_SET_DEFAULT(UseAdler32Intrinsics, true);
+ }
+ } else if (UseAdler32Intrinsics) {
+ warning("SPARC Adler32 intrinsics require VIS3 instruction support. Intrinsics will be disabled.");
+ FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
+ }
+
if (FLAG_IS_DEFAULT(ContendedPaddingWidth) &&
(cache_line_size > ContendedPaddingWidth))
ContendedPaddingWidth = cache_line_size;
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -4320,7 +4320,9 @@
// register obj is destroyed afterwards.
BarrierSet* bs = Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
+ assert(bs->kind() == BarrierSet::CardTableForRS ||
+ bs->kind() == BarrierSet::CardTableExtension,
+ "Wrong barrier set kind");
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -722,7 +722,7 @@
__ popa();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -754,7 +754,7 @@
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -367,16 +367,20 @@
#ifdef ASSERT
// verify that threads correspond
{
- Label L, S;
+ Label L1, L2, L3;
__ cmpptr(r15_thread, thread);
- __ jcc(Assembler::notEqual, S);
+ __ jcc(Assembler::equal, L1);
+ __ stop("StubRoutines::call_stub: r15_thread is corrupted");
+ __ bind(L1);
__ get_thread(rbx);
+ __ cmpptr(r15_thread, thread);
+ __ jcc(Assembler::equal, L2);
+ __ stop("StubRoutines::call_stub: r15_thread is modified by call");
+ __ bind(L2);
__ cmpptr(r15_thread, rbx);
- __ jcc(Assembler::equal, L);
- __ bind(S);
- __ jcc(Assembler::equal, L);
+ __ jcc(Assembler::equal, L3);
__ stop("StubRoutines::call_stub: threads must correspond");
- __ bind(L);
+ __ bind(L3);
}
#endif
@@ -450,15 +454,20 @@
#ifdef ASSERT
// verify that threads correspond
{
- Label L, S;
+ Label L1, L2, L3;
__ cmpptr(r15_thread, thread);
- __ jcc(Assembler::notEqual, S);
+ __ jcc(Assembler::equal, L1);
+ __ stop("StubRoutines::catch_exception: r15_thread is corrupted");
+ __ bind(L1);
__ get_thread(rbx);
+ __ cmpptr(r15_thread, thread);
+ __ jcc(Assembler::equal, L2);
+ __ stop("StubRoutines::catch_exception: r15_thread is modified by call");
+ __ bind(L2);
__ cmpptr(r15_thread, rbx);
- __ jcc(Assembler::equal, L);
- __ bind(S);
+ __ jcc(Assembler::equal, L3);
__ stop("StubRoutines::catch_exception: threads must correspond");
- __ bind(L);
+ __ bind(L3);
}
#endif
@@ -1244,7 +1253,7 @@
__ popa();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -1284,7 +1293,7 @@
__ popa();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
--- a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -200,7 +200,7 @@
}
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
if (val == noreg) {
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -714,6 +714,11 @@
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
}
+ if (UseAdler32Intrinsics) {
+ warning("Adler32Intrinsics not available on this CPU.");
+ FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
+ }
+
// Adjust RTM (Restricted Transactional Memory) flags
if (!supports_rtm() && UseRTMLocking) {
// Can't continue because UseRTMLocking affects UseBiasedLocking flag
--- a/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2015, 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,6 +53,10 @@
return cpuinfo_field_contains("cpu", "Niagara");
}
+static bool detect_M_family() {
+ return cpuinfo_field_contains("cpu", "SPARC-M");
+}
+
static bool detect_blkinit() {
return cpuinfo_field_contains("cpucaps", "blkinit");
}
@@ -66,6 +70,11 @@
features = niagara1_m | T_family_m;
}
+ if (detect_M_family()) {
+ NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Detected Linux on M family");)
+ features = sun4v_m | generic_v9_m | M_family_m | T_family_m;
+ }
+
if (detect_blkinit()) {
features |= blk_init_instructions_m;
}
--- a/hotspot/src/share/vm/adlc/Doc/Syntax.doc Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/adlc/Doc/Syntax.doc Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2015, 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
@@ -33,7 +33,7 @@
the architecture of a processor, and is the input to the ADL Compiler. The
ADL Compiler compiles an ADL file into code which is incorporated into the
Optimizing Just In Time Compiler (OJIT) to generate efficient and correct code
-for the target architecture. The ADL describes three bassic different types
+for the target architecture. The ADL describes three basic different types
of architectural features. It describes the instruction set (and associated
operands) of the target architecture. It describes the register set of the
target architecture along with relevant information for the register allocator.
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -32,7 +32,6 @@
#include "c1/c1_Runtime1.hpp"
#include "c1/c1_ValueType.hpp"
#include "compiler/compileBroker.hpp"
-#include "compiler/compilerOracle.hpp"
#include "interpreter/linkResolver.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -4212,7 +4212,7 @@
if (!PrintInlining && !compilation()->method()->has_option("PrintInlining")) {
return;
}
- CompileTask::print_inlining(callee, scope()->level(), bci(), msg);
+ CompileTask::print_inlining_tty(callee, scope()->level(), bci(), msg);
if (success && CIPrintMethodCodes) {
callee->print_codes();
}
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1425,7 +1425,7 @@
G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info);
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
// No pre barriers
break;
@@ -1445,7 +1445,7 @@
G1SATBCardTableModRef_post_barrier(addr, new_val);
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
CardTableModRef_post_barrier(addr, new_val);
break;
--- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1447,7 +1447,6 @@
if (methodData() == NULL)
return;
- bool printit = _method->should_print_assembly();
if (methodData()->has_escape_info()) {
TRACE_BCEA(2, tty->print_cr("[EA] Reading previous results for %s.%s",
method->holder()->name()->as_utf8(),
--- a/hotspot/src/share/vm/classfile/classLoader.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -28,8 +28,8 @@
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoaderExt.hpp"
-#include "classfile/imageFile.hpp"
#include "classfile/javaClasses.hpp"
+#include "classfile/jimage.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "compiler/compileBroker.hpp"
@@ -58,6 +58,7 @@
#include "runtime/os.hpp"
#include "runtime/threadCritical.hpp"
#include "runtime/timer.hpp"
+#include "runtime/vm_version.hpp"
#include "services/management.hpp"
#include "services/threadService.hpp"
#include "utilities/events.hpp"
@@ -68,7 +69,7 @@
#include "classfile/sharedPathsMiscInfo.hpp"
#endif
-// Entry points in zip.dll for loading zip/jar file entries and image file entries
+// Entry points in zip.dll for loading zip/jar file entries
typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
typedef void (JNICALL *ZipClose_t)(jzfile *zip);
@@ -89,6 +90,15 @@
static ZipInflateFully_t ZipInflateFully = NULL;
static Crc32_t Crc32 = NULL;
+// Entry points for jimage.dll for loading jimage file entries
+
+static JImageOpen_t JImageOpen = NULL;
+static JImageClose_t JImageClose = NULL;
+static JImagePackageToModule_t JImagePackageToModule = NULL;
+static JImageFindResource_t JImageFindResource = NULL;
+static JImageGetResource_t JImageGetResource = NULL;
+static JImageResourceIterator_t JImageResourceIterator = NULL;
+
// Globals
PerfCounter* ClassLoader::_perf_accumulated_time = NULL;
@@ -141,6 +151,15 @@
return (strncmp(str, str_to_find, str_to_find_len) == 0);
}
+static const char* get_jimage_version_string() {
+ static char version_string[10] = "";
+ if (version_string[0] == '\0') {
+ jio_snprintf(version_string, sizeof(version_string), "%d.%d",
+ Abstract_VM_Version::vm_minor_version(), Abstract_VM_Version::vm_micro_version());
+ }
+ return (const char*)version_string;
+}
+
bool string_ends_with(const char* str, const char* str_to_find) {
size_t str_len = strlen(str);
size_t str_to_find_len = strlen(str_to_find);
@@ -272,98 +291,114 @@
}
}
-ClassPathImageEntry::ClassPathImageEntry(ImageFileReader* image) :
+ClassPathImageEntry::ClassPathImageEntry(JImageFile* jimage, const char* name) :
ClassPathEntry(),
- _image(image),
- _module_data(NULL) {
- guarantee(image != NULL, "image file is null");
-
- char module_data_name[JVM_MAXPATHLEN];
- ImageModuleData::module_data_name(module_data_name, _image->name());
- _module_data = new ImageModuleData(_image, module_data_name);
+ _jimage(jimage) {
+ guarantee(jimage != NULL, "jimage file is null");
+ guarantee(name != NULL, "jimage file name is null");
+ size_t len = strlen(name) + 1;
+ _name = NEW_C_HEAP_ARRAY(const char, len, mtClass);
+ strncpy((char *)_name, name, len);
}
ClassPathImageEntry::~ClassPathImageEntry() {
- if (_module_data != NULL) {
- delete _module_data;
- _module_data = NULL;
+ if (_name != NULL) {
+ FREE_C_HEAP_ARRAY(const char, _name);
+ _name = NULL;
}
-
- if (_image != NULL) {
- ImageFileReader::close(_image);
- _image = NULL;
+ if (_jimage != NULL) {
+ (*JImageClose)(_jimage);
+ _jimage = NULL;
}
}
-const char* ClassPathImageEntry::name() {
- return _image ? _image->name() : "";
+void ClassPathImageEntry::name_to_package(const char* name, char* buffer, int length) {
+ const char *pslash = strrchr(name, '/');
+ if (pslash == NULL) {
+ buffer[0] = '\0';
+ return;
+ }
+ int len = pslash - name;
+#if INCLUDE_CDS
+ if (len <= 0 && DumpSharedSpaces) {
+ buffer[0] = '\0';
+ return;
+ }
+#endif
+ assert(len > 0, "Bad length for package name");
+ if (len >= length) {
+ buffer[0] = '\0';
+ return;
+ }
+ // drop name after last slash (including slash)
+ // Ex., "java/lang/String.class" => "java/lang"
+ strncpy(buffer, name, len);
+ // ensure string termination (strncpy does not guarantee)
+ buffer[len] = '\0';
}
+// For a class in a named module, look it up in the jimage file using this syntax:
+// /<module-name>/<package-name>/<base-class>
+//
+// Assumptions:
+// 1. There are no unnamed modules in the jimage file.
+// 2. A package is in at most one module in the jimage file.
+//
ClassFileStream* ClassPathImageEntry::open_stream(const char* name, TRAPS) {
- ImageLocation location;
- bool found = _image->find_location(name, location);
-
- if (!found) {
- const char *pslash = strrchr(name, '/');
- int len = pslash - name;
+ jlong size;
+ JImageLocationRef location = (*JImageFindResource)(_jimage, "", get_jimage_version_string(), name, &size);
- // NOTE: IMAGE_MAX_PATH is used here since this path is internal to the jimage
- // (effectively unlimited.) There are several JCK tests that use paths over
- // 1024 characters long, the limit on Windows systems.
- if (pslash && 0 < len && len < IMAGE_MAX_PATH) {
-
- char path[IMAGE_MAX_PATH];
- strncpy(path, name, len);
- path[len] = '\0';
- const char* moduleName = _module_data->package_to_module(path);
-
- if (moduleName != NULL && (len + strlen(moduleName) + 2) < IMAGE_MAX_PATH) {
- jio_snprintf(path, IMAGE_MAX_PATH - 1, "/%s/%s", moduleName, name);
- location.clear_data();
- found = _image->find_location(path, location);
- }
+ if (location == 0) {
+ char package[JIMAGE_MAX_PATH];
+ name_to_package(name, package, JIMAGE_MAX_PATH);
+ if (package[0] != '\0') {
+ const char* module = (*JImagePackageToModule)(_jimage, package);
+ if (module == NULL) {
+ module = "java.base";
+ }
+ location = (*JImageFindResource)(_jimage, module, get_jimage_version_string(), name, &size);
}
}
- if (found) {
- u8 size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ if (location != 0) {
if (UsePerfData) {
ClassLoader::perf_sys_classfile_bytes_read()->inc(size);
}
- u1* data = NEW_RESOURCE_ARRAY(u1, size);
- _image->get_resource(location, data);
- return new ClassFileStream(data, (int)size, _image->name()); // Resource allocated
+ char* data = NEW_RESOURCE_ARRAY(char, size);
+ (*JImageGetResource)(_jimage, location, data, size);
+ return new ClassFileStream((u1*)data, (int)size, _name); // Resource allocated
}
return NULL;
}
#ifndef PRODUCT
+bool ctw_visitor(JImageFile* jimage,
+ const char* module_name, const char* version, const char* package,
+ const char* name, const char* extension, void* arg) {
+ if (strcmp(extension, "class") == 0) {
+ Thread* THREAD = Thread::current();
+ char path[JIMAGE_MAX_PATH];
+ jio_snprintf(path, JIMAGE_MAX_PATH - 1, "%s/%s.class", package, name);
+ ClassLoader::compile_the_world_in(path, *(Handle*)arg, THREAD);
+ return !HAS_PENDING_EXCEPTION;
+ }
+ return true;
+}
+
void ClassPathImageEntry::compile_the_world(Handle loader, TRAPS) {
tty->print_cr("CompileTheWorld : Compiling all classes in %s", name());
tty->cr();
- const ImageStrings strings = _image->get_strings();
- // Retrieve each path component string.
- u4 length = _image->table_length();
- for (u4 i = 0; i < length; i++) {
- u1* location_data = _image->get_location_data(i);
-
- if (location_data != NULL) {
- ImageLocation location(location_data);
- char path[IMAGE_MAX_PATH];
- _image->location_path(location, path, IMAGE_MAX_PATH);
- ClassLoader::compile_the_world_in(path, loader, CHECK);
+ (*JImageResourceIterator)(_jimage, (JImageResourceVisitor_t)ctw_visitor, (void *)&loader);
+ if (HAS_PENDING_EXCEPTION) {
+ if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
+ CLEAR_PENDING_EXCEPTION;
+ tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
+ tty->print_cr("Increase class metadata storage if a limit was set");
+ } else {
+ tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
}
}
- if (HAS_PENDING_EXCEPTION) {
- if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
- CLEAR_PENDING_EXCEPTION;
- tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
- tty->print_cr("Increase class metadata storage if a limit was set");
- } else {
- tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
- }
- }
}
bool ClassPathImageEntry::is_jrt() {
@@ -490,7 +525,7 @@
JavaThread* thread = JavaThread::current();
ClassPathEntry* new_entry = NULL;
if ((st->st_mode & S_IFREG) == S_IFREG) {
- // Regular file, should be a zip or image file
+ // Regular file, should be a zip or jimage file
// Canonicalized filename
char canonical_path[JVM_MAXPATHLEN];
if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
@@ -501,9 +536,10 @@
return NULL;
}
}
- ImageFileReader* image = ImageFileReader::open(canonical_path);
- if (image != NULL) {
- new_entry = new ClassPathImageEntry(image);
+ jint error;
+ JImageFile* jimage =(*JImageOpen)(canonical_path, &error);
+ if (jimage != NULL) {
+ new_entry = new ClassPathImageEntry(jimage, canonical_path);
} else {
char* error_msg = NULL;
jzfile* zip;
@@ -682,6 +718,35 @@
// This lookup only works on 1.3. Do not check for non-null here
}
+void ClassLoader::load_jimage_library() {
+ // First make sure native library is loaded
+ os::native_java_library();
+ // Load jimage library
+ char path[JVM_MAXPATHLEN];
+ char ebuf[1024];
+ void* handle = NULL;
+ if (os::dll_build_name(path, sizeof(path), Arguments::get_dll_dir(), "jimage")) {
+ handle = os::dll_load(path, ebuf, sizeof ebuf);
+ }
+ if (handle == NULL) {
+ vm_exit_during_initialization("Unable to load jimage library", path);
+ }
+
+ // Lookup jimage entry points
+ JImageOpen = CAST_TO_FN_PTR(JImageOpen_t, os::dll_lookup(handle, "JIMAGE_Open"));
+ guarantee(JImageOpen != NULL, "function JIMAGE_Open not found");
+ JImageClose = CAST_TO_FN_PTR(JImageClose_t, os::dll_lookup(handle, "JIMAGE_Close"));
+ guarantee(JImageClose != NULL, "function JIMAGE_Close not found");
+ JImagePackageToModule = CAST_TO_FN_PTR(JImagePackageToModule_t, os::dll_lookup(handle, "JIMAGE_PackageToModule"));
+ guarantee(JImagePackageToModule != NULL, "function JIMAGE_PackageToModule not found");
+ JImageFindResource = CAST_TO_FN_PTR(JImageFindResource_t, os::dll_lookup(handle, "JIMAGE_FindResource"));
+ guarantee(JImageFindResource != NULL, "function JIMAGE_FindResource not found");
+ JImageGetResource = CAST_TO_FN_PTR(JImageGetResource_t, os::dll_lookup(handle, "JIMAGE_GetResource"));
+ guarantee(JImageGetResource != NULL, "function JIMAGE_GetResource not found");
+ JImageResourceIterator = CAST_TO_FN_PTR(JImageResourceIterator_t, os::dll_lookup(handle, "JIMAGE_ResourceIterator"));
+ guarantee(JImageResourceIterator != NULL, "function JIMAGE_ResourceIterator not found");
+}
+
jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
}
@@ -1086,6 +1151,8 @@
// lookup zip library entry points
load_zip_library();
+ // lookup jimage library entry points
+ load_jimage_library();
#if INCLUDE_CDS
// initialize search path
if (DumpSharedSpaces) {
--- a/hotspot/src/share/vm/classfile/classLoader.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -37,8 +37,7 @@
// Class path entry (directory or zip file)
-class ImageFileReader;
-class ImageModuleData;
+class JImageFile;
class ClassPathEntry: public CHeapObj<mtClass> {
private:
@@ -52,7 +51,7 @@
}
virtual bool is_jar_file() = 0;
virtual const char* name() = 0;
- virtual ImageFileReader* image() = 0;
+ virtual JImageFile* jimage() = 0;
// Constructor
ClassPathEntry();
// Attempt to locate file_name through this class path entry.
@@ -70,7 +69,7 @@
public:
bool is_jar_file() { return false; }
const char* name() { return _dir; }
- ImageFileReader* image() { return NULL; }
+ JImageFile* jimage() { return NULL; }
ClassPathDirEntry(const char* dir);
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
@@ -100,7 +99,7 @@
public:
bool is_jar_file() { return true; }
const char* name() { return _zip_name; }
- ImageFileReader* image() { return NULL; }
+ JImageFile* jimage() { return NULL; }
ClassPathZipEntry(jzfile* zip, const char* zip_name);
~ClassPathZipEntry();
u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
@@ -115,16 +114,16 @@
// For java image files
class ClassPathImageEntry: public ClassPathEntry {
private:
- ImageFileReader* _image;
- ImageModuleData* _module_data;
+ JImageFile* _jimage;
+ const char* _name;
public:
bool is_jar_file() { return false; }
- bool is_open() { return _image != NULL; }
- const char* name();
- ImageFileReader* image() { return _image; }
- ImageModuleData* module_data() { return _module_data; }
- ClassPathImageEntry(ImageFileReader* image);
+ bool is_open() { return _jimage != NULL; }
+ const char* name() { return _name == NULL ? "" : _name; }
+ JImageFile* jimage() { return _jimage; }
+ ClassPathImageEntry(JImageFile* jimage, const char* name);
~ClassPathImageEntry();
+ static void name_to_package(const char* name, char* buffer, int length);
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
@@ -206,6 +205,7 @@
static void setup_search_path(const char *class_path);
static void load_zip_library();
+ static void load_jimage_library();
static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
bool throw_exception, TRAPS);
--- a/hotspot/src/share/vm/classfile/imageDecompressor.cpp Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "runtime/thread.inline.hpp"
-#include "classfile/imageDecompressor.hpp"
-#include "runtime/thread.hpp"
-#include "utilities/bytes.hpp"
-
-/*
- * Allocate in C Heap not in resource area, otherwise JVM crashes.
- * This array life time is the VM life time. Array is never freed and
- * is not expected to contain more than few references.
- */
-GrowableArray<ImageDecompressor*>* ImageDecompressor::_decompressors =
- new(ResourceObj::C_HEAP, mtInternal) GrowableArray<ImageDecompressor*>(2, true);
-
-static Symbol* createSymbol(const char* str) {
- Thread* THREAD = Thread::current();
- Symbol* sym = SymbolTable::lookup(str, (int) strlen(str), THREAD);
- if (HAS_PENDING_EXCEPTION) {
- warning("can't create symbol\n");
- CLEAR_PENDING_EXCEPTION;
- return NULL;
- }
- return sym;
-}
-
-/*
- * Initialize the array of decompressors.
- */
-bool image_decompressor_init() {
- Symbol* zipSymbol = createSymbol("zip");
- if (zipSymbol == NULL) {
- return false;
- }
- ImageDecompressor::add_decompressor(new ZipDecompressor(zipSymbol));
-
- return true;
-}
-
-/*
- * Decompression entry point. Called from ImageFileReader::get_resource.
- */
-void ImageDecompressor::decompress_resource(u1* compressed, u1* uncompressed,
- u4 uncompressed_size, const ImageStrings* strings, bool is_C_heap) {
- bool has_header = false;
- u1* decompressed_resource = compressed;
- u1* compressed_resource = compressed;
-
- // Resource could have been transformed by a stack of decompressors.
- // Iterate and decompress resources until there is no more header.
- do {
- ResourceHeader _header;
- memcpy(&_header, compressed_resource, sizeof (ResourceHeader));
- has_header = _header._magic == ResourceHeader::resource_header_magic;
- if (has_header) {
- // decompressed_resource array contains the result of decompression
- // when a resource content is terminal, it means that it is an actual resource,
- // not an intermediate not fully uncompressed content. In this case
- // the resource is allocated as an mtClass, otherwise as an mtOther
- decompressed_resource = is_C_heap && _header._is_terminal ?
- NEW_C_HEAP_ARRAY(u1, _header._uncompressed_size, mtClass) :
- NEW_C_HEAP_ARRAY(u1, _header._uncompressed_size, mtOther);
- // Retrieve the decompressor name
- const char* decompressor_name = strings->get(_header._decompressor_name_offset);
- if (decompressor_name == NULL) warning("image decompressor not found\n");
- guarantee(decompressor_name, "image decompressor not found");
- // Retrieve the decompressor instance
- ImageDecompressor* decompressor = get_decompressor(decompressor_name);
- if (decompressor == NULL) {
- warning("image decompressor %s not found\n", decompressor_name);
- }
- guarantee(decompressor, "image decompressor not found");
- u1* compressed_resource_base = compressed_resource;
- compressed_resource += ResourceHeader::resource_header_length;
- // Ask the decompressor to decompress the compressed content
- decompressor->decompress_resource(compressed_resource, decompressed_resource,
- &_header, strings);
- if (compressed_resource_base != compressed) {
- FREE_C_HEAP_ARRAY(char, compressed_resource_base);
- }
- compressed_resource = decompressed_resource;
- }
- } while (has_header);
- memcpy(uncompressed, decompressed_resource, uncompressed_size);
-}
-
-// Zip decompressor
-
-void ZipDecompressor::decompress_resource(u1* data, u1* uncompressed,
- ResourceHeader* header, const ImageStrings* strings) {
- char* msg = NULL;
- jboolean res = ClassLoader::decompress(data, header->_size, uncompressed,
- header->_uncompressed_size, &msg);
- if (!res) warning("decompression failed due to %s\n", msg);
- guarantee(res, "decompression failed");
-}
-
-// END Zip Decompressor
--- a/hotspot/src/share/vm/classfile/imageDecompressor.hpp Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- */
-
-#ifndef SHARE_VM_CLASSFILE_IMAGEDECOMPRESSOR_HPP
-#define SHARE_VM_CLASSFILE_IMAGEDECOMPRESSOR_HPP
-
-#include "runtime/thread.inline.hpp"
-#include "classfile/classLoader.hpp"
-#include "classfile/imageFile.hpp"
-#include "classfile/symbolTable.hpp"
-#include "oops/symbol.hpp"
-#include "utilities/growableArray.hpp"
-
-/*
- * Compressed resources located in image have an header.
- * This header contains:
- * - _magic: A magic u4, required to retrieved the header in the compressed content
- * - _size: The size of the compressed resource.
- * - _uncompressed_size: The uncompressed size of the compressed resource.
- * - _decompressor_name_offset: The ImageDecompressor instance name StringsTable offset.
- * - _decompressor_config_offset: StringsTable offset of configuration that could be needed by
- * the decompressor in order to decompress.
- * - _is_terminal: 1: the compressed content is terminal. Uncompressing it would
- * create the actual resource. 0: the compressed content is not terminal. Uncompressing it
- * will result in a compressed content to be decompressed (This occurs when a stack of compressors
- * have been used to compress the resource.
- */
-struct ResourceHeader {
- /* Length of header, needed to retrieve content offset */
- static const u1 resource_header_length = 21;
- /* magic bytes that identifies a compressed resource header*/
- static const u4 resource_header_magic = 0xCAFEFAFA;
- u4 _magic; // Resource header
- u4 _size; // Resource size
- u4 _uncompressed_size; // Expected uncompressed size
- u4 _decompressor_name_offset; // Strings table decompressor offset
- u4 _decompressor_config_offset; // Strings table config offset
- u1 _is_terminal; // Last decompressor 1, otherwise 0.
-};
-
-/*
- * Resources located in jimage file can be compressed. Compression occurs at
- * jimage file creation time. When compressed a resource is added an header that
- * contains the name of the compressor that compressed it.
- * Various compression strategies can be applied to compress a resource.
- * The same resource can even be compressed multiple time by a stack of compressors.
- * At runtime, a resource is decompressed in a loop until there is no more header
- * meaning that the resource is equivalent to the not compressed resource.
- * In each iteration, the name of the compressor located in the current header
- * is used to retrieve the associated instance of ImageDecompressor.
- * For example “zip” is the name of the compressor that compresses resources
- * using the zip algorithm. The ZipDecompressor class name is also “zip”.
- * ImageDecompressor instances are retrieved from a static array in which
- * they are registered.
- */
-class ImageDecompressor: public CHeapObj<mtClass> {
-
-private:
- const Symbol* _name;
-
- /*
- * Array of concrete decompressors. This array is used to retrieve the decompressor
- * that can handle resource decompression.
- */
- static GrowableArray<ImageDecompressor*>* _decompressors;
-
- /*
- * Identifier of a decompressor. This name is the identification key to retrieve
- * decompressor from a resource header.
- */
- inline const Symbol* get_name() const { return _name; }
-
-protected:
- ImageDecompressor(const Symbol* name) : _name(name) {
- }
- virtual void decompress_resource(u1* data, u1* uncompressed,
- ResourceHeader* header, const ImageStrings* strings) = 0;
-
-public:
- inline static void add_decompressor(ImageDecompressor* decompressor) {
- _decompressors->append(decompressor);
- }
- inline static ImageDecompressor* get_decompressor(const char * decompressor_name) {
- Thread* THREAD = Thread::current();
- TempNewSymbol sym = SymbolTable::new_symbol(decompressor_name,
- (int) strlen(decompressor_name), CHECK_NULL);
- if (HAS_PENDING_EXCEPTION) {
- warning("can't create symbol\n");
- CLEAR_PENDING_EXCEPTION;
- return NULL;
- }
- for (int i = 0; i < _decompressors->length(); i++) {
- ImageDecompressor* decompressor = _decompressors->at(i);
- if (decompressor->get_name()->fast_compare(sym) == 0) {
- return decompressor;
- }
- }
- guarantee(false, "No decompressor found.");
- return NULL;
- }
- static void decompress_resource(u1* compressed, u1* uncompressed,
- u4 uncompressed_size, const ImageStrings* strings, bool is_C_heap);
-};
-
-/**
- * Zip decompressor.
- */
-class ZipDecompressor : public ImageDecompressor {
-public:
- ZipDecompressor(const Symbol* sym) : ImageDecompressor(sym) { }
- void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
- const ImageStrings* strings);
-};
-
-#endif // SHARE_VM_CLASSFILE_IMAGEDECOMPRESSOR_HPP
--- a/hotspot/src/share/vm/classfile/imageFile.cpp Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,546 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/imageDecompressor.hpp"
-#include "classfile/imageFile.hpp"
-#include "memory/resourceArea.hpp"
-#include "runtime/mutex.hpp"
-#include "runtime/mutexLocker.hpp"
-#include "runtime/os.inline.hpp"
-#include "utilities/endian.hpp"
-#include "utilities/growableArray.hpp"
-
-// Image files are an alternate file format for storing classes and resources. The
-// goal is to supply file access which is faster and smaller than the jar format.
-//
-// (More detailed nodes in the header.)
-//
-
-// Compute the Perfect Hashing hash code for the supplied UTF-8 string.
-s4 ImageStrings::hash_code(const char* string, s4 seed) {
- // Access bytes as unsigned.
- u1* bytes = (u1*)string;
- // Compute hash code.
- for (u1 byte = *bytes++; byte; byte = *bytes++) {
- seed = (seed * HASH_MULTIPLIER) ^ byte;
- }
- // Ensure the result is not signed.
- return seed & 0x7FFFFFFF;
-}
-
-// Match up a string in a perfect hash table. Result still needs validation
-// for precise match (false positive.)
-s4 ImageStrings::find(Endian* endian, const char* name, s4* redirect, u4 length) {
- // If the table is empty, then short cut.
- if (redirect == NULL || length == 0) {
- return NOT_FOUND;
- }
- // Compute the basic perfect hash for name.
- s4 hash_code = ImageStrings::hash_code(name);
- // Modulo table size.
- s4 index = hash_code % length;
- // Get redirect entry.
- // value == 0 then not found
- // value < 0 then -1 - value is true index
- // value > 0 then value is seed for recomputing hash.
- s4 value = endian->get(redirect[index]);
- // if recompute is required.
- if (value > 0) {
- // Entry collision value, need to recompute hash.
- hash_code = ImageStrings::hash_code(name, value);
- // Modulo table size.
- return hash_code % length;
- } else if (value < 0) {
- // Compute direct index.
- return -1 - value;
- }
- // No entry found.
- return NOT_FOUND;
-}
-
-// Test to see if UTF-8 string begins with the start UTF-8 string. If so,
-// return non-NULL address of remaining portion of string. Otherwise, return
-// NULL. Used to test sections of a path without copying from image string
-// table.
-const char* ImageStrings::starts_with(const char* string, const char* start) {
- char ch1, ch2;
- // Match up the strings the best we can.
- while ((ch1 = *string) && (ch2 = *start)) {
- if (ch1 != ch2) {
- // Mismatch, return NULL.
- return NULL;
- }
- // Next characters.
- string++, start++;
- }
- // Return remainder of string.
- return string;
-}
-
-// Inflates the attribute stream into individual values stored in the long
-// array _attributes. This allows an attribute value to be quickly accessed by
-// direct indexing. Unspecified values default to zero (from constructor.)
-void ImageLocation::set_data(u1* data) {
- // Deflate the attribute stream into an array of attributes.
- u1 byte;
- // Repeat until end header is found.
- while ((byte = *data)) {
- // Extract kind from header byte.
- u1 kind = attribute_kind(byte);
- guarantee(kind < ATTRIBUTE_COUNT, "invalid image location attribute");
- // Extract length of data (in bytes).
- u1 n = attribute_length(byte);
- // Read value (most significant first.)
- _attributes[kind] = attribute_value(data + 1, n);
- // Position to next attribute by skipping attribute header and data bytes.
- data += n + 1;
- }
-}
-
-// Zero all attribute values.
-void ImageLocation::clear_data() {
- // Set defaults to zero.
- memset(_attributes, 0, sizeof(_attributes));
-}
-
-// ImageModuleData constructor maps out sub-tables for faster access.
-ImageModuleData::ImageModuleData(const ImageFileReader* image_file,
- const char* module_data_name) :
- _image_file(image_file),
- _endian(image_file->endian()),
- _strings(image_file->get_strings()) {
- // Retrieve the resource containing the module data for the image file.
- ImageLocation location;
- bool found = image_file->find_location(module_data_name, location);
- guarantee(found, "missing module data");
- u8 data_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
- _data = (u1*)NEW_C_HEAP_ARRAY(char, data_size, mtClass);
- _image_file->get_resource(location, _data);
- // Map out the header.
- _header = (Header*)_data;
- // Get the package to module entry count.
- u4 ptm_count = _header->ptm_count(_endian);
- // Get the module to package entry count.
- u4 mtp_count = _header->mtp_count(_endian);
- // Compute the offset of the package to module perfect hash redirect.
- u4 ptm_redirect_offset = sizeof(Header);
- // Compute the offset of the package to module data.
- u4 ptm_data_offset = ptm_redirect_offset + ptm_count * sizeof(s4);
- // Compute the offset of the module to package perfect hash redirect.
- u4 mtp_redirect_offset = ptm_data_offset + ptm_count * sizeof(PTMData);
- // Compute the offset of the module to package data.
- u4 mtp_data_offset = mtp_redirect_offset + mtp_count * sizeof(s4);
- // Compute the offset of the module to package tables.
- u4 mtp_packages_offset = mtp_data_offset + mtp_count * sizeof(MTPData);
- // Compute the address of the package to module perfect hash redirect.
- _ptm_redirect = (s4*)(_data + ptm_redirect_offset);
- // Compute the address of the package to module data.
- _ptm_data = (PTMData*)(_data + ptm_data_offset);
- // Compute the address of the module to package perfect hash redirect.
- _mtp_redirect = (s4*)(_data + mtp_redirect_offset);
- // Compute the address of the module to package data.
- _mtp_data = (MTPData*)(_data + mtp_data_offset);
- // Compute the address of the module to package tables.
- _mtp_packages = (s4*)(_data + mtp_packages_offset);
-}
-
-// Release module data resource.
-ImageModuleData::~ImageModuleData() {
- if (_data != NULL) {
- FREE_C_HEAP_ARRAY(u1, _data);
- }
-}
-
-// Return the name of the module data resource. Ex. "./lib/modules/file.jimage"
-// yields "file.jdata"
-void ImageModuleData::module_data_name(char* buffer, const char* image_file_name) {
- // Locate the last slash in the file name path.
- const char* slash = strrchr(image_file_name, os::file_separator()[0]);
- // Trim the path to name and extension.
- const char* name = slash != NULL ? slash + 1 : (char *)image_file_name;
- // Locate the extension period.
- const char* dot = strrchr(name, '.');
- guarantee(dot, "missing extension on jimage name");
- // Trim to only base name.
- int length = dot - name;
- strncpy(buffer, name, length);
- buffer[length] = '\0';
- // Append extension.
- strcat(buffer, ".jdata");
-}
-
-// Return the module in which a package resides. Returns NULL if not found.
-const char* ImageModuleData::package_to_module(const char* package_name) {
- // Search the package to module table.
- s4 index = ImageStrings::find(_endian, package_name, _ptm_redirect,
- _header->ptm_count(_endian));
- // If entry is found.
- if (index != ImageStrings::NOT_FOUND) {
- // Retrieve the package to module entry.
- PTMData* data = _ptm_data + index;
- // Verify that it is the correct data.
- if (strcmp(package_name, get_string(data->name_offset(_endian))) != 0) {
- return NULL;
- }
- // Return the module name.
- return get_string(data->module_name_offset(_endian));
- }
- return NULL;
-}
-
-// Returns all the package names in a module. Returns NULL if module not found.
-GrowableArray<const char*>* ImageModuleData::module_to_packages(const char* module_name) {
- // Search the module to package table.
- s4 index = ImageStrings::find(_endian, module_name, _mtp_redirect,
- _header->mtp_count(_endian));
- // If entry is found.
- if (index != ImageStrings::NOT_FOUND) {
- // Retrieve the module to package entry.
- MTPData* data = _mtp_data + index;
- // Verify that it is the correct data.
- if (strcmp(module_name, get_string(data->name_offset(_endian))) != 0) {
- return NULL;
- }
- // Construct an array of all the package entries.
- GrowableArray<const char*>* packages = new GrowableArray<const char*>();
- s4 package_offset = data->package_offset(_endian);
- for (u4 i = 0; i < data->package_count(_endian); i++) {
- u4 package_name_offset = mtp_package(package_offset + i);
- const char* package_name = get_string(package_name_offset);
- packages->append(package_name);
- }
- return packages;
- }
- return NULL;
-}
-
-// Table to manage multiple opens of an image file.
-GrowableArray<ImageFileReader*>* ImageFileReader::_reader_table =
- new(ResourceObj::C_HEAP, mtInternal) GrowableArray<ImageFileReader*>(2, true);
-
-// Open an image file, reuse structure if file already open.
-ImageFileReader* ImageFileReader::open(const char* name, bool big_endian) {
- // Lock out _reader_table.
- MutexLocker ml(ImageFileReaderTable_lock);
- ImageFileReader* reader;
- // Search for an exist image file.
- for (int i = 0; i < _reader_table->length(); i++) {
- // Retrieve table entry.
- reader = _reader_table->at(i);
- // If name matches, then reuse (bump up use count.)
- if (strcmp(reader->name(), name) == 0) {
- reader->inc_use();
- return reader;
- }
- }
- // Need a new image reader.
- reader = new ImageFileReader(name, big_endian);
- bool opened = reader->open();
- // If failed to open.
- if (!opened) {
- delete reader;
- return NULL;
- }
- // Bump use count and add to table.
- reader->inc_use();
- _reader_table->append(reader);
- return reader;
-}
-
-// Close an image file if the file is not in use elsewhere.
-void ImageFileReader::close(ImageFileReader *reader) {
- // Lock out _reader_table.
- MutexLocker ml(ImageFileReaderTable_lock);
- // If last use then remove from table and then close.
- if (reader->dec_use()) {
- _reader_table->remove(reader);
- delete reader;
- }
-}
-
-// Return an id for the specifed ImageFileReader.
-u8 ImageFileReader::readerToID(ImageFileReader *reader) {
- // ID is just the cloaked reader address.
- return (u8)reader;
-}
-
-// Validate the image id.
-bool ImageFileReader::idCheck(u8 id) {
- // Make sure the ID is a managed (_reader_table) reader.
- MutexLocker ml(ImageFileReaderTable_lock);
- return _reader_table->contains((ImageFileReader*)id);
-}
-
-// Return an id for the specifed ImageFileReader.
-ImageFileReader* ImageFileReader::idToReader(u8 id) {
-#ifdef PRODUCT
- // Fast convert.
- return (ImageFileReader*)id;
-#else
- // Do a slow check before fast convert.
- return idCheck(id) ? (ImageFileReader*)id : NULL;
-#endif
-}
-
-// Constructor intializes to a closed state.
-ImageFileReader::ImageFileReader(const char* name, bool big_endian) {
- // Copy the image file name.
- _name = NEW_C_HEAP_ARRAY(char, strlen(name) + 1, mtClass);
- strcpy(_name, name);
- // Initialize for a closed file.
- _fd = -1;
- _endian = Endian::get_handler(big_endian);
- _index_data = NULL;
-}
-
-// Close image and free up data structures.
-ImageFileReader::~ImageFileReader() {
- // Ensure file is closed.
- close();
- // Free up name.
- if (_name != NULL) {
- FREE_C_HEAP_ARRAY(char, _name);
- _name = NULL;
- }
-}
-
-// Open image file for read access.
-bool ImageFileReader::open() {
- // If file exists open for reading.
- struct stat st;
- if (os::stat(_name, &st) != 0 ||
- (st.st_mode & S_IFREG) != S_IFREG ||
- (_fd = os::open(_name, 0, O_RDONLY)) == -1) {
- return false;
- }
- // Retrieve the file size.
- _file_size = (u8)st.st_size;
- // Read image file header and verify it has a valid header.
- size_t header_size = sizeof(ImageHeader);
- if (_file_size < header_size ||
- !read_at((u1*)&_header, header_size, 0) ||
- _header.magic(_endian) != IMAGE_MAGIC ||
- _header.major_version(_endian) != MAJOR_VERSION ||
- _header.minor_version(_endian) != MINOR_VERSION) {
- close();
- return false;
- }
- // Size of image index.
- _index_size = index_size();
- // Make sure file is large enough to contain the index.
- if (_file_size < _index_size) {
- return false;
- }
- // Determine how much of the image is memory mapped.
- off_t map_size = (off_t)(MemoryMapImage ? _file_size : _index_size);
- // Memory map image (minimally the index.)
- _index_data = (u1*)os::map_memory(_fd, _name, 0, NULL, map_size, true, false);
- guarantee(_index_data, "image file not memory mapped");
- // Retrieve length of index perfect hash table.
- u4 length = table_length();
- // Compute offset of the perfect hash table redirect table.
- u4 redirect_table_offset = (u4)header_size;
- // Compute offset of index attribute offsets.
- u4 offsets_table_offset = redirect_table_offset + length * sizeof(s4);
- // Compute offset of index location attribute data.
- u4 location_bytes_offset = offsets_table_offset + length * sizeof(u4);
- // Compute offset of index string table.
- u4 string_bytes_offset = location_bytes_offset + locations_size();
- // Compute address of the perfect hash table redirect table.
- _redirect_table = (s4*)(_index_data + redirect_table_offset);
- // Compute address of index attribute offsets.
- _offsets_table = (u4*)(_index_data + offsets_table_offset);
- // Compute address of index location attribute data.
- _location_bytes = _index_data + location_bytes_offset;
- // Compute address of index string table.
- _string_bytes = _index_data + string_bytes_offset;
- // Successful open.
- return true;
-}
-
-// Close image file.
-void ImageFileReader::close() {
- // Dealllocate the index.
- if (_index_data != NULL) {
- os::unmap_memory((char*)_index_data, _index_size);
- _index_data = NULL;
- }
- // Close file.
- if (_fd != -1) {
- os::close(_fd);
- _fd = -1;
- }
-}
-
-// Read directly from the file.
-bool ImageFileReader::read_at(u1* data, u8 size, u8 offset) const {
- return os::read_at(_fd, data, size, offset) == size;
-}
-
-// Find the location attributes associated with the path. Returns true if
-// the location is found, false otherwise.
-bool ImageFileReader::find_location(const char* path, ImageLocation& location) const {
- // Locate the entry in the index perfect hash table.
- s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
- // If is found.
- if (index != ImageStrings::NOT_FOUND) {
- // Get address of first byte of location attribute stream.
- u1* data = get_location_data(index);
- // Expand location attributes.
- location.set_data(data);
- // Make sure result is not a false positive.
- return verify_location(location, path);
- }
- return false;
-}
-
-// Assemble the location path from the string fragments indicated in the location attributes.
-void ImageFileReader::location_path(ImageLocation& location, char* path, size_t max) const {
- // Manage the image string table.
- ImageStrings strings(_string_bytes, _header.strings_size(_endian));
- // Position to first character of the path buffer.
- char* next = path;
- // Temp for string length.
- size_t length;
- // Get module string.
- const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
- // If module string is not empty string.
- if (*module != '\0') {
- // Get length of module name.
- length = strlen(module);
- // Make sure there is no buffer overflow.
- guarantee(next - path + length + 2 < max, "buffer overflow");
- // Append '/module/'.
- *next++ = '/';
- strcpy(next, module); next += length;
- *next++ = '/';
- }
- // Get parent (package) string.
- const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
- // If parent string is not empty string.
- if (*parent != '\0') {
- // Get length of module string.
- length = strlen(parent);
- // Make sure there is no buffer overflow.
- guarantee(next - path + length + 1 < max, "buffer overflow");
- // Append 'patent/' .
- strcpy(next, parent); next += length;
- *next++ = '/';
- }
- // Get base name string.
- const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
- // Get length of base name.
- length = strlen(base);
- // Make sure there is no buffer overflow.
- guarantee(next - path + length < max, "buffer overflow");
- // Append base name.
- strcpy(next, base); next += length;
- // Get extension string.
- const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
- // If extension string is not empty string.
- if (*extension != '\0') {
- // Get length of extension string.
- length = strlen(extension);
- // Make sure there is no buffer overflow.
- guarantee(next - path + length + 1 < max, "buffer overflow");
- // Append '.extension' .
- *next++ = '.';
- strcpy(next, extension); next += length;
- }
- // Make sure there is no buffer overflow.
- guarantee((size_t)(next - path) < max, "buffer overflow");
- // Terminate string.
- *next = '\0';
-}
-
-// Verify that a found location matches the supplied path (without copying.)
-bool ImageFileReader::verify_location(ImageLocation& location, const char* path) const {
- // Manage the image string table.
- ImageStrings strings(_string_bytes, _header.strings_size(_endian));
- // Position to first character of the path string.
- const char* next = path;
- // Get module name string.
- const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
- // If module string is not empty.
- if (*module != '\0') {
- // Compare '/module/' .
- if (*next++ != '/') return false;
- if (!(next = ImageStrings::starts_with(next, module))) return false;
- if (*next++ != '/') return false;
- }
- // Get parent (package) string
- const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
- // If parent string is not empty string.
- if (*parent != '\0') {
- // Compare 'parent/' .
- if (!(next = ImageStrings::starts_with(next, parent))) return false;
- if (*next++ != '/') return false;
- }
- // Get base name string.
- const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
- // Compare with basne name.
- if (!(next = ImageStrings::starts_with(next, base))) return false;
- // Get extension string.
- const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
- // If extension is not empty.
- if (*extension != '\0') {
- // Compare '.extension' .
- if (*next++ != '.') return false;
- if (!(next = ImageStrings::starts_with(next, extension))) return false;
- }
- // True only if complete match and no more characters.
- return *next == '\0';
-}
-
-// Return the resource data for the supplied location.
-void ImageFileReader::get_resource(ImageLocation& location, u1* uncompressed_data) const {
- // Retrieve the byte offset and size of the resource.
- u8 offset = location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
- u8 uncompressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
- u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
- if (compressed_size != 0) {
- ResourceMark rm;
- u1* compressed_data;
- // If not memory mapped read in bytes.
- if (!MemoryMapImage) {
- // Allocate buffer for compression.
- compressed_data = NEW_RESOURCE_ARRAY(u1, compressed_size);
- // Read bytes from offset beyond the image index.
- bool is_read = read_at(compressed_data, compressed_size, _index_size + offset);
- guarantee(is_read, "error reading from image or short read");
- } else {
- compressed_data = get_data_address() + offset;
- }
- // Get image string table.
- const ImageStrings strings = get_strings();
- // Decompress resource.
- ImageDecompressor::decompress_resource(compressed_data, uncompressed_data, uncompressed_size,
- &strings, false);
- } else {
- // Read bytes from offset beyond the image index.
- bool is_read = read_at(uncompressed_data, uncompressed_size, _index_size + offset);
- guarantee(is_read, "error reading from image or short read");
- }
-}
--- a/hotspot/src/share/vm/classfile/imageFile.hpp Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,602 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- *
- */
-
-#ifndef SHARE_VM_CLASSFILE_IMAGEFILE_HPP
-#define SHARE_VM_CLASSFILE_IMAGEFILE_HPP
-
-#include "classfile/classLoader.hpp"
-#include "memory/allocation.hpp"
-#include "memory/allocation.inline.hpp"
-#include "utilities/endian.hpp"
-#include "utilities/globalDefinitions.hpp"
-#include "utilities/growableArray.hpp"
-
-// Image files are an alternate file format for storing classes and resources. The
-// goal is to supply file access which is faster and smaller than the jar format.
-// It should be noted that unlike jars, information stored in an image is in native
-// endian format. This allows the image to be mapped into memory without endian
-// translation. This also means that images are platform dependent.
-//
-// Image files are structured as three sections;
-//
-// +-----------+
-// | Header |
-// +-----------+
-// | |
-// | Index |
-// | |
-// +-----------+
-// | |
-// | |
-// | Resources |
-// | |
-// | |
-// +-----------+
-//
-// The header contains information related to identification and description of
-// contents.
-//
-// +-------------------------+
-// | Magic (0xCAFEDADA) |
-// +------------+------------+
-// | Major Vers | Minor Vers |
-// +------------+------------+
-// | Flags |
-// +-------------------------+
-// | Resource Count |
-// +-------------------------+
-// | Table Length |
-// +-------------------------+
-// | Attributes Size |
-// +-------------------------+
-// | Strings Size |
-// +-------------------------+
-//
-// Magic - means of identifying validity of the file. This avoids requiring a
-// special file extension.
-// Major vers, minor vers - differences in version numbers indicate structural
-// changes in the image.
-// Flags - various image wide flags (future).
-// Resource count - number of resources in the file.
-// Table length - the length of lookup tables used in the index.
-// Attributes size - number of bytes in the region used to store location attribute
-// streams.
-// Strings size - the size of the region used to store strings used by the
-// index and meta data.
-//
-// The index contains information related to resource lookup. The algorithm
-// used for lookup is "A Practical Minimal Perfect Hashing Method"
-// (http://homepages.dcc.ufmg.br/~nivio/papers/wea05.pdf). Given a path string
-// in the form /<module>/<package>/<base>.<extension> return the resource location
-// information;
-//
-// redirectIndex = hash(path, DEFAULT_SEED) % table_length;
-// redirect = redirectTable[redirectIndex];
-// if (redirect == 0) return not found;
-// locationIndex = redirect < 0 ? -1 - redirect : hash(path, redirect) % table_length;
-// location = locationTable[locationIndex];
-// if (!verify(location, path)) return not found;
-// return location;
-//
-// Note: The hash function takes an initial seed value. A different seed value
-// usually returns a different result for strings that would otherwise collide with
-// other seeds. The verify function guarantees the found resource location is
-// indeed the resource we are looking for.
-//
-// The following is the format of the index;
-//
-// +-------------------+
-// | Redirect Table |
-// +-------------------+
-// | Attribute Offsets |
-// +-------------------+
-// | Attribute Data |
-// +-------------------+
-// | Strings |
-// +-------------------+
-//
-// Redirect Table - Array of 32-bit signed values representing actions that
-// should take place for hashed strings that map to that
-// value. Negative values indicate no hash collision and can be
-// quickly converted to indices into attribute offsets. Positive
-// values represent a new seed for hashing an index into attribute
-// offsets. Zero indicates not found.
-// Attribute Offsets - Array of 32-bit unsigned values representing offsets into
-// attribute data. Attribute offsets can be iterated to do a
-// full survey of resources in the image. Offset of zero
-// indicates no attributes.
-// Attribute Data - Bytes representing compact attribute data for locations. (See
-// comments in ImageLocation.)
-// Strings - Collection of zero terminated UTF-8 strings used by the index and
-// image meta data. Each string is accessed by offset. Each string is
-// unique. Offset zero is reserved for the empty string.
-//
-// Note that the memory mapped index assumes 32 bit alignment of each component
-// in the index.
-//
-// Endianness of an image.
-// An image booted by hotspot is always in native endian. However, it is possible
-// to read (by the JDK) in alternate endian format. Primarily, this is during
-// cross platform scenarios. Ex, where javac needs to read an embedded image
-// to access classes for crossing compilation.
-//
-
-class ImageFileReader; // forward declaration
-
-// Manage image file string table.
-class ImageStrings VALUE_OBJ_CLASS_SPEC {
-private:
- u1* _data; // Data bytes for strings.
- u4 _size; // Number of bytes in the string table.
-public:
- enum {
- // Not found result from find routine.
- NOT_FOUND = -1,
- // Prime used to generate hash for Perfect Hashing.
- HASH_MULTIPLIER = 0x01000193
- };
-
- ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
-
- // Return the UTF-8 string beginning at offset.
- inline const char* get(u4 offset) const {
- guarantee(offset < _size, "offset exceeds string table size");
- return (const char*)(_data + offset);
- }
-
- // Compute the Perfect Hashing hash code for the supplied UTF-8 string.
- inline static u4 hash_code(const char* string) {
- return hash_code(string, HASH_MULTIPLIER);
- }
-
- // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
- static s4 hash_code(const char* string, s4 seed);
-
- // Match up a string in a perfect hash table. Result still needs validation
- // for precise match.
- static s4 find(Endian* endian, const char* name, s4* redirect, u4 length);
-
- // Test to see if UTF-8 string begins with the start UTF-8 string. If so,
- // return non-NULL address of remaining portion of string. Otherwise, return
- // NULL. Used to test sections of a path without copying from image string
- // table.
- static const char* starts_with(const char* string, const char* start);
-
- // Test to see if UTF-8 string begins with start char. If so, return non-NULL
- // address of remaining portion of string. Otherwise, return NULL. Used
- // to test a character of a path without copying.
- inline static const char* starts_with(const char* string, const char ch) {
- return *string == ch ? string + 1 : NULL;
- }
-};
-
-// Manage image file location attribute data. Within an image, a location's
-// attributes are compressed into a stream of bytes. An attribute stream is
-// composed of individual attribute sequences. Each attribute sequence begins with
-// a header byte containing the attribute 'kind' (upper 5 bits of header) and the
-// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
-// attribute value. Attribute values present as most significant byte first.
-//
-// Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22
-// (kind = 4, length = 3), 0x03, 0x35, 0x62.
-//
-// An attribute stream is terminated with a header kind of ATTRIBUTE_END (header
-// byte of zero.)
-//
-// ImageLocation inflates the stream into individual values stored in the long
-// array _attributes. This allows an attribute value can be quickly accessed by
-// direct indexing. Unspecified values default to zero.
-//
-// Notes:
-// - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
-// streams will contain zero byte values to represent lesser significant bits.
-// Thus, detecting a zero byte is not sufficient to detect the end of an attribute
-// stream.
-// - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
-// storing the resources. Thus, in an image this represents the number of bytes
-// after the index.
-// - Currently, compressed resources are represented by having a non-zero
-// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the
-// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
-// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
-// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
-// in memory. In the future, additional compression techniques will be used and
-// represented differently.
-// - Package strings include trailing slash and extensions include prefix period.
-//
-class ImageLocation VALUE_OBJ_CLASS_SPEC {
-public:
- enum {
- ATTRIBUTE_END, // End of attribute stream marker
- ATTRIBUTE_MODULE, // String table offset of module name
- ATTRIBUTE_PARENT, // String table offset of resource path parent
- ATTRIBUTE_BASE, // String table offset of resource path base
- ATTRIBUTE_EXTENSION, // String table offset of resource path extension
- ATTRIBUTE_OFFSET, // Container byte offset of resource
- ATTRIBUTE_COMPRESSED, // In image byte size of the compressed resource
- ATTRIBUTE_UNCOMPRESSED, // In memory byte size of the uncompressed resource
- ATTRIBUTE_COUNT // Number of attribute kinds
- };
-
-private:
- // Values of inflated attributes.
- u8 _attributes[ATTRIBUTE_COUNT];
-
- // Return the attribute value number of bytes.
- inline static u1 attribute_length(u1 data) {
- return (data & 0x7) + 1;
- }
-
- // Return the attribute kind.
- inline static u1 attribute_kind(u1 data) {
- u1 kind = data >> 3;
- guarantee(kind < ATTRIBUTE_COUNT, "invalid attribute kind");
- return kind;
- }
-
- // Return the attribute length.
- inline static u8 attribute_value(u1* data, u1 n) {
- guarantee(0 < n && n <= 8, "invalid attribute value length");
- u8 value = 0;
- // Most significant bytes first.
- for (u1 i = 0; i < n; i++) {
- value <<= 8;
- value |= data[i];
- }
- return value;
- }
-
-public:
- ImageLocation() {
- clear_data();
- }
-
- ImageLocation(u1* data) {
- clear_data();
- set_data(data);
- }
-
- // Inflates the attribute stream into individual values stored in the long
- // array _attributes. This allows an attribute value to be quickly accessed by
- // direct indexing. Unspecified values default to zero.
- void set_data(u1* data);
-
- // Zero all attribute values.
- void clear_data();
-
- // Retrieve an attribute value from the inflated array.
- inline u8 get_attribute(u1 kind) const {
- guarantee(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT, "invalid attribute kind");
- return _attributes[kind];
- }
-
- // Retrieve an attribute string value from the inflated array.
- inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
- return strings.get((u4)get_attribute(kind));
- }
-};
-
-//
-// NOTE: needs revision.
-// Each loader requires set of module meta data to identify which modules and
-// packages are managed by that loader. Currently, there is one image file per
-// builtin loader, so only one module meta data resource per file.
-//
-// Each element in the module meta data is a native endian 4 byte integer. Note
-// that entries with zero offsets for string table entries should be ignored (
-// padding for hash table lookup.)
-//
-// Format:
-// Count of package to module entries
-// Count of module to package entries
-// Perfect Hash redirect table[Count of package to module entries]
-// Package to module entries[Count of package to module entries]
-// Offset to package name in string table
-// Offset to module name in string table
-// Perfect Hash redirect table[Count of module to package entries]
-// Module to package entries[Count of module to package entries]
-// Offset to module name in string table
-// Count of packages in module
-// Offset to first package in packages table
-// Packages[]
-// Offset to package name in string table
-//
-// Manage the image module meta data.
-class ImageModuleData : public CHeapObj<mtClass> {
- class Header VALUE_OBJ_CLASS_SPEC {
- private:
- u4 _ptm_count; // Count of package to module entries
- u4 _mtp_count; // Count of module to package entries
- public:
- inline u4 ptm_count(Endian* endian) const { return endian->get(_ptm_count); }
- inline u4 mtp_count(Endian* endian) const { return endian->get(_mtp_count); }
- };
-
- // Hashtable entry
- class HashData VALUE_OBJ_CLASS_SPEC {
- private:
- u4 _name_offset; // Name offset in string table
- public:
- inline s4 name_offset(Endian* endian) const { return endian->get(_name_offset); }
- };
-
- // Package to module hashtable entry
- class PTMData : public HashData {
- private:
- u4 _module_name_offset; // Module name offset in string table
- public:
- inline s4 module_name_offset(Endian* endian) const { return endian->get(_module_name_offset); }
- };
-
- // Module to package hashtable entry
- class MTPData : public HashData {
- private:
- u4 _package_count; // Number of packages in module
- u4 _package_offset; // Offset in package list
- public:
- inline u4 package_count(Endian* endian) const { return endian->get(_package_count); }
- inline u4 package_offset(Endian* endian) const { return endian->get(_package_offset); }
- };
-
- const ImageFileReader* _image_file; // Source image file
- Endian* _endian; // Endian handler
- ImageStrings _strings; // Image file strings
- u1* _data; // Module data resource data
- u8 _data_size; // Size of resource data
- Header* _header; // Module data header
- s4* _ptm_redirect; // Package to module hashtable redirect
- PTMData* _ptm_data; // Package to module data
- s4* _mtp_redirect; // Module to packages hashtable redirect
- MTPData* _mtp_data; // Module to packages data
- s4* _mtp_packages; // Package data (name offsets)
-
- // Return a string from the string table.
- inline const char* get_string(u4 offset) {
- return _strings.get(offset);
- }
-
- inline u4 mtp_package(u4 index) {
- return _endian->get(_mtp_packages[index]);
- }
-
-public:
- ImageModuleData(const ImageFileReader* image_file, const char* module_data_name);
- ~ImageModuleData();
-
- // Return the name of the module data resource.
- static void module_data_name(char* buffer, const char* image_file_name);
-
- // Return the module in which a package resides. Returns NULL if not found.
- const char* package_to_module(const char* package_name);
-
- // Returns all the package names in a module. Returns NULL if module not found.
- GrowableArray<const char*>* module_to_packages(const char* module_name);
-};
-
-// Image file header, starting at offset 0.
-class ImageHeader VALUE_OBJ_CLASS_SPEC {
-private:
- u4 _magic; // Image file marker
- u4 _version; // Image file major version number
- u4 _flags; // Image file flags
- u4 _resource_count; // Number of resources in file
- u4 _table_length; // Number of slots in index tables
- u4 _locations_size; // Number of bytes in attribute table
- u4 _strings_size; // Number of bytes in string table
-
-public:
- u4 magic() const { return _magic; }
- u4 magic(Endian* endian) const { return endian->get(_magic); }
- void set_magic(Endian* endian, u4 magic) { return endian->set(_magic, magic); }
-
- u4 major_version(Endian* endian) const { return endian->get(_version) >> 16; }
- u4 minor_version(Endian* endian) const { return endian->get(_version) & 0xFFFF; }
- void set_version(Endian* endian, u4 major_version, u4 minor_version) {
- return endian->set(_version, major_version << 16 | minor_version);
- }
-
- u4 flags(Endian* endian) const { return endian->get(_flags); }
- void set_flags(Endian* endian, u4 value) { return endian->set(_flags, value); }
-
- u4 resource_count(Endian* endian) const { return endian->get(_resource_count); }
- void set_resource_count(Endian* endian, u4 count) { return endian->set(_resource_count, count); }
-
- u4 table_length(Endian* endian) const { return endian->get(_table_length); }
- void set_table_length(Endian* endian, u4 count) { return endian->set(_table_length, count); }
-
- u4 locations_size(Endian* endian) const { return endian->get(_locations_size); }
- void set_locations_size(Endian* endian, u4 size) { return endian->set(_locations_size, size); }
-
- u4 strings_size(Endian* endian) const { return endian->get(_strings_size); }
- void set_strings_size(Endian* endian, u4 size) { return endian->set(_strings_size, size); }
-};
-
-// Max path length limit independent of platform. Windows max path is 1024,
-// other platforms use 4096. The JCK fails several tests when 1024 is used.
-#define IMAGE_MAX_PATH 4096
-
-// Manage the image file.
-// ImageFileReader manages the content of an image file.
-// Initially, the header of the image file is read for validation. If valid,
-// values in the header are used calculate the size of the image index. The
-// index is then memory mapped to allow load on demand and sharing. The
-// -XX:+MemoryMapImage flag determines if the entire file is loaded (server use.)
-// An image can be used by Hotspot and multiple reference points in the JDK, thus
-// it is desirable to share a reader. To accomodate sharing, a share table is
-// defined (see ImageFileReaderTable in imageFile.cpp) To track the number of
-// uses, ImageFileReader keeps a use count (_use). Use is incremented when
-// 'opened' by reference point and decremented when 'closed'. Use of zero
-// leads the ImageFileReader to be actually closed and discarded.
-class ImageFileReader : public CHeapObj<mtClass> {
-private:
- // Manage a number of image files such that an image can be shared across
- // multiple uses (ex. loader.)
- static GrowableArray<ImageFileReader*>* _reader_table;
-
- char* _name; // Name of image
- s4 _use; // Use count
- int _fd; // File descriptor
- Endian* _endian; // Endian handler
- u8 _file_size; // File size in bytes
- ImageHeader _header; // Image header
- size_t _index_size; // Total size of index
- u1* _index_data; // Raw index data
- s4* _redirect_table; // Perfect hash redirect table
- u4* _offsets_table; // Location offset table
- u1* _location_bytes; // Location attributes
- u1* _string_bytes; // String table
-
- ImageFileReader(const char* name, bool big_endian);
- ~ImageFileReader();
-
- // Compute number of bytes in image file index.
- inline u8 index_size() {
- return sizeof(ImageHeader) +
- table_length() * sizeof(u4) * 2 + locations_size() + strings_size();
- }
-
-public:
- enum {
- // Image file marker.
- IMAGE_MAGIC = 0xCAFEDADA,
- // Endian inverted Image file marker.
- IMAGE_MAGIC_INVERT = 0xDADAFECA,
- // Image file major version number.
- MAJOR_VERSION = 1,
- // Image file minor version number.
- MINOR_VERSION = 0
- };
-
- // Open an image file, reuse structure if file already open.
- static ImageFileReader* open(const char* name, bool big_endian = Endian::is_big_endian());
-
- // Close an image file if the file is not in use elsewhere.
- static void close(ImageFileReader *reader);
-
- // Return an id for the specifed ImageFileReader.
- static u8 readerToID(ImageFileReader *reader);
-
- // Validate the image id.
- static bool idCheck(u8 id);
-
- // Return an id for the specifed ImageFileReader.
- static ImageFileReader* idToReader(u8 id);
-
- // Open image file for read access.
- bool open();
-
- // Close image file.
- void close();
-
- // Read directly from the file.
- bool read_at(u1* data, u8 size, u8 offset) const;
-
- inline Endian* endian() const { return _endian; }
-
- // Retrieve name of image file.
- inline const char* name() const {
- return _name;
- }
-
- // Retrieve size of image file.
- inline u8 file_size() const {
- return _file_size;
- }
-
- // Return first address of index data.
- inline u1* get_index_address() const {
- return _index_data;
- }
-
- // Return first address of resource data.
- inline u1* get_data_address() const {
- return _index_data + _index_size;
- }
-
- // Get the size of the index data.
- size_t get_index_size() const {
- return _index_size;
- }
-
- inline u4 table_length() const {
- return _header.table_length(_endian);
- }
-
- inline u4 locations_size() const {
- return _header.locations_size(_endian);
- }
-
- inline u4 strings_size()const {
- return _header.strings_size(_endian);
- }
-
- inline u4* offsets_table() const {
- return _offsets_table;
- }
-
- // Increment use count.
- inline void inc_use() {
- _use++;
- }
-
- // Decrement use count.
- inline bool dec_use() {
- return --_use == 0;
- }
-
- // Return a string table accessor.
- inline const ImageStrings get_strings() const {
- return ImageStrings(_string_bytes, _header.strings_size(_endian));
- }
-
- // Return location attribute stream at offset.
- inline u1* get_location_offset_data(u4 offset) const {
- guarantee((u4)offset < _header.locations_size(_endian),
- "offset exceeds location attributes size");
- return offset != 0 ? _location_bytes + offset : NULL;
- }
-
- // Return location attribute stream for location i.
- inline u1* get_location_data(u4 index) const {
- guarantee((u4)index < _header.table_length(_endian),
- "index exceeds location count");
- u4 offset = _endian->get(_offsets_table[index]);
-
- return get_location_offset_data(offset);
- }
-
- // Find the location attributes associated with the path. Returns true if
- // the location is found, false otherwise.
- bool find_location(const char* path, ImageLocation& location) const;
-
- // Assemble the location path.
- void location_path(ImageLocation& location, char* path, size_t max) const;
-
- // Verify that a found location matches the supplied path.
- bool verify_location(ImageLocation& location, const char* path) const;
-
- // Return the resource for the supplied path.
- void get_resource(ImageLocation& location, u1* uncompressed_data) const;
-};
-#endif // SHARE_VM_CLASSFILE_IMAGEFILE_HPP
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -29,7 +29,6 @@
#include "classfile/vmSymbols.hpp"
#include "code/debugInfo.hpp"
#include "code/pcDesc.hpp"
-#include "compiler/compilerOracle.hpp"
#include "interpreter/interpreter.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/jimage.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+#include "jni.h"
+
+// Opaque reference to a JImage file.
+class JImageFile;
+// Opaque reference to an image file resource location.
+typedef jlong JImageLocationRef;
+
+// Max path length limit independent of platform. Windows max path is 1024,
+// other platforms use 4096. The JCK fails several tests when 1024 is used.
+#define JIMAGE_MAX_PATH 4096
+
+// JImage Error Codes
+
+// The image file is not prefixed with 0xCAFEDADA
+#define JIMAGE_BAD_MAGIC (-1)
+// The image file does not have a compatible (translatable) version
+#define JIMAGE_BAD_VERSION (-2)
+// The image file content is malformed
+#define JIMAGE_CORRUPTED (-3)
+
+/*
+ * JImageOpen - Given the supplied full path file name, open an image file. This
+ * function will also initialize tables and retrieve meta-data necessary to
+ * satisfy other functions in the API. If the image file has been previously
+ * open, a new open request will share memory and resources used by the previous
+ * open. A call to JImageOpen should be balanced by a call to JImageClose, to
+ * release memory and resources used. If the image file is not found or cannot
+ * be open, then NULL is returned and error will contain a reason for the
+ * failure; a positive value for a system error number, negative for a jimage
+ * specific error (see JImage Error Codes.)
+ *
+ * Ex.
+ * jint error;
+ * JImageFile* jimage = (*JImageOpen)(JAVA_HOME "lib/modules/bootmodules.jimage", &error);
+ * if (image == NULL) {
+ * tty->print_cr("JImage failed to open: %d", error);
+ * ...
+ * }
+ * ...
+ */
+
+extern "C" JImageFile* JIMAGE_Open(const char *name, jint* error);
+
+typedef JImageFile* (*JImageOpen_t)(const char *name, jint* error);
+
+/*
+ * JImageClose - Given the supplied open image file (see JImageOpen), release
+ * memory and resources used by the open file and close the file. If the image
+ * file is shared by other uses, release and close is deferred until the last use
+ * is also closed.
+ *
+ * Ex.
+ * (*JImageClose)(image);
+ */
+
+extern "C" void JIMAGE_Close(JImageFile* jimage);
+
+typedef void (*JImageClose_t)(JImageFile* jimage);
+
+
+/*
+ * JImagePackageToModule - Given an open image file (see JImageOpen) and the name
+ * of a package, return the name of module where the package resides. If the
+ * package does not exist in the image file, the function returns NULL.
+ * The resulting string does/should not have to be released. All strings are
+ * utf-8, zero byte terminated.
+ *
+ * Ex.
+ * const char* package = (*JImagePackageToModule)(image, "java/lang");
+ * tty->print_cr(package);
+ * —> java.base
+ */
+
+extern "C" const char * JIMAGE_PackageToModule(JImageFile* jimage, const char* package_name);
+
+typedef const char* (*JImagePackageToModule_t)(JImageFile* jimage, const char* package_name);
+
+
+/*
+ * JImageFindResource - Given an open image file (see JImageOpen), a module
+ * name, a version string and the name of a class/resource, return location
+ * information describing the resource and its size. If no resource is found, the
+ * function returns JIMAGE_NOT_FOUND and the value of size is undefined.
+ * The version number should be "9.0" and is not used in locating the resource.
+ * The resulting location does/should not have to be released.
+ * All strings are utf-8, zero byte terminated.
+ *
+ * Ex.
+ * jlong size;
+ * JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ */
+extern "C" JImageLocationRef JIMAGE_FindResource(JImageFile* jimage,
+ const char* module_name, const char* version, const char* name,
+ jlong* size);
+
+typedef JImageLocationRef(*JImageFindResource_t)(JImageFile* jimage,
+ const char* module_name, const char* version, const char* name,
+ jlong* size);
+
+
+/*
+ * JImageGetResource - Given an open image file (see JImageOpen), a resource’s
+ * location information (see JImageFindResource), a buffer of appropriate
+ * size and the size, retrieve the bytes associated with the
+ * resource. If the size is less than the resource size then the read is truncated.
+ * If the size is greater than the resource size then the remainder of the buffer
+ * is zero filled. The function will return the actual size of the resource.
+ *
+ * Ex.
+ * jlong size;
+ * JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ * char* buffer = new char[size];
+ * (*JImageGetResource)(image, location, buffer, size);
+ */
+extern "C" jlong JIMAGE_GetResource(JImageFile* jimage, JImageLocationRef location,
+ char* buffer, jlong size);
+
+typedef jlong(*JImageGetResource_t)(JImageFile* jimage, JImageLocationRef location,
+ char* buffer, jlong size);
+
+
+/*
+ * JImageResourceIterator - Given an open image file (see JImageOpen), a visitor
+ * function and a visitor argument, iterator through each of the image's resources.
+ * The visitor function is called with the image file, the module name, the
+ * package name, the base name, the extension and the visitor argument. The return
+ * value of the visitor function should be true, unless an early iteration exit is
+ * required. All strings are utf-8, zero byte terminated.file.
+ *
+ * Ex.
+ * bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, const char* name, const char* extension, void* arg) {
+ * if (strcmp(extension, “class”) == 0) {
+ * char path[JIMAGE_MAX_PATH];
+ * Thread* THREAD = Thread::current();
+ * jio_snprintf(path, JIMAGE_MAX_PATH - 1, "/%s/%s", package, name);
+ * ClassLoader::compile_the_world_in(path, (Handle)arg, THREAD);
+ * return !HAS_PENDING_EXCEPTION;
+ * }
+ * return true;
+ * }
+ * (*JImageResourceIterator)(image, ctw_visitor, loader);
+ */
+
+typedef bool (*JImageResourceVisitor_t)(JImageFile* jimage,
+ const char* module_name, const char* version, const char* package,
+ const char* name, const char* extension, void* arg);
+
+extern "C" void JIMAGE_ResourceIterator(JImageFile* jimage,
+ JImageResourceVisitor_t visitor, void *arg);
+
+typedef void (*JImageResourceIterator_t)(JImageFile* jimage,
+ JImageResourceVisitor_t visitor, void* arg);
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -625,6 +625,10 @@
case vmIntrinsics::_updateDirectByteBufferCRC32C:
if (!UseCRC32CIntrinsics) return true;
break;
+ case vmIntrinsics::_updateBytesAdler32:
+ case vmIntrinsics::_updateByteBufferAdler32:
+ if (!UseAdler32Intrinsics) return true;
+ break;
case vmIntrinsics::_copyMemory:
if (!InlineArrayCopy || !InlineUnsafeOps) return true;
break;
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -927,6 +927,12 @@
do_intrinsic(_updateDirectByteBufferCRC32C, java_util_zip_CRC32C, updateDirectByteBuffer_C_name, updateByteBuffer_signature, F_S) \
do_name( updateDirectByteBuffer_C_name, "updateDirectByteBuffer") \
\
+ /* support for java.util.zip.Adler32 */ \
+ do_class(java_util_zip_Adler32, "java/util/zip/Adler32") \
+ do_intrinsic(_updateBytesAdler32, java_util_zip_Adler32, updateBytes_C_name, updateBytes_signature, F_SN) \
+ do_intrinsic(_updateByteBufferAdler32, java_util_zip_Adler32, updateByteBuffer_A_name, updateByteBuffer_signature, F_SN) \
+ do_name( updateByteBuffer_A_name, "updateByteBuffer") \
+ \
/* support for sun.misc.Unsafe */ \
do_class(sun_misc_Unsafe, "sun/misc/Unsafe") \
\
--- a/hotspot/src/share/vm/code/nmethod.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/code/nmethod.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -848,10 +848,10 @@
if (st != NULL) {
ttyLocker ttyl;
if (WizardMode) {
- CompileTask::print_compilation(st, this, msg, /*short_form:*/ true);
+ CompileTask::print(st, this, msg, /*short_form:*/ true);
st->print_cr(" (" INTPTR_FORMAT ")", this);
} else {
- CompileTask::print_compilation(st, this, msg, /*short_form:*/ false);
+ CompileTask::print(st, this, msg, /*short_form:*/ false);
}
}
}
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -157,7 +157,6 @@
CompileQueue* CompileBroker::_c2_compile_queue = NULL;
CompileQueue* CompileBroker::_c1_compile_queue = NULL;
-
class CompilationLog : public StringEventLog {
public:
CompilationLog() : StringEventLog("Compilation events") {
@@ -167,7 +166,7 @@
StringLogMessage lm;
stringStream sstr = lm.stream();
// msg.time_stamp().update_to(tty->time_stamp().ticks());
- task->print_compilation(&sstr, NULL, true, false);
+ task->print(&sstr, NULL, true, false);
log(thread, "%s", (const char*)lm);
}
@@ -233,371 +232,6 @@
}
}
-
-CompileTask* CompileTask::_task_free_list = NULL;
-#ifdef ASSERT
-int CompileTask::_num_allocated_tasks = 0;
-#endif
-/**
- * Allocate a CompileTask, from the free list if possible.
- */
-CompileTask* CompileTask::allocate() {
- MutexLocker locker(CompileTaskAlloc_lock);
- CompileTask* task = NULL;
-
- if (_task_free_list != NULL) {
- task = _task_free_list;
- _task_free_list = task->next();
- task->set_next(NULL);
- } else {
- task = new CompileTask();
- DEBUG_ONLY(_num_allocated_tasks++;)
- assert (WhiteBoxAPI || _num_allocated_tasks < 10000, "Leaking compilation tasks?");
- task->set_next(NULL);
- task->set_is_free(true);
- }
- assert(task->is_free(), "Task must be free.");
- task->set_is_free(false);
- return task;
-}
-
-
-/**
- * Add a task to the free list.
- */
-void CompileTask::free(CompileTask* task) {
- MutexLocker locker(CompileTaskAlloc_lock);
- if (!task->is_free()) {
- task->set_code(NULL);
- assert(!task->lock()->is_locked(), "Should not be locked when freed");
- JNIHandles::destroy_global(task->_method_holder);
- JNIHandles::destroy_global(task->_hot_method_holder);
-
- task->set_is_free(true);
- task->set_next(_task_free_list);
- _task_free_list = task;
- }
-}
-
-void CompileTask::initialize(int compile_id,
- methodHandle method,
- int osr_bci,
- int comp_level,
- methodHandle hot_method,
- int hot_count,
- const char* comment,
- bool is_blocking) {
- assert(!_lock->is_locked(), "bad locking");
-
- _compile_id = compile_id;
- _method = method();
- _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder());
- _osr_bci = osr_bci;
- _is_blocking = is_blocking;
- _comp_level = comp_level;
- _num_inlined_bytecodes = 0;
-
- _is_complete = false;
- _is_success = false;
- _code_handle = NULL;
-
- _hot_method = NULL;
- _hot_method_holder = NULL;
- _hot_count = hot_count;
- _time_queued = 0; // tidy
- _comment = comment;
- _failure_reason = NULL;
-
- if (LogCompilation) {
- _time_queued = os::elapsed_counter();
- if (hot_method.not_null()) {
- if (hot_method == method) {
- _hot_method = _method;
- } else {
- _hot_method = hot_method();
- // only add loader or mirror if different from _method_holder
- _hot_method_holder = JNIHandles::make_global(hot_method->method_holder()->klass_holder());
- }
- }
- }
-
- _next = NULL;
-}
-
-// ------------------------------------------------------------------
-// CompileTask::code/set_code
-nmethod* CompileTask::code() const {
- if (_code_handle == NULL) return NULL;
- return _code_handle->code();
-}
-void CompileTask::set_code(nmethod* nm) {
- if (_code_handle == NULL && nm == NULL) return;
- guarantee(_code_handle != NULL, "");
- _code_handle->set_code(nm);
- if (nm == NULL) _code_handle = NULL; // drop the handle also
-}
-
-void CompileTask::mark_on_stack() {
- // Mark these methods as something redefine classes cannot remove.
- _method->set_on_stack(true);
- if (_hot_method != NULL) {
- _hot_method->set_on_stack(true);
- }
-}
-
-// RedefineClasses support
-void CompileTask::metadata_do(void f(Metadata*)) {
- f(method());
- if (hot_method() != NULL && hot_method() != method()) {
- f(hot_method());
- }
-}
-
-// ------------------------------------------------------------------
-// CompileTask::print_line_on_error
-//
-// This function is called by fatal error handler when the thread
-// causing troubles is a compiler thread.
-//
-// Do not grab any lock, do not allocate memory.
-//
-// Otherwise it's the same as CompileTask::print_line()
-//
-void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) {
- // print compiler name
- st->print("%s:", CompileBroker::compiler_name(comp_level()));
- print_compilation(st);
-}
-
-// ------------------------------------------------------------------
-// CompileTask::print_line
-void CompileTask::print_tty() {
- ttyLocker ttyl; // keep the following output all in one block
- // print compiler name if requested
- if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level()));
- print_compilation(tty);
-}
-
-// ------------------------------------------------------------------
-// CompileTask::print_compilation_impl
-void CompileTask::print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level,
- bool is_osr_method, int osr_bci, bool is_blocking,
- const char* msg, bool short_form, bool cr) {
- if (!short_form) {
- st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp
- }
- st->print("%4d ", compile_id); // print compilation number
-
- // For unloaded methods the transition to zombie occurs after the
- // method is cleared so it's impossible to report accurate
- // information for that case.
- bool is_synchronized = false;
- bool has_exception_handler = false;
- bool is_native = false;
- if (method != NULL) {
- is_synchronized = method->is_synchronized();
- has_exception_handler = method->has_exception_handler();
- is_native = method->is_native();
- }
- // method attributes
- const char compile_type = is_osr_method ? '%' : ' ';
- const char sync_char = is_synchronized ? 's' : ' ';
- const char exception_char = has_exception_handler ? '!' : ' ';
- const char blocking_char = is_blocking ? 'b' : ' ';
- const char native_char = is_native ? 'n' : ' ';
-
- // print method attributes
- st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
-
- if (TieredCompilation) {
- if (comp_level != -1) st->print("%d ", comp_level);
- else st->print("- ");
- }
- st->print(" "); // more indent
-
- if (method == NULL) {
- st->print("(method)");
- } else {
- method->print_short_name(st);
- if (is_osr_method) {
- st->print(" @ %d", osr_bci);
- }
- if (method->is_native())
- st->print(" (native)");
- else
- st->print(" (%d bytes)", method->code_size());
- }
-
- if (msg != NULL) {
- st->print(" %s", msg);
- }
- if (cr) {
- st->cr();
- }
-}
-
-// ------------------------------------------------------------------
-// CompileTask::print_inlining
-void CompileTask::print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) {
- // 1234567
- st->print(" "); // print timestamp
- // 1234
- st->print(" "); // print compilation number
-
- // method attributes
- if (method->is_loaded()) {
- const char sync_char = method->is_synchronized() ? 's' : ' ';
- const char exception_char = method->has_exception_handlers() ? '!' : ' ';
- const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' ';
-
- // print method attributes
- st->print(" %c%c%c ", sync_char, exception_char, monitors_char);
- } else {
- // %s!bn
- st->print(" "); // print method attributes
- }
-
- if (TieredCompilation) {
- st->print(" ");
- }
- st->print(" "); // more indent
- st->print(" "); // initial inlining indent
-
- for (int i = 0; i < inline_level; i++) st->print(" ");
-
- st->print("@ %d ", bci); // print bci
- method->print_short_name(st);
- if (method->is_loaded())
- st->print(" (%d bytes)", method->code_size());
- else
- st->print(" (not loaded)");
-
- if (msg != NULL) {
- st->print(" %s", msg);
- }
- st->cr();
-}
-
-// ------------------------------------------------------------------
-// CompileTask::print_inline_indent
-void CompileTask::print_inline_indent(int inline_level, outputStream* st) {
- // 1234567
- st->print(" "); // print timestamp
- // 1234
- st->print(" "); // print compilation number
- // %s!bn
- st->print(" "); // print method attributes
- if (TieredCompilation) {
- st->print(" ");
- }
- st->print(" "); // more indent
- st->print(" "); // initial inlining indent
- for (int i = 0; i < inline_level; i++) st->print(" ");
-}
-
-// ------------------------------------------------------------------
-// CompileTask::print_compilation
-void CompileTask::print_compilation(outputStream* st, const char* msg, bool short_form, bool cr) {
- bool is_osr_method = osr_bci() != InvocationEntryBci;
- print_compilation_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr);
-}
-
-// ------------------------------------------------------------------
-// CompileTask::log_task
-void CompileTask::log_task(xmlStream* log) {
- Thread* thread = Thread::current();
- methodHandle method(thread, this->method());
- ResourceMark rm(thread);
-
- // <task compiler='Cx' id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
- log->print(" compiler='%s' compile_id='%d'", _comp_level <= CompLevel_full_profile ? "C1" : "C2", _compile_id);
- if (_osr_bci != CompileBroker::standard_entry_bci) {
- log->print(" compile_kind='osr'"); // same as nmethod::compile_kind
- } // else compile_kind='c2c'
- if (!method.is_null()) log->method(method);
- if (_osr_bci != CompileBroker::standard_entry_bci) {
- log->print(" osr_bci='%d'", _osr_bci);
- }
- if (_comp_level != CompLevel_highest_tier) {
- log->print(" level='%d'", _comp_level);
- }
- if (_is_blocking) {
- log->print(" blocking='1'");
- }
- log->stamp();
-}
-
-
-// ------------------------------------------------------------------
-// CompileTask::log_task_queued
-void CompileTask::log_task_queued() {
- Thread* thread = Thread::current();
- ttyLocker ttyl;
- ResourceMark rm(thread);
-
- xtty->begin_elem("task_queued");
- log_task(xtty);
- if (_comment != NULL) {
- xtty->print(" comment='%s'", _comment);
- }
- if (_hot_method != NULL) {
- methodHandle hot(thread, _hot_method);
- methodHandle method(thread, _method);
- if (hot() != method()) {
- xtty->method(hot);
- }
- }
- if (_hot_count != 0) {
- xtty->print(" hot_count='%d'", _hot_count);
- }
- xtty->end_elem();
-}
-
-
-// ------------------------------------------------------------------
-// CompileTask::log_task_start
-void CompileTask::log_task_start(CompileLog* log) {
- log->begin_head("task");
- log_task(log);
- log->end_head();
-}
-
-
-// ------------------------------------------------------------------
-// CompileTask::log_task_done
-void CompileTask::log_task_done(CompileLog* log) {
- Thread* thread = Thread::current();
- methodHandle method(thread, this->method());
- ResourceMark rm(thread);
-
- if (!_is_success) {
- const char* reason = _failure_reason != NULL ? _failure_reason : "unknown";
- log->elem("failure reason='%s'", reason);
- }
-
- // <task_done ... stamp='1.234'> </task>
- nmethod* nm = code();
- log->begin_elem("task_done success='%d' nmsize='%d' count='%d'",
- _is_success, nm == NULL ? 0 : nm->content_size(),
- method->invocation_count());
- int bec = method->backedge_count();
- if (bec != 0) log->print(" backedge_count='%d'", bec);
- // Note: "_is_complete" is about to be set, but is not.
- if (_num_inlined_bytecodes != 0) {
- log->print(" inlined_bytes='%d'", _num_inlined_bytecodes);
- }
- log->stamp();
- log->end_elem();
- log->tail("task");
- log->clear_identities(); // next task will have different CI
- if (log->unflushed_count() > 2000) {
- log->flush();
- }
- log->mark_file_end();
-}
-
-
-
/**
* Add a CompileTask to a CompileQueue.
*/
@@ -807,7 +441,7 @@
st->print_cr("Empty");
} else {
while (task != NULL) {
- task->print_compilation(st, NULL, true, true);
+ task->print(st, NULL, true, true);
task = task->next();
}
}
@@ -1349,7 +983,7 @@
#ifndef TIERED
// seems like an assert of dubious value
assert(comp_level == CompLevel_highest_tier,
- "all OSR compiles are assumed to be at a single compilation lavel");
+ "all OSR compiles are assumed to be at a single compilation level");
#endif // TIERED
// We accept a higher level osr method
nmethod* nm = method->lookup_osr_nmethod_for(osr_bci, comp_level, false);
@@ -2037,7 +1671,7 @@
FormatBufferResource msg = retry_message != NULL ?
err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) :
err_msg_res("COMPILE SKIPPED: %s", ci_env.failure_reason());
- task->print_compilation(tty, msg);
+ task->print(tty, msg);
}
} else {
task->mark_success();
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -27,127 +27,12 @@
#include "ci/compilerInterface.hpp"
#include "compiler/abstractCompiler.hpp"
+#include "compiler/compileTask.hpp"
#include "runtime/perfData.hpp"
class nmethod;
class nmethodLocker;
-// CompileTask
-//
-// An entry in the compile queue. It represents a pending or current
-// compilation.
-class CompileTask : public CHeapObj<mtCompiler> {
- friend class VMStructs;
-
- private:
- static CompileTask* _task_free_list;
-#ifdef ASSERT
- static int _num_allocated_tasks;
-#endif
-
- Monitor* _lock;
- uint _compile_id;
- Method* _method;
- jobject _method_holder;
- int _osr_bci;
- bool _is_complete;
- bool _is_success;
- bool _is_blocking;
- int _comp_level;
- int _num_inlined_bytecodes;
- nmethodLocker* _code_handle; // holder of eventual result
- CompileTask* _next, *_prev;
- bool _is_free;
- // Fields used for logging why the compilation was initiated:
- jlong _time_queued; // in units of os::elapsed_counter()
- Method* _hot_method; // which method actually triggered this task
- jobject _hot_method_holder;
- int _hot_count; // information about its invocation counter
- const char* _comment; // more info about the task
- const char* _failure_reason;
-
- public:
- CompileTask() {
- _lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock");
- }
-
- void initialize(int compile_id, methodHandle method, int osr_bci, int comp_level,
- methodHandle hot_method, int hot_count, const char* comment,
- bool is_blocking);
-
- static CompileTask* allocate();
- static void free(CompileTask* task);
-
- int compile_id() const { return _compile_id; }
- Method* method() const { return _method; }
- Method* hot_method() const { return _hot_method; }
- int osr_bci() const { return _osr_bci; }
- bool is_complete() const { return _is_complete; }
- bool is_blocking() const { return _is_blocking; }
- bool is_success() const { return _is_success; }
-
- nmethodLocker* code_handle() const { return _code_handle; }
- void set_code_handle(nmethodLocker* l) { _code_handle = l; }
- nmethod* code() const; // _code_handle->code()
- void set_code(nmethod* nm); // _code_handle->set_code(nm)
-
- Monitor* lock() const { return _lock; }
-
- void mark_complete() { _is_complete = true; }
- void mark_success() { _is_success = true; }
-
- int comp_level() { return _comp_level;}
- void set_comp_level(int comp_level) { _comp_level = comp_level;}
-
- int num_inlined_bytecodes() const { return _num_inlined_bytecodes; }
- void set_num_inlined_bytecodes(int n) { _num_inlined_bytecodes = n; }
-
- CompileTask* next() const { return _next; }
- void set_next(CompileTask* next) { _next = next; }
- CompileTask* prev() const { return _prev; }
- void set_prev(CompileTask* prev) { _prev = prev; }
- bool is_free() const { return _is_free; }
- void set_is_free(bool val) { _is_free = val; }
-
- // RedefineClasses support
- void metadata_do(void f(Metadata*));
-
-private:
- static void print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level,
- bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false,
- const char* msg = NULL, bool short_form = false, bool cr = true);
-
-public:
- void print_compilation(outputStream* st = tty, const char* msg = NULL, bool short_form = false, bool cr = true);
- static void print_compilation(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true) {
- print_compilation_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
- nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,
- msg, short_form, cr);
- }
-
- static void print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL);
- static void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
- print_inlining(tty, method, inline_level, bci, msg);
- }
-
- // Redefine Classes support
- void mark_on_stack();
-
- static void print_inline_indent(int inline_level, outputStream* st = tty);
-
- void print_tty();
- void print_line_on_error(outputStream* st, char* buf, int buflen);
-
- void log_task(xmlStream* log);
- void log_task_queued();
- void log_task_start(CompileLog* log);
- void log_task_done(CompileLog* log);
-
- void set_failure_reason(const char* reason) {
- _failure_reason = reason;
- }
-};
-
// CompilerCounters
//
// Per Compiler Performance Counters.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/compiler/compileTask.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,391 @@
+/*
+ * Copyright (c) 1998, 2014, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "compiler/compileTask.hpp"
+#include "compiler/compileLog.hpp"
+#include "compiler/compileBroker.hpp"
+
+CompileTask* CompileTask::_task_free_list = NULL;
+#ifdef ASSERT
+int CompileTask::_num_allocated_tasks = 0;
+#endif
+
+/**
+ * Allocate a CompileTask, from the free list if possible.
+ */
+CompileTask* CompileTask::allocate() {
+ MutexLocker locker(CompileTaskAlloc_lock);
+ CompileTask* task = NULL;
+
+ if (_task_free_list != NULL) {
+ task = _task_free_list;
+ _task_free_list = task->next();
+ task->set_next(NULL);
+ } else {
+ task = new CompileTask();
+ DEBUG_ONLY(_num_allocated_tasks++;)
+ assert (WhiteBoxAPI || _num_allocated_tasks < 10000, "Leaking compilation tasks?");
+ task->set_next(NULL);
+ task->set_is_free(true);
+ }
+ assert(task->is_free(), "Task must be free.");
+ task->set_is_free(false);
+ return task;
+}
+
+/**
+* Add a task to the free list.
+*/
+
+void CompileTask::free(CompileTask* task) {
+ MutexLocker locker(CompileTaskAlloc_lock);
+ if (!task->is_free()) {
+ task->set_code(NULL);
+ assert(!task->lock()->is_locked(), "Should not be locked when freed");
+ JNIHandles::destroy_global(task->_method_holder);
+ JNIHandles::destroy_global(task->_hot_method_holder);
+
+ task->set_is_free(true);
+ task->set_next(_task_free_list);
+ _task_free_list = task;
+ }
+}
+
+
+void CompileTask::initialize(int compile_id,
+ methodHandle method,
+ int osr_bci,
+ int comp_level,
+ methodHandle hot_method,
+ int hot_count,
+ const char* comment,
+ bool is_blocking) {
+ assert(!_lock->is_locked(), "bad locking");
+
+ _compile_id = compile_id;
+ _method = method();
+ _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder());
+ _osr_bci = osr_bci;
+ _is_blocking = is_blocking;
+ _comp_level = comp_level;
+ _num_inlined_bytecodes = 0;
+
+ _is_complete = false;
+ _is_success = false;
+ _code_handle = NULL;
+
+ _hot_method = NULL;
+ _hot_method_holder = NULL;
+ _hot_count = hot_count;
+ _time_queued = 0; // tidy
+ _comment = comment;
+ _failure_reason = NULL;
+
+ if (LogCompilation) {
+ _time_queued = os::elapsed_counter();
+ if (hot_method.not_null()) {
+ if (hot_method == method) {
+ _hot_method = _method;
+ } else {
+ _hot_method = hot_method();
+ // only add loader or mirror if different from _method_holder
+ _hot_method_holder = JNIHandles::make_global(hot_method->method_holder()->klass_holder());
+ }
+ }
+ }
+
+ _next = NULL;
+}
+
+// ------------------------------------------------------------------
+// CompileTask::code/set_code
+//
+nmethod* CompileTask::code() const {
+ if (_code_handle == NULL) return NULL;
+ return _code_handle->code();
+}
+
+void CompileTask::set_code(nmethod* nm) {
+ if (_code_handle == NULL && nm == NULL) return;
+ guarantee(_code_handle != NULL, "");
+ _code_handle->set_code(nm);
+ if (nm == NULL) _code_handle = NULL; // drop the handle also
+}
+
+void CompileTask::mark_on_stack() {
+ // Mark these methods as something redefine classes cannot remove.
+ _method->set_on_stack(true);
+ if (_hot_method != NULL) {
+ _hot_method->set_on_stack(true);
+ }
+}
+
+// RedefineClasses support
+void CompileTask::metadata_do(void f(Metadata*)) {
+ f(method());
+ if (hot_method() != NULL && hot_method() != method()) {
+ f(hot_method());
+ }
+}
+
+// ------------------------------------------------------------------
+// CompileTask::print_line_on_error
+//
+// This function is called by fatal error handler when the thread
+// causing troubles is a compiler thread.
+//
+// Do not grab any lock, do not allocate memory.
+//
+// Otherwise it's the same as CompileTask::print_line()
+//
+void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) {
+ // print compiler name
+ st->print("%s:", CompileBroker::compiler_name(comp_level()));
+ print(st);
+}
+
+// ------------------------------------------------------------------
+// CompileTask::print_tty
+void CompileTask::print_tty() {
+ ttyLocker ttyl; // keep the following output all in one block
+ // print compiler name if requested
+ if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level()));
+ print(tty);
+}
+
+// ------------------------------------------------------------------
+// CompileTask::print_impl
+void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
+ bool is_osr_method, int osr_bci, bool is_blocking,
+ const char* msg, bool short_form, bool cr) {
+ if (!short_form) {
+ st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp
+ }
+ st->print("%4d ", compile_id); // print compilation number
+
+ // For unloaded methods the transition to zombie occurs after the
+ // method is cleared so it's impossible to report accurate
+ // information for that case.
+ bool is_synchronized = false;
+ bool has_exception_handler = false;
+ bool is_native = false;
+ if (method != NULL) {
+ is_synchronized = method->is_synchronized();
+ has_exception_handler = method->has_exception_handler();
+ is_native = method->is_native();
+ }
+ // method attributes
+ const char compile_type = is_osr_method ? '%' : ' ';
+ const char sync_char = is_synchronized ? 's' : ' ';
+ const char exception_char = has_exception_handler ? '!' : ' ';
+ const char blocking_char = is_blocking ? 'b' : ' ';
+ const char native_char = is_native ? 'n' : ' ';
+
+ // print method attributes
+ st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
+
+ if (TieredCompilation) {
+ if (comp_level != -1) st->print("%d ", comp_level);
+ else st->print("- ");
+ }
+ st->print(" "); // more indent
+
+ if (method == NULL) {
+ st->print("(method)");
+ } else {
+ method->print_short_name(st);
+ if (is_osr_method) {
+ st->print(" @ %d", osr_bci);
+ }
+ if (method->is_native())
+ st->print(" (native)");
+ else
+ st->print(" (%d bytes)", method->code_size());
+ }
+
+ if (msg != NULL) {
+ st->print(" %s", msg);
+ }
+ if (cr) {
+ st->cr();
+ }
+}
+
+void CompileTask::print_inline_indent(int inline_level, outputStream* st) {
+ // 1234567
+ st->print(" "); // print timestamp
+ // 1234
+ st->print(" "); // print compilation number
+ // %s!bn
+ st->print(" "); // print method attributes
+ if (TieredCompilation) {
+ st->print(" ");
+ }
+ st->print(" "); // more indent
+ st->print(" "); // initial inlining indent
+ for (int i = 0; i < inline_level; i++) st->print(" ");
+}
+
+// ------------------------------------------------------------------
+// CompileTask::print_compilation
+void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) {
+ bool is_osr_method = osr_bci() != InvocationEntryBci;
+ print_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr);
+}
+
+// ------------------------------------------------------------------
+// CompileTask::log_task
+void CompileTask::log_task(xmlStream* log) {
+ Thread* thread = Thread::current();
+ methodHandle method(thread, this->method());
+ ResourceMark rm(thread);
+
+ // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
+ log->print(" compile_id='%d'", _compile_id);
+ if (_osr_bci != CompileBroker::standard_entry_bci) {
+ log->print(" compile_kind='osr'"); // same as nmethod::compile_kind
+ } // else compile_kind='c2c'
+ if (!method.is_null()) log->method(method);
+ if (_osr_bci != CompileBroker::standard_entry_bci) {
+ log->print(" osr_bci='%d'", _osr_bci);
+ }
+ if (_comp_level != CompLevel_highest_tier) {
+ log->print(" level='%d'", _comp_level);
+ }
+ if (_is_blocking) {
+ log->print(" blocking='1'");
+ }
+ log->stamp();
+}
+
+// ------------------------------------------------------------------
+// CompileTask::log_task_queued
+void CompileTask::log_task_queued() {
+ Thread* thread = Thread::current();
+ ttyLocker ttyl;
+ ResourceMark rm(thread);
+
+ xtty->begin_elem("task_queued");
+ log_task(xtty);
+ if (_comment != NULL) {
+ xtty->print(" comment='%s'", _comment);
+ }
+ if (_hot_method != NULL) {
+ methodHandle hot(thread, _hot_method);
+ methodHandle method(thread, _method);
+ if (hot() != method()) {
+ xtty->method(hot);
+ }
+ }
+ if (_hot_count != 0) {
+ xtty->print(" hot_count='%d'", _hot_count);
+ }
+ xtty->end_elem();
+}
+
+
+// ------------------------------------------------------------------
+// CompileTask::log_task_start
+void CompileTask::log_task_start(CompileLog* log) {
+ log->begin_head("task");
+ log_task(log);
+ log->end_head();
+}
+
+
+// ------------------------------------------------------------------
+// CompileTask::log_task_done
+void CompileTask::log_task_done(CompileLog* log) {
+ Thread* thread = Thread::current();
+ methodHandle method(thread, this->method());
+ ResourceMark rm(thread);
+
+ if (!_is_success) {
+ const char* reason = _failure_reason != NULL ? _failure_reason : "unknown";
+ log->elem("failure reason='%s'", reason);
+ }
+
+ // <task_done ... stamp='1.234'> </task>
+ nmethod* nm = code();
+ log->begin_elem("task_done success='%d' nmsize='%d' count='%d'",
+ _is_success, nm == NULL ? 0 : nm->content_size(),
+ method->invocation_count());
+ int bec = method->backedge_count();
+ if (bec != 0) log->print(" backedge_count='%d'", bec);
+ // Note: "_is_complete" is about to be set, but is not.
+ if (_num_inlined_bytecodes != 0) {
+ log->print(" inlined_bytes='%d'", _num_inlined_bytecodes);
+ }
+ log->stamp();
+ log->end_elem();
+ log->clear_identities(); // next task will have different CI
+ log->tail("task");
+ if (log->unflushed_count() > 2000) {
+ log->flush();
+ }
+ log->mark_file_end();
+}
+
+// ------------------------------------------------------------------
+// CompileTask::print_inlining
+void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) {
+ // 1234567
+ st->print(" "); // print timestamp
+ // 1234
+ st->print(" "); // print compilation number
+
+ // method attributes
+ if (method->is_loaded()) {
+ const char sync_char = method->is_synchronized() ? 's' : ' ';
+ const char exception_char = method->has_exception_handlers() ? '!' : ' ';
+ const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' ';
+
+ // print method attributes
+ st->print(" %c%c%c ", sync_char, exception_char, monitors_char);
+ } else {
+ // %s!bn
+ st->print(" "); // print method attributes
+ }
+
+ if (TieredCompilation) {
+ st->print(" ");
+ }
+ st->print(" "); // more indent
+ st->print(" "); // initial inlining indent
+
+ for (int i = 0; i < inline_level; i++) st->print(" ");
+
+ st->print("@ %d ", bci); // print bci
+ method->print_short_name(st);
+ if (method->is_loaded())
+ st->print(" (%d bytes)", method->code_size());
+ else
+ st->print(" (not loaded)");
+
+ if (msg != NULL) {
+ st->print(" %s", msg);
+ }
+ st->cr();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/compiler/compileTask.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 1998, 2015, 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.
+ *
+ */
+
+#ifndef SHARE_VM_COMPILER_COMPILETASK_HPP
+#define SHARE_VM_COMPILER_COMPILETASK_HPP
+
+#include "code/nmethod.hpp"
+#include "ci/ciMethod.hpp"
+#include "compiler/compileLog.hpp"
+#include "memory/allocation.inline.hpp"
+#include "utilities/xmlstream.hpp"
+
+// CompileTask
+//
+// An entry in the compile queue. It represents a pending or current
+// compilation.
+
+class CompileTask : public CHeapObj<mtCompiler> {
+ friend class VMStructs;
+
+ private:
+ static CompileTask* _task_free_list;
+#ifdef ASSERT
+ static int _num_allocated_tasks;
+#endif
+
+ Monitor* _lock;
+ uint _compile_id;
+ Method* _method;
+ jobject _method_holder;
+ int _osr_bci;
+ bool _is_complete;
+ bool _is_success;
+ bool _is_blocking;
+ int _comp_level;
+ int _num_inlined_bytecodes;
+ nmethodLocker* _code_handle; // holder of eventual result
+ CompileTask* _next, *_prev;
+ bool _is_free;
+ // Fields used for logging why the compilation was initiated:
+ jlong _time_queued; // in units of os::elapsed_counter()
+ Method* _hot_method; // which method actually triggered this task
+ jobject _hot_method_holder;
+ int _hot_count; // information about its invocation counter
+ const char* _comment; // more info about the task
+ const char* _failure_reason;
+
+ public:
+ CompileTask() {
+ _lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock");
+ }
+
+ void initialize(int compile_id, methodHandle method, int osr_bci, int comp_level,
+ methodHandle hot_method, int hot_count, const char* comment,
+ bool is_blocking);
+
+ static CompileTask* allocate();
+ static void free(CompileTask* task);
+
+ int compile_id() const { return _compile_id; }
+ Method* method() const { return _method; }
+ Method* hot_method() const { return _hot_method; }
+ int osr_bci() const { return _osr_bci; }
+ bool is_complete() const { return _is_complete; }
+ bool is_blocking() const { return _is_blocking; }
+ bool is_success() const { return _is_success; }
+
+ nmethodLocker* code_handle() const { return _code_handle; }
+ void set_code_handle(nmethodLocker* l) { _code_handle = l; }
+ nmethod* code() const; // _code_handle->code()
+ void set_code(nmethod* nm); // _code_handle->set_code(nm)
+
+ Monitor* lock() const { return _lock; }
+
+ void mark_complete() { _is_complete = true; }
+ void mark_success() { _is_success = true; }
+
+ int comp_level() { return _comp_level;}
+ void set_comp_level(int comp_level) { _comp_level = comp_level;}
+
+ int num_inlined_bytecodes() const { return _num_inlined_bytecodes; }
+ void set_num_inlined_bytecodes(int n) { _num_inlined_bytecodes = n; }
+
+ CompileTask* next() const { return _next; }
+ void set_next(CompileTask* next) { _next = next; }
+ CompileTask* prev() const { return _prev; }
+ void set_prev(CompileTask* prev) { _prev = prev; }
+ bool is_free() const { return _is_free; }
+ void set_is_free(bool val) { _is_free = val; }
+
+ // RedefineClasses support
+ void metadata_do(void f(Metadata*));
+ void mark_on_stack();
+
+private:
+ static void print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
+ bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false,
+ const char* msg = NULL, bool short_form = false, bool cr = true);
+
+public:
+ void print(outputStream* st = tty, const char* msg = NULL, bool short_form = false, bool cr = true);
+ static void print(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true) {
+ print_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
+ nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,
+ msg, short_form, cr);
+ }
+
+ static void print_inline_indent(int inline_level, outputStream* st = tty);
+
+ void print_tty();
+ void print_line_on_error(outputStream* st, char* buf, int buflen);
+
+ void log_task(xmlStream* log);
+ void log_task_queued();
+ void log_task_start(CompileLog* log);
+ void log_task_done(CompileLog* log);
+
+ void set_failure_reason(const char* reason) {
+ _failure_reason = reason;
+ }
+
+ bool check_break_at_flags();
+
+ static void print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL);
+ static void print_inlining_tty(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
+ print_inlining_inner(tty, method, inline_level, bci, msg);
+ }
+};
+
+#endif // SHARE_VM_COMPILER_COMPILETASK_HPP
--- a/hotspot/src/share/vm/gc/cms/cmsOopClosures.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/cmsOopClosures.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -66,7 +66,8 @@
virtual void do_klass(Klass* k);
void do_klass_nv(Klass* k);
- virtual void do_class_loader_data(ClassLoaderData* cld);
+ virtual void do_cld(ClassLoaderData* cld) { do_cld_nv(cld); }
+ void do_cld_nv(ClassLoaderData* cld);
};
class MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure {
--- a/hotspot/src/share/vm/gc/cms/cmsOopClosures.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/cmsOopClosures.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -50,11 +50,11 @@
inline void MetadataAwareOopsInGenClosure::do_klass_nv(Klass* k) {
ClassLoaderData* cld = k->class_loader_data();
- do_class_loader_data(cld);
+ do_cld_nv(cld);
}
inline void MetadataAwareOopsInGenClosure::do_klass(Klass* k) { do_klass_nv(k); }
-inline void MetadataAwareOopsInGenClosure::do_class_loader_data(ClassLoaderData* cld) {
+inline void MetadataAwareOopsInGenClosure::do_cld_nv(ClassLoaderData* cld) {
assert(_klass_closure._oop_closure == this, "Must be");
bool claim = true; // Must claim the class loader data before processing.
--- a/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -702,7 +702,7 @@
!_cfls->CompactibleFreeListSpace::obj_allocated_since_save_marks( \
oop(bottom)) && \
!_collector->CMSCollector::is_dead_obj(oop(bottom))) { \
- size_t word_sz = oop(bottom)->oop_iterate(cl, mr); \
+ size_t word_sz = oop(bottom)->oop_iterate_size(cl, mr); \
bottom += _cfls->adjustObjectSize(word_sz); \
} else { \
bottom += _cfls->CompactibleFreeListSpace::block_size(bottom); \
@@ -729,7 +729,7 @@
!_cfls->CompactibleFreeListSpace::obj_allocated_since_save_marks( \
oop(bottom)) && \
!_collector->CMSCollector::is_dead_obj(oop(bottom))) { \
- size_t word_sz = oop(bottom)->oop_iterate(cl, mr); \
+ size_t word_sz = oop(bottom)->oop_iterate_size(cl, mr); \
bottom += _cfls->adjustObjectSize(word_sz); \
} else { \
bottom += _cfls->CompactibleFreeListSpace::block_size_nopar(bottom); \
@@ -2989,7 +2989,7 @@
assert(task_size > CardTableModRefBS::card_size_in_words &&
(task_size % CardTableModRefBS::card_size_in_words == 0),
"Otherwise arithmetic below would be incorrect");
- MemRegion span = _gen->reserved();
+ MemRegion span = _old_gen->reserved();
if (low != NULL) {
if (span.contains(low)) {
// Align low down to a card boundary so that
--- a/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/compactibleFreeListSpace.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -99,7 +99,7 @@
BlockOffsetArrayNonContigSpace _bt;
CMSCollector* _collector;
- ConcurrentMarkSweepGeneration* _gen;
+ ConcurrentMarkSweepGeneration* _old_gen;
// Data structures for free blocks (used during allocation/sweeping)
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -212,7 +212,7 @@
use_adaptive_freelists,
dictionaryChoice);
NOT_PRODUCT(debug_cms_space = _cmsSpace;)
- _cmsSpace->_gen = this;
+ _cmsSpace->_old_gen = this;
_gc_stats = new CMSGCStats();
@@ -359,13 +359,13 @@
(size_t) _cms_gen->gc_stats()->avg_promoted()->padded_average());
if (cms_free > expected_promotion) {
// Start a cms collection if there isn't enough space to promote
- // for the next minor collection. Use the padded average as
+ // for the next young collection. Use the padded average as
// a safety factor.
cms_free -= expected_promotion;
// Adjust by the safety factor.
double cms_free_dbl = (double)cms_free;
- double cms_adjustment = (100.0 - CMSIncrementalSafetyFactor)/100.0;
+ double cms_adjustment = (100.0 - CMSIncrementalSafetyFactor) / 100.0;
// Apply a further correction factor which tries to adjust
// for recent occurance of concurrent mode failures.
cms_adjustment = cms_adjustment * cms_free_adjustment_factor(cms_free);
@@ -531,7 +531,7 @@
if (CMSConcurrentMTEnabled) {
if (FLAG_IS_DEFAULT(ConcGCThreads)) {
// just for now
- FLAG_SET_DEFAULT(ConcGCThreads, (ParallelGCThreads + 3)/4);
+ FLAG_SET_DEFAULT(ConcGCThreads, (ParallelGCThreads + 3) / 4);
}
if (ConcGCThreads > 1) {
_conc_workers = new YieldingFlexibleWorkGang("CMS Thread",
@@ -592,7 +592,7 @@
_cmsGen ->init_initiating_occupancy(CMSInitiatingOccupancyFraction, CMSTriggerRatio);
// Clip CMSBootstrapOccupancy between 0 and 100.
- _bootstrap_occupancy = ((double)CMSBootstrapOccupancy)/(double)100;
+ _bootstrap_occupancy = CMSBootstrapOccupancy / 100.0;
// Now tell CMS generations the identity of their collector
ConcurrentMarkSweepGeneration::set_collector(this);
@@ -613,7 +613,7 @@
_end_addr = gch->end_addr();
assert(_young_gen != NULL, "no _young_gen");
_eden_chunk_index = 0;
- _eden_chunk_capacity = (_young_gen->max_capacity()+CMSSamplingGrain)/CMSSamplingGrain;
+ _eden_chunk_capacity = (_young_gen->max_capacity() + CMSSamplingGrain) / CMSSamplingGrain;
_eden_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, _eden_chunk_capacity, mtGC);
}
@@ -795,29 +795,22 @@
size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
gclog_or_tty->print_cr("\nFrom compute_new_size: ");
gclog_or_tty->print_cr(" Free fraction %f", free_percentage);
- gclog_or_tty->print_cr(" Desired free fraction %f",
- desired_free_percentage);
- gclog_or_tty->print_cr(" Maximum free fraction %f",
- maximum_free_percentage);
- gclog_or_tty->print_cr(" Capacity " SIZE_FORMAT, capacity()/1000);
- gclog_or_tty->print_cr(" Desired capacity " SIZE_FORMAT,
- desired_capacity/1000);
+ gclog_or_tty->print_cr(" Desired free fraction %f", desired_free_percentage);
+ gclog_or_tty->print_cr(" Maximum free fraction %f", maximum_free_percentage);
+ gclog_or_tty->print_cr(" Capacity " SIZE_FORMAT, capacity() / 1000);
+ gclog_or_tty->print_cr(" Desired capacity " SIZE_FORMAT, desired_capacity / 1000);
GenCollectedHeap* gch = GenCollectedHeap::heap();
assert(gch->is_old_gen(this), "The CMS generation should always be the old generation");
size_t young_size = gch->young_gen()->capacity();
gclog_or_tty->print_cr(" Young gen size " SIZE_FORMAT, young_size / 1000);
- gclog_or_tty->print_cr(" unsafe_max_alloc_nogc " SIZE_FORMAT,
- unsafe_max_alloc_nogc()/1000);
- gclog_or_tty->print_cr(" contiguous available " SIZE_FORMAT,
- contiguous_available()/1000);
- gclog_or_tty->print_cr(" Expand by " SIZE_FORMAT " (bytes)",
- expand_bytes);
+ gclog_or_tty->print_cr(" unsafe_max_alloc_nogc " SIZE_FORMAT, unsafe_max_alloc_nogc() / 1000);
+ gclog_or_tty->print_cr(" contiguous available " SIZE_FORMAT, contiguous_available() / 1000);
+ gclog_or_tty->print_cr(" Expand by " SIZE_FORMAT " (bytes)", expand_bytes);
}
// safe if expansion fails
expand_for_gc_cause(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio);
if (PrintGCDetails && Verbose) {
- gclog_or_tty->print_cr(" Expanded free fraction %f",
- ((double) free()) / capacity());
+ gclog_or_tty->print_cr(" Expanded free fraction %f", ((double) free()) / capacity());
}
} else {
size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
@@ -834,16 +827,14 @@
return cmsSpace()->freelistLock();
}
-HeapWord* ConcurrentMarkSweepGeneration::allocate(size_t size,
- bool tlab) {
+HeapWord* ConcurrentMarkSweepGeneration::allocate(size_t size, bool tlab) {
CMSSynchronousYieldRequest yr;
- MutexLockerEx x(freelistLock(),
- Mutex::_no_safepoint_check_flag);
+ MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
return have_lock_and_allocate(size, tlab);
}
HeapWord* ConcurrentMarkSweepGeneration::have_lock_and_allocate(size_t size,
- bool tlab /* ignored */) {
+ bool tlab /* ignored */) {
assert_lock_strong(freelistLock());
size_t adjustedSize = CompactibleFreeListSpace::adjustObjectSize(size);
HeapWord* res = cmsSpace()->allocate(adjustedSize);
@@ -2426,7 +2417,7 @@
gch->gen_process_roots(&srs,
GenCollectedHeap::OldGen,
- true, // younger gens are roots
+ true, // young gen as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
@@ -2498,7 +2489,7 @@
gch->gen_process_roots(&srs,
GenCollectedHeap::OldGen,
- true, // younger gens are roots
+ true, // young gen as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
@@ -2952,12 +2943,7 @@
assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped");
assert(_collectorState == InitialMarking, "just checking");
- // If there has not been a GC[n-1] since last GC[n] cycle completed,
- // precede our marking with a collection of all
- // younger generations to keep floating garbage to a minimum.
- // XXX: we won't do this for now -- it's an optimization to be done later.
-
- // already have locks
+ // Already have locks.
assert_lock_strong(bitMapLock());
assert(_markBitMap.isAllClear(), "was reset at end of previous cycle");
@@ -3027,7 +3013,7 @@
gch->gen_process_roots(&srs,
GenCollectedHeap::OldGen,
- true, // younger gens are roots
+ true, // young gen as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
@@ -3037,7 +3023,7 @@
}
// Clear mod-union table; it will be dirtied in the prologue of
- // CMS generation per each younger generation collection.
+ // CMS generation per each young generation collection.
assert(_modUnionTable.isAllClear(),
"Was cleared in most recent final checkpoint phase"
@@ -3057,7 +3043,7 @@
// assert(!SafepointSynchronize::is_at_safepoint(),
// "inconsistent argument?");
// However that wouldn't be right, because it's possible that
- // a safepoint is indeed in progress as a younger generation
+ // a safepoint is indeed in progress as a young generation
// stop-the-world GC happens even as we mark in this generation.
assert(_collectorState == Marking, "inconsistent state?");
check_correct_thread_executing();
@@ -3065,7 +3051,7 @@
// Weak ref discovery note: We may be discovering weak
// refs in this generation concurrent (but interleaved) with
- // weak ref discovery by a younger generation collector.
+ // weak ref discovery by the young generation collector.
CMSTokenSyncWithLocks ts(true, bitMapLock());
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
@@ -3095,7 +3081,7 @@
// Note that when we do a marking step we need to hold the
// bit map lock -- recall that direct allocation (by mutators)
- // and promotion (by younger generation collectors) is also
+ // and promotion (by the young generation collector) is also
// marking the bit map. [the so-called allocate live policy.]
// Because the implementation of bit map marking is not
// robust wrt simultaneous marking of bits in the same word,
@@ -4049,7 +4035,7 @@
// one of these methods, please check the other method too.
size_t CMSCollector::preclean_mod_union_table(
- ConcurrentMarkSweepGeneration* gen,
+ ConcurrentMarkSweepGeneration* old_gen,
ScanMarkedObjectsAgainCarefullyClosure* cl) {
verify_work_stacks_empty();
verify_overflow_empty();
@@ -4064,10 +4050,10 @@
// generation, but we might potentially miss cards when the
// generation is rapidly expanding while we are in the midst
// of precleaning.
- HeapWord* startAddr = gen->reserved().start();
- HeapWord* endAddr = gen->reserved().end();
-
- cl->setFreelistLock(gen->freelistLock()); // needed for yielding
+ HeapWord* startAddr = old_gen->reserved().start();
+ HeapWord* endAddr = old_gen->reserved().end();
+
+ cl->setFreelistLock(old_gen->freelistLock()); // needed for yielding
size_t numDirtyCards, cumNumDirtyCards;
HeapWord *nextAddr, *lastAddr;
@@ -4109,7 +4095,7 @@
HeapWord* stop_point = NULL;
stopTimer();
// Potential yield point
- CMSTokenSyncWithLocks ts(true, gen->freelistLock(),
+ CMSTokenSyncWithLocks ts(true, old_gen->freelistLock(),
bitMapLock());
startTimer();
{
@@ -4117,7 +4103,7 @@
verify_overflow_empty();
sample_eden();
stop_point =
- gen->cmsSpace()->object_iterate_careful_m(dirtyRegion, cl);
+ old_gen->cmsSpace()->object_iterate_careful_m(dirtyRegion, cl);
}
if (stop_point != NULL) {
// The careful iteration stopped early either because it found an
@@ -4152,15 +4138,15 @@
// below are largely identical; if you need to modify
// one of these methods, please check the other method too.
-size_t CMSCollector::preclean_card_table(ConcurrentMarkSweepGeneration* gen,
+size_t CMSCollector::preclean_card_table(ConcurrentMarkSweepGeneration* old_gen,
ScanMarkedObjectsAgainCarefullyClosure* cl) {
// strategy: it's similar to precleamModUnionTable above, in that
// we accumulate contiguous ranges of dirty cards, mark these cards
// precleaned, then scan the region covered by these cards.
- HeapWord* endAddr = (HeapWord*)(gen->_virtual_space.high());
- HeapWord* startAddr = (HeapWord*)(gen->_virtual_space.low());
-
- cl->setFreelistLock(gen->freelistLock()); // needed for yielding
+ HeapWord* endAddr = (HeapWord*)(old_gen->_virtual_space.high());
+ HeapWord* startAddr = (HeapWord*)(old_gen->_virtual_space.low());
+
+ cl->setFreelistLock(old_gen->freelistLock()); // needed for yielding
size_t numDirtyCards, cumNumDirtyCards;
HeapWord *lastAddr, *nextAddr;
@@ -4197,13 +4183,13 @@
if (!dirtyRegion.is_empty()) {
stopTimer();
- CMSTokenSyncWithLocks ts(true, gen->freelistLock(), bitMapLock());
+ CMSTokenSyncWithLocks ts(true, old_gen->freelistLock(), bitMapLock());
startTimer();
sample_eden();
verify_work_stacks_empty();
verify_overflow_empty();
HeapWord* stop_point =
- gen->cmsSpace()->object_iterate_careful_m(dirtyRegion, cl);
+ old_gen->cmsSpace()->object_iterate_careful_m(dirtyRegion, cl);
if (stop_point != NULL) {
assert((_collectorState == AbortablePreclean && should_abort_preclean()),
"Should only be AbortablePreclean.");
@@ -4623,7 +4609,7 @@
ResourceMark rm;
GrowableArray<ClassLoaderData*>* array = ClassLoaderDataGraph::new_clds();
for (int i = 0; i < array->length(); i++) {
- par_mrias_cl.do_class_loader_data(array->at(i));
+ par_mrias_cl.do_cld_nv(array->at(i));
}
// We don't need to keep track of new CLDs anymore.
@@ -5086,7 +5072,7 @@
// preclean phase did of eden, plus the [two] tasks of
// scanning the [two] survivor spaces. Further fine-grain
// parallelization of the scanning of the survivor spaces
- // themselves, and of precleaning of the younger gen itself
+ // themselves, and of precleaning of the young gen itself
// is deferred to the future.
initialize_sequential_subtasks_for_young_gen_rescan(n_workers);
@@ -5177,7 +5163,7 @@
gch->gen_process_roots(&srs,
GenCollectedHeap::OldGen,
- true, // younger gens as roots
+ true, // young gen as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
&mrias_cl,
@@ -5199,7 +5185,7 @@
ResourceMark rm;
GrowableArray<ClassLoaderData*>* array = ClassLoaderDataGraph::new_clds();
for (int i = 0; i < array->length(); i++) {
- mrias_cl.do_class_loader_data(array->at(i));
+ mrias_cl.do_cld_nv(array->at(i));
}
// We don't need to keep track of new CLDs anymore.
@@ -5661,7 +5647,7 @@
}
}
-void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen) {
+void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* old_gen) {
// We iterate over the space(s) underlying this generation,
// checking the mark bit map to see if the bits corresponding
// to specific blocks are marked or not. Blocks that are
@@ -5690,26 +5676,26 @@
// check that we hold the requisite locks
assert(have_cms_token(), "Should hold cms token");
assert(ConcurrentMarkSweepThread::cms_thread_has_cms_token(), "Should possess CMS token to sweep");
- assert_lock_strong(gen->freelistLock());
+ assert_lock_strong(old_gen->freelistLock());
assert_lock_strong(bitMapLock());
assert(!_inter_sweep_timer.is_active(), "Was switched off in an outer context");
assert(_intra_sweep_timer.is_active(), "Was switched on in an outer context");
- gen->cmsSpace()->beginSweepFLCensus((float)(_inter_sweep_timer.seconds()),
- _inter_sweep_estimate.padded_average(),
- _intra_sweep_estimate.padded_average());
- gen->setNearLargestChunk();
+ old_gen->cmsSpace()->beginSweepFLCensus((float)(_inter_sweep_timer.seconds()),
+ _inter_sweep_estimate.padded_average(),
+ _intra_sweep_estimate.padded_average());
+ old_gen->setNearLargestChunk();
{
- SweepClosure sweepClosure(this, gen, &_markBitMap, CMSYield);
- gen->cmsSpace()->blk_iterate_careful(&sweepClosure);
+ SweepClosure sweepClosure(this, old_gen, &_markBitMap, CMSYield);
+ old_gen->cmsSpace()->blk_iterate_careful(&sweepClosure);
// We need to free-up/coalesce garbage/blocks from a
// co-terminal free run. This is done in the SweepClosure
// destructor; so, do not remove this scope, else the
// end-of-sweep-census below will be off by a little bit.
}
- gen->cmsSpace()->sweep_completed();
- gen->cmsSpace()->endSweepFLCensus(sweep_count());
+ old_gen->cmsSpace()->sweep_completed();
+ old_gen->cmsSpace()->endSweepFLCensus(sweep_count());
if (should_unload_classes()) { // unloaded classes this cycle,
_concurrent_cycles_since_last_unload = 0; // ... reset count
} else { // did not unload classes,
@@ -6324,12 +6310,12 @@
// objArrays are precisely marked; restrict scanning
// to dirty cards only.
size = CompactibleFreeListSpace::adjustObjectSize(
- p->oop_iterate(_scanningClosure, mr));
+ p->oop_iterate_size(_scanningClosure, mr));
} else {
// A non-array may have been imprecisely marked; we need
// to scan object in its entirety.
size = CompactibleFreeListSpace::adjustObjectSize(
- p->oop_iterate(_scanningClosure));
+ p->oop_iterate_size(_scanningClosure));
}
#ifdef ASSERT
size_t direct_size =
@@ -6417,7 +6403,7 @@
// Note that we do not yield while we iterate over
// the interior oops of p, pushing the relevant ones
// on our marking stack.
- size_t size = p->oop_iterate(_scanning_closure);
+ size_t size = p->oop_iterate_size(_scanning_closure);
do_yield_check();
// Observe that below, we do not abandon the preclean
// phase as soon as we should; rather we empty the
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -723,7 +723,7 @@
private:
// Support for parallelizing young gen rescan in CMS remark phase
- ParNewGeneration* _young_gen; // the younger gen
+ ParNewGeneration* _young_gen;
HeapWord** _top_addr; // ... Top of Eden
HeapWord** _end_addr; // ... End of Eden
@@ -772,9 +772,9 @@
private:
// Concurrent precleaning work
- size_t preclean_mod_union_table(ConcurrentMarkSweepGeneration* gen,
+ size_t preclean_mod_union_table(ConcurrentMarkSweepGeneration* old_gen,
ScanMarkedObjectsAgainCarefullyClosure* cl);
- size_t preclean_card_table(ConcurrentMarkSweepGeneration* gen,
+ size_t preclean_card_table(ConcurrentMarkSweepGeneration* old_gen,
ScanMarkedObjectsAgainCarefullyClosure* cl);
// Does precleaning work, returning a quantity indicative of
// the amount of "useful work" done.
@@ -797,7 +797,7 @@
void refProcessingWork();
// Concurrent sweeping work
- void sweepWork(ConcurrentMarkSweepGeneration* gen);
+ void sweepWork(ConcurrentMarkSweepGeneration* old_gen);
// (Concurrent) resetting of support data structures
void reset(bool concurrent);
@@ -1120,10 +1120,8 @@
MemRegion used_region_at_save_marks() const;
// Does a "full" (forced) collection invoked on this generation collect
- // all younger generations as well? Note that the second conjunct is a
- // hack to allow the collection of the younger gen first if the flag is
- // set.
- virtual bool full_collects_younger_generations() const {
+ // the young generation as well?
+ virtual bool full_collects_young_generation() const {
return !ScavengeBeforeFullGC;
}
@@ -1153,9 +1151,8 @@
virtual bool promotion_attempt_is_safe(size_t promotion_in_bytes) const;
- // Inform this (non-young) generation that a promotion failure was
- // encountered during a collection of a younger generation that
- // promotes into this generation.
+ // Inform this (old) generation that a promotion failure was
+ // encountered during a collection of the young generation.
virtual void promotion_failure_occurred();
bool should_collect(bool full, size_t size, bool tlab);
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -295,7 +295,7 @@
promoted_bytes = _cms_used_at_gc0_end - _cms_used_at_gc0_begin;
}
- // If the younger gen collections were skipped, then the
+ // If the young gen collection was skipped, then the
// number of promoted bytes will be 0 and adding it to the
// average will incorrectly lessen the average. It is, however,
// also possible that no promotion was needed.
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepThread.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepThread.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -39,23 +39,17 @@
// ======= Concurrent Mark Sweep Thread ========
-// The CMS thread is created when Concurrent Mark Sweep is used in the
-// older of two generations in a generational memory system.
+ConcurrentMarkSweepThread* ConcurrentMarkSweepThread::_cmst = NULL;
+CMSCollector* ConcurrentMarkSweepThread::_collector = NULL;
+bool ConcurrentMarkSweepThread::_should_terminate = false;
+int ConcurrentMarkSweepThread::_CMS_flag = CMS_nil;
-ConcurrentMarkSweepThread*
- ConcurrentMarkSweepThread::_cmst = NULL;
-CMSCollector* ConcurrentMarkSweepThread::_collector = NULL;
-bool ConcurrentMarkSweepThread::_should_terminate = false;
-int ConcurrentMarkSweepThread::_CMS_flag = CMS_nil;
+volatile jint ConcurrentMarkSweepThread::_pending_yields = 0;
-volatile jint ConcurrentMarkSweepThread::_pending_yields = 0;
-
-SurrogateLockerThread*
- ConcurrentMarkSweepThread::_slt = NULL;
+SurrogateLockerThread* ConcurrentMarkSweepThread::_slt = NULL;
SurrogateLockerThread::SLT_msg_type
ConcurrentMarkSweepThread::_sltBuffer = SurrogateLockerThread::empty;
-Monitor*
- ConcurrentMarkSweepThread::_sltMonitor = NULL;
+Monitor* ConcurrentMarkSweepThread::_sltMonitor = NULL;
ConcurrentMarkSweepThread::ConcurrentMarkSweepThread(CMSCollector* collector)
: ConcurrentGCThread() {
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -69,20 +69,28 @@
Stack<oop, mtGC>* overflow_stacks_,
size_t desired_plab_sz_,
ParallelTaskTerminator& term_) :
- _to_space(to_space_), _old_gen(old_gen_), _young_gen(young_gen_), _thread_num(thread_num_),
- _work_queue(work_queue_set_->queue(thread_num_)), _to_space_full(false),
+ _to_space(to_space_),
+ _old_gen(old_gen_),
+ _young_gen(young_gen_),
+ _thread_num(thread_num_),
+ _work_queue(work_queue_set_->queue(thread_num_)),
+ _to_space_full(false),
_overflow_stack(overflow_stacks_ ? overflow_stacks_ + thread_num_ : NULL),
_ageTable(false), // false ==> not the global age table, no perf data.
_to_space_alloc_buffer(desired_plab_sz_),
- _to_space_closure(young_gen_, this), _old_gen_closure(young_gen_, this),
- _to_space_root_closure(young_gen_, this), _old_gen_root_closure(young_gen_, this),
+ _to_space_closure(young_gen_, this),
+ _old_gen_closure(young_gen_, this),
+ _to_space_root_closure(young_gen_, this),
+ _old_gen_root_closure(young_gen_, this),
_older_gen_closure(young_gen_, this),
_evacuate_followers(this, &_to_space_closure, &_old_gen_closure,
&_to_space_root_closure, young_gen_, &_old_gen_root_closure,
work_queue_set_, &term_),
- _is_alive_closure(young_gen_), _scan_weak_ref_closure(young_gen_, this),
+ _is_alive_closure(young_gen_),
+ _scan_weak_ref_closure(young_gen_, this),
_keep_alive_closure(&_scan_weak_ref_closure),
- _strong_roots_time(0.0), _term_time(0.0)
+ _strong_roots_time(0.0),
+ _term_time(0.0)
{
#if TASKQUEUE_STATS
_term_attempts = 0;
@@ -90,8 +98,7 @@
_overflow_refill_objs = 0;
#endif // TASKQUEUE_STATS
- _survivor_chunk_array =
- (ChunkArray*) old_gen()->get_data_recorder(thread_num());
+ _survivor_chunk_array = (ChunkArray*) old_gen()->get_data_recorder(thread_num());
_hash_seed = 17; // Might want to take time-based random value.
_start = os::elapsedTime();
_old_gen_closure.set_generation(old_gen_);
@@ -154,7 +161,6 @@
}
}
-
void ParScanThreadState::trim_queues(int max_size) {
ObjToScanQueue* queue = work_queue();
do {
@@ -222,15 +228,12 @@
}
HeapWord* ParScanThreadState::alloc_in_to_space_slow(size_t word_sz) {
-
- // Otherwise, if the object is small enough, try to reallocate the
- // buffer.
+ // If the object is small enough, try to reallocate the buffer.
HeapWord* obj = NULL;
if (!_to_space_full) {
PLAB* const plab = to_space_alloc_buffer();
- Space* const sp = to_space();
- if (word_sz * 100 <
- ParallelGCBufferWastePct * plab->word_sz()) {
+ Space* const sp = to_space();
+ if (word_sz * 100 < ParallelGCBufferWastePct * plab->word_sz()) {
// Is small enough; abandon this buffer and start a new one.
plab->retire();
size_t buf_size = plab->word_sz();
@@ -241,8 +244,7 @@
size_t free_bytes = sp->free();
while(buf_space == NULL && free_bytes >= min_bytes) {
buf_size = free_bytes >> LogHeapWordSize;
- assert(buf_size == (size_t)align_object_size(buf_size),
- "Invariant");
+ assert(buf_size == (size_t)align_object_size(buf_size), "Invariant");
buf_space = sp->par_allocate(buf_size);
free_bytes = sp->free();
}
@@ -262,7 +264,6 @@
// We're used up.
_to_space_full = true;
}
-
} else {
// Too large; allocate the object individually.
obj = sp->par_allocate(word_sz);
@@ -271,7 +272,6 @@
return obj;
}
-
void ParScanThreadState::undo_alloc_in_to_space(HeapWord* obj, size_t word_sz) {
to_space_alloc_buffer()->undo_allocation(obj, word_sz);
}
@@ -288,7 +288,7 @@
// Initializes states for the specified number of threads;
ParScanThreadStateSet(int num_threads,
Space& to_space,
- ParNewGeneration& gen,
+ ParNewGeneration& young_gen,
Generation& old_gen,
ObjToScanQueueSet& queue_set,
Stack<oop, mtGC>* overflow_stacks_,
@@ -315,21 +315,25 @@
private:
ParallelTaskTerminator& _term;
- ParNewGeneration& _gen;
+ ParNewGeneration& _young_gen;
Generation& _old_gen;
public:
bool is_valid(int id) const { return id < length(); }
ParallelTaskTerminator* terminator() { return &_term; }
};
-
-ParScanThreadStateSet::ParScanThreadStateSet(
- int num_threads, Space& to_space, ParNewGeneration& gen,
- Generation& old_gen, ObjToScanQueueSet& queue_set,
- Stack<oop, mtGC>* overflow_stacks,
- size_t desired_plab_sz, ParallelTaskTerminator& term)
+ParScanThreadStateSet::ParScanThreadStateSet(int num_threads,
+ Space& to_space,
+ ParNewGeneration& young_gen,
+ Generation& old_gen,
+ ObjToScanQueueSet& queue_set,
+ Stack<oop, mtGC>* overflow_stacks,
+ size_t desired_plab_sz,
+ ParallelTaskTerminator& term)
: ResourceArray(sizeof(ParScanThreadState), num_threads),
- _gen(gen), _old_gen(old_gen), _term(term)
+ _young_gen(young_gen),
+ _old_gen(old_gen),
+ _term(term)
{
assert(num_threads > 0, "sanity check!");
assert(ParGCUseLocalOverflow == (overflow_stacks != NULL),
@@ -337,13 +341,12 @@
// Initialize states.
for (int i = 0; i < num_threads; ++i) {
new ((ParScanThreadState*)_data + i)
- ParScanThreadState(&to_space, &gen, &old_gen, i, &queue_set,
+ ParScanThreadState(&to_space, &young_gen, &old_gen, i, &queue_set,
overflow_stacks, desired_plab_sz, term);
}
}
-inline ParScanThreadState& ParScanThreadStateSet::thread_state(int i)
-{
+inline ParScanThreadState& ParScanThreadStateSet::thread_state(int i) {
assert(i >= 0 && i < length(), "sanity check!");
return ((ParScanThreadState*)_data)[i];
}
@@ -357,8 +360,7 @@
}
}
-void ParScanThreadStateSet::reset(uint active_threads, bool promotion_failed)
-{
+void ParScanThreadStateSet::reset(uint active_threads, bool promotion_failed) {
_term.reset_for_reuse(active_threads);
if (promotion_failed) {
for (int i = 0; i < length(); ++i) {
@@ -368,36 +370,27 @@
}
#if TASKQUEUE_STATS
-void
-ParScanThreadState::reset_stats()
-{
+void ParScanThreadState::reset_stats() {
taskqueue_stats().reset();
_term_attempts = 0;
_overflow_refills = 0;
_overflow_refill_objs = 0;
}
-void ParScanThreadStateSet::reset_stats()
-{
+void ParScanThreadStateSet::reset_stats() {
for (int i = 0; i < length(); ++i) {
thread_state(i).reset_stats();
}
}
-void
-ParScanThreadStateSet::print_termination_stats_hdr(outputStream* const st)
-{
+void ParScanThreadStateSet::print_termination_stats_hdr(outputStream* const st) {
st->print_raw_cr("GC Termination Stats");
- st->print_raw_cr(" elapsed --strong roots-- "
- "-------termination-------");
- st->print_raw_cr("thr ms ms % "
- " ms % attempts");
- st->print_raw_cr("--- --------- --------- ------ "
- "--------- ------ --------");
+ st->print_raw_cr(" elapsed --strong roots-- -------termination-------");
+ st->print_raw_cr("thr ms ms % ms % attempts");
+ st->print_raw_cr("--- --------- --------- ------ --------- ------ --------");
}
-void ParScanThreadStateSet::print_termination_stats(outputStream* const st)
-{
+void ParScanThreadStateSet::print_termination_stats(outputStream* const st) {
print_termination_stats_hdr(st);
for (int i = 0; i < length(); ++i) {
@@ -405,23 +398,20 @@
const double elapsed_ms = pss.elapsed_time() * 1000.0;
const double s_roots_ms = pss.strong_roots_time() * 1000.0;
const double term_ms = pss.term_time() * 1000.0;
- st->print_cr("%3d %9.2f %9.2f %6.2f "
- "%9.2f %6.2f " SIZE_FORMAT_W(8),
+ st->print_cr("%3d %9.2f %9.2f %6.2f %9.2f %6.2f " SIZE_FORMAT_W(8),
i, elapsed_ms, s_roots_ms, s_roots_ms * 100 / elapsed_ms,
term_ms, term_ms * 100 / elapsed_ms, pss.term_attempts());
}
}
// Print stats related to work queue activity.
-void ParScanThreadStateSet::print_taskqueue_stats_hdr(outputStream* const st)
-{
+void ParScanThreadStateSet::print_taskqueue_stats_hdr(outputStream* const st) {
st->print_raw_cr("GC Task Stats");
st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
}
-void ParScanThreadStateSet::print_taskqueue_stats(outputStream* const st)
-{
+void ParScanThreadStateSet::print_taskqueue_stats(outputStream* const st) {
print_taskqueue_stats_hdr(st);
TaskQueueStats totals;
@@ -443,8 +433,7 @@
}
#endif // TASKQUEUE_STATS
-void ParScanThreadStateSet::flush()
-{
+void ParScanThreadStateSet::flush() {
// Work in this loop should be kept as lightweight as
// possible since this might otherwise become a bottleneck
// to scaling. Should we add heavy-weight work into this
@@ -454,12 +443,12 @@
// Flush stats related to To-space PLAB activity and
// retire the last buffer.
- par_scan_state.to_space_alloc_buffer()->flush_and_retire_stats(_gen.plab_stats());
+ par_scan_state.to_space_alloc_buffer()->flush_and_retire_stats(_young_gen.plab_stats());
// Every thread has its own age table. We need to merge
// them all into one.
ageTable *local_table = par_scan_state.age_table();
- _gen.age_table()->merge(local_table);
+ _young_gen.age_table()->merge(local_table);
// Inform old gen that we're done.
_old_gen.par_promote_alloc_done(i);
@@ -478,8 +467,7 @@
ParScanClosure::ParScanClosure(ParNewGeneration* g,
ParScanThreadState* par_scan_state) :
- OopsInKlassOrGenClosure(g), _par_scan_state(par_scan_state), _g(g)
-{
+ OopsInKlassOrGenClosure(g), _par_scan_state(par_scan_state), _g(g) {
_boundary = _g->reserved().end();
}
@@ -531,24 +519,23 @@
ObjToScanQueue* work_q = par_scan_state()->work_queue();
while (true) {
-
// Scan to-space and old-gen objs until we run out of both.
oop obj_to_scan;
par_scan_state()->trim_queues(0);
// We have no local work, attempt to steal from other threads.
- // attempt to steal work from promoted.
+ // Attempt to steal work from promoted.
if (task_queues()->steal(par_scan_state()->thread_num(),
par_scan_state()->hash_seed(),
obj_to_scan)) {
bool res = work_q->push(obj_to_scan);
assert(res, "Empty queue should have room for a push.");
- // if successful, goto Start.
+ // If successful, goto Start.
continue;
- // try global overflow list.
+ // Try global overflow list.
} else if (par_gen()->take_from_overflow_list(par_scan_state())) {
continue;
}
@@ -564,15 +551,17 @@
par_scan_state()->end_term_time();
}
-ParNewGenTask::ParNewGenTask(ParNewGeneration* young_gen, Generation* old_gen,
- HeapWord* young_old_boundary, ParScanThreadStateSet* state_set,
+ParNewGenTask::ParNewGenTask(ParNewGeneration* young_gen,
+ Generation* old_gen,
+ HeapWord* young_old_boundary,
+ ParScanThreadStateSet* state_set,
StrongRootsScope* strong_roots_scope) :
AbstractGangTask("ParNewGeneration collection"),
_young_gen(young_gen), _old_gen(old_gen),
_young_old_boundary(young_old_boundary),
_state_set(state_set),
_strong_roots_scope(strong_roots_scope)
- {}
+{}
void ParNewGenTask::work(uint worker_id) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
@@ -595,8 +584,7 @@
par_scan_state.start_strong_roots();
gch->gen_process_roots(_strong_roots_scope,
GenCollectedHeap::YoungGen,
- true, // Process younger gens, if any,
- // as strong roots.
+ true, // Process younger gens, if any, as strong roots.
GenCollectedHeap::SO_ScavengeCodeCache,
GenCollectedHeap::StrongAndWeakRoots,
&par_scan_state.to_space_root_closure(),
@@ -613,8 +601,7 @@
#pragma warning( push )
#pragma warning( disable:4355 ) // 'this' : used in base member initializer list
#endif
-ParNewGeneration::
-ParNewGeneration(ReservedSpace rs, size_t initial_byte_size)
+ParNewGeneration::ParNewGeneration(ReservedSpace rs, size_t initial_byte_size)
: DefNewGeneration(rs, initial_byte_size, "PCopy"),
_overflow_list(NULL),
_is_alive_closure(this),
@@ -625,20 +612,19 @@
_task_queues = new ObjToScanQueueSet(ParallelGCThreads);
guarantee(_task_queues != NULL, "task_queues allocation failure.");
- for (uint i1 = 0; i1 < ParallelGCThreads; i1++) {
+ for (uint i = 0; i < ParallelGCThreads; i++) {
ObjToScanQueue *q = new ObjToScanQueue();
guarantee(q != NULL, "work_queue Allocation failure.");
- _task_queues->register_queue(i1, q);
+ _task_queues->register_queue(i, q);
}
- for (uint i2 = 0; i2 < ParallelGCThreads; i2++)
- _task_queues->queue(i2)->initialize();
+ for (uint i = 0; i < ParallelGCThreads; i++) {
+ _task_queues->queue(i)->initialize();
+ }
_overflow_stacks = NULL;
if (ParGCUseLocalOverflow) {
-
- // typedef to workaround NEW_C_HEAP_ARRAY macro, which can not deal
- // with ','
+ // typedef to workaround NEW_C_HEAP_ARRAY macro, which can not deal with ','
typedef Stack<oop, mtGC> GCOopStack;
_overflow_stacks = NEW_C_HEAP_ARRAY(GCOopStack, ParallelGCThreads, mtGC);
@@ -742,7 +728,7 @@
typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
public:
ParNewRefProcTaskProxy(ProcessTask& task,
- ParNewGeneration& gen,
+ ParNewGeneration& young_gen,
Generation& old_gen,
HeapWord* young_old_boundary,
ParScanThreadStateSet& state_set);
@@ -768,11 +754,9 @@
_old_gen(old_gen),
_young_old_boundary(young_old_boundary),
_state_set(state_set)
-{
-}
+{ }
-void ParNewRefProcTaskProxy::work(uint worker_id)
-{
+void ParNewRefProcTaskProxy::work(uint worker_id) {
ResourceMark rm;
HandleMark hm;
ParScanThreadState& par_scan_state = _state_set.thread_state(worker_id);
@@ -792,15 +776,12 @@
_task(task)
{ }
- virtual void work(uint worker_id)
- {
+ virtual void work(uint worker_id) {
_task.work(worker_id);
}
};
-
-void ParNewRefProcTaskExecutor::execute(ProcessTask& task)
-{
+void ParNewRefProcTaskExecutor::execute(ProcessTask& task) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
WorkGang* workers = gch->workers();
assert(workers != NULL, "Need parallel worker threads.");
@@ -812,8 +793,7 @@
_young_gen.promotion_failed());
}
-void ParNewRefProcTaskExecutor::execute(EnqueueTask& task)
-{
+void ParNewRefProcTaskExecutor::execute(EnqueueTask& task) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
WorkGang* workers = gch->workers();
assert(workers != NULL, "Need parallel worker threads.");
@@ -821,8 +801,7 @@
workers->run_task(&enq_task);
}
-void ParNewRefProcTaskExecutor::set_single_threaded_mode()
-{
+void ParNewRefProcTaskExecutor::set_single_threaded_mode() {
_state_set.flush();
GenCollectedHeap* gch = GenCollectedHeap::heap();
gch->save_marks();
@@ -830,7 +809,8 @@
ScanClosureWithParBarrier::
ScanClosureWithParBarrier(ParNewGeneration* g, bool gc_barrier) :
- ScanClosure(g, gc_barrier) {}
+ ScanClosure(g, gc_barrier)
+{ }
EvacuateFollowersClosureGeneral::
EvacuateFollowersClosureGeneral(GenCollectedHeap* gch,
@@ -838,7 +818,7 @@
OopsInGenClosure* older) :
_gch(gch),
_scan_cur_or_nonheap(cur), _scan_older(older)
-{}
+{ }
void EvacuateFollowersClosureGeneral::do_void() {
do {
@@ -850,7 +830,6 @@
} while (!_gch->no_allocs_since_save_marks());
}
-
// A Generation that does parallel young-gen collection.
void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set) {
@@ -996,9 +975,9 @@
if (ZapUnusedHeapArea) {
// This is now done here because of the piece-meal mangling which
// can check for valid mangling at intermediate points in the
- // collection(s). When a minor collection fails to collect
+ // collection(s). When a young collection fails to collect
// sufficient space resizing of the young generation can occur
- // an redistribute the spaces in the young generation. Mangle
+ // and redistribute the spaces in the young generation. Mangle
// here so that unzapped regions don't get distributed to
// other spaces.
to()->mangle_unused_area();
@@ -1113,8 +1092,10 @@
// thus avoiding the need to undo the copy as in
// copy_to_survivor_space_avoiding_with_undo.
-oop ParNewGeneration::copy_to_survivor_space(
- ParScanThreadState* par_scan_state, oop old, size_t sz, markOop m) {
+oop ParNewGeneration::copy_to_survivor_space(ParScanThreadState* par_scan_state,
+ oop old,
+ size_t sz,
+ markOop m) {
// In the sequential version, this assert also says that the object is
// not forwarded. That might not be the case here. It is the case that
// the caller observed it to be not forwarded at some time in the past.
@@ -1141,8 +1122,7 @@
}
if (new_obj == NULL) {
- // Either to-space is full or we decided to promote
- // try allocating obj tenured
+ // Either to-space is full or we decided to promote try allocating obj tenured
// Attempt to install a null forwarding pointer (atomically),
// to claim the right to install the real forwarding pointer.
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -71,11 +71,7 @@
ParScanWithoutBarrierClosure _to_space_closure; // scan_without_gc_barrier
ParScanWithBarrierClosure _old_gen_closure; // scan_with_gc_barrier
ParRootScanWithoutBarrierClosure _to_space_root_closure; // scan_root_without_gc_barrier
- // One of these two will be passed to process_roots, which will
- // set its generation. The first is for two-gen configs where the
- // old gen collects the perm gen; the second is for arbitrary configs.
- // The second isn't used right now (it used to be used for the train, an
- // incremental collector) but the declaration has been left as a reminder.
+ // Will be passed to process_roots to set its generation.
ParRootScanWithBarrierTwoGensClosure _older_gen_closure;
// This closure will always be bound to the old gen; it will be used
// in evacuate_followers.
@@ -85,7 +81,6 @@
ParScanWeakRefClosure _scan_weak_ref_closure;
ParKeepAliveClosure _keep_alive_closure;
-
Space* _to_space;
Space* to_space() { return _to_space; }
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1143,7 +1143,7 @@
while (curr < end) {
Prefetch::read(curr, interval);
oop obj = oop(curr);
- int size = obj->oop_iterate(&cl);
+ int size = obj->oop_iterate_size(&cl);
assert(size == obj->size(), "sanity");
curr += size;
}
--- a/hotspot/src/share/vm/gc/g1/g1Allocator.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1Allocator.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -367,7 +367,7 @@
_max = _bottom + HeapRegion::min_region_size_in_words();
// Tell mark-sweep that objects in this region are not to be marked.
- G1MarkSweep::mark_range_archive(MemRegion(_bottom, HeapRegion::GrainWords));
+ G1MarkSweep::set_range_archive(MemRegion(_bottom, HeapRegion::GrainWords), true);
// Since we've modified the old set, call update_sizes.
_g1h->g1mm()->update_sizes();
--- a/hotspot/src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1BlockOffsetTable.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -27,6 +27,7 @@
#include "gc/g1/g1BlockOffsetTable.hpp"
#include "gc/g1/heapRegion.hpp"
+#include "gc/shared/memset_with_concurrent_readers.hpp"
#include "gc/shared/space.hpp"
inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) {
@@ -68,15 +69,7 @@
check_index(right, "right index out of range");
assert(left <= right, "indexes out of order");
size_t num_cards = right - left + 1;
- if (UseMemSetInBOT) {
- memset(&_offset_array[left], offset, num_cards);
- } else {
- size_t i = left;
- const size_t end = i + num_cards;
- for (; i < end; i++) {
- _offset_array[i] = offset;
- }
- }
+ memset_with_concurrent_readers(&_offset_array[left], offset, num_cards);
}
// Variant of index_for that does not check the index for validity.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CodeBlobClosure.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "code/nmethod.hpp"
+#include "gc/g1/g1CodeBlobClosure.hpp"
+#include "gc/g1/g1CollectedHeap.inline.hpp"
+#include "gc/g1/heapRegion.hpp"
+#include "gc/g1/heapRegionRemSet.hpp"
+#include "oops/oop.inline.hpp"
+
+template <typename T>
+void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop_work(T* p) {
+ _work->do_oop(p);
+ T oop_or_narrowoop = oopDesc::load_heap_oop(p);
+ if (!oopDesc::is_null(oop_or_narrowoop)) {
+ oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
+ HeapRegion* hr = _g1h->heap_region_containing_raw(o);
+ assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in collection set then evacuation failed and nm must already be in the remset");
+ hr->add_strong_code_root(_nm);
+ }
+}
+
+void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(oop* o) {
+ do_oop_work(o);
+}
+
+void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(narrowOop* o) {
+ do_oop_work(o);
+}
+
+void G1CodeBlobClosure::do_code_blob(CodeBlob* cb) {
+ nmethod* nm = cb->as_nmethod_or_null();
+ if (nm != NULL) {
+ if (!nm->test_set_oops_do_mark()) {
+ _oc.set_nm(nm);
+ nm->oops_do(&_oc);
+ nm->fix_oop_relocations();
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CodeBlobClosure.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+#include "gc/g1/g1CollectedHeap.hpp"
+#include "memory/iterator.hpp"
+
+class nmethod;
+
+class G1CodeBlobClosure : public CodeBlobClosure {
+ class HeapRegionGatheringOopClosure : public OopClosure {
+ G1CollectedHeap* _g1h;
+ OopClosure* _work;
+ nmethod* _nm;
+
+ template <typename T>
+ void do_oop_work(T* p);
+
+ public:
+ HeapRegionGatheringOopClosure(OopClosure* oc) : _g1h(G1CollectedHeap::heap()), _work(oc), _nm(NULL) {}
+
+ void do_oop(oop* o);
+ void do_oop(narrowOop* o);
+
+ void set_nm(nmethod* nm) {
+ _nm = nm;
+ }
+ };
+
+ HeapRegionGatheringOopClosure _oc;
+public:
+ G1CodeBlobClosure(OopClosure* oc) : _oc(oc) {}
+
+ void do_code_blob(CodeBlob* cb);
+};
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -65,6 +65,7 @@
#include "memory/iterator.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.inline.hpp"
+#include "runtime/init.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/globalDefinitions.hpp"
@@ -949,6 +950,7 @@
}
bool G1CollectedHeap::alloc_archive_regions(MemRegion* ranges, size_t count) {
+ assert(!is_init_completed(), "Expect to be called at JVM init time");
assert(ranges != NULL, "MemRegion array NULL");
assert(count != 0, "No MemRegions provided");
MutexLockerEx x(Heap_lock);
@@ -1037,12 +1039,13 @@
}
// Notify mark-sweep of the archive range.
- G1MarkSweep::mark_range_archive(curr_range);
+ G1MarkSweep::set_range_archive(curr_range, true);
}
return true;
}
void G1CollectedHeap::fill_archive_regions(MemRegion* ranges, size_t count) {
+ assert(!is_init_completed(), "Expect to be called at JVM init time");
assert(ranges != NULL, "MemRegion array NULL");
assert(count != 0, "No MemRegions provided");
MemRegion reserved = _hrm.reserved();
@@ -1125,6 +1128,81 @@
return result;
}
+void G1CollectedHeap::dealloc_archive_regions(MemRegion* ranges, size_t count) {
+ assert(!is_init_completed(), "Expect to be called at JVM init time");
+ assert(ranges != NULL, "MemRegion array NULL");
+ assert(count != 0, "No MemRegions provided");
+ MemRegion reserved = _hrm.reserved();
+ HeapWord* prev_last_addr = NULL;
+ HeapRegion* prev_last_region = NULL;
+ size_t size_used = 0;
+ size_t uncommitted_regions = 0;
+
+ // For each Memregion, free the G1 regions that constitute it, and
+ // notify mark-sweep that the range is no longer to be considered 'archive.'
+ MutexLockerEx x(Heap_lock);
+ for (size_t i = 0; i < count; i++) {
+ HeapWord* start_address = ranges[i].start();
+ HeapWord* last_address = ranges[i].last();
+
+ assert(reserved.contains(start_address) && reserved.contains(last_address),
+ err_msg("MemRegion outside of heap [" PTR_FORMAT ", " PTR_FORMAT "]",
+ p2i(start_address), p2i(last_address)));
+ assert(start_address > prev_last_addr,
+ err_msg("Ranges not in ascending order: " PTR_FORMAT " <= " PTR_FORMAT ,
+ p2i(start_address), p2i(prev_last_addr)));
+ size_used += ranges[i].byte_size();
+ prev_last_addr = last_address;
+
+ HeapRegion* start_region = _hrm.addr_to_region(start_address);
+ HeapRegion* last_region = _hrm.addr_to_region(last_address);
+
+ // Check for ranges that start in the same G1 region in which the previous
+ // range ended, and adjust the start address so we don't try to free
+ // the same region again. If the current range is entirely within that
+ // region, skip it.
+ if (start_region == prev_last_region) {
+ start_address = start_region->end();
+ if (start_address > last_address) {
+ continue;
+ }
+ start_region = _hrm.addr_to_region(start_address);
+ }
+ prev_last_region = last_region;
+
+ // After verifying that each region was marked as an archive region by
+ // alloc_archive_regions, set it free and empty and uncommit it.
+ HeapRegion* curr_region = start_region;
+ while (curr_region != NULL) {
+ guarantee(curr_region->is_archive(),
+ err_msg("Expected archive region at index %u", curr_region->hrm_index()));
+ uint curr_index = curr_region->hrm_index();
+ _old_set.remove(curr_region);
+ curr_region->set_free();
+ curr_region->set_top(curr_region->bottom());
+ if (curr_region != last_region) {
+ curr_region = _hrm.next_region_in_heap(curr_region);
+ } else {
+ curr_region = NULL;
+ }
+ _hrm.shrink_at(curr_index, 1);
+ uncommitted_regions++;
+ }
+
+ // Notify mark-sweep that this is no longer an archive range.
+ G1MarkSweep::set_range_archive(ranges[i], false);
+ }
+
+ if (uncommitted_regions != 0) {
+ ergo_verbose1(ErgoHeapSizing,
+ "attempt heap shrinking",
+ ergo_format_reason("uncommitted archive regions")
+ ergo_format_byte("total size"),
+ HeapRegion::GrainWords * HeapWordSize * uncommitted_regions);
+ }
+ decrease_used(size_used);
+}
+
HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size,
uint* gc_count_before_ret,
uint* gclocker_retry_count_ret) {
@@ -2845,9 +2923,9 @@
}
// For G1 TLABs should not contain humongous objects, so the maximum TLAB size
-// must be smaller than the humongous object limit.
+// must be equal to the humongous object limit.
size_t G1CollectedHeap::max_tlab_size() const {
- return align_size_down(_humongous_object_threshold_in_words - 1, MinObjAlignment);
+ return align_size_down(_humongous_object_threshold_in_words, MinObjAlignment);
}
size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const {
@@ -4051,7 +4129,9 @@
g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty);
#endif // YOUNG_LIST_VERBOSE
- g1_policy()->finalize_cset(target_pause_time_ms, evacuation_info);
+ g1_policy()->finalize_cset(target_pause_time_ms);
+
+ evacuation_info.set_collectionset_regions(g1_policy()->cset_region_length());
register_humongous_regions_with_cset();
@@ -4175,7 +4255,10 @@
// investigate this in CR 7178365.
double sample_end_time_sec = os::elapsedTime();
double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
- g1_policy()->record_collection_pause_end(pause_time_ms, evacuation_info);
+ g1_policy()->record_collection_pause_end(pause_time_ms);
+
+ evacuation_info.set_collectionset_used_before(g1_policy()->collection_set_bytes_used_before());
+ evacuation_info.set_bytes_copied(g1_policy()->bytes_copied_during_gc());
MemoryService::track_memory_usage();
@@ -4501,8 +4584,7 @@
bool only_young, bool claim)
: _oop_closure(oop_closure),
_oop_in_klass_closure(oop_closure->g1(),
- oop_closure->pss(),
- oop_closure->rp()),
+ oop_closure->pss()),
_klass_in_cld_closure(&_oop_in_klass_closure, only_young),
_claim(claim) {
@@ -4531,18 +4613,18 @@
bool only_young = _g1h->collector_state()->gcs_are_young();
// Non-IM young GC.
- G1ParCopyClosure<G1BarrierNone, G1MarkNone> scan_only_root_cl(_g1h, pss, rp);
+ G1ParCopyClosure<G1BarrierNone, G1MarkNone> scan_only_root_cl(_g1h, pss);
G1CLDClosure<G1MarkNone> scan_only_cld_cl(&scan_only_root_cl,
only_young, // Only process dirty klasses.
false); // No need to claim CLDs.
// IM young GC.
// Strong roots closures.
- G1ParCopyClosure<G1BarrierNone, G1MarkFromRoot> scan_mark_root_cl(_g1h, pss, rp);
+ G1ParCopyClosure<G1BarrierNone, G1MarkFromRoot> scan_mark_root_cl(_g1h, pss);
G1CLDClosure<G1MarkFromRoot> scan_mark_cld_cl(&scan_mark_root_cl,
false, // Process all klasses.
true); // Need to claim CLDs.
// Weak roots closures.
- G1ParCopyClosure<G1BarrierNone, G1MarkPromotedFromRoot> scan_mark_weak_root_cl(_g1h, pss, rp);
+ G1ParCopyClosure<G1BarrierNone, G1MarkPromotedFromRoot> scan_mark_weak_root_cl(_g1h, pss);
G1CLDClosure<G1MarkPromotedFromRoot> scan_mark_weak_cld_cl(&scan_mark_weak_root_cl,
false, // Process all klasses.
true); // Need to claim CLDs.
@@ -4582,9 +4664,9 @@
worker_id);
G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, pss);
- _root_processor->scan_remembered_sets(&push_heap_rs_cl,
- weak_root_cl,
- worker_id);
+ _g1h->g1_rem_set()->oops_into_collection_set_do(&push_heap_rs_cl,
+ weak_root_cl,
+ worker_id);
double strong_roots_sec = os::elapsedTime() - start_strong_roots_sec;
double term_sec = 0.0;
@@ -5241,9 +5323,9 @@
G1ParScanThreadState* pss = _pss[worker_id];
pss->set_ref_processor(NULL);
- G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, pss, NULL);
-
- G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, pss, NULL);
+ G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, pss);
+
+ G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, pss);
OopClosure* copy_non_heap_cl = &only_copy_non_heap_cl;
@@ -5341,9 +5423,9 @@
pss->set_ref_processor(NULL);
assert(pss->queue_is_empty(), "both queue and overflow should be empty");
- G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, pss, NULL);
-
- G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, pss, NULL);
+ G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, pss);
+
+ G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, pss);
OopClosure* copy_non_heap_cl = &only_copy_non_heap_cl;
@@ -5451,9 +5533,9 @@
// closures while we're actually processing the discovered
// reference objects.
- G1ParScanExtRootClosure only_copy_non_heap_cl(this, pss, NULL);
-
- G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(this, pss, NULL);
+ G1ParScanExtRootClosure only_copy_non_heap_cl(this, pss);
+
+ G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(this, pss);
OopClosure* copy_non_heap_cl = &only_copy_non_heap_cl;
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -757,6 +757,12 @@
// alloc_archive_regions, and after class loading has occurred.
void fill_archive_regions(MemRegion* range, size_t count);
+ // For each of the specified MemRegions, uncommit the containing G1 regions
+ // which had been allocated by alloc_archive_regions. This should be called
+ // rather than fill_archive_regions at JVM init time if the archive file
+ // mapping failed, with the same non-overlapping and sorted MemRegion array.
+ void dealloc_archive_regions(MemRegion* range, size_t count);
+
protected:
// Shrink the garbage-first heap by at most the given size (in bytes!).
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -181,15 +181,6 @@
G1ErgoVerbose::set_enabled(false);
}
- // Verify PLAB sizes
- const size_t region_size = HeapRegion::GrainWords;
- if (YoungPLABSize > region_size || OldPLABSize > region_size) {
- char buffer[128];
- jio_snprintf(buffer, sizeof(buffer), "%sPLABSize should be at most " SIZE_FORMAT,
- OldPLABSize > region_size ? "Old" : "Young", region_size);
- vm_exit_during_initialization(buffer);
- }
-
_recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime());
_prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
@@ -932,7 +923,7 @@
// Anything below that is considered to be zero
#define MIN_TIMER_GRANULARITY 0.0000001
-void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, EvacuationInfo& evacuation_info) {
+void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms) {
double end_time_sec = os::elapsedTime();
assert(_cur_collection_pause_used_regions_at_start >= cset_region_length(),
"otherwise, the subtraction below does not make sense");
@@ -964,9 +955,6 @@
_mmu_tracker->add_pause(end_time_sec - pause_time_ms/1000.0,
end_time_sec, _g1->gc_tracer_stw()->gc_id());
- evacuation_info.set_collectionset_used_before(_collection_set_bytes_used_before);
- evacuation_info.set_bytes_copied(_bytes_copied_during_gc);
-
if (update_stats) {
_trace_young_gen_time_data.record_end_collection(pause_time_ms, phase_times());
// this is where we update the allocation rate of the application
@@ -1883,7 +1871,7 @@
}
-void G1CollectorPolicy::finalize_cset(double target_pause_time_ms, EvacuationInfo& evacuation_info) {
+void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) {
double young_start_time_sec = os::elapsedTime();
YoungList* young_list = _g1->young_list();
@@ -2093,7 +2081,6 @@
double non_young_end_time_sec = os::elapsedTime();
phase_times()->record_non_young_cset_choice_time_ms((non_young_end_time_sec - non_young_start_time_sec) * 1000.0);
- evacuation_info.set_collectionset_regions(cset_region_length());
}
void TraceYoungGenTimeData::record_start_collection(double time_to_stop_the_world_ms) {
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -604,10 +604,6 @@
virtual G1CollectorPolicy* as_g1_policy() { return this; }
- virtual CollectorPolicy::Name kind() {
- return CollectorPolicy::G1CollectorPolicyKind;
- }
-
G1CollectorState* collector_state();
G1GCPhaseTimes* phase_times() const { return _phase_times; }
@@ -634,13 +630,11 @@
virtual HeapWord* satisfy_failed_allocation(size_t size,
bool is_tlab);
- BarrierSet::Name barrier_set_name() { return BarrierSet::G1SATBCTLogging; }
-
bool need_to_start_conc_mark(const char* source, size_t alloc_word_size = 0);
// Record the start and end of an evacuation pause.
void record_collection_pause_start(double start_time_sec);
- void record_collection_pause_end(double pause_time_ms, EvacuationInfo& evacuation_info);
+ void record_collection_pause_end(double pause_time_ms);
// Record the start and end of a full collection.
void record_full_collection_start();
@@ -682,6 +676,10 @@
return _bytes_copied_during_gc;
}
+ size_t collection_set_bytes_used_before() const {
+ return _collection_set_bytes_used_before;
+ }
+
// Determine whether there are candidate regions so that the
// next GC should be mixed. The two action strings are used
// in the ergo output when the method returns true or false.
@@ -691,7 +689,7 @@
// Choose a new collection set. Marks the chosen regions as being
// "in_collection_set", and links them together. The head and number of
// the collection set are available via access methods.
- void finalize_cset(double target_pause_time_ms, EvacuationInfo& evacuation_info);
+ void finalize_cset(double target_pause_time_ms);
// The head of the list (via "next_in_collection_set()") representing the
// current collection set.
--- a/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -54,17 +54,46 @@
_allocated, _wasted, _region_end_waste, _unused, used()));
_allocated = 1;
}
- // We account region end waste fully to PLAB allocation. This is not completely fair,
- // but is a conservative assumption because PLABs may be sized flexibly while we
- // cannot adjust direct allocations.
- // In some cases, wasted_frac may become > 1 but that just reflects the problem
- // with region_end_waste.
- double wasted_frac = (double)(_unused + _wasted + _region_end_waste) / (double)_allocated;
- size_t target_refills = (size_t)((wasted_frac * TargetSurvivorRatio) / TargetPLABWastePct);
- if (target_refills == 0) {
- target_refills = 1;
- }
- size_t cur_plab_sz = used() / target_refills;
+ // The size of the PLAB caps the amount of space that can be wasted at the
+ // end of the collection. In the worst case the last PLAB could be completely
+ // empty.
+ // This allows us to calculate the new PLAB size to achieve the
+ // TargetPLABWastePct given the latest memory usage and that the last buffer
+ // will be G1LastPLABAverageOccupancy full.
+ //
+ // E.g. assume that if in the current GC 100 words were allocated and a
+ // TargetPLABWastePct of 10 had been set.
+ //
+ // So we could waste up to 10 words to meet that percentage. Given that we
+ // also assume that that buffer is typically half-full, the new desired PLAB
+ // size is set to 20 words.
+ //
+ // The amount of allocation performed should be independent of the number of
+ // threads, so should the maximum waste we can spend in total. So if
+ // we used n threads to allocate, each of them can spend maximum waste/n words in
+ // a first rough approximation. The number of threads only comes into play later
+ // when actually retrieving the actual desired PLAB size.
+ //
+ // After calculating this optimal PLAB size the algorithm applies the usual
+ // exponential decaying average over this value to guess the next PLAB size.
+ //
+ // We account region end waste fully to PLAB allocation (in the calculation of
+ // what we consider as "used_for_waste_calculation" below). This is not
+ // completely fair, but is a conservative assumption because PLABs may be sized
+ // flexibly while we cannot adjust inline allocations.
+ // Allocation during GC will try to minimize region end waste so this impact
+ // should be minimal.
+ //
+ // We need to cover overflow when calculating the amount of space actually used
+ // by objects in PLABs when subtracting the region end waste.
+ // Region end waste may be higher than actual allocation. This may occur if many
+ // threads do not allocate anything but a few rather large objects. In this
+ // degenerate case the PLAB size would simply quickly tend to minimum PLAB size,
+ // which is an okay reaction.
+ size_t const used_for_waste_calculation = used() > _region_end_waste ? used() - _region_end_waste : 0;
+
+ size_t const total_waste_allowed = used_for_waste_calculation * TargetPLABWastePct;
+ size_t const cur_plab_sz = (double)total_waste_allowed / G1LastPLABAverageOccupancy;
// Take historical weighted average
_filter.sample(cur_plab_sz);
// Clip from above and below, and align to object boundary
--- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -74,7 +74,7 @@
assert(rp != NULL, "should be non-NULL");
assert(rp == G1CollectedHeap::heap()->ref_processor_stw(), "Precondition");
- GenMarkSweep::_ref_processor = rp;
+ GenMarkSweep::set_ref_processor(rp);
rp->setup_policy(clear_all_softrefs);
// When collecting the permanent generation Method*s may be moving,
@@ -108,7 +108,7 @@
JvmtiExport::gc_epilogue();
// refs processing: clean slate
- GenMarkSweep::_ref_processor = NULL;
+ GenMarkSweep::set_ref_processor(NULL);
}
@@ -310,9 +310,9 @@
HeapRegion::GrainBytes);
}
-void G1MarkSweep::mark_range_archive(MemRegion range) {
+void G1MarkSweep::set_range_archive(MemRegion range, bool is_archive) {
assert(_archive_check_enabled, "archive range check not enabled");
- _archive_region_map.set_by_address(range, true);
+ _archive_region_map.set_by_address(range, is_archive);
}
bool G1MarkSweep::in_archive_range(oop object) {
--- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -58,8 +58,8 @@
// Create the _archive_region_map which is used to identify archive objects.
static void enable_archive_object_check();
- // Mark the regions containing the specified address range as archive regions.
- static void mark_range_archive(MemRegion range);
+ // Set the regions containing the specified address range as archive/non-archive.
+ static void set_range_archive(MemRegion range, bool is_archive);
// Check if an object is in an archive region using the _archive_region_map.
static bool in_archive_range(oop object);
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -125,8 +125,7 @@
template <class T> void do_oop_work(T* p);
public:
- G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state,
- ReferenceProcessor* rp) :
+ G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
G1ParCopyHelper(g1, par_scan_state) {
assert(_ref_processor == NULL, "sanity");
}
@@ -141,7 +140,6 @@
G1CollectedHeap* g1() { return _g1; };
G1ParScanThreadState* pss() { return _par_scan_state; }
- ReferenceProcessor* rp() { return _ref_processor; };
};
typedef G1ParCopyClosure<G1BarrierNone, G1MarkNone> G1ParScanExtRootClosure;
--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -186,6 +186,21 @@
return dest(state);
}
+void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state,
+ oop const old, size_t word_sz, uint age,
+ HeapWord * const obj_ptr,
+ const AllocationContext_t context) const {
+ G1PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state, context);
+ if (alloc_buf->contains(obj_ptr)) {
+ _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
+ dest_state.value() == InCSetState::Old,
+ alloc_buf->word_sz());
+ } else {
+ _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz, age,
+ dest_state.value() == InCSetState::Old);
+ }
+}
+
oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
oop const old,
markOop const old_mark) {
@@ -219,6 +234,10 @@
return handle_evacuation_failure_par(old, old_mark);
}
}
+ if (_g1h->_gc_tracer_stw->should_report_promotion_events()) {
+ // The events are checked individually as part of the actual commit
+ report_promotion_event(dest_state, old, word_sz, age, obj_ptr, context);
+ }
}
assert(obj_ptr != NULL, "when we get here, allocation should have succeeded");
--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -173,6 +173,10 @@
bool previous_plab_refill_failed);
inline InCSetState next_state(InCSetState const state, markOop const m, uint& age);
+
+ void report_promotion_event(InCSetState const dest_state,
+ oop const old, size_t word_sz, uint age,
+ HeapWord * const obj_ptr, const AllocationContext_t context) const;
public:
oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark);
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -26,6 +26,7 @@
#include "gc/g1/concurrentG1Refine.hpp"
#include "gc/g1/concurrentG1RefineThread.hpp"
#include "gc/g1/g1BlockOffsetTable.inline.hpp"
+#include "gc/g1/g1CodeBlobClosure.hpp"
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1CollectorPolicy.hpp"
#include "gc/g1/g1GCPhaseTimes.hpp"
@@ -228,12 +229,15 @@
};
void G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
- CodeBlobClosure* code_root_cl,
+ OopClosure* non_heap_roots,
uint worker_i) {
double rs_time_start = os::elapsedTime();
+
+ G1CodeBlobClosure code_root_cl(non_heap_roots);
+
HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i);
- ScanRSClosure scanRScl(oc, code_root_cl, worker_i);
+ ScanRSClosure scanRScl(oc, &code_root_cl, worker_i);
_g1->collection_set_iterate_from(startRegion, &scanRScl);
scanRScl.set_try_claimed();
@@ -295,7 +299,7 @@
}
void G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
- CodeBlobClosure* code_root_cl,
+ OopClosure* non_heap_roots,
uint worker_i) {
#if CARD_REPEAT_HISTO
ct_freq_update_histo_and_reset();
@@ -318,7 +322,7 @@
DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set());
updateRS(&into_cset_dcq, worker_i);
- scanRS(oc, code_root_cl, worker_i);
+ scanRS(oc, non_heap_roots, worker_i);
// We now clear the cached values of _cset_rs_update_cl for this worker
_cset_rs_update_cl[worker_i] = NULL;
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -85,7 +85,7 @@
// invoked "blk->set_region" to set the "from" region correctly
// beforehand.)
//
- // Invoke code_root_cl->do_code_blob on the unmarked nmethods
+ // Apply non_heap_roots on the oops of the unmarked nmethods
// on the strong code roots list for each region in the
// collection set.
//
@@ -95,7 +95,7 @@
// the "i" passed to the calling thread's work(i) function.
// In the sequential case this param will be ignored.
void oops_into_collection_set_do(G1ParPushHeapRSClosure* blk,
- CodeBlobClosure* code_root_cl,
+ OopClosure* non_heap_roots,
uint worker_i);
// Prepare for and cleanup after an oops_into_collection_set_do
@@ -107,7 +107,7 @@
void cleanup_after_oops_into_collection_set_do();
void scanRS(G1ParPushHeapRSClosure* oc,
- CodeBlobClosure* code_root_cl,
+ OopClosure* non_heap_roots,
uint worker_i);
void updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i);
--- a/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -28,6 +28,7 @@
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "gc/g1/bufferingOopClosure.hpp"
+#include "gc/g1/g1CodeBlobClosure.hpp"
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1CollectorPolicy.hpp"
#include "gc/g1/g1CollectorState.hpp"
@@ -40,57 +41,6 @@
#include "runtime/mutex.hpp"
#include "services/management.hpp"
-class G1CodeBlobClosure : public CodeBlobClosure {
- class HeapRegionGatheringOopClosure : public OopClosure {
- G1CollectedHeap* _g1h;
- OopClosure* _work;
- nmethod* _nm;
-
- template <typename T>
- void do_oop_work(T* p) {
- _work->do_oop(p);
- T oop_or_narrowoop = oopDesc::load_heap_oop(p);
- if (!oopDesc::is_null(oop_or_narrowoop)) {
- oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
- HeapRegion* hr = _g1h->heap_region_containing_raw(o);
- assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in CS then evacuation failed and nm must already be in the remset");
- hr->add_strong_code_root(_nm);
- }
- }
-
- public:
- HeapRegionGatheringOopClosure(OopClosure* oc) : _g1h(G1CollectedHeap::heap()), _work(oc), _nm(NULL) {}
-
- void do_oop(oop* o) {
- do_oop_work(o);
- }
-
- void do_oop(narrowOop* o) {
- do_oop_work(o);
- }
-
- void set_nm(nmethod* nm) {
- _nm = nm;
- }
- };
-
- HeapRegionGatheringOopClosure _oc;
-public:
- G1CodeBlobClosure(OopClosure* oc) : _oc(oc) {}
-
- void do_code_blob(CodeBlob* cb) {
- nmethod* nm = cb->as_nmethod_or_null();
- if (nm != NULL) {
- if (!nm->test_set_oops_do_mark()) {
- _oc.set_nm(nm);
- nm->oops_do(&_oc);
- nm->fix_oop_relocations();
- }
- }
- }
-};
-
-
void G1RootProcessor::worker_has_discovered_all_strong_classes() {
assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
@@ -321,14 +271,6 @@
}
}
-void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
- OopClosure* scan_non_heap_weak_roots,
- uint worker_i) {
- G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots);
-
- _g1h->g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i);
-}
-
uint G1RootProcessor::n_workers() const {
return _srs.n_threads();
}
--- a/hotspot/src/share/vm/gc/g1/g1RootProcessor.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1RootProcessor.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -107,13 +107,6 @@
CLDClosure* clds,
CodeBlobClosure* blobs);
- // Apply scan_rs to all locations in the union of the remembered sets for all
- // regions in the collection set
- // (having done "set_region" to indicate the region in which the root resides),
- void scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
- OopClosure* scan_non_heap_weak_roots,
- uint worker_i);
-
// Number of worker threads used by the root processor.
uint n_workers() const;
};
--- a/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -27,6 +27,7 @@
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
#include "gc/g1/heapRegion.hpp"
#include "gc/g1/satbQueue.hpp"
+#include "gc/shared/memset_with_concurrent_readers.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.inline.hpp"
#include "runtime/mutexLocker.hpp"
@@ -108,15 +109,7 @@
jbyte *const first = byte_for(mr.start());
jbyte *const last = byte_after(mr.last());
- // Below we may use an explicit loop instead of memset() because on
- // certain platforms memset() can give concurrent readers phantom zeros.
- if (UseMemSetInBOT) {
- memset(first, g1_young_gen, last - first);
- } else {
- for (jbyte* i = first; i < last; i++) {
- *i = g1_young_gen;
- }
- }
+ memset_with_concurrent_readers(first, g1_young_gen, last - first);
}
#ifndef PRODUCT
@@ -207,7 +200,7 @@
// Otherwise, log it.
G1SATBCardTableLoggingModRefBS* g1_bs =
barrier_set_cast<G1SATBCardTableLoggingModRefBS>(G1CollectedHeap::heap()->barrier_set());
- g1_bs->write_ref_field_work(field, new_val);
+ g1_bs->write_ref_field_work(field, new_val, false);
}
void
--- a/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -147,6 +147,10 @@
private:
G1SATBCardTableLoggingModRefBSChangedListener _listener;
DirtyCardQueueSet& _dcqs;
+
+ protected:
+ virtual void write_ref_field_work(void* field, oop new_val, bool release);
+
public:
static size_t compute_size(size_t mem_region_size_in_words) {
size_t number_of_slots = (mem_region_size_in_words / card_size_in_words);
@@ -165,8 +169,6 @@
virtual void resize_covered_region(MemRegion new_region) { ShouldNotReachHere(); }
- void write_ref_field_work(void* field, oop new_val, bool release = false);
-
// Can be called from static contexts.
static void write_ref_field_static(void* field, oop new_val);
--- a/hotspot/src/share/vm/gc/g1/g1_globals.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1_globals.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -82,6 +82,11 @@
"If true, enable reference discovery during concurrent " \
"marking and reference processing at the end of remark.") \
\
+ experimental(double, G1LastPLABAverageOccupancy, 50.0, \
+ "The expected average occupancy of the last PLAB in " \
+ "percent.") \
+ range(0.001, 100.0) \
+ \
product(size_t, G1SATBBufferSize, 1*K, \
"Number of entries in an SATB log buffer.") \
\
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -68,7 +68,7 @@
// or it was allocated after marking finished, then we add it. Otherwise
// we can safely ignore the object.
if (!g1h->is_obj_dead(oop(cur), _hr)) {
- oop_size = oop(cur)->oop_iterate(_rs_scan, mr);
+ oop_size = oop(cur)->oop_iterate_size(_rs_scan, mr);
} else {
oop_size = _hr->block_size(cur);
}
--- a/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -426,7 +426,7 @@
(num_last_found = find_empty_from_idx_reverse(cur, &idx_last_found)) > 0) {
uint to_remove = MIN2(num_regions_to_remove - removed, num_last_found);
- uncommit_regions(idx_last_found + num_last_found - to_remove, to_remove);
+ shrink_at(idx_last_found + num_last_found - to_remove, to_remove);
cur = idx_last_found;
removed += to_remove;
@@ -437,6 +437,17 @@
return removed;
}
+void HeapRegionManager::shrink_at(uint index, size_t num_regions) {
+#ifdef ASSERT
+ for (uint i = index; i < (index + num_regions); i++) {
+ assert(is_available(i), err_msg("Expected available region at index %u", i));
+ assert(at(i)->is_empty(), err_msg("Expected empty region at index %u", i));
+ assert(at(i)->is_free(), err_msg("Expected free region at index %u", i));
+ }
+#endif
+ uncommit_regions(index, num_regions);
+}
+
uint HeapRegionManager::find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const {
guarantee(start_idx < _allocated_heapregions_length, "checking");
guarantee(res_idx != NULL, "checking");
--- a/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -241,6 +241,10 @@
// Return the actual number of uncommitted regions.
uint shrink_by(uint num_regions_to_remove);
+ // Uncommit a number of regions starting at the specified index, which must be available,
+ // empty, and free.
+ void shrink_at(uint index, size_t num_regions);
+
void verify();
// Do some sanity checking.
--- a/hotspot/src/share/vm/gc/g1/heapRegionType.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/heapRegionType.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -35,7 +35,7 @@
// We encode the value of the heap region type so the generation can be
// determined quickly. The tag is split into two parts:
//
- // major type (young, humongous) : top N-1 bits
+ // major type (young, old, humongous, archive) : top N-1 bits
// minor type (eden / survivor, starts / cont hum, etc.) : bottom 1 bit
//
// If there's need to increase the number of minor types in the
--- a/hotspot/src/share/vm/gc/parallel/cardTableExtension.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/cardTableExtension.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -89,7 +89,7 @@
CheckForUnmarkedOops object_check(_young_gen, _card_table);
obj->oop_iterate_no_header(&object_check);
if (object_check.has_unmarked_oop()) {
- assert(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
+ guarantee(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
}
}
};
--- a/hotspot/src/share/vm/gc/parallel/cardTableExtension.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/cardTableExtension.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -56,13 +56,7 @@
CardTableExtension(MemRegion whole_heap) :
CardTableModRefBS(
whole_heap,
- // Concrete tag should be BarrierSet::CardTableExtension.
- // That will presently break things in a bunch of places though.
- // The concrete tag is used as a dispatch key in many places, and
- // CardTableExtension does not correctly dispatch in some of those
- // uses. This will be addressed as part of a reorganization of the
- // BarrierSet hierarchy.
- BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableExtension))
+ BarrierSet::FakeRtti(BarrierSet::CardTableExtension))
{ }
// Scavenge support
--- a/hotspot/src/share/vm/gc/parallel/immutableSpace.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/immutableSpace.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -44,7 +44,7 @@
HeapWord* t = end();
// Could call objects iterate, but this is easier.
while (obj_addr < t) {
- obj_addr += oop(obj_addr)->oop_iterate(cl);
+ obj_addr += oop(obj_addr)->oop_iterate_size(cl);
}
}
--- a/hotspot/src/share/vm/gc/parallel/mutableSpace.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/mutableSpace.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -213,15 +213,6 @@
return (HeapWord*)Atomic::cmpxchg_ptr(obj, top_addr(), expected_top) == expected_top;
}
-void MutableSpace::oop_iterate(ExtendedOopClosure* cl) {
- HeapWord* obj_addr = bottom();
- HeapWord* t = top();
- // Could call objects iterate, but this is easier.
- while (obj_addr < t) {
- obj_addr += oop(obj_addr)->oop_iterate(cl);
- }
-}
-
void MutableSpace::oop_iterate_no_header(OopClosure* cl) {
HeapWord* obj_addr = bottom();
HeapWord* t = top();
--- a/hotspot/src/share/vm/gc/parallel/mutableSpace.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/mutableSpace.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -134,7 +134,6 @@
bool cas_deallocate(HeapWord *obj, size_t size);
// Iteration.
- void oop_iterate(ExtendedOopClosure* cl);
void oop_iterate_no_header(OopClosure* cl);
void object_iterate(ObjectClosure* cl);
--- a/hotspot/src/share/vm/gc/parallel/parallelScavengeHeap.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/parallelScavengeHeap.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -30,26 +30,22 @@
#include "gc/parallel/psParallelCompact.hpp"
#include "gc/parallel/psScavenge.hpp"
-inline size_t ParallelScavengeHeap::total_invocations()
-{
+inline size_t ParallelScavengeHeap::total_invocations() {
return UseParallelOldGC ? PSParallelCompact::total_invocations() :
PSMarkSweep::total_invocations();
}
-inline bool ParallelScavengeHeap::should_alloc_in_eden(const size_t size) const
-{
+inline bool ParallelScavengeHeap::should_alloc_in_eden(const size_t size) const {
const size_t eden_size = young_gen()->eden_space()->capacity_in_words();
return size < eden_size / 2;
}
-inline void ParallelScavengeHeap::invoke_scavenge()
-{
+inline void ParallelScavengeHeap::invoke_scavenge() {
PSScavenge::invoke();
}
inline bool ParallelScavengeHeap::is_in_young(oop p) {
// Assumes the the old gen address range is lower than that of the young gen.
- const void* loc = (void*) p;
bool result = ((HeapWord*)p) >= young_gen()->reserved().start();
assert(result == young_gen()->is_in_reserved(p),
err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p)));
--- a/hotspot/src/share/vm/gc/parallel/psAdaptiveSizePolicy.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psAdaptiveSizePolicy.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -299,7 +299,7 @@
// subtracted out.
size_t eden_limit = max_eden_size;
- const double gc_cost_limit = GCTimeLimit/100.0;
+ const double gc_cost_limit = GCTimeLimit / 100.0;
// Which way should we go?
// if pause requirement is not met
--- a/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -60,7 +60,7 @@
void PSMarkSweep::initialize() {
MemRegion mr = ParallelScavengeHeap::heap()->reserved_region();
- _ref_processor = new ReferenceProcessor(mr); // a vanilla ref proc
+ set_ref_processor(new ReferenceProcessor(mr)); // a vanilla ref proc
_counters = new CollectorCounters("PSMarkSweep", 1);
}
--- a/hotspot/src/share/vm/gc/parallel/psOldGen.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psOldGen.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -486,12 +486,12 @@
object_space()->verify();
}
class VerifyObjectStartArrayClosure : public ObjectClosure {
- PSOldGen* _gen;
+ PSOldGen* _old_gen;
ObjectStartArray* _start_array;
public:
- VerifyObjectStartArrayClosure(PSOldGen* gen, ObjectStartArray* start_array) :
- _gen(gen), _start_array(start_array) { }
+ VerifyObjectStartArrayClosure(PSOldGen* old_gen, ObjectStartArray* start_array) :
+ _old_gen(old_gen), _start_array(start_array) { }
virtual void do_object(oop obj) {
HeapWord* test_addr = (HeapWord*)obj + 1;
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -958,7 +958,7 @@
{
// Update the from & to space pointers in space_info, since they are swapped
// at each young gen gc. Do the update unconditionally (even though a
- // promotion failure does not swap spaces) because an unknown number of minor
+ // promotion failure does not swap spaces) because an unknown number of young
// collections will have swapped the spaces an unknown number of times.
GCTraceTime tm("pre compact", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -303,7 +303,7 @@
// completed(), which is desirable since a region must be claimed before it
// can be completed.
bool available() const { return _dc_and_los < dc_one; }
- bool claimed() const { return _dc_and_los >= dc_claimed; }
+ bool claimed() const { return _dc_and_los >= dc_claimed; }
bool completed() const { return _dc_and_los >= dc_completed; }
// These are not atomic.
@@ -979,7 +979,6 @@
static bool _dwl_initialized;
#endif // #ifdef ASSERT
-
public:
static ParallelOldTracer* gc_tracer() { return &_gc_tracer; }
--- a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -597,9 +597,9 @@
// to allow resizes that may have been inhibited by the
// relative location of the "to" and "from" spaces.
- // Resizing the old gen at minor collects can cause increases
+ // Resizing the old gen at young collections can cause increases
// that don't feed back to the generation sizing policy until
- // a major collection. Don't resize the old gen here.
+ // a full collection. Don't resize the old gen here.
heap->resize_young_gen(size_policy->calculated_eden_size_in_bytes(),
size_policy->calculated_survivor_size_in_bytes());
--- a/hotspot/src/share/vm/gc/parallel/psTasks.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psTasks.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -172,10 +172,10 @@
void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) {
// There are not old-to-young pointers if the old gen is empty.
- assert(!_gen->object_space()->is_empty(),
+ assert(!_old_gen->object_space()->is_empty(),
"Should not be called is there is no work");
- assert(_gen != NULL, "Sanity");
- assert(_gen->object_space()->contains(_gen_top) || _gen_top == _gen->object_space()->top(), "Sanity");
+ assert(_old_gen != NULL, "Sanity");
+ assert(_old_gen->object_space()->contains(_gen_top) || _gen_top == _old_gen->object_space()->top(), "Sanity");
assert(_stripe_number < ParallelGCThreads, "Sanity");
{
@@ -183,8 +183,8 @@
CardTableExtension* card_table =
barrier_set_cast<CardTableExtension>(ParallelScavengeHeap::heap()->barrier_set());
- card_table->scavenge_contents_parallel(_gen->start_array(),
- _gen->object_space(),
+ card_table->scavenge_contents_parallel(_old_gen->start_array(),
+ _old_gen->object_space(),
_gen_top,
pm,
_stripe_number,
--- a/hotspot/src/share/vm/gc/parallel/psTasks.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/psTasks.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -160,17 +160,17 @@
class OldToYoungRootsTask : public GCTask {
private:
- PSOldGen* _gen;
+ PSOldGen* _old_gen;
HeapWord* _gen_top;
uint _stripe_number;
uint _stripe_total;
public:
- OldToYoungRootsTask(PSOldGen *gen,
+ OldToYoungRootsTask(PSOldGen *old_gen,
HeapWord* gen_top,
uint stripe_number,
uint stripe_total) :
- _gen(gen),
+ _old_gen(old_gen),
_gen_top(gen_top),
_stripe_number(stripe_number),
_stripe_total(stripe_total) { }
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -106,14 +106,14 @@
_gch(gch), _scan_cur_or_nonheap(cur), _scan_older(older)
{
assert(_gch->young_gen()->kind() == Generation::DefNew, "Generation should be DefNew");
- _gen = (DefNewGeneration*)_gch->young_gen();
+ _young_gen = (DefNewGeneration*)_gch->young_gen();
}
void DefNewGeneration::FastEvacuateFollowersClosure::do_void() {
do {
_gch->oop_since_save_marks_iterate(GenCollectedHeap::YoungGen, _scan_cur_or_nonheap, _scan_older);
} while (!_gch->no_allocs_since_save_marks());
- guarantee(_gen->promo_failure_scan_is_complete(), "Failed to finish scan");
+ guarantee(_young_gen->promo_failure_scan_is_complete(), "Failed to finish scan");
}
ScanClosure::ScanClosure(DefNewGeneration* g, bool gc_barrier) :
@@ -200,8 +200,9 @@
_from_space = new ContiguousSpace();
_to_space = new ContiguousSpace();
- if (_eden_space == NULL || _from_space == NULL || _to_space == NULL)
+ if (_eden_space == NULL || _from_space == NULL || _to_space == NULL) {
vm_exit_during_initialization("Could not allocate a new gen space");
+ }
// Compute the maximum eden and survivor space sizes. These sizes
// are computed assuming the entire reserved space is committed.
@@ -655,7 +656,7 @@
if (ZapUnusedHeapArea) {
// This is now done here because of the piece-meal mangling which
// can check for valid mangling at intermediate points in the
- // collection(s). When a minor collection fails to collect
+ // collection(s). When a young collection fails to collect
// sufficient space resizing of the young generation can occur
// an redistribute the spaces in the young generation. Mangle
// here so that unzapped regions don't get distributed to
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -193,7 +193,7 @@
class FastEvacuateFollowersClosure: public VoidClosure {
GenCollectedHeap* _gch;
- DefNewGeneration* _gen;
+ DefNewGeneration* _young_gen;
FastScanClosure* _scan_cur_or_nonheap;
FastScanClosure* _scan_older;
public:
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -57,8 +57,8 @@
// each generation, allowing them in turn to examine the modified
// field.
//
- // We could check that p is also in an older generation, but
- // dirty cards in the youngest gen are never scanned, so the
+ // We could check that p is also in the old generation, but
+ // dirty cards in the young gen are never scanned, so the
// extra check probably isn't worthwhile.
if (GenCollectedHeap::heap()->is_in_reserved(p)) {
oop obj = oopDesc::load_decode_heap_oop_not_null(p);
--- a/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -67,7 +67,7 @@
// hook up weak ref data so it can be used during Mark-Sweep
assert(ref_processor() == NULL, "no stomping");
assert(rp != NULL, "should be non-NULL");
- _ref_processor = rp;
+ set_ref_processor(rp);
rp->setup_policy(clear_all_softrefs);
GCTraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, _gc_tracer->gc_id());
@@ -136,7 +136,7 @@
}
// refs processing: clean slate
- _ref_processor = NULL;
+ set_ref_processor(NULL);
// Update heap occupancy information which is used as
// input to soft ref clearing policy at the next gc.
--- a/hotspot/src/share/vm/gc/serial/markSweep.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/markSweep.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -28,11 +28,20 @@
#include "gc/shared/collectedHeap.inline.hpp"
#include "gc/shared/gcTimer.hpp"
#include "gc/shared/gcTrace.hpp"
+#include "gc/shared/specialized_oop_closures.hpp"
+#include "memory/iterator.inline.hpp"
+#include "oops/instanceClassLoaderKlass.inline.hpp"
#include "oops/instanceKlass.inline.hpp"
#include "oops/instanceMirrorKlass.inline.hpp"
+#include "oops/instanceRefKlass.inline.hpp"
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.inline.hpp"
#include "oops/oop.inline.hpp"
+#include "utilities/macros.hpp"
+#include "utilities/stack.inline.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc/g1/g1StringDedup.hpp"
+#endif // INCLUDE_ALL_GCS
uint MarkSweep::_total_invocations = 0;
@@ -50,176 +59,101 @@
MarkSweep::FollowRootClosure MarkSweep::follow_root_closure;
-void MarkSweep::FollowRootClosure::do_oop(oop* p) { follow_root(p); }
-void MarkSweep::FollowRootClosure::do_oop(narrowOop* p) { follow_root(p); }
-
-MarkSweep::MarkAndPushClosure MarkSweep::mark_and_push_closure;
+MarkAndPushClosure MarkSweep::mark_and_push_closure;
CLDToOopClosure MarkSweep::follow_cld_closure(&mark_and_push_closure);
CLDToOopClosure MarkSweep::adjust_cld_closure(&adjust_pointer_closure);
-template <typename T>
-void MarkSweep::MarkAndPushClosure::do_oop_nv(T* p) { mark_and_push(p); }
-void MarkSweep::MarkAndPushClosure::do_oop(oop* p) { do_oop_nv(p); }
-void MarkSweep::MarkAndPushClosure::do_oop(narrowOop* p) { do_oop_nv(p); }
+inline void MarkSweep::mark_object(oop obj) {
+#if INCLUDE_ALL_GCS
+ if (G1StringDedup::is_enabled()) {
+ // We must enqueue the object before it is marked
+ // as we otherwise can't read the object's age.
+ G1StringDedup::enqueue_from_mark(obj);
+ }
+#endif
+ // some marks may contain information we need to preserve so we store them away
+ // and overwrite the mark. We'll restore it at the end of markSweep.
+ markOop mark = obj->mark();
+ obj->set_mark(markOopDesc::prototype()->set_marked());
-void MarkSweep::follow_class_loader(ClassLoaderData* cld) {
- MarkSweep::follow_cld_closure.do_cld(cld);
-}
-
-void InstanceKlass::oop_ms_follow_contents(oop obj) {
- assert(obj != NULL, "can't follow the content of NULL object");
- MarkSweep::follow_klass(this);
-
- oop_oop_iterate_oop_maps<true>(obj, &MarkSweep::mark_and_push_closure);
+ if (mark->must_be_preserved(obj)) {
+ preserve_mark(obj, mark);
+ }
}
-void InstanceMirrorKlass::oop_ms_follow_contents(oop obj) {
- InstanceKlass::oop_ms_follow_contents(obj);
-
- // Follow the klass field in the mirror
- Klass* klass = java_lang_Class::as_Klass(obj);
- if (klass != NULL) {
- // An anonymous class doesn't have its own class loader, so the call
- // to follow_klass will mark and push its java mirror instead of the
- // class loader. When handling the java mirror for an anonymous class
- // we need to make sure its class loader data is claimed, this is done
- // by calling follow_class_loader explicitly. For non-anonymous classes
- // the call to follow_class_loader is made when the class loader itself
- // is handled.
- if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
- MarkSweep::follow_class_loader(klass->class_loader_data());
- } else {
- MarkSweep::follow_klass(klass);
+template <class T> inline void MarkSweep::mark_and_push(T* p) {
+ T heap_oop = oopDesc::load_heap_oop(p);
+ if (!oopDesc::is_null(heap_oop)) {
+ oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
+ if (!obj->mark()->is_marked() &&
+ !is_archive_object(obj)) {
+ mark_object(obj);
+ _marking_stack.push(obj);
}
- } else {
- // If klass is NULL then this a mirror for a primitive type.
- // We don't have to follow them, since they are handled as strong
- // roots in Universe::oops_do.
- assert(java_lang_Class::is_primitive(obj), "Sanity check");
- }
-
- oop_oop_iterate_statics<true>(obj, &MarkSweep::mark_and_push_closure);
-}
-
-void InstanceClassLoaderKlass::oop_ms_follow_contents(oop obj) {
- InstanceKlass::oop_ms_follow_contents(obj);
-
- ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj);
-
- // We must NULL check here, since the class loader
- // can be found before the loader data has been set up.
- if(loader_data != NULL) {
- MarkSweep::follow_class_loader(loader_data);
}
}
-template <class T>
-static void oop_ms_follow_contents_specialized(InstanceRefKlass* klass, oop obj) {
- T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
- T heap_oop = oopDesc::load_heap_oop(referent_addr);
- debug_only(
- if(TraceReferenceGC && PrintGCDetails) {
- gclog_or_tty->print_cr("InstanceRefKlass::oop_ms_follow_contents_specialized " PTR_FORMAT, p2i(obj));
- }
- )
- if (!oopDesc::is_null(heap_oop)) {
- oop referent = oopDesc::decode_heap_oop_not_null(heap_oop);
- if (!referent->is_gc_marked() &&
- MarkSweep::ref_processor()->discover_reference(obj, klass->reference_type())) {
- // reference was discovered, referent will be traversed later
- klass->InstanceKlass::oop_ms_follow_contents(obj);
- debug_only(
- if(TraceReferenceGC && PrintGCDetails) {
- gclog_or_tty->print_cr(" Non NULL enqueued " PTR_FORMAT, p2i(obj));
- }
- )
- return;
- } else {
- // treat referent as normal oop
- debug_only(
- if(TraceReferenceGC && PrintGCDetails) {
- gclog_or_tty->print_cr(" Non NULL normal " PTR_FORMAT, p2i(obj));
- }
- )
- MarkSweep::mark_and_push(referent_addr);
- }
- }
- T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
- // Treat discovered as normal oop, if ref is not "active",
- // i.e. if next is non-NULL.
- T next_oop = oopDesc::load_heap_oop(next_addr);
- if (!oopDesc::is_null(next_oop)) { // i.e. ref is not "active"
- T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);
- debug_only(
- if(TraceReferenceGC && PrintGCDetails) {
- gclog_or_tty->print_cr(" Process discovered as normal "
- PTR_FORMAT, p2i(discovered_addr));
- }
- )
- MarkSweep::mark_and_push(discovered_addr);
- }
- // treat next as normal oop. next is a link in the reference queue.
- debug_only(
- if(TraceReferenceGC && PrintGCDetails) {
- gclog_or_tty->print_cr(" Process next as normal " PTR_FORMAT, p2i(next_addr));
- }
- )
- MarkSweep::mark_and_push(next_addr);
- klass->InstanceKlass::oop_ms_follow_contents(obj);
+inline void MarkSweep::follow_klass(Klass* klass) {
+ oop op = klass->klass_holder();
+ MarkSweep::mark_and_push(&op);
+}
+
+inline void MarkSweep::follow_cld(ClassLoaderData* cld) {
+ MarkSweep::follow_cld_closure.do_cld(cld);
}
-void InstanceRefKlass::oop_ms_follow_contents(oop obj) {
- if (UseCompressedOops) {
- oop_ms_follow_contents_specialized<narrowOop>(this, obj);
- } else {
- oop_ms_follow_contents_specialized<oop>(this, obj);
+template <typename T>
+inline void MarkAndPushClosure::do_oop_nv(T* p) { MarkSweep::mark_and_push(p); }
+void MarkAndPushClosure::do_oop(oop* p) { do_oop_nv(p); }
+void MarkAndPushClosure::do_oop(narrowOop* p) { do_oop_nv(p); }
+inline bool MarkAndPushClosure::do_metadata_nv() { return true; }
+bool MarkAndPushClosure::do_metadata() { return do_metadata_nv(); }
+inline void MarkAndPushClosure::do_klass_nv(Klass* k) { MarkSweep::follow_klass(k); }
+void MarkAndPushClosure::do_klass(Klass* k) { do_klass_nv(k); }
+inline void MarkAndPushClosure::do_cld_nv(ClassLoaderData* cld) { MarkSweep::follow_cld(cld); }
+void MarkAndPushClosure::do_cld(ClassLoaderData* cld) { do_cld_nv(cld); }
+
+template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
+ mark_and_push(p);
+}
+
+void MarkSweep::push_objarray(oop obj, size_t index) {
+ ObjArrayTask task(obj, index);
+ assert(task.is_valid(), "bad ObjArrayTask");
+ _objarray_stack.push(task);
+}
+
+inline void MarkSweep::follow_array(objArrayOop array) {
+ MarkSweep::follow_klass(array->klass());
+ // Don't push empty arrays to avoid unnecessary work.
+ if (array->length() > 0) {
+ MarkSweep::push_objarray(array, 0);
}
}
-template <class T>
-static void oop_ms_follow_contents_specialized(oop obj, int index) {
- objArrayOop a = objArrayOop(obj);
- const size_t len = size_t(a->length());
- const size_t beg_index = size_t(index);
- assert(beg_index < len || len == 0, "index too large");
-
- const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
- const size_t end_index = beg_index + stride;
- T* const base = (T*)a->base();
- T* const beg = base + beg_index;
- T* const end = base + end_index;
-
- // Push the non-NULL elements of the next stride on the marking stack.
- for (T* e = beg; e < end; e++) {
- MarkSweep::mark_and_push<T>(e);
- }
-
- if (end_index < len) {
- MarkSweep::push_objarray(a, end_index); // Push the continuation.
+inline void MarkSweep::follow_object(oop obj) {
+ assert(obj->is_gc_marked(), "should be marked");
+ if (obj->is_objArray()) {
+ // Handle object arrays explicitly to allow them to
+ // be split into chunks if needed.
+ MarkSweep::follow_array((objArrayOop)obj);
+ } else {
+ obj->oop_iterate(&mark_and_push_closure);
}
}
-void ObjArrayKlass::oop_ms_follow_contents(oop obj) {
- assert (obj->is_array(), "obj must be array");
- MarkSweep::follow_klass(this);
- if (UseCompressedOops) {
- oop_ms_follow_contents_specialized<narrowOop>(obj, 0);
- } else {
- oop_ms_follow_contents_specialized<oop>(obj, 0);
- }
-}
+void MarkSweep::follow_array_chunk(objArrayOop array, int index) {
+ const int len = array->length();
+ const int beg_index = index;
+ assert(beg_index < len || len == 0, "index too large");
-void TypeArrayKlass::oop_ms_follow_contents(oop obj) {
- assert(obj->is_typeArray(),"must be a type array");
- // Performance tweak: We skip iterating over the klass pointer since we
- // know that Universe::TypeArrayKlass never moves.
-}
+ const int stride = MIN2(len - beg_index, (int) ObjArrayMarkingStride);
+ const int end_index = beg_index + stride;
-void MarkSweep::follow_array(objArrayOop array, int index) {
- if (UseCompressedOops) {
- oop_ms_follow_contents_specialized<narrowOop>(array, index);
- } else {
- oop_ms_follow_contents_specialized<oop>(array, index);
+ array->oop_iterate_range(&mark_and_push_closure, beg_index, end_index);
+
+ if (end_index < len) {
+ MarkSweep::push_objarray(array, end_index); // Push the continuation.
}
}
@@ -233,7 +167,7 @@
// Process ObjArrays one at a time to avoid marking stack bloat.
if (!_objarray_stack.is_empty()) {
ObjArrayTask task = _objarray_stack.pop();
- follow_array(objArrayOop(task.obj()), task.index());
+ follow_array_chunk(objArrayOop(task.obj()), task.index());
}
} while (!_marking_stack.is_empty() || !_objarray_stack.is_empty());
}
@@ -242,6 +176,24 @@
void MarkSweep::FollowStackClosure::do_void() { follow_stack(); }
+template <class T> inline void MarkSweep::follow_root(T* p) {
+ assert(!Universe::heap()->is_in_reserved(p),
+ "roots shouldn't be things within the heap");
+ T heap_oop = oopDesc::load_heap_oop(p);
+ if (!oopDesc::is_null(heap_oop)) {
+ oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
+ if (!obj->mark()->is_marked() &&
+ !is_archive_object(obj)) {
+ mark_object(obj);
+ follow_object(obj);
+ }
+ }
+ follow_stack();
+}
+
+void MarkSweep::FollowRootClosure::do_oop(oop* p) { follow_root(p); }
+void MarkSweep::FollowRootClosure::do_oop(narrowOop* p) { follow_root(p); }
+
void PreservedMark::adjust_pointer() {
MarkSweep::adjust_pointer(&_obj);
}
@@ -266,6 +218,11 @@
}
}
+void MarkSweep::set_ref_processor(ReferenceProcessor* rp) {
+ _ref_processor = rp;
+ mark_and_push_closure.set_ref_processor(_ref_processor);
+}
+
MarkSweep::AdjustPointerClosure MarkSweep::adjust_pointer_closure;
template <typename T>
@@ -405,3 +362,6 @@
// know that Universe::TypeArrayKlass never moves.
return t->object_size();
}
+
+// Generate MS specialized oop_oop_iterate functions.
+SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_MS(ALL_KLASS_OOP_OOP_ITERATE_DEFN)
--- a/hotspot/src/share/vm/gc/serial/markSweep.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/markSweep.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -49,6 +49,7 @@
// declared at end
class PreservedMark;
+class MarkAndPushClosure;
class MarkSweep : AllStatic {
//
@@ -60,13 +61,6 @@
virtual void do_oop(narrowOop* p);
};
- class MarkAndPushClosure: public ExtendedOopClosure {
- public:
- template <typename T> void do_oop_nv(T* p);
- virtual void do_oop(oop* p);
- virtual void do_oop(narrowOop* p);
- };
-
class FollowStackClosure: public VoidClosure {
public:
virtual void do_void();
@@ -146,6 +140,7 @@
// Reference Processing
static ReferenceProcessor* const ref_processor() { return _ref_processor; }
+ static void set_ref_processor(ReferenceProcessor* rp);
// Archive Object handling
static inline bool is_archive_object(oop object);
@@ -153,34 +148,55 @@
static STWGCTimer* gc_timer() { return _gc_timer; }
static SerialOldTracer* gc_tracer() { return _gc_tracer; }
+ static void preserve_mark(oop p, markOop mark);
+ // Save the mark word so it can be restored later
+ static void adjust_marks(); // Adjust the pointers in the preserved marks table
+ static void restore_marks(); // Restore the marks that we saved in preserve_mark
+
+ static int adjust_pointers(oop obj);
+
+ static void follow_stack(); // Empty marking stack.
+
+ static void follow_klass(Klass* klass);
+
+ static void follow_cld(ClassLoaderData* cld);
+
+ template <class T> static inline void adjust_pointer(T* p);
+
+ // Check mark and maybe push on marking stack
+ template <class T> static void mark_and_push(T* p);
+
+ private:
// Call backs for marking
static void mark_object(oop obj);
// Mark pointer and follow contents. Empty marking stack afterwards.
template <class T> static inline void follow_root(T* p);
- // Check mark and maybe push on marking stack
- template <class T> static void mark_and_push(T* p);
-
static inline void push_objarray(oop obj, size_t index);
- static void follow_stack(); // Empty marking stack.
-
static void follow_object(oop obj);
- static void follow_array(objArrayOop array, int index);
+ static void follow_array(objArrayOop array);
+
+ static void follow_array_chunk(objArrayOop array, int index);
+};
- static void follow_klass(Klass* klass);
-
- static void follow_class_loader(ClassLoaderData* cld);
+class MarkAndPushClosure: public ExtendedOopClosure {
+public:
+ template <typename T> void do_oop_nv(T* p);
+ virtual void do_oop(oop* p);
+ virtual void do_oop(narrowOop* p);
- static int adjust_pointers(oop obj);
+ virtual bool do_metadata();
+ bool do_metadata_nv();
- static void preserve_mark(oop p, markOop mark);
- // Save the mark word so it can be restored later
- static void adjust_marks(); // Adjust the pointers in the preserved marks table
- static void restore_marks(); // Restore the marks that we saved in preserve_mark
+ virtual void do_klass(Klass* k);
+ void do_klass_nv(Klass* k);
- template <class T> static inline void adjust_pointer(T* p);
+ virtual void do_cld(ClassLoaderData* cld);
+ void do_cld_nv(ClassLoaderData* cld);
+
+ void set_ref_processor(ReferenceProcessor* rp) { _ref_processor = rp; }
};
class PreservedMark VALUE_OBJ_CLASS_SPEC {
--- a/hotspot/src/share/vm/gc/serial/markSweep.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/markSweep.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -26,38 +26,13 @@
#define SHARE_VM_GC_SERIAL_MARKSWEEP_INLINE_HPP
#include "gc/serial/markSweep.hpp"
-#include "gc/shared/collectedHeap.hpp"
-#include "oops/instanceClassLoaderKlass.inline.hpp"
-#include "oops/instanceKlass.inline.hpp"
-#include "oops/instanceMirrorKlass.inline.hpp"
-#include "oops/instanceRefKlass.inline.hpp"
+#include "memory/universe.hpp"
#include "oops/markOop.inline.hpp"
-#include "oops/objArrayKlass.inline.hpp"
-#include "utilities/macros.hpp"
-#include "utilities/stack.inline.hpp"
+#include "oops/oop.inline.hpp"
#if INCLUDE_ALL_GCS
-#include "gc/g1/g1StringDedup.hpp"
#include "gc/g1/g1MarkSweep.hpp"
#endif // INCLUDE_ALL_GCS
-inline void MarkSweep::mark_object(oop obj) {
-#if INCLUDE_ALL_GCS
- if (G1StringDedup::is_enabled()) {
- // We must enqueue the object before it is marked
- // as we otherwise can't read the object's age.
- G1StringDedup::enqueue_from_mark(obj);
- }
-#endif
- // some marks may contain information we need to preserve so we store them away
- // and overwrite the mark. We'll restore it at the end of markSweep.
- markOop mark = obj->mark();
- obj->set_mark(markOopDesc::prototype()->set_marked());
-
- if (mark->must_be_preserved(obj)) {
- preserve_mark(obj, mark);
- }
-}
-
inline bool MarkSweep::is_archive_object(oop object) {
#if INCLUDE_ALL_GCS
return (G1MarkSweep::archive_check_enabled() &&
@@ -67,51 +42,6 @@
#endif
}
-inline void MarkSweep::follow_klass(Klass* klass) {
- oop op = klass->klass_holder();
- MarkSweep::mark_and_push(&op);
-}
-
-inline void MarkSweep::follow_object(oop obj) {
- assert(obj->is_gc_marked(), "should be marked");
-
- obj->ms_follow_contents();
-}
-
-template <class T> inline void MarkSweep::follow_root(T* p) {
- assert(!Universe::heap()->is_in_reserved(p),
- "roots shouldn't be things within the heap");
- T heap_oop = oopDesc::load_heap_oop(p);
- if (!oopDesc::is_null(heap_oop)) {
- oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
- if (!obj->mark()->is_marked() &&
- !is_archive_object(obj)) {
- mark_object(obj);
- follow_object(obj);
- }
- }
- follow_stack();
-}
-
-template <class T> inline void MarkSweep::mark_and_push(T* p) {
-// assert(Universe::heap()->is_in_reserved(p), "should be in object space");
- T heap_oop = oopDesc::load_heap_oop(p);
- if (!oopDesc::is_null(heap_oop)) {
- oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
- if (!obj->mark()->is_marked() &&
- !is_archive_object(obj)) {
- mark_object(obj);
- _marking_stack.push(obj);
- }
- }
-}
-
-void MarkSweep::push_objarray(oop obj, size_t index) {
- ObjArrayTask task(obj, index);
- assert(task.is_valid(), "bad ObjArrayTask");
- _objarray_stack.push(task);
-}
-
inline int MarkSweep::adjust_pointers(oop obj) {
return obj->ms_adjust_pointers();
}
@@ -139,8 +69,4 @@
}
}
-template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
- mark_and_push(p);
-}
-
#endif // SHARE_VM_GC_SERIAL_MARKSWEEP_INLINE_HPP
--- a/hotspot/src/share/vm/gc/serial/tenuredGeneration.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/tenuredGeneration.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -108,7 +108,7 @@
free());
}
}
- // If we had to expand to accommodate promotions from younger generations
+ // If we had to expand to accommodate promotions from the young generation
if (!result && _capacity_at_prologue < capacity()) {
result = true;
if (PrintGC && Verbose) {
@@ -140,11 +140,11 @@
// that are of interest at this point.
bool current_is_young = GenCollectedHeap::heap()->is_young_gen(current_generation);
if (!full && current_is_young) {
- // Calculate size of data promoted from the younger generations
+ // Calculate size of data promoted from the young generation
// before doing the collection.
size_t used_before_gc = used();
- // If the younger gen collections were skipped, then the
+ // If the young gen collection was skipped, then the
// number of promoted bytes will be 0 and adding it to the
// average will incorrectly lessen the average. It is, however,
// also possible that no promotion was needed.
--- a/hotspot/src/share/vm/gc/serial/tenuredGeneration.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/tenuredGeneration.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -42,10 +42,10 @@
friend class VM_PopulateDumpSharedSpace;
protected:
- ContiguousSpace* _the_space; // Actual space holding objects
+ ContiguousSpace* _the_space; // Actual space holding objects
- GenerationCounters* _gen_counters;
- CSpaceCounters* _space_counters;
+ GenerationCounters* _gen_counters;
+ CSpaceCounters* _space_counters;
// Allocation failure
virtual bool expand(size_t bytes, size_t expand_bytes);
@@ -54,6 +54,7 @@
ContiguousSpace* space() const { return _the_space; }
void assert_correct_size_change_locking();
+
public:
TenuredGeneration(ReservedSpace rs,
size_t initial_byte_size,
@@ -66,10 +67,9 @@
const char* short_name() const { return "Tenured"; }
// Does a "full" (forced) collection invoked on this generation collect
- // all younger generations as well? Note that this is a
- // hack to allow the collection of the younger gen first if the flag is
- // set.
- virtual bool full_collects_younger_generations() const {
+ // the young generation as well? Note that this is a hack to allow the
+ // collection of the young gen first if the flag is set.
+ virtual bool full_collects_young_generation() const {
return !ScavengeBeforeFullGC;
}
@@ -99,15 +99,16 @@
bool clear_all_soft_refs,
size_t size,
bool is_tlab);
+
HeapWord* expand_and_allocate(size_t size,
bool is_tlab,
bool parallel = false);
virtual void prepare_for_verify();
-
virtual void gc_prologue(bool full);
virtual void gc_epilogue(bool full);
+
bool should_collect(bool full,
size_t word_size,
bool is_tlab);
--- a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -266,22 +266,22 @@
}
// The policy does not have enough data until at least some
- // minor collections have been done.
+ // young collections have been done.
_young_gen_policy_is_ready =
(_avg_minor_gc_cost->count() >= AdaptiveSizePolicyReadyThreshold);
// Calculate variables used to estimate pause time vs. gen sizes
- double eden_size_in_mbytes = ((double)_eden_size)/((double)M);
+ double eden_size_in_mbytes = ((double)_eden_size) / ((double)M);
update_minor_pause_young_estimator(minor_pause_in_ms);
update_minor_pause_old_estimator(minor_pause_in_ms);
if (PrintAdaptiveSizePolicy && Verbose) {
gclog_or_tty->print("AdaptiveSizePolicy::minor_collection_end: "
- "minor gc cost: %f average: %f", collection_cost,
- _avg_minor_gc_cost->average());
+ "minor gc cost: %f average: %f", collection_cost,
+ _avg_minor_gc_cost->average());
gclog_or_tty->print_cr(" minor pause: %f minor period %f",
- minor_pause_in_ms,
- _latest_minor_mutator_interval_seconds * MILLIUNITS);
+ minor_pause_in_ms,
+ _latest_minor_mutator_interval_seconds * MILLIUNITS);
}
// Calculate variable used to estimate collection cost vs. gen sizes
@@ -295,8 +295,7 @@
_minor_timer.start();
}
-size_t AdaptiveSizePolicy::eden_increment(size_t cur_eden,
- uint percent_change) {
+size_t AdaptiveSizePolicy::eden_increment(size_t cur_eden, uint percent_change) {
size_t eden_heap_delta;
eden_heap_delta = cur_eden / 100 * percent_change;
return eden_heap_delta;
@@ -312,8 +311,7 @@
return eden_heap_delta;
}
-size_t AdaptiveSizePolicy::promo_increment(size_t cur_promo,
- uint percent_change) {
+size_t AdaptiveSizePolicy::promo_increment(size_t cur_promo, uint percent_change) {
size_t promo_heap_delta;
promo_heap_delta = cur_promo / 100 * percent_change;
return promo_heap_delta;
--- a/hotspot/src/share/vm/gc/shared/barrierSet.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/barrierSet.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -132,6 +132,9 @@
// First the pre-write versions...
template <class T> inline void write_ref_field_pre(T* field, oop new_val);
private:
+ // Helper for write_ref_field_pre and friends, testing for specialized cases.
+ bool devirtualize_reference_writes() const;
+
// Keep this private so as to catch violations at build time.
virtual void write_ref_field_pre_work( void* field, oop new_val) { guarantee(false, "Not needed"); };
protected:
@@ -142,7 +145,7 @@
// ...then the post-write version.
inline void write_ref_field(void* field, oop new_val, bool release = false);
protected:
- virtual void write_ref_field_work(void* field, oop new_val, bool release = false) = 0;
+ virtual void write_ref_field_work(void* field, oop new_val, bool release) = 0;
public:
// Invoke the barrier, if any, necessary when writing the "bytes"-byte
--- a/hotspot/src/share/vm/gc/shared/barrierSet.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/barrierSet.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -32,8 +32,18 @@
// performance-critical calls when the barrier is the most common
// card-table kind.
+inline bool BarrierSet::devirtualize_reference_writes() const {
+ switch (kind()) {
+ case CardTableForRS:
+ case CardTableExtension:
+ return true;
+ default:
+ return false;
+ }
+}
+
template <class T> void BarrierSet::write_ref_field_pre(T* field, oop new_val) {
- if (kind() == CardTableModRef) {
+ if (devirtualize_reference_writes()) {
barrier_set_cast<CardTableModRefBS>(this)->inline_write_ref_field_pre(field, new_val);
} else {
write_ref_field_pre_work(field, new_val);
@@ -41,7 +51,7 @@
}
void BarrierSet::write_ref_field(void* field, oop new_val, bool release) {
- if (kind() == CardTableModRef) {
+ if (devirtualize_reference_writes()) {
barrier_set_cast<CardTableModRefBS>(this)->inline_write_ref_field(field, new_val, release);
} else {
write_ref_field_work(field, new_val, release);
@@ -77,7 +87,7 @@
inline void BarrierSet::write_region(MemRegion mr) {
- if (kind() == CardTableModRef) {
+ if (devirtualize_reference_writes()) {
barrier_set_cast<CardTableModRefBS>(this)->inline_write_region(mr);
} else {
write_region_work(mr);
--- a/hotspot/src/share/vm/gc/shared/blockOffsetTable.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/blockOffsetTable.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -25,9 +25,12 @@
#ifndef SHARE_VM_GC_SHARED_BLOCKOFFSETTABLE_HPP
#define SHARE_VM_GC_SHARED_BLOCKOFFSETTABLE_HPP
+#include "gc/shared/memset_with_concurrent_readers.hpp"
#include "memory/memRegion.hpp"
#include "memory/virtualspace.hpp"
+#include "runtime/globals.hpp"
#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
// The CollectedHeap type requires subtypes to implement a method
// "block_start". For some subtypes, notably generational
@@ -126,6 +129,19 @@
VirtualSpace _vs;
u_char* _offset_array; // byte array keeping backwards offsets
+ void fill_range(size_t start, size_t num_cards, u_char offset) {
+ void* start_ptr = &_offset_array[start];
+#if INCLUDE_ALL_GCS
+ // If collector is concurrent, special handling may be needed.
+ assert(!UseG1GC, "Shouldn't be here when using G1");
+ if (UseConcMarkSweepGC) {
+ memset_with_concurrent_readers(start_ptr, offset, num_cards);
+ return;
+ }
+#endif // INCLUDE_ALL_GCS
+ memset(start_ptr, offset, num_cards);
+ }
+
protected:
// Bounds checking accessors:
// For performance these have to devolve to array accesses in product builds.
@@ -160,20 +176,7 @@
assert(left < right, "Heap addresses out of order");
size_t num_cards = pointer_delta(right, left) >> LogN_words;
- // Below, we may use an explicit loop instead of memset()
- // because on certain platforms memset() can give concurrent
- // readers "out-of-thin-air," phantom zeros; see 6948537.
- if (UseMemSetInBOT) {
- memset(&_offset_array[index_for(left)], offset, num_cards);
- } else {
- size_t i = index_for(left);
- const size_t end = i + num_cards;
- for (; i < end; i++) {
- // Elided until CR 6977974 is fixed properly.
- // assert(!reducing || _offset_array[i] >= offset, "Not reducing");
- _offset_array[i] = offset;
- }
- }
+ fill_range(index_for(left), num_cards, offset);
}
void set_offset_array(size_t left, size_t right, u_char offset, bool reducing = false) {
@@ -182,20 +185,7 @@
assert(left <= right, "indexes out of order");
size_t num_cards = right - left + 1;
- // Below, we may use an explicit loop instead of memset
- // because on certain platforms memset() can give concurrent
- // readers "out-of-thin-air," phantom zeros; see 6948537.
- if (UseMemSetInBOT) {
- memset(&_offset_array[left], offset, num_cards);
- } else {
- size_t i = left;
- const size_t end = i + num_cards;
- for (; i < end; i++) {
- // Elided until CR 6977974 is fixed properly.
- // assert(!reducing || _offset_array[i] >= offset, "Not reducing");
- _offset_array[i] = offset;
- }
- }
+ fill_range(left, num_cards, offset);
}
void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const {
--- a/hotspot/src/share/vm/gc/shared/cardTableModRefBS.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBS.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -183,7 +183,7 @@
// these functions here for performance.
void write_ref_field_work(oop obj, size_t offset, oop newVal);
- virtual void write_ref_field_work(void* field, oop newVal, bool release = false);
+ virtual void write_ref_field_work(void* field, oop newVal, bool release);
public:
bool has_write_ref_array_opt() { return true; }
--- a/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -31,13 +31,7 @@
CardTableModRefBSForCTRS::CardTableModRefBSForCTRS(MemRegion whole_heap) :
CardTableModRefBS(
whole_heap,
- // Concrete tag should be BarrierSet::CardTableForRS.
- // That will presently break things in a bunch of places though.
- // The concrete tag is used as a dispatch key in many places, and
- // CardTableForRS does not correctly dispatch in some of those
- // uses. This will be addressed as part of a reorganization of the
- // BarrierSet hierarchy.
- BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableForRS)),
+ BarrierSet::FakeRtti(BarrierSet::CardTableForRS)),
// LNC functionality
_lowest_non_clean(NULL),
_lowest_non_clean_chunk_size(NULL),
--- a/hotspot/src/share/vm/gc/shared/cardTableRS.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableRS.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -80,7 +80,9 @@
break;
}
}
- if (!seen) return v;
+ if (!seen) {
+ return v;
+ }
}
ShouldNotReachHere();
return 0;
@@ -502,7 +504,7 @@
//
// The main point below is that the parallel card scanning code
// deals correctly with these stale card values. There are two main
- // cases to consider where we have a stale "younger gen" value and a
+ // cases to consider where we have a stale "young gen" value and a
// "derivative" case to consider, where we have a stale
// "cur_younger_gen_and_prev_non_clean" value, as will become
// apparent in the case analysis below.
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -160,16 +160,20 @@
// Memory state functions.
-CollectedHeap::CollectedHeap() {
+CollectedHeap::CollectedHeap() :
+ _barrier_set(NULL),
+ _is_gc_active(false),
+ _total_collections(0),
+ _total_full_collections(0),
+ _gc_cause(GCCause::_no_gc),
+ _gc_lastcause(GCCause::_no_gc),
+ _defer_initial_card_mark(false) // strengthened by subclass in pre_initialize() below.
+{
const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT));
const size_t elements_per_word = HeapWordSize / sizeof(jint);
_filler_array_max_size = align_object_size(filler_array_hdr_size() +
max_len / elements_per_word);
- _barrier_set = NULL;
- _is_gc_active = false;
- _total_collections = _total_full_collections = 0;
- _gc_cause = _gc_lastcause = GCCause::_no_gc;
NOT_PRODUCT(_promotion_failure_alot_count = 0;)
NOT_PRODUCT(_promotion_failure_alot_gc_number = 0;)
@@ -184,7 +188,7 @@
PerfDataManager::create_string_variable(SUN_GC, "lastCause",
80, GCCause::to_string(_gc_lastcause), CHECK);
}
- _defer_initial_card_mark = false; // strengthened by subclass in pre_initialize() below.
+
// Create the ring log
if (LogEvents) {
_gc_heap_log = new GCHeapLog();
@@ -570,8 +574,8 @@
void CollectedHeap::pre_full_gc_dump(GCTimer* timer) {
if (HeapDumpBeforeFullGC) {
GCTraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, timer, GCId::create());
- // We are doing a "major" collection and a heap dump before
- // major collection has been requested.
+ // We are doing a full collection and a heap dump before
+ // full collection has been requested.
HeapDumper::dump_heap();
}
if (PrintClassHistogramBeforeFullGC) {
--- a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -111,13 +111,6 @@
size_t max_heap_byte_size() { return _max_heap_byte_size; }
size_t min_heap_byte_size() { return _min_heap_byte_size; }
- enum Name {
- CollectorPolicyKind,
- GenCollectorPolicyKind,
- ConcurrentMarkSweepPolicyKind,
- G1CollectorPolicyKind
- };
-
AdaptiveSizePolicy* size_policy() { return _size_policy; }
bool should_clear_all_soft_refs() { return _should_clear_all_soft_refs; }
void set_should_clear_all_soft_refs(bool v) { _should_clear_all_soft_refs = v; }
@@ -150,8 +143,6 @@
#endif // INCLUDE_ALL_GCS
- virtual BarrierSet::Name barrier_set_name() = 0;
-
virtual GenRemSet* create_rem_set(MemRegion reserved);
// This method controls how a collector satisfies a request
@@ -182,10 +173,6 @@
ShouldNotReachHere();
}
- virtual CollectorPolicy::Name kind() {
- return CollectorPolicy::CollectorPolicyKind;
- }
-
// Do any updates required to global flags that are due to heap initialization
// changes
virtual void post_heap_initialize() = 0;
@@ -298,12 +285,6 @@
virtual void post_heap_initialize() {
assert(_max_young_size == MaxNewSize, "Should be taken care of by initialize_size_info");
}
-
- BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; }
-
- virtual CollectorPolicy::Name kind() {
- return CollectorPolicy::GenCollectorPolicyKind;
- }
};
class MarkSweepPolicy : public GenCollectorPolicy {
--- a/hotspot/src/share/vm/gc/shared/gcTrace.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/gcTrace.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -88,6 +88,8 @@
send_reference_stats_event(REF_WEAK, rps.weak_count());
send_reference_stats_event(REF_FINAL, rps.final_count());
send_reference_stats_event(REF_PHANTOM, rps.phantom_count());
+ send_reference_stats_event(REF_CLEANER, rps.cleaner_count());
+ send_reference_stats_event(REF_JNI, rps.jni_weak_ref_count());
}
#if INCLUDE_SERVICES
@@ -173,6 +175,11 @@
_tenuring_threshold = tenuring_threshold;
}
+bool YoungGCTracer::should_report_promotion_events() const {
+ return should_report_promotion_in_new_plab_event() ||
+ should_report_promotion_outside_plab_event();
+}
+
bool YoungGCTracer::should_report_promotion_in_new_plab_event() const {
return should_send_promotion_in_new_plab_event();
}
--- a/hotspot/src/share/vm/gc/shared/gcTrace.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/gcTrace.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -172,6 +172,7 @@
*
* plab_size is the size of the newly allocated PLAB in bytes.
*/
+ bool should_report_promotion_events() const;
bool should_report_promotion_in_new_plab_event() const;
bool should_report_promotion_outside_plab_event() const;
void report_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -464,7 +464,7 @@
bool prepared_for_verification = false;
bool collected_old = false;
bool old_collects_young = complete &&
- _old_gen->full_collects_younger_generations();
+ _old_gen->full_collects_young_generation();
if (!old_collects_young &&
_young_gen->should_collect(full, size, is_tlab)) {
if (run_verification && VerifyGCLevel <= 0 && VerifyBeforeGC) {
@@ -521,7 +521,7 @@
// a whole heap collection.
complete = complete || collected_old;
- if (complete) { // We did a "major" collection
+ if (complete) { // We did a full collection
// FIXME: See comment at pre_full_gc_dump call
post_full_gc_dump(NULL); // do any post full gc dumps
}
@@ -668,13 +668,13 @@
void GenCollectedHeap::gen_process_roots(StrongRootsScope* scope,
GenerationType type,
- bool younger_gens_as_roots,
+ bool young_gen_as_roots,
ScanningOption so,
bool only_strong_roots,
OopsInGenClosure* not_older_gens,
OopsInGenClosure* older_gens,
CLDClosure* cld_closure) {
- const bool is_adjust_phase = !only_strong_roots && !younger_gens_as_roots;
+ const bool is_adjust_phase = !only_strong_roots && !young_gen_as_roots;
bool is_moving_collection = false;
if (type == YoungGen || is_adjust_phase) {
@@ -691,7 +691,7 @@
cld_closure, weak_cld_closure,
&mark_code_closure);
- if (younger_gens_as_roots) {
+ if (young_gen_as_roots) {
if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
if (type == OldGen) {
not_older_gens->set_generation(_young_gen);
@@ -763,25 +763,25 @@
void GenCollectedHeap::collect(GCCause::Cause cause) {
if (should_do_concurrent_full_gc(cause)) {
#if INCLUDE_ALL_GCS
- // mostly concurrent full collection
+ // Mostly concurrent full collection.
collect_mostly_concurrent(cause);
#else // INCLUDE_ALL_GCS
ShouldNotReachHere();
#endif // INCLUDE_ALL_GCS
} else if (cause == GCCause::_wb_young_gc) {
- // minor collection for WhiteBox API
+ // Young collection for the WhiteBox API.
collect(cause, YoungGen);
} else {
#ifdef ASSERT
if (cause == GCCause::_scavenge_alot) {
- // minor collection only
+ // Young collection only.
collect(cause, YoungGen);
} else {
- // Stop-the-world full collection
+ // Stop-the-world full collection.
collect(cause, OldGen);
}
#else
- // Stop-the-world full collection
+ // Stop-the-world full collection.
collect(cause, OldGen);
#endif
}
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -173,8 +173,7 @@
size_t max_capacity() const;
- HeapWord* mem_allocate(size_t size,
- bool* gc_overhead_limit_was_exceeded);
+ HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded);
// We may support a shared contiguous allocation area, if the youngest
// generation does.
@@ -403,7 +402,7 @@
void gen_process_roots(StrongRootsScope* scope,
GenerationType type,
- bool younger_gens_as_roots,
+ bool young_gen_as_roots,
ScanningOption so,
bool only_strong_roots,
OopsInGenClosure* not_older_gens,
--- a/hotspot/src/share/vm/gc/shared/genRemSet.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/genRemSet.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -110,13 +110,11 @@
virtual void print() {}
// Informs the RS that the given memregion contains no references to
- // younger generations.
+ // the young generation.
virtual void clear(MemRegion mr) = 0;
- // Informs the RS that there are no references to generations
- // younger than gen from generations gen and older.
- // The parameter clear_perm indicates if the perm_gen's
- // remembered set should also be processed/cleared.
+ // Informs the RS that there are no references to the young generation
+ // from old_gen.
virtual void clear_into_younger(Generation* old_gen) = 0;
// Informs the RS that refs in the given "mr" may have changed
--- a/hotspot/src/share/vm/gc/shared/generation.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/generation.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -80,7 +80,6 @@
// first two fields are word-sized.)
};
-
class Generation: public CHeapObj<mtGC> {
friend class VMStructs;
private:
@@ -299,8 +298,7 @@
// word of "obj" may have been overwritten with a forwarding pointer, and
// also taking care to copy the klass pointer *last*. Returns the new
// object if successful, or else NULL.
- virtual oop par_promote(int thread_num,
- oop obj, markOop m, size_t word_sz);
+ virtual oop par_promote(int thread_num, oop obj, markOop m, size_t word_sz);
// Informs the current generation that all par_promote_alloc's in the
// collection have been completed; any supporting data structures can be
@@ -315,7 +313,7 @@
// This generation will collect all younger generations
// during a full collection.
- virtual bool full_collects_younger_generations() const { return false; }
+ virtual bool full_collects_young_generation() const { return false; }
// This generation does in-place marking, meaning that mark words
// are mutated during the marking phase and presumably reinitialized
@@ -370,18 +368,18 @@
// Some generations may require some cleanup or preparation actions before
// allowing a collection. The default is to do nothing.
- virtual void gc_prologue(bool full) {};
+ virtual void gc_prologue(bool full) {}
// Some generations may require some cleanup actions after a collection.
// The default is to do nothing.
- virtual void gc_epilogue(bool full) {};
+ virtual void gc_epilogue(bool full) {}
// Save the high water marks for the used space in a generation.
- virtual void record_spaces_top() {};
+ virtual void record_spaces_top() {}
// Some generations may need to be "fixed-up" after some allocation
// activity to make them parsable again. The default is to do nothing.
- virtual void ensure_parsability() {};
+ virtual void ensure_parsability() {}
// Time (in ms) when we were last collected or now if a collection is
// in progress.
@@ -417,7 +415,7 @@
virtual void adjust_pointers();
// Mark sweep support phase4
virtual void compact();
- virtual void post_compact() {ShouldNotReachHere();}
+ virtual void post_compact() { ShouldNotReachHere(); }
// Support for CMS's rescan. In this general form we return a pointer
// to an abstract object that can be used, based on specific previously
@@ -432,7 +430,7 @@
// Some generations may require some cleanup actions before allowing
// a verification.
- virtual void prepare_for_verify() {};
+ virtual void prepare_for_verify() {}
// Accessing "marks".
@@ -483,7 +481,7 @@
// Give each generation an opportunity to do clean up for any
// contributed scratch.
- virtual void reset_scratch() {};
+ virtual void reset_scratch() {}
// When an older generation has been collected, and perhaps resized,
// this method will be invoked on all younger generations (from older to
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+
+#include <string.h>
+#include "gc/shared/memset_with_concurrent_readers.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+#include "utilities/ostream.hpp"
+
+#if INCLUDE_ALL_GCS
+
+// Unit test
+#ifdef ASSERT
+
+static unsigned line_byte(const char* line, size_t i) {
+ return unsigned(line[i]) & 0xFF;
+}
+
+// Verify memset_with_concurrent_readers mimics memset.
+// We don't attempt to verify the concurrent reader case.
+void test_memset_with_concurrent_readers() {
+ const size_t chunk_size = 8 * BytesPerWord;
+ const unsigned chunk_count = 4;
+ const size_t block_size = (chunk_count + 4) * chunk_size;
+ char block[block_size];
+ char clear_block[block_size];
+ char set_block[block_size];
+
+ // block format:
+ // 0: unused leading chunk
+ // 1: chunk written from start index to end of chunk
+ // ... nchunks fully written chunks
+ // N: chunk written from start of chunk to end index
+ // N+1: unused trailing chunk
+
+ const int clear_value = 0;
+ const int set_value = 0xAC;
+
+ memset(clear_block, clear_value, block_size);
+ memset(set_block, set_value, block_size);
+
+ for (unsigned nchunks = 0; nchunks <= chunk_count; ++nchunks) {
+ for (size_t start = 1; start <= chunk_size; ++start) {
+ for (size_t end = 0; end <= chunk_size; ++end) {
+ size_t set_start = chunk_size + start;
+ size_t set_end = (2 + nchunks) * chunk_size + end;
+ size_t set_size = set_end - set_start;
+
+ memset(block, clear_value, block_size);
+ memset_with_concurrent_readers(&block[set_start], set_value, set_size);
+ bool head_clear = !memcmp(clear_block, block, set_start);
+ bool middle_set = !memcmp(set_block, block + set_start, set_size);
+ bool tail_clear = !memcmp(clear_block, block + set_end, block_size - set_end);
+ if (!(head_clear && middle_set && tail_clear)) {
+ tty->print_cr("*** memset_with_concurrent_readers failed: "
+ "set start " SIZE_FORMAT ", set end " SIZE_FORMAT,
+ set_start, set_end);
+ for (unsigned chunk = 0; chunk < (block_size / chunk_size); ++chunk) {
+ for (unsigned line = 0; line < (chunk_size / BytesPerWord); ++line) {
+ const char* lp = &block[chunk * chunk_size + line * BytesPerWord];
+ tty->print_cr("%d,%d: %2x %2x %2x %2x %2x %2x %2x %2x",
+ chunk, line,
+ line_byte(lp, 0), line_byte(lp, 1),
+ line_byte(lp, 2), line_byte(lp, 3),
+ line_byte(lp, 4), line_byte(lp, 5),
+ line_byte(lp, 6), line_byte(lp, 7));
+ }
+ }
+ assert(head_clear, "leading byte not clear");
+ assert(middle_set, "memset byte not set");
+ assert(tail_clear, "trailing bye not clear");
+ }
+ }
+ }
+ }
+}
+
+#endif // end unit test
+
+#endif // INCLUDE_ALL_GCS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc/shared/memset_with_concurrent_readers.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+#ifndef SRC_SHARE_VM_GC_SHARED_MEMSETWITHCONCURRENTREADERS_HPP
+#define SRC_SHARE_VM_GC_SHARED_MEMSETWITHCONCURRENTREADERS_HPP
+
+#include <stddef.h>
+#include <string.h>
+#include "utilities/macros.hpp"
+
+// Only used by concurrent collectors.
+#if INCLUDE_ALL_GCS
+
+// Fill a block of memory with value, like memset, but with the
+// understanding that there may be concurrent readers of that memory.
+void memset_with_concurrent_readers(void* to, int value, size_t size);
+
+#ifdef TARGET_ARCH_sparc
+
+// SPARC requires special handling. See SPARC-specific definition.
+
+#else
+// All others just use memset.
+
+inline void memset_with_concurrent_readers(void* to, int value, size_t size) {
+ ::memset(to, value, size);
+}
+
+#endif // End of target dispatch.
+
+#endif // INCLUDE_ALL_GCS
+
+#endif // include guard
--- a/hotspot/src/share/vm/gc/shared/modRefBarrierSet.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/modRefBarrierSet.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -60,7 +60,6 @@
: BarrierSet(fake_rtti.add_tag(BarrierSet::ModRef)) { }
~ModRefBarrierSet() { }
- virtual void write_ref_field_work(void* field, oop new_val, bool release = false) = 0;
public:
void write_prim_field(HeapWord* field, size_t bytes,
juint val1, juint val2) {}
--- a/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -243,10 +243,13 @@
process_discovered_reflist(_discoveredPhantomRefs, NULL, false,
is_alive, keep_alive, complete_gc, task_executor);
- // Process cleaners, but include them in phantom statistics. We expect
- // Cleaner references to be temporary, and don't want to deal with
- // possible incompatibilities arising from making it more visible.
- phantom_count +=
+ }
+
+ // Cleaners
+ size_t cleaner_count = 0;
+ {
+ GCTraceTime tt("Cleaners", trace_time, false, gc_timer, gc_id);
+ cleaner_count =
process_discovered_reflist(_discoveredCleanerRefs, NULL, true,
is_alive, keep_alive, complete_gc, task_executor);
}
@@ -256,15 +259,17 @@
// that is not how the JDK1.2 specification is. See #4126360. Native code can
// thus use JNI weak references to circumvent the phantom references and
// resurrect a "post-mortem" object.
+ size_t jni_weak_ref_count = 0;
{
GCTraceTime tt("JNI Weak Reference", trace_time, false, gc_timer, gc_id);
if (task_executor != NULL) {
task_executor->set_single_threaded_mode();
}
- process_phaseJNI(is_alive, keep_alive, complete_gc);
+ jni_weak_ref_count =
+ process_phaseJNI(is_alive, keep_alive, complete_gc);
}
- return ReferenceProcessorStats(soft_count, weak_count, final_count, phantom_count);
+ return ReferenceProcessorStats(soft_count, weak_count, final_count, phantom_count, cleaner_count, jni_weak_ref_count);
}
#ifndef PRODUCT
@@ -291,17 +296,17 @@
}
#endif
-void ReferenceProcessor::process_phaseJNI(BoolObjectClosure* is_alive,
- OopClosure* keep_alive,
- VoidClosure* complete_gc) {
-#ifndef PRODUCT
+size_t ReferenceProcessor::process_phaseJNI(BoolObjectClosure* is_alive,
+ OopClosure* keep_alive,
+ VoidClosure* complete_gc) {
+ DEBUG_ONLY(size_t check_count = count_jni_refs();)
+ size_t count = JNIHandles::weak_oops_do(is_alive, keep_alive);
+ assert(count == check_count, "Counts didn't match");
+ complete_gc->do_void();
if (PrintGCDetails && PrintReferenceGC) {
- unsigned int count = count_jni_refs();
- gclog_or_tty->print(", %u refs", count);
+ gclog_or_tty->print(", " SIZE_FORMAT " refs", count);
}
-#endif
- JNIHandles::weak_oops_do(is_alive, keep_alive);
- complete_gc->do_void();
+ return count;
}
@@ -941,9 +946,10 @@
list = &_discoveredCleanerRefs[id];
break;
case REF_NONE:
+ case REF_JNI:
// we should not reach here if we are an InstanceRefKlass
default:
- ShouldNotReachHere();
+ guarantee(false, err_msg("rt should not be %d", rt));
}
if (TraceReferenceGC && PrintGCDetails) {
gclog_or_tty->print_cr("Thread %d gets list " INTPTR_FORMAT, id, p2i(list));
@@ -1059,7 +1065,7 @@
// can mark through them now, rather than delaying that
// to the reference-processing phase. Since all current
// time-stamp policies advance the soft-ref clock only
- // at a major collection cycle, this is always currently
+ // at a full collection cycle, this is always currently
// accurate.
if (!_current_soft_ref_policy->should_clear_reference(obj, _soft_ref_timestamp_clock)) {
return false;
--- a/hotspot/src/share/vm/gc/shared/referenceProcessor.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/referenceProcessor.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -247,7 +247,7 @@
DiscoveredList* _discoveredCleanerRefs;
public:
- static int number_of_subclasses_of_ref() { return (REF_CLEANER - REF_OTHER); }
+ static int number_of_subclasses_of_ref() { return REF_LISTS_COUNT; }
uint num_q() { return _num_q; }
uint max_num_q() { return _max_num_q; }
@@ -271,9 +271,9 @@
VoidClosure* complete_gc,
AbstractRefProcTaskExecutor* task_executor);
- void process_phaseJNI(BoolObjectClosure* is_alive,
- OopClosure* keep_alive,
- VoidClosure* complete_gc);
+ size_t process_phaseJNI(BoolObjectClosure* is_alive,
+ OopClosure* keep_alive,
+ VoidClosure* complete_gc);
// Work methods used by the method process_discovered_reflist
// Phase1: keep alive all those referents that are otherwise
--- a/hotspot/src/share/vm/gc/shared/referenceProcessorStats.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/referenceProcessorStats.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -36,22 +36,30 @@
size_t _weak_count;
size_t _final_count;
size_t _phantom_count;
+ size_t _cleaner_count;
+ size_t _jni_weak_ref_count;
public:
ReferenceProcessorStats() :
_soft_count(0),
_weak_count(0),
_final_count(0),
- _phantom_count(0) {}
+ _phantom_count(0),
+ _cleaner_count(0),
+ _jni_weak_ref_count(0) {}
ReferenceProcessorStats(size_t soft_count,
size_t weak_count,
size_t final_count,
- size_t phantom_count) :
+ size_t phantom_count,
+ size_t cleaner_count,
+ size_t jni_weak_ref_count) :
_soft_count(soft_count),
_weak_count(weak_count),
_final_count(final_count),
- _phantom_count(phantom_count)
+ _phantom_count(phantom_count),
+ _cleaner_count(cleaner_count),
+ _jni_weak_ref_count(jni_weak_ref_count)
{}
size_t soft_count() const {
@@ -69,5 +77,13 @@
size_t phantom_count() const {
return _phantom_count;
}
+
+ size_t cleaner_count() const {
+ return _cleaner_count;
+ }
+
+ size_t jni_weak_ref_count() const {
+ return _jni_weak_ref_count;
+ }
};
#endif
--- a/hotspot/src/share/vm/gc/shared/space.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/space.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -237,7 +237,7 @@
HeapWord* bottom, \
HeapWord* top, \
ClosureType* cl) { \
- bottom += oop(bottom)->oop_iterate(cl, mr); \
+ bottom += oop(bottom)->oop_iterate_size(cl, mr); \
if (bottom < top) { \
HeapWord* next_obj = bottom + oop(bottom)->size(); \
while (next_obj < top) { \
@@ -508,7 +508,7 @@
HeapWord* t = mr.end(); \
while (obj_addr < t) { \
assert(oop(obj_addr)->is_oop(), "Should be an oop"); \
- obj_addr += oop(obj_addr)->oop_iterate(blk); \
+ obj_addr += oop(obj_addr)->oop_iterate_size(blk); \
} \
}
@@ -523,7 +523,7 @@
HeapWord* t = top();
// Could call objects iterate, but this is easier.
while (obj_addr < t) {
- obj_addr += oop(obj_addr)->oop_iterate(blk);
+ obj_addr += oop(obj_addr)->oop_iterate_size(blk);
}
}
@@ -578,7 +578,7 @@
Prefetch::write(p, interval); \
debug_only(HeapWord* prev = p); \
oop m = oop(p); \
- p += m->oop_iterate(blk); \
+ p += m->oop_iterate_size(blk); \
} \
} while (t < top()); \
\
--- a/hotspot/src/share/vm/gc/shared/specialized_oop_closures.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/specialized_oop_closures.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -42,6 +42,8 @@
class ScanClosure;
class FastScanClosure;
class FilteringClosure;
+// MarkSweep
+class MarkAndPushClosure;
// ParNew
class ParScanWithBarrierClosure;
class ParScanWithoutBarrierClosure;
@@ -87,6 +89,9 @@
SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_S(f) \
SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f)
+#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_MS(f) \
+ f(MarkAndPushClosure,_nv)
+
#if INCLUDE_ALL_GCS
#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f) \
f(MarkRefsIntoAndScanClosure,_nv) \
@@ -101,10 +106,12 @@
#if INCLUDE_ALL_GCS
#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) \
+ SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_MS(f) \
SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f) \
SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f)
#else // INCLUDE_ALL_GCS
-#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)
+#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) \
+ SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_MS(f)
#endif // INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/gc/shared/taskqueue.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -258,8 +258,8 @@
#ifdef ASSERT
bool ObjArrayTask::is_valid() const {
- return _obj != NULL && _obj->is_objArray() && _index > 0 &&
- _index < objArrayOop(_obj)->length();
+ return _obj != NULL && _obj->is_objArray() && _index >= 0 &&
+ _index < objArrayOop(_obj)->length();
}
#endif // ASSERT
--- a/hotspot/src/share/vm/gc/shared/vmGCOperations.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/vmGCOperations.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -213,15 +213,18 @@
size_t _size; // size of object to be allocated
Metaspace::MetadataType _mdtype;
ClassLoaderData* _loader_data;
+
public:
VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
- size_t size, Metaspace::MetadataType mdtype,
+ size_t size,
+ Metaspace::MetadataType mdtype,
uint gc_count_before,
uint full_gc_count_before,
GCCause::Cause gc_cause)
: VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
_loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) {
}
+
virtual VMOp_Type type() const { return VMOp_CollectForMetadataAllocation; }
virtual void doit();
MetaWord* result() const { return _result; }
--- a/hotspot/src/share/vm/memory/filemap.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/memory/filemap.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -707,12 +707,16 @@
addr, string_ranges[i].byte_size(), si->_read_only,
si->_allow_exec);
if (base == NULL || base != addr) {
+ // dealloc the string regions from java heap
+ dealloc_string_regions();
fail_continue("Unable to map shared string space at required address.");
return false;
}
}
if (!verify_string_regions()) {
+ // dealloc the string regions from java heap
+ dealloc_string_regions();
fail_continue("Shared string regions are corrupt");
return false;
}
@@ -745,12 +749,14 @@
}
void FileMapInfo::fixup_string_regions() {
+#if INCLUDE_ALL_GCS
// If any string regions were found, call the fill routine to make them parseable.
// Note that string_ranges may be non-NULL even if no ranges were found.
if (num_ranges != 0) {
assert(string_ranges != NULL, "Null string_ranges array with non-zero count");
G1CollectedHeap::heap()->fill_archive_regions(string_ranges, num_ranges);
}
+#endif
}
bool FileMapInfo::verify_region_checksum(int i) {
@@ -793,20 +799,14 @@
}
}
-void FileMapInfo::unmap_string_regions() {
- for (int i = MetaspaceShared::first_string;
- i < MetaspaceShared::first_string + MetaspaceShared::max_strings; i++) {
- struct FileMapInfo::FileMapHeader::space_info* si = &_header->_space[i];
- size_t used = si->_used;
- if (used > 0) {
- size_t size = align_size_up(used, os::vm_allocation_granularity());
- char* addr = (char*)((void*)oopDesc::decode_heap_oop_not_null(
- (narrowOop)si->_addr._offset));
- if (!os::unmap_memory(addr, size)) {
- fail_stop("Unable to unmap shared space.");
- }
- }
+// dealloc the archived string region from java heap
+void FileMapInfo::dealloc_string_regions() {
+#if INCLUDE_ALL_GCS
+ if (num_ranges > 0) {
+ assert(string_ranges != NULL, "Null string_ranges array with non-zero count");
+ G1CollectedHeap::heap()->dealloc_archive_regions(string_ranges, num_ranges);
}
+#endif
}
void FileMapInfo::assert_mark(bool check) {
@@ -967,7 +967,9 @@
map_info->_header->_space[i]._addr._base = NULL;
}
}
- map_info->unmap_string_regions();
+ // Dealloc the string regions only without unmapping. The string regions are part
+ // of the java heap. Unmapping of the heap regions are managed by GC.
+ map_info->dealloc_string_regions();
} else if (DumpSharedSpaces) {
fail_stop("%s", msg);
}
--- a/hotspot/src/share/vm/memory/filemap.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/memory/filemap.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -208,7 +208,7 @@
bool verify_string_regions();
void fixup_string_regions();
void unmap_region(int i);
- void unmap_string_regions();
+ void dealloc_string_regions();
bool verify_region_checksum(int i);
void close();
bool is_open() { return _file_open; }
--- a/hotspot/src/share/vm/memory/iterator.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/memory/iterator.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -61,7 +61,7 @@
//
// 1) do_klass on the header klass pointer.
// 2) do_klass on the klass pointer in the mirrors.
- // 3) do_class_loader_data on the class loader data in class loaders.
+ // 3) do_cld on the class loader data in class loaders.
//
// The virtual (without suffix) and the non-virtual (with _nv suffix) need
// to be updated together, or else the devirtualization will break.
@@ -71,13 +71,14 @@
// ExtendedOopClosures that don't need to walk the metadata.
// Currently, only CMS and G1 need these.
+ bool do_metadata_nv() { return false; }
virtual bool do_metadata() { return do_metadata_nv(); }
- bool do_metadata_nv() { return false; }
- virtual void do_klass(Klass* k) { do_klass_nv(k); }
- void do_klass_nv(Klass* k) { ShouldNotReachHere(); }
+ void do_klass_nv(Klass* k) { ShouldNotReachHere(); }
+ virtual void do_klass(Klass* k) { do_klass_nv(k); }
- virtual void do_class_loader_data(ClassLoaderData* cld) { ShouldNotReachHere(); }
+ void do_cld_nv(ClassLoaderData* cld) { ShouldNotReachHere(); }
+ virtual void do_cld(ClassLoaderData* cld) { do_cld_nv(cld); }
// True iff this closure may be safely applied more than once to an oop
// location without an intervening "major reset" (like the end of a GC).
@@ -180,13 +181,14 @@
_klass_closure.initialize(this);
}
- virtual bool do_metadata() { return do_metadata_nv(); }
- inline bool do_metadata_nv() { return true; }
+ bool do_metadata_nv() { return true; }
+ virtual bool do_metadata() { return do_metadata_nv(); }
- virtual void do_klass(Klass* k);
void do_klass_nv(Klass* k);
+ virtual void do_klass(Klass* k) { do_klass_nv(k); }
- virtual void do_class_loader_data(ClassLoaderData* cld);
+ void do_cld_nv(ClassLoaderData* cld);
+ virtual void do_cld(ClassLoaderData* cld) { do_cld_nv(cld); }
};
// ObjectClosure is used for iterating through an object space
@@ -370,6 +372,7 @@
public:
template <class OopClosureType, typename T> static void do_oop(OopClosureType* closure, T* p);
template <class OopClosureType> static void do_klass(OopClosureType* closure, Klass* k);
+ template <class OopClosureType> static void do_cld(OopClosureType* closure, ClassLoaderData* cld);
template <class OopClosureType> static bool do_metadata(OopClosureType* closure);
};
@@ -378,6 +381,7 @@
public:
template <class OopClosureType, typename T> static void do_oop(OopClosureType* closure, T* p);
template <class OopClosureType> static void do_klass(OopClosureType* closure, Klass* k);
+ template <class OopClosureType> static void do_cld(OopClosureType* closure, ClassLoaderData* cld);
template <class OopClosureType> static bool do_metadata(OopClosureType* closure);
};
--- a/hotspot/src/share/vm/memory/iterator.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/memory/iterator.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -36,7 +36,7 @@
#include "oops/typeArrayKlass.inline.hpp"
#include "utilities/debug.hpp"
-inline void MetadataAwareOopClosure::do_class_loader_data(ClassLoaderData* cld) {
+inline void MetadataAwareOopClosure::do_cld_nv(ClassLoaderData* cld) {
assert(_klass_closure._oop_closure == this, "Must be");
bool claim = true; // Must claim the class loader data before processing.
@@ -45,11 +45,9 @@
inline void MetadataAwareOopClosure::do_klass_nv(Klass* k) {
ClassLoaderData* cld = k->class_loader_data();
- do_class_loader_data(cld);
+ do_cld_nv(cld);
}
-inline void MetadataAwareOopClosure::do_klass(Klass* k) { do_klass_nv(k); }
-
#ifdef ASSERT
// This verification is applied to all visited oops.
// The closures can turn is off by overriding should_verify_oops().
@@ -78,6 +76,10 @@
closure->do_klass_nv(k);
}
template <class OopClosureType>
+void Devirtualizer<true>::do_cld(OopClosureType* closure, ClassLoaderData* cld) {
+ closure->do_cld_nv(cld);
+}
+template <class OopClosureType>
inline bool Devirtualizer<true>::do_metadata(OopClosureType* closure) {
// Make sure the non-virtual and the virtual versions match.
assert(closure->do_metadata_nv() == closure->do_metadata(), "Inconsistency in do_metadata");
@@ -96,6 +98,10 @@
closure->do_klass(k);
}
template <class OopClosureType>
+void Devirtualizer<false>::do_cld(OopClosureType* closure, ClassLoaderData* cld) {
+ closure->do_cld(cld);
+}
+template <class OopClosureType>
bool Devirtualizer<false>::do_metadata(OopClosureType* closure) {
return closure->do_metadata();
}
--- a/hotspot/src/share/vm/memory/referenceType.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/memory/referenceType.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -32,11 +32,15 @@
enum ReferenceType {
REF_NONE, // Regular class
REF_OTHER, // Subclass of java/lang/ref/Reference, but not subclass of one of the classes below
+ ///////////////// Only the types below have their own discovered lists
REF_SOFT, // Subclass of java/lang/ref/SoftReference
REF_WEAK, // Subclass of java/lang/ref/WeakReference
REF_FINAL, // Subclass of java/lang/ref/FinalReference
REF_PHANTOM, // Subclass of java/lang/ref/PhantomReference
- REF_CLEANER // Subclass of sun/misc/Cleaner
+ REF_CLEANER, // Subclass of sun/misc/Cleaner
+ ///////////////// Only the types in the above range have their own discovered lists
+ REF_JNI, // JNI weak refs
+ REF_LISTS_COUNT = REF_CLEANER - REF_OTHER // Number of discovered lists
};
#endif // SHARE_VM_MEMORY_REFERENCETYPE_HPP
--- a/hotspot/src/share/vm/oops/arrayKlass.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/arrayKlass.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -147,30 +147,30 @@
// Array oop iteration macros for declarations.
// Used to generate the declarations in the *ArrayKlass header files.
-#define OOP_OOP_ITERATE_DECL_RANGE(OopClosureType, nv_suffix) \
- int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* closure, int start, int end);
+#define OOP_OOP_ITERATE_DECL_RANGE(OopClosureType, nv_suffix) \
+ void oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* closure, int start, int end);
#if INCLUDE_ALL_GCS
// Named NO_BACKWARDS because the definition used by *ArrayKlass isn't reversed, see below.
-#define OOP_OOP_ITERATE_DECL_NO_BACKWARDS(OopClosureType, nv_suffix) \
- int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure);
+#define OOP_OOP_ITERATE_DECL_NO_BACKWARDS(OopClosureType, nv_suffix) \
+ void oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure);
#endif // INCLUDE_ALL_GCS
// Array oop iteration macros for definitions.
// Used to generate the definitions in the *ArrayKlass.inline.hpp files.
-#define OOP_OOP_ITERATE_DEFN_RANGE(KlassType, OopClosureType, nv_suffix) \
- \
-int KlassType::oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* closure, int start, int end) { \
- return oop_oop_iterate_range<nvs_to_bool(nv_suffix)>(obj, closure, start, end); \
+#define OOP_OOP_ITERATE_DEFN_RANGE(KlassType, OopClosureType, nv_suffix) \
+ \
+void KlassType::oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* closure, int start, int end) { \
+ oop_oop_iterate_range<nvs_to_bool(nv_suffix)>(obj, closure, start, end); \
}
#if INCLUDE_ALL_GCS
-#define OOP_OOP_ITERATE_DEFN_NO_BACKWARDS(KlassType, OopClosureType, nv_suffix) \
-int KlassType::oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
- /* No reverse implementation ATM. */ \
- return oop_oop_iterate<nvs_to_bool(nv_suffix)>(obj, closure); \
+#define OOP_OOP_ITERATE_DEFN_NO_BACKWARDS(KlassType, OopClosureType, nv_suffix) \
+void KlassType::oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
+ /* No reverse implementation ATM. */ \
+ oop_oop_iterate<nvs_to_bool(nv_suffix)>(obj, closure); \
}
#else
#define OOP_OOP_ITERATE_DEFN_NO_BACKWARDS(KlassType, OopClosureType, nv_suffix)
--- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -51,7 +51,6 @@
// GC specific object visitors
//
// Mark Sweep
- void oop_ms_follow_contents(oop obj);
int oop_ms_adjust_pointers(oop obj);
#if INCLUDE_ALL_GCS
// Parallel Scavenge
@@ -71,19 +70,19 @@
// Forward iteration
// Iterate over the oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate(oop obj, OopClosureType* closure);
#if INCLUDE_ALL_GCS
// Reverse iteration
// Iterate over the oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
#endif
// Bounded range iteration
// Iterate over the oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
+ inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
public:
--- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -26,6 +26,7 @@
#define SHARE_VM_OOPS_INSTANCECLASSLOADERKLASS_INLINE_HPP
#include "classfile/javaClasses.hpp"
+#include "memory/iterator.inline.hpp"
#include "oops/instanceClassLoaderKlass.hpp"
#include "oops/instanceKlass.inline.hpp"
#include "oops/oop.inline.hpp"
@@ -34,48 +35,42 @@
#include "utilities/macros.hpp"
template <bool nv, class OopClosureType>
-inline int InstanceClassLoaderKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
- int size = InstanceKlass::oop_oop_iterate<nv>(obj, closure);
+inline void InstanceClassLoaderKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
+ InstanceKlass::oop_oop_iterate<nv>(obj, closure);
if (Devirtualizer<nv>::do_metadata(closure)) {
ClassLoaderData* cld = java_lang_ClassLoader::loader_data(obj);
// cld can be null if we have a non-registered class loader.
if (cld != NULL) {
- closure->do_class_loader_data(cld);
+ Devirtualizer<nv>::do_cld(closure, cld);
}
}
-
- return size;
}
#if INCLUDE_ALL_GCS
template <bool nv, class OopClosureType>
-inline int InstanceClassLoaderKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
- int size = InstanceKlass::oop_oop_iterate_reverse<nv>(obj, closure);
+inline void InstanceClassLoaderKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
+ InstanceKlass::oop_oop_iterate_reverse<nv>(obj, closure);
assert(!Devirtualizer<nv>::do_metadata(closure),
"Code to handle metadata is not implemented");
-
- return size;
}
#endif // INCLUDE_ALL_GCS
template <bool nv, class OopClosureType>
-inline int InstanceClassLoaderKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
- int size = InstanceKlass::oop_oop_iterate_bounded<nv>(obj, closure, mr);
+inline void InstanceClassLoaderKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
+ InstanceKlass::oop_oop_iterate_bounded<nv>(obj, closure, mr);
if (Devirtualizer<nv>::do_metadata(closure)) {
if (mr.contains(obj)) {
ClassLoaderData* cld = java_lang_ClassLoader::loader_data(obj);
// cld can be null if we have a non-registered class loader.
if (cld != NULL) {
- closure->do_class_loader_data(cld);
+ Devirtualizer<nv>::do_cld(closure, cld);
}
}
}
-
- return size;
}
#define ALL_INSTANCE_CLASS_LOADER_KLASS_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -1014,7 +1014,6 @@
// GC specific object visitors
//
// Mark Sweep
- void oop_ms_follow_contents(oop obj);
int oop_ms_adjust_pointers(oop obj);
#if INCLUDE_ALL_GCS
// Parallel Scavenge
--- a/hotspot/src/share/vm/oops/instanceKlass.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -38,6 +38,8 @@
// as the previous macro based implementation.
#ifdef TARGET_COMPILER_visCPP
#define INLINE __forceinline
+#elif defined(TARGET_COMPILER_sparcWorks)
+#define INLINE __attribute__((always_inline))
#else
#define INLINE inline
#endif
--- a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -91,7 +91,6 @@
// GC specific object visitors
//
// Mark Sweep
- void oop_ms_follow_contents(oop obj);
int oop_ms_adjust_pointers(oop obj);
#if INCLUDE_ALL_GCS
// Parallel Scavenge
@@ -121,21 +120,21 @@
// Forward iteration
// Iterate over the oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate(oop obj, OopClosureType* closure);
// Reverse iteration
#if INCLUDE_ALL_GCS
// Iterate over the oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
#endif
// Bounded range iteration
// Iterate over the oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
+ inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
// Iterate over the static fields.
template <bool nv, class OopClosureType>
--- a/hotspot/src/share/vm/oops/instanceMirrorKlass.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -53,30 +53,40 @@
}
template <bool nv, class OopClosureType>
-int InstanceMirrorKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
+void InstanceMirrorKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
InstanceKlass::oop_oop_iterate<nv>(obj, closure);
if (Devirtualizer<nv>::do_metadata(closure)) {
Klass* klass = java_lang_Class::as_Klass(obj);
// We'll get NULL for primitive mirrors.
if (klass != NULL) {
- Devirtualizer<nv>::do_klass(closure, klass);
+ if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
+ // An anonymous class doesn't have its own class loader, so when handling
+ // the java mirror for an anonymous class we need to make sure its class
+ // loader data is claimed, this is done by calling do_cld explicitly.
+ // For non-anonymous classes the call to do_cld is made when the class
+ // loader itself is handled.
+ Devirtualizer<nv>::do_cld(closure, klass->class_loader_data());
+ } else {
+ Devirtualizer<nv>::do_klass(closure, klass);
+ }
+ } else {
+ // If klass is NULL then this a mirror for a primitive type.
+ // We don't have to follow them, since they are handled as strong
+ // roots in Universe::oops_do.
+ assert(java_lang_Class::is_primitive(obj), "Sanity check");
}
}
oop_oop_iterate_statics<nv>(obj, closure);
-
- return oop_size(obj);
}
#if INCLUDE_ALL_GCS
template <bool nv, class OopClosureType>
-int InstanceMirrorKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
+void InstanceMirrorKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
InstanceKlass::oop_oop_iterate_reverse<nv>(obj, closure);
InstanceMirrorKlass::oop_oop_iterate_statics<nv>(obj, closure);
-
- return oop_size(obj);
}
#endif
@@ -115,7 +125,7 @@
}
template <bool nv, class OopClosureType>
-int InstanceMirrorKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
+void InstanceMirrorKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
InstanceKlass::oop_oop_iterate_bounded<nv>(obj, closure, mr);
if (Devirtualizer<nv>::do_metadata(closure)) {
@@ -129,8 +139,6 @@
}
oop_oop_iterate_statics_bounded<nv>(obj, closure, mr);
-
- return oop_size(obj);
}
#define ALL_INSTANCE_MIRROR_KLASS_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
--- a/hotspot/src/share/vm/oops/instanceRefKlass.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -67,7 +67,6 @@
// GC specific object visitors
//
// Mark Sweep
- void oop_ms_follow_contents(oop obj);
int oop_ms_adjust_pointers(oop obj);
#if INCLUDE_ALL_GCS
// Parallel Scavenge
@@ -88,19 +87,19 @@
private:
// Iterate over all oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate(oop obj, OopClosureType* closure);
// Reverse iteration
#if INCLUDE_ALL_GCS
// Iterate over all oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
#endif // INCLUDE_ALL_GCS
// Bounded range iteration
// Iterate over all oop fields and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
+ inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
// Reference processing part of the iterators.
--- a/hotspot/src/share/vm/oops/instanceRefKlass.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -106,37 +106,27 @@
}
template <bool nv, class OopClosureType>
-int InstanceRefKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
- // Get size before changing pointers
- int size = InstanceKlass::oop_oop_iterate<nv>(obj, closure);
+void InstanceRefKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
+ InstanceKlass::oop_oop_iterate<nv>(obj, closure);
oop_oop_iterate_ref_processing<nv>(obj, closure);
-
- return size;
}
#if INCLUDE_ALL_GCS
template <bool nv, class OopClosureType>
-int InstanceRefKlass::
-oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
- // Get size before changing pointers
- int size = InstanceKlass::oop_oop_iterate_reverse<nv>(obj, closure);
+void InstanceRefKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
+ InstanceKlass::oop_oop_iterate_reverse<nv>(obj, closure);
oop_oop_iterate_ref_processing<nv>(obj, closure);
-
- return size;
}
#endif // INCLUDE_ALL_GCS
template <bool nv, class OopClosureType>
-int InstanceRefKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
- // Get size before changing pointers
- int size = InstanceKlass::oop_oop_iterate_bounded<nv>(obj, closure, mr);
+void InstanceRefKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
+ InstanceKlass::oop_oop_iterate_bounded<nv>(obj, closure, mr);
oop_oop_iterate_ref_processing_bounded<nv>(obj, closure, mr);
-
- return size;
}
// Macro to define InstanceRefKlass::oop_oop_iterate for virtual/nonvirtual for
--- a/hotspot/src/share/vm/oops/klass.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/klass.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -572,7 +572,6 @@
// GC specific object visitors
//
// Mark Sweep
- virtual void oop_ms_follow_contents(oop obj) = 0;
virtual int oop_ms_adjust_pointers(oop obj) = 0;
#if INCLUDE_ALL_GCS
// Parallel Scavenge
@@ -584,17 +583,17 @@
// Iterators specialized to particular subtypes
// of ExtendedOopClosure, to avoid closure virtual calls.
-#define Klass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
- virtual int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) = 0; \
- /* Iterates "closure" over all the oops in "obj" (of type "this") within "mr". */ \
- virtual int oop_oop_iterate_bounded##nv_suffix(oop obj, OopClosureType* closure, MemRegion mr) = 0;
+#define Klass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
+ virtual void oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) = 0; \
+ /* Iterates "closure" over all the oops in "obj" (of type "this") within "mr". */ \
+ virtual void oop_oop_iterate_bounded##nv_suffix(oop obj, OopClosureType* closure, MemRegion mr) = 0;
ALL_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL)
ALL_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL)
#if INCLUDE_ALL_GCS
-#define Klass_OOP_OOP_ITERATE_DECL_BACKWARDS(OopClosureType, nv_suffix) \
- virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) = 0;
+#define Klass_OOP_OOP_ITERATE_DECL_BACKWARDS(OopClosureType, nv_suffix) \
+ virtual void oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) = 0;
ALL_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL_BACKWARDS)
ALL_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL_BACKWARDS)
@@ -661,35 +660,35 @@
// Used to generate declarations in the *Klass header files.
#define OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
- int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure); \
- int oop_oop_iterate_bounded##nv_suffix(oop obj, OopClosureType* closure, MemRegion mr);
+ void oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure); \
+ void oop_oop_iterate_bounded##nv_suffix(oop obj, OopClosureType* closure, MemRegion mr);
#if INCLUDE_ALL_GCS
-#define OOP_OOP_ITERATE_DECL_BACKWARDS(OopClosureType, nv_suffix) \
- int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure);
+#define OOP_OOP_ITERATE_DECL_BACKWARDS(OopClosureType, nv_suffix) \
+ void oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure);
#endif // INCLUDE_ALL_GCS
// Oop iteration macros for definitions.
// Used to generate definitions in the *Klass.inline.hpp files.
-#define OOP_OOP_ITERATE_DEFN(KlassType, OopClosureType, nv_suffix) \
-int KlassType::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
- return oop_oop_iterate<nvs_to_bool(nv_suffix)>(obj, closure); \
+#define OOP_OOP_ITERATE_DEFN(KlassType, OopClosureType, nv_suffix) \
+void KlassType::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
+ oop_oop_iterate<nvs_to_bool(nv_suffix)>(obj, closure); \
}
#if INCLUDE_ALL_GCS
-#define OOP_OOP_ITERATE_DEFN_BACKWARDS(KlassType, OopClosureType, nv_suffix) \
-int KlassType::oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
- return oop_oop_iterate_reverse<nvs_to_bool(nv_suffix)>(obj, closure); \
+#define OOP_OOP_ITERATE_DEFN_BACKWARDS(KlassType, OopClosureType, nv_suffix) \
+void KlassType::oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
+ oop_oop_iterate_reverse<nvs_to_bool(nv_suffix)>(obj, closure); \
}
#else
#define OOP_OOP_ITERATE_DEFN_BACKWARDS(KlassType, OopClosureType, nv_suffix)
#endif
-#define OOP_OOP_ITERATE_DEFN_BOUNDED(KlassType, OopClosureType, nv_suffix) \
-int KlassType::oop_oop_iterate_bounded##nv_suffix(oop obj, OopClosureType* closure, MemRegion mr) { \
- return oop_oop_iterate_bounded<nvs_to_bool(nv_suffix)>(obj, closure, mr); \
+#define OOP_OOP_ITERATE_DEFN_BOUNDED(KlassType, OopClosureType, nv_suffix) \
+void KlassType::oop_oop_iterate_bounded##nv_suffix(oop obj, OopClosureType* closure, MemRegion mr) { \
+ oop_oop_iterate_bounded<nvs_to_bool(nv_suffix)>(obj, closure, mr); \
}
#endif // SHARE_VM_OOPS_KLASS_HPP
--- a/hotspot/src/share/vm/oops/objArrayKlass.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/objArrayKlass.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -105,7 +105,6 @@
// GC specific object visitors
//
// Mark Sweep
- void oop_ms_follow_contents(oop obj);
int oop_ms_adjust_pointers(oop obj);
#if INCLUDE_ALL_GCS
// Parallel Scavenge
@@ -125,15 +124,15 @@
// Iterate over oop elements and metadata.
template <bool nv, typename OopClosureType>
- inline int oop_oop_iterate(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate(oop obj, OopClosureType* closure);
// Iterate over oop elements within mr, and metadata.
template <bool nv, typename OopClosureType>
- inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
+ inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
// Iterate over oop elements with indices within [start, end), and metadata.
template <bool nv, class OopClosureType>
- inline int oop_oop_iterate_range(oop obj, OopClosureType* closure, int start, int end);
+ inline void oop_oop_iterate_range(oop obj, OopClosureType* closure, int start, int end);
// Iterate over oop elements within [start, end), and metadata.
// Specialized for [T = oop] or [T = narrowOop].
--- a/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -85,46 +85,31 @@
}
template <bool nv, typename OopClosureType>
-int ObjArrayKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
+void ObjArrayKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
assert (obj->is_array(), "obj must be array");
objArrayOop a = objArrayOop(obj);
- // Get size before changing pointers.
- // Don't call size() or oop_size() since that is a virtual call.
- int size = a->object_size();
if (Devirtualizer<nv>::do_metadata(closure)) {
Devirtualizer<nv>::do_klass(closure, obj->klass());
}
oop_oop_iterate_elements<nv>(a, closure);
-
- return size;
}
template <bool nv, typename OopClosureType>
-int ObjArrayKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
+void ObjArrayKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
assert(obj->is_array(), "obj must be array");
objArrayOop a = objArrayOop(obj);
- // Get size before changing pointers.
- // Don't call size() or oop_size() since that is a virtual call
- int size = a->object_size();
-
if (Devirtualizer<nv>::do_metadata(closure)) {
Devirtualizer<nv>::do_klass(closure, a->klass());
}
oop_oop_iterate_elements_bounded<nv>(a, closure, mr);
-
- return size;
}
template <bool nv, typename T, class OopClosureType>
void ObjArrayKlass::oop_oop_iterate_range_specialized(objArrayOop a, OopClosureType* closure, int start, int end) {
- if (Devirtualizer<nv>::do_metadata(closure)) {
- Devirtualizer<nv>::do_klass(closure, a->klass());
- }
-
T* low = start == 0 ? cast_from_oop<T*>(a) : a->obj_at_addr<T>(start);
T* high = (T*)a->base() + end;
@@ -134,21 +119,15 @@
// Like oop_oop_iterate but only iterates over a specified range and only used
// for objArrayOops.
template <bool nv, class OopClosureType>
-int ObjArrayKlass::oop_oop_iterate_range(oop obj, OopClosureType* closure, int start, int end) {
+void ObjArrayKlass::oop_oop_iterate_range(oop obj, OopClosureType* closure, int start, int end) {
assert(obj->is_array(), "obj must be array");
objArrayOop a = objArrayOop(obj);
- // Get size before changing pointers.
- // Don't call size() or oop_size() since that is a virtual call
- int size = a->object_size();
-
if (UseCompressedOops) {
oop_oop_iterate_range_specialized<nv, narrowOop>(a, closure, start, end);
} else {
oop_oop_iterate_range_specialized<nv, oop>(a, closure, start, end);
}
-
- return size;
}
#define ALL_OBJ_ARRAY_KLASS_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
--- a/hotspot/src/share/vm/oops/objArrayOop.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/objArrayOop.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -46,8 +46,8 @@
#define ObjArrayOop_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
\
-int objArrayOopDesc::oop_iterate_range(OopClosureType* blk, int start, int end) { \
- return ((ObjArrayKlass*)klass())->oop_oop_iterate_range##nv_suffix(this, blk, start, end); \
+void objArrayOopDesc::oop_iterate_range(OopClosureType* blk, int start, int end) { \
+ ((ObjArrayKlass*)klass())->oop_oop_iterate_range##nv_suffix(this, blk, start, end); \
}
ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayOop_OOP_ITERATE_DEFN)
--- a/hotspot/src/share/vm/oops/objArrayOop.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/objArrayOop.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -106,7 +106,7 @@
// special iterators for index ranges, returns size of object
#define ObjArrayOop_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
- int oop_iterate_range(OopClosureType* blk, int start, int end);
+ void oop_iterate_range(OopClosureType* blk, int start, int end);
ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayOop_OOP_ITERATE_DECL)
ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayOop_OOP_ITERATE_DECL)
--- a/hotspot/src/share/vm/oops/oop.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/oop.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -330,7 +330,6 @@
// Garbage Collection support
// Mark Sweep
- void ms_follow_contents();
// Adjust all pointers in this object to point at it's forwarded location and
// return the size of this oop. This is used by the MarkSweep collector.
int ms_adjust_pointers();
@@ -344,17 +343,25 @@
// iterators, returns size of object
-#define OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
- int oop_iterate(OopClosureType* blk); \
- int oop_iterate(OopClosureType* blk, MemRegion mr); // Only in mr.
+#define OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
+ void oop_iterate(OopClosureType* blk); \
+ void oop_iterate(OopClosureType* blk, MemRegion mr); // Only in mr.
ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DECL)
ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_DECL)
+#define OOP_ITERATE_SIZE_DECL(OopClosureType, nv_suffix) \
+ int oop_iterate_size(OopClosureType* blk); \
+ int oop_iterate_size(OopClosureType* blk, MemRegion mr); // Only in mr.
+
+ ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_SIZE_DECL)
+ ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_SIZE_DECL)
+
+
#if INCLUDE_ALL_GCS
-#define OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
- int oop_iterate_backwards(OopClosureType* blk);
+#define OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
+ void oop_iterate_backwards(OopClosureType* blk);
ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DECL)
ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DECL)
--- a/hotspot/src/share/vm/oops/oop.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -695,10 +695,6 @@
}
}
-inline void oopDesc::ms_follow_contents() {
- klass()->oop_ms_follow_contents(this);
-}
-
inline int oopDesc::ms_adjust_pointers() {
debug_only(int check_size = size());
int s = klass()->oop_ms_adjust_pointers(this);
@@ -730,34 +726,50 @@
}
#endif
-#define OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
- \
-inline int oopDesc::oop_iterate(OopClosureType* blk) { \
- return klass()->oop_oop_iterate##nv_suffix(this, blk); \
-} \
- \
-inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) { \
- return klass()->oop_oop_iterate_bounded##nv_suffix(this, blk, mr); \
+#define OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
+ \
+inline void oopDesc::oop_iterate(OopClosureType* blk) { \
+ klass()->oop_oop_iterate##nv_suffix(this, blk); \
+} \
+ \
+inline void oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) { \
+ klass()->oop_oop_iterate_bounded##nv_suffix(this, blk, mr); \
}
+#define OOP_ITERATE_SIZE_DEFN(OopClosureType, nv_suffix) \
+ \
+inline int oopDesc::oop_iterate_size(OopClosureType* blk) { \
+ Klass* k = klass(); \
+ int size = size_given_klass(k); \
+ k->oop_oop_iterate##nv_suffix(this, blk); \
+ return size; \
+} \
+ \
+inline int oopDesc::oop_iterate_size(OopClosureType* blk, \
+ MemRegion mr) { \
+ Klass* k = klass(); \
+ int size = size_given_klass(k); \
+ k->oop_oop_iterate_bounded##nv_suffix(this, blk, mr); \
+ return size; \
+}
inline int oopDesc::oop_iterate_no_header(OopClosure* blk) {
// The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all
// the do_oop calls, but turns off all other features in ExtendedOopClosure.
NoHeaderExtendedOopClosure cl(blk);
- return oop_iterate(&cl);
+ return oop_iterate_size(&cl);
}
inline int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) {
NoHeaderExtendedOopClosure cl(blk);
- return oop_iterate(&cl, mr);
+ return oop_iterate_size(&cl, mr);
}
#if INCLUDE_ALL_GCS
#define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
\
-inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) { \
- return klass()->oop_oop_iterate_backwards##nv_suffix(this, blk); \
+inline void oopDesc::oop_iterate_backwards(OopClosureType* blk) { \
+ klass()->oop_oop_iterate_backwards##nv_suffix(this, blk); \
}
#else
#define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix)
@@ -765,6 +777,7 @@
#define ALL_OOPDESC_OOP_ITERATE(OopClosureType, nv_suffix) \
OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
+ OOP_ITERATE_SIZE_DEFN(OopClosureType, nv_suffix) \
OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix)
ALL_OOP_OOP_ITERATE_CLOSURES_1(ALL_OOPDESC_OOP_ITERATE)
--- a/hotspot/src/share/vm/oops/typeArrayKlass.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/typeArrayKlass.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -75,7 +75,6 @@
// GC specific object visitors
//
// Mark Sweep
- void oop_ms_follow_contents(oop obj);
int oop_ms_adjust_pointers(oop obj);
#if INCLUDE_ALL_GCS
// Parallel Scavenge
@@ -90,15 +89,15 @@
private:
// The implementation used by all oop_oop_iterate functions in TypeArrayKlasses.
- inline int oop_oop_iterate_impl(oop obj, ExtendedOopClosure* closure);
+ inline void oop_oop_iterate_impl(oop obj, ExtendedOopClosure* closure);
// Wraps oop_oop_iterate_impl to conform to macros.
template <bool nv, typename OopClosureType>
- inline int oop_oop_iterate(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate(oop obj, OopClosureType* closure);
// Wraps oop_oop_iterate_impl to conform to macros.
template <bool nv, typename OopClosureType>
- inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
+ inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
public:
--- a/hotspot/src/share/vm/oops/typeArrayKlass.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/oops/typeArrayKlass.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -33,22 +33,20 @@
class ExtendedOopClosure;
-inline int TypeArrayKlass::oop_oop_iterate_impl(oop obj, ExtendedOopClosure* closure) {
+inline void TypeArrayKlass::oop_oop_iterate_impl(oop obj, ExtendedOopClosure* closure) {
assert(obj->is_typeArray(),"must be a type array");
- typeArrayOop t = typeArrayOop(obj);
// Performance tweak: We skip iterating over the klass pointer since we
// know that Universe::TypeArrayKlass never moves.
- return t->object_size();
}
template <bool nv, typename OopClosureType>
-int TypeArrayKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
- return oop_oop_iterate_impl(obj, closure);
+void TypeArrayKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
+ oop_oop_iterate_impl(obj, closure);
}
template <bool nv, typename OopClosureType>
-int TypeArrayKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
- return oop_oop_iterate_impl(obj, closure);
+void TypeArrayKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
+ oop_oop_iterate_impl(obj, closure);
}
#define ALL_TYPE_ARRAY_KLASS_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
--- a/hotspot/src/share/vm/opto/arraycopynode.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/arraycopynode.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -681,10 +681,10 @@
uint header = arrayOopDesc::base_offset_in_bytes(ary_elem);
uint elemsize = type2aelembytes(ary_elem);
- intptr_t dest_pos_plus_len_lo = (((intptr_t)dest_pos_t->_lo) + len_t->_lo) * elemsize + header;
- intptr_t dest_pos_plus_len_hi = (((intptr_t)dest_pos_t->_hi) + len_t->_hi) * elemsize + header;
- intptr_t dest_pos_lo = ((intptr_t)dest_pos_t->_lo) * elemsize + header;
- intptr_t dest_pos_hi = ((intptr_t)dest_pos_t->_hi) * elemsize + header;
+ jlong dest_pos_plus_len_lo = (((jlong)dest_pos_t->_lo) + len_t->_lo) * elemsize + header;
+ jlong dest_pos_plus_len_hi = (((jlong)dest_pos_t->_hi) + len_t->_hi) * elemsize + header;
+ jlong dest_pos_lo = ((jlong)dest_pos_t->_lo) * elemsize + header;
+ jlong dest_pos_hi = ((jlong)dest_pos_t->_hi) * elemsize + header;
if (must_modify) {
if (offset_lo >= dest_pos_hi && offset_hi < dest_pos_plus_len_lo) {
--- a/hotspot/src/share/vm/opto/c2compiler.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -419,6 +419,8 @@
case vmIntrinsics::_updateByteBufferCRC32:
case vmIntrinsics::_updateBytesCRC32C:
case vmIntrinsics::_updateDirectByteBufferCRC32C:
+ case vmIntrinsics::_updateBytesAdler32:
+ case vmIntrinsics::_updateByteBufferAdler32:
case vmIntrinsics::_profileBoolean:
case vmIntrinsics::_isCompileConstant:
break;
--- a/hotspot/src/share/vm/opto/compile.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/compile.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -523,7 +523,7 @@
void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
stringStream ss;
- CompileTask::print_inlining(&ss, method, inline_level, bci, msg);
+ CompileTask::print_inlining_inner(&ss, method, inline_level, bci, msg);
print_inlining_stream()->print("%s", ss.as_string());
}
--- a/hotspot/src/share/vm/opto/doCall.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/doCall.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -49,7 +49,7 @@
method->print_short_name();
tty->cr();
}
- CompileTask::print_inlining(prof_method, depth, bci);
+ CompileTask::print_inlining_tty(prof_method, depth, bci);
} else {
out = C->print_inlining_stream();
}
--- a/hotspot/src/share/vm/opto/escape.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/escape.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -963,6 +963,7 @@
strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 ||
strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 ||
+ strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 ||
strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
@@ -3241,7 +3242,7 @@
// Note 2: MergeMem may already contains instance memory slices added
// during find_inst_mem() call when memory nodes were processed above.
igvn->hash_delete(nmm);
- uint nslices = nmm->req();
+ uint nslices = MIN2(nmm->req(), new_index_start);
for (uint i = Compile::AliasIdxRaw+1; i < nslices; i++) {
Node* mem = nmm->in(i);
Node* cur = NULL;
--- a/hotspot/src/share/vm/opto/graphKit.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1522,7 +1522,7 @@
g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -1539,7 +1539,7 @@
case BarrierSet::G1SATBCTLogging:
return true; // Can move it if no safepoint
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
return true; // There is no pre-barrier
@@ -1565,7 +1565,7 @@
g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
break;
@@ -3791,7 +3791,7 @@
Node* cast = __ CastPX(__ ctrl(), adr);
// Divide by card size
- assert(Universe::heap()->barrier_set()->kind() == BarrierSet::CardTableModRef,
+ assert(Universe::heap()->barrier_set()->is_a(BarrierSet::CardTableModRef),
"Only one we handle so far.");
Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) );
--- a/hotspot/src/share/vm/opto/library_call.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -296,6 +296,8 @@
Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
bool inline_updateBytesCRC32C();
bool inline_updateDirectByteBufferCRC32C();
+ bool inline_updateBytesAdler32();
+ bool inline_updateByteBufferAdler32();
bool inline_multiplyToLen();
bool inline_squareToLen();
bool inline_mulAdd();
@@ -699,6 +701,11 @@
case vmIntrinsics::_updateDirectByteBufferCRC32C:
return inline_updateDirectByteBufferCRC32C();
+ case vmIntrinsics::_updateBytesAdler32:
+ return inline_updateBytesAdler32();
+ case vmIntrinsics::_updateByteBufferAdler32:
+ return inline_updateByteBufferAdler32();
+
case vmIntrinsics::_profileBoolean:
return inline_profileBoolean();
case vmIntrinsics::_isCompileConstant:
@@ -5547,6 +5554,87 @@
return true;
}
+//------------------------------inline_updateBytesAdler32----------------------
+//
+// Calculate Adler32 checksum for byte[] array.
+// int java.util.zip.Adler32.updateBytes(int crc, byte[] buf, int off, int len)
+//
+bool LibraryCallKit::inline_updateBytesAdler32() {
+ assert(UseAdler32Intrinsics, "Adler32 Instrinsic support need"); // check if we actually need to check this flag or check a different one
+ assert(callee()->signature()->size() == 4, "updateBytes has 4 parameters");
+ assert(callee()->holder()->is_loaded(), "Adler32 class must be loaded");
+ // no receiver since it is static method
+ Node* crc = argument(0); // type: int
+ Node* src = argument(1); // type: oop
+ Node* offset = argument(2); // type: int
+ Node* length = argument(3); // type: int
+
+ const Type* src_type = src->Value(&_gvn);
+ const TypeAryPtr* top_src = src_type->isa_aryptr();
+ if (top_src == NULL || top_src->klass() == NULL) {
+ // failed array check
+ return false;
+ }
+
+ // Figure out the size and type of the elements we will be copying.
+ BasicType src_elem = src_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
+ if (src_elem != T_BYTE) {
+ return false;
+ }
+
+ // 'src_start' points to src array + scaled offset
+ Node* src_start = array_element_address(src, offset, src_elem);
+
+ // We assume that range check is done by caller.
+ // TODO: generate range check (offset+length < src.length) in debug VM.
+
+ // Call the stub.
+ address stubAddr = StubRoutines::updateBytesAdler32();
+ const char *stubName = "updateBytesAdler32";
+
+ Node* call = make_runtime_call(RC_LEAF, OptoRuntime::updateBytesAdler32_Type(),
+ stubAddr, stubName, TypePtr::BOTTOM,
+ crc, src_start, length);
+ Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
+ set_result(result);
+ return true;
+}
+
+//------------------------------inline_updateByteBufferAdler32---------------
+//
+// Calculate Adler32 checksum for DirectByteBuffer.
+// int java.util.zip.Adler32.updateByteBuffer(int crc, long buf, int off, int len)
+//
+bool LibraryCallKit::inline_updateByteBufferAdler32() {
+ assert(UseAdler32Intrinsics, "Adler32 Instrinsic support need"); // check if we actually need to check this flag or check a different one
+ assert(callee()->signature()->size() == 5, "updateByteBuffer has 4 parameters and one is long");
+ assert(callee()->holder()->is_loaded(), "Adler32 class must be loaded");
+ // no receiver since it is static method
+ Node* crc = argument(0); // type: int
+ Node* src = argument(1); // type: long
+ Node* offset = argument(3); // type: int
+ Node* length = argument(4); // type: int
+
+ src = ConvL2X(src); // adjust Java long to machine word
+ Node* base = _gvn.transform(new CastX2PNode(src));
+ offset = ConvI2X(offset);
+
+ // 'src_start' points to src array + scaled offset
+ Node* src_start = basic_plus_adr(top(), base, offset);
+
+ // Call the stub.
+ address stubAddr = StubRoutines::updateBytesAdler32();
+ const char *stubName = "updateBytesAdler32";
+
+ Node* call = make_runtime_call(RC_LEAF, OptoRuntime::updateBytesAdler32_Type(),
+ stubAddr, stubName, TypePtr::BOTTOM,
+ crc, src_start, length);
+
+ Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
+ set_result(result);
+ return true;
+}
+
//----------------------------inline_reference_get----------------------------
// public T java.lang.ref.Reference.get();
bool LibraryCallKit::inline_reference_get() {
--- a/hotspot/src/share/vm/opto/memnode.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/memnode.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1677,6 +1677,9 @@
if (klass == env->String_klass() &&
adr->is_AddP() && off != Type::OffsetBot) {
// For constant Strings treat the final fields as compile time constants.
+ // While we can list what field types java.lang.String has, it is more
+ // future-proof to handle all possible field types, anticipating future
+ // changes and experiments in String code.
Node* base = adr->in(AddPNode::Base);
const TypeOopPtr* t = phase->type(base)->isa_oopptr();
if (t != NULL && t->singleton()) {
@@ -1684,14 +1687,13 @@
if (field != NULL && field->is_final()) {
ciObject* string = t->const_oop();
ciConstant constant = string->as_instance()->field_value(field);
- if (constant.basic_type() == T_INT) {
- return TypeInt::make(constant.as_int());
- } else if (constant.basic_type() == T_ARRAY) {
- if (adr->bottom_type()->is_ptr_to_narrowoop()) {
- return TypeNarrowOop::make_from_constant(constant.as_object(), true);
- } else {
- return TypeOopPtr::make_from_constant(constant.as_object(), true);
- }
+ // Type::make_from_constant does not handle narrow oops, so handle it here.
+ // Everything else can use the factory method.
+ if ((constant.basic_type() == T_ARRAY || constant.basic_type() == T_OBJECT)
+ && adr->bottom_type()->is_ptr_to_narrowoop()) {
+ return TypeNarrowOop::make_from_constant(constant.as_object(), true);
+ } else {
+ return Type::make_from_constant(constant, true);
}
}
}
--- a/hotspot/src/share/vm/opto/runtime.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/runtime.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -33,7 +33,6 @@
#include "code/scopeDesc.hpp"
#include "code/vtableStubs.hpp"
#include "compiler/compileBroker.hpp"
-#include "compiler/compilerOracle.hpp"
#include "compiler/oopMap.hpp"
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
#include "gc/g1/heapRegion.hpp"
@@ -921,6 +920,28 @@
return TypeFunc::make(domain, range);
}
+/**
+* int updateBytesAdler32(int adler, bytes* b, int off, int len)
+*/
+const TypeFunc* OptoRuntime::updateBytesAdler32_Type() {
+ // create input type (domain)
+ int num_args = 3;
+ int argcnt = num_args;
+ const Type** fields = TypeTuple::fields(argcnt);
+ int argp = TypeFunc::Parms;
+ fields[argp++] = TypeInt::INT; // crc
+ fields[argp++] = TypePtr::NOTNULL; // src + offset
+ fields[argp++] = TypeInt::INT; // len
+ assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
+ const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
+
+ // result type needed
+ fields = TypeTuple::fields(1);
+ fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result
+ const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields);
+ return TypeFunc::make(domain, range);
+}
+
// for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning int
const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() {
// create input type (domain)
--- a/hotspot/src/share/vm/opto/runtime.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/opto/runtime.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -331,6 +331,8 @@
static const TypeFunc* updateBytesCRC32_Type();
static const TypeFunc* updateBytesCRC32C_Type();
+ static const TypeFunc* updateBytesAdler32_Type();
+
// leaf on stack replacement interpreter accessor types
static const TypeFunc* osr_end_Type();
--- a/hotspot/src/share/vm/precompiled/precompiled.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/precompiled/precompiled.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -57,8 +57,6 @@
# include "classfile/classFileParser.hpp"
# include "classfile/classFileStream.hpp"
# include "classfile/classLoader.hpp"
-# include "classfile/imageDecompressor.hpp"
-# include "classfile/imageFile.hpp"
# include "classfile/javaClasses.hpp"
# include "classfile/symbolTable.hpp"
# include "classfile/systemDictionary.hpp"
@@ -232,7 +230,6 @@
# include "utilities/constantTag.hpp"
# include "utilities/copy.hpp"
# include "utilities/debug.hpp"
-# include "utilities/endian.hpp"
# include "utilities/exceptions.hpp"
# include "utilities/globalDefinitions.hpp"
# include "utilities/growableArray.hpp"
--- a/hotspot/src/share/vm/prims/jni.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/jni.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -3869,6 +3869,7 @@
void TestBufferingOopClosure_test();
void TestCodeCacheRemSet_test();
void FreeRegionList_test();
+void test_memset_with_concurrent_readers();
#endif
void execute_internal_vm_tests() {
@@ -3910,6 +3911,7 @@
if (UseG1GC) {
run_unit_test(FreeRegionList_test());
}
+ run_unit_test(test_memset_with_concurrent_readers());
#endif
tty->print_cr("All internal VM tests passed");
}
--- a/hotspot/src/share/vm/prims/jvm.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -24,8 +24,6 @@
#include "precompiled.hpp"
#include "classfile/classLoader.hpp"
-#include "classfile/imageDecompressor.hpp"
-#include "classfile/imageFile.hpp"
#include "classfile/javaAssertions.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/stringTable.hpp"
@@ -71,7 +69,6 @@
#include "utilities/copy.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/dtrace.hpp"
-#include "utilities/endian.hpp"
#include "utilities/events.hpp"
#include "utilities/histogram.hpp"
#include "utilities/macros.hpp"
@@ -3668,244 +3665,3 @@
info->is_attachable = AttachListener::is_attach_supported();
}
JVM_END
-
-// jdk.internal.jimage /////////////////////////////////////////////////////////
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-
-// Java entry to open an image file for sharing.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jlong,
-JVM_ImageOpen(JNIEnv *env, const char *nativePath, jboolean big_endian)) {
- JVMWrapper("JVM_ImageOpen");
- // Open image file for reading.
- ImageFileReader* reader = ImageFileReader::open(nativePath, big_endian != JNI_FALSE);
- // Return image ID as a jlong.
- return ImageFileReader::readerToID(reader);
-}
-JVM_END
-
-// Java entry for closing a shared image file.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(void,
-JVM_ImageClose(JNIEnv *env, jlong id)) {
- JVMWrapper("JVM_ImageClose");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // If valid reader the close.
- if (reader != NULL) {
- ImageFileReader::close(reader);
- }
-}
-JVM_END
-
-// Java entry for accessing the base address of the image index.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jlong,
-JVM_ImageGetIndexAddress(JNIEnv *env, jlong id)) {
- JVMWrapper("JVM_ImageGetIndexAddress");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // If valid reader return index base address (as jlong) else zero.
- return reader != NULL ? (jlong)reader->get_index_address() : 0L;
-}
-JVM_END
-
-// Java entry for accessing the base address of the image data.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jlong,
-JVM_ImageGetDataAddress(JNIEnv *env, jlong id)) {
- JVMWrapper("JVM_ImageGetDataAddress");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // If valid reader return data base address (as jlong) else zero.
- return MemoryMapImage && reader != NULL ? (jlong)reader->get_data_address() : 0L;
-}
-JVM_END
-
-// Java entry for reading an uncompressed resource from the image.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jboolean,
-JVM_ImageRead(JNIEnv *env, jlong id, jlong offset,
- unsigned char* uncompressedAddress, jlong uncompressed_size)) {
- JVMWrapper("JVM_ImageRead");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);\
- // If not a valid reader the fail the read.
- if (reader == NULL) return false;
- // Get the file offset of resource data.
- u8 file_offset = reader->get_index_size() + offset;
- // Check validity of arguments.
- if (offset < 0 ||
- uncompressed_size < 0 ||
- file_offset > reader->file_size() - uncompressed_size) {
- return false;
- }
- // Read file content into buffer.
- return (jboolean)reader->read_at((u1*)uncompressedAddress, uncompressed_size,
- file_offset);
-}
-JVM_END
-
-// Java entry for reading a compressed resource from the image.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jboolean,
-JVM_ImageReadCompressed(JNIEnv *env,
- jlong id, jlong offset,
- unsigned char* compressedAddress, jlong compressed_size,
- unsigned char* uncompressedAddress, jlong uncompressed_size)) {
- JVMWrapper("JVM_ImageReadCompressed");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // If not a valid reader the fail the read.
- if (reader == NULL) return false;
- // Get the file offset of resource data.
- u8 file_offset = reader->get_index_size() + offset;
- // Check validity of arguments.
- if (offset < 0 ||
- compressed_size < 0 ||
- uncompressed_size < 0 ||
- file_offset > reader->file_size() - compressed_size) {
- return false;
- }
-
- // Read file content into buffer.
- bool is_read = reader->read_at(compressedAddress, compressed_size,
- file_offset);
- // If successfully read then decompress.
- if (is_read) {
- const ImageStrings strings = reader->get_strings();
- ImageDecompressor::decompress_resource(compressedAddress, uncompressedAddress,
- uncompressed_size, &strings, true);
- }
- return (jboolean)is_read;
-}
-JVM_END
-
-// Java entry for retrieving UTF-8 bytes from image string table.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(const char*, JVM_ImageGetStringBytes(JNIEnv *env, jlong id, jint offset)) {
- JVMWrapper("JVM_ImageGetStringBytes");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // Fail if not valid reader.
- if (reader == NULL) return NULL;
- // Manage image string table.
- ImageStrings strings = reader->get_strings();
- // Retrieve string adrress from table.
- const char* data = strings.get(offset);
- return data;
-}
-JVM_END
-
-// Utility function to copy location information into a jlong array.
-// WARNING: This function is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-static void image_expand_location(JNIEnv *env, jlong* rawAttributes, ImageLocation& location) {
- // Copy attributes from location.
- for (int kind = ImageLocation::ATTRIBUTE_END + 1;
- kind < ImageLocation::ATTRIBUTE_COUNT;
- kind++) {
- rawAttributes[kind] = location.get_attribute(kind);
- }
-}
-
-// Java entry for retrieving location attributes for attribute offset.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jlong*, JVM_ImageGetAttributes(JNIEnv *env, jlong* rawAttributes, jlong id, jint offset)) {
- JVMWrapper("JVM_ImageGetAttributes");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // Fail if not valid reader.
- if (reader == NULL) return NULL;
- // Retrieve first byte address of resource's location attribute stream.
- u1* data = reader->get_location_offset_data(offset);
- // Fail if not valid offset.
- if (data == NULL) return NULL;
- // Expand stream into array.
- ImageLocation location(data);
- image_expand_location(env, rawAttributes, location);
- return rawAttributes;
-}
-JVM_END
-
-// Java entry for retrieving location attributes count for attribute offset.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jsize, JVM_ImageGetAttributesCount(JNIEnv *env)) {
- JVMWrapper("JVM_ImageGetAttributesCount");
- return ImageLocation::ATTRIBUTE_COUNT;
-}
-JVM_END
-
-// Java entry for retrieving location attributes for named resource.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jlong*,
-JVM_ImageFindAttributes(JNIEnv *env, jlong* rawAttributes, jbyte* rawBytes, jsize size, jlong id)) {
- JVMWrapper("JVM_ImageFindAttributes");
- // Mark for temporary buffers.
- ResourceMark rm;
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // Fail if not valid reader.
- if (reader == NULL) return NULL;
- // Convert byte array to a cstring.
- char* path = NEW_RESOURCE_ARRAY(char, size + 1);
- memcpy(path, rawBytes, size);
- path[size] = '\0';
- // Locate resource location data.
- ImageLocation location;
- bool found = reader->find_location(path, location);
- // Resource not found.
- if (!found) return NULL;
- // Expand stream into array.
- image_expand_location(env, rawAttributes, location);
- return rawAttributes;
-}
-JVM_END
-
-// Java entry for retrieving all the attribute stream offsets from an image.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(jint*, JVM_ImageAttributeOffsets(JNIEnv *env, jint* rawOffsets, unsigned int length, jlong id)) {
- JVMWrapper("JVM_ImageAttributeOffsets");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // Fail if not valid reader.
- if (reader == NULL) return NULL;
- // Determine endian for reader.
- Endian* endian = reader->endian();
- // Get base address of attribute stream offsets table.
- u4* offsets_table = reader->offsets_table();
- // Allocate int array result.
- // Copy values to result (converting endian.)
- for (u4 i = 0; i < length; i++) {
- rawOffsets[i] = endian->get(offsets_table[i]);
- }
- return rawOffsets;
-}
-JVM_END
-
-// Java entry for retrieving all the attribute stream offsets length from an image.
-// WARNING: This API is experimental and temporary during JDK 9 development
-// cycle. It will not be supported in the eventual JDK 9 release.
-JVM_ENTRY(unsigned int, JVM_ImageAttributeOffsetsLength(JNIEnv *env, jlong id)) {
- JVMWrapper("JVM_ImageAttributeOffsetsLength");
- // Convert image ID to image reader structure.
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- // Fail if not valid reader.
- if (reader == NULL) return 0;
- // Get perfect hash table length.
- u4 length = reader->table_length();
- return (jint) length;
-}
-JVM_END
--- a/hotspot/src/share/vm/prims/jvm.h Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvm.h Tue Sep 22 11:01:54 2015 -0700
@@ -571,52 +571,6 @@
JNIEXPORT jboolean JNICALL
JVM_SupportsCX8(void);
-/*
- * jdk.internal.jimage
- * WARNING: This API is experimental and temporary during JDK 9 development
- * cycle. It will not be supported in the eventual JDK 9 release.
- */
-
-JNIEXPORT jlong JNICALL
-JVM_ImageOpen(JNIEnv *env, const char *nativePath, jboolean big_endian);
-
-JNIEXPORT void JNICALL
-JVM_ImageClose(JNIEnv *env, jlong id);
-
-JNIEXPORT jlong JNICALL
-JVM_ImageGetIndexAddress(JNIEnv *env, jlong id);
-
-JNIEXPORT jlong JNICALL
-JVM_ImageGetDataAddress(JNIEnv *env,jlong id);
-
-JNIEXPORT jboolean JNICALL
-JVM_ImageRead(JNIEnv *env, jlong id, jlong offset,
- unsigned char* uncompressedAddress, jlong uncompressed_size);
-
-
-JNIEXPORT jboolean JNICALL
-JVM_ImageReadCompressed(JNIEnv *env, jlong id, jlong offset,
- unsigned char* compressedBuffer, jlong compressed_size,
- unsigned char* uncompressedBuffer, jlong uncompressed_size);
-
-JNIEXPORT const char* JNICALL
-JVM_ImageGetStringBytes(JNIEnv *env, jlong id, jint offset);
-
-JNIEXPORT jlong* JNICALL
-JVM_ImageGetAttributes(JNIEnv *env, jlong* rawAttributes, jlong id, jint offset);
-
-JNIEXPORT jsize JNICALL
-JVM_ImageGetAttributesCount(JNIEnv *env);
-
-JNIEXPORT jlong* JNICALL
-JVM_ImageFindAttributes(JNIEnv *env, jlong* rawAttributes, jbyte* rawBytes, jsize size, jlong id);
-
-JNIEXPORT jint* JNICALL
-JVM_ImageAttributeOffsets(JNIEnv *env, jint* rawOffsets, unsigned int length, jlong id);
-
-JNIEXPORT unsigned int JNICALL
-JVM_ImageAttributeOffsetsLength(JNIEnv *env, jlong id);
-
/*************************************************************************
PART 2: Support for the Verifier and Class File Format Checker
************************************************************************/
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -3482,7 +3482,7 @@
for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
if (strcmp(property, p->key()) == 0) {
- if (p->set_value((char *)value_ptr)) {
+ if (p->set_value(value_ptr)) {
err = JVMTI_ERROR_NONE;
}
}
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -2181,8 +2181,8 @@
JvmtiVMObjectAllocEventCollector::oops_do_for_all_threads(f);
}
-void JvmtiExport::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
- JvmtiTagMap::weak_oops_do(is_alive, f);
+size_t JvmtiExport::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
+ return JvmtiTagMap::weak_oops_do(is_alive, f);
}
void JvmtiExport::gc_epilogue() {
--- a/hotspot/src/share/vm/prims/jvmtiExport.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiExport.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -366,7 +366,7 @@
static void clear_detected_exception (JavaThread* thread) NOT_JVMTI_RETURN;
static void oops_do(OopClosure* f) NOT_JVMTI_RETURN;
- static void weak_oops_do(BoolObjectClosure* b, OopClosure* f) NOT_JVMTI_RETURN;
+ static size_t weak_oops_do(BoolObjectClosure* b, OopClosure* f) NOT_JVMTI_RETURN_(0);
static void gc_epilogue() NOT_JVMTI_RETURN;
static void transition_pending_onload_raw_monitors() NOT_JVMTI_RETURN;
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -3284,32 +3284,35 @@
}
-void JvmtiTagMap::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
+size_t JvmtiTagMap::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
// No locks during VM bring-up (0 threads) and no safepoints after main
// thread creation and before VMThread creation (1 thread); initial GC
// verification can happen in that window which gets to here.
assert(Threads::number_of_threads() <= 1 ||
SafepointSynchronize::is_at_safepoint(),
"must be executed at a safepoint");
+ size_t count = 0;
if (JvmtiEnv::environments_might_exist()) {
JvmtiEnvIterator it;
for (JvmtiEnvBase* env = it.first(); env != NULL; env = it.next(env)) {
JvmtiTagMap* tag_map = env->tag_map();
if (tag_map != NULL && !tag_map->is_empty()) {
- tag_map->do_weak_oops(is_alive, f);
+ count += tag_map->do_weak_oops(is_alive, f);
}
}
}
+ return count;
}
-void JvmtiTagMap::do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f) {
+size_t JvmtiTagMap::do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f) {
// does this environment have the OBJECT_FREE event enabled
bool post_object_free = env()->is_enabled(JVMTI_EVENT_OBJECT_FREE);
// counters used for trace message
- int freed = 0;
- int moved = 0;
+ size_t freed = 0;
+ size_t moved = 0;
+ size_t stayed = 0;
JvmtiTagHashmap* hashmap = this->hashmap();
@@ -3318,7 +3321,7 @@
// if the hashmap is empty then we can skip it
if (hashmap->_entry_count == 0) {
- return;
+ return 0;
}
// now iterate through each entry in the table
@@ -3380,6 +3383,7 @@
} else {
// object didn't move
prev = entry;
+ stayed++;
}
}
@@ -3398,10 +3402,12 @@
// stats
if (TraceJVMTIObjectTagging) {
- int post_total = hashmap->_entry_count;
- int pre_total = post_total + freed;
-
- tty->print_cr("(%d->%d, %d freed, %d total moves)",
- pre_total, post_total, freed, moved);
+ size_t post_total = hashmap->_entry_count;
+ size_t pre_total = post_total + freed;
+
+ tty->print_cr("(" SIZE_FORMAT "->" SIZE_FORMAT ", " SIZE_FORMAT " freed, " SIZE_FORMAT " stayed, " SIZE_FORMAT " moved)",
+ pre_total, post_total, freed, stayed, moved);
}
+
+ return (freed + stayed + moved);
}
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -60,7 +60,7 @@
inline Mutex* lock() { return &_lock; }
inline JvmtiEnv* env() const { return _env; }
- void do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f);
+ size_t do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f);
// iterate over all entries in this tag map
void entry_iterate(JvmtiTagHashmapEntryClosure* closure);
@@ -122,8 +122,8 @@
jint* count_ptr, jobject** object_result_ptr,
jlong** tag_result_ptr);
- static void weak_oops_do(
- BoolObjectClosure* is_alive, OopClosure* f) NOT_JVMTI_RETURN;
+ static size_t weak_oops_do(BoolObjectClosure* is_alive,
+ OopClosure* f) NOT_JVMTI_RETURN_(0);
};
#endif // SHARE_VM_PRIMS_JVMTITAGMAP_HPP
--- a/hotspot/src/share/vm/prims/whitebox.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/prims/whitebox.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -27,7 +27,6 @@
#include <new>
#include "classfile/classLoaderData.hpp"
-#include "classfile/imageFile.hpp"
#include "classfile/stringTable.hpp"
#include "code/codeCache.hpp"
#include "jvmtifiles/jvmtiEnv.hpp"
@@ -56,6 +55,7 @@
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/heapRegionRemSet.hpp"
#include "gc/parallel/parallelScavengeHeap.inline.hpp"
+#include "gc/parallel/adjoiningGenerations.hpp"
#endif // INCLUDE_ALL_GCS
#if INCLUDE_NMT
#include "services/mallocSiteTable.hpp"
@@ -297,6 +297,11 @@
return p->size() * HeapWordSize;
WB_END
+WB_ENTRY(jlong, WB_GetHeapSpaceAlignment(JNIEnv* env, jobject o))
+ size_t alignment = Universe::heap()->collector_policy()->space_alignment();
+ return (jlong)alignment;
+WB_END
+
#if INCLUDE_ALL_GCS
WB_ENTRY(jboolean, WB_G1IsHumongous(JNIEnv* env, jobject o, jobject obj))
G1CollectedHeap* g1 = G1CollectedHeap::heap();
@@ -335,6 +340,17 @@
return (jint)HeapRegion::GrainBytes;
WB_END
+WB_ENTRY(jlong, WB_PSVirtualSpaceAlignment(JNIEnv* env, jobject o))
+ ParallelScavengeHeap* ps = ParallelScavengeHeap::heap();
+ size_t alignment = ps->gens()->virtual_spaces()->alignment();
+ return (jlong)alignment;
+WB_END
+
+WB_ENTRY(jlong, WB_PSHeapGenerationAlignment(JNIEnv* env, jobject o))
+ size_t alignment = ParallelScavengeHeap::heap()->generation_alignment();
+ return (jlong)alignment;
+WB_END
+
WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env))
ResourceMark rm(THREAD);
G1CollectedHeap* g1h = G1CollectedHeap::heap();
@@ -1144,131 +1160,7 @@
return (jlong) MetaspaceGC::capacity_until_GC();
WB_END
-WB_ENTRY(jboolean, WB_ReadImageFile(JNIEnv* env, jobject wb, jstring imagefile))
- const char* filename = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(imagefile));
- return ImageFileReader::open(filename) != NULL;
-WB_END
-WB_ENTRY(jlong, WB_imageOpenImage(JNIEnv *env, jobject wb, jstring path, jboolean big_endian))
- ThreadToNativeFromVM ttn(thread);
- const char *nativePath = env->GetStringUTFChars(path, NULL);
- jlong ret = JVM_ImageOpen(env, nativePath, big_endian);
-
- env->ReleaseStringUTFChars(path, nativePath);
- return ret;
-WB_END
-
-WB_ENTRY(void, WB_imageCloseImage(JNIEnv *env, jobject wb, jlong id))
- ThreadToNativeFromVM ttn(thread);
- JVM_ImageClose(env, id);
-WB_END
-
-WB_ENTRY(jlong, WB_imageGetIndexAddress(JNIEnv *env, jobject wb, jlong id))
- ThreadToNativeFromVM ttn(thread);
- return JVM_ImageGetIndexAddress(env, id);
-WB_END
-
-WB_ENTRY(jlong, WB_imageGetDataAddress(JNIEnv *env, jobject wb, jlong id))
- ThreadToNativeFromVM ttn(thread);
- return JVM_ImageGetDataAddress(env, id);
-WB_END
-
-WB_ENTRY(jboolean, WB_imageRead(JNIEnv *env, jobject wb, jlong id, jlong offset, jobject uncompressedBuffer, jlong uncompressed_size))
- ThreadToNativeFromVM ttn(thread);
- if (uncompressedBuffer == NULL) {
- return JNI_FALSE;
- }
- unsigned char* uncompressedAddress =
- (unsigned char*) env->GetDirectBufferAddress(uncompressedBuffer);
- return JVM_ImageRead(env, id, offset, uncompressedAddress, uncompressed_size);
-WB_END
-
-WB_ENTRY(jboolean, WB_imageReadCompressed(JNIEnv *env, jobject wb, jlong id, jlong offset, jobject compressedBuffer, jlong compressed_size, jobject uncompressedBuffer, jlong uncompressed_size))
- ThreadToNativeFromVM ttn(thread);
- if (uncompressedBuffer == NULL || compressedBuffer == NULL) {
- return false;
- }
- // Get address of read direct buffer.
- unsigned char* compressedAddress =
- (unsigned char*) env->GetDirectBufferAddress(compressedBuffer);
- // Get address of decompression direct buffer.
- unsigned char* uncompressedAddress =
- (unsigned char*) env->GetDirectBufferAddress(uncompressedBuffer);
- return JVM_ImageReadCompressed(env, id, offset, compressedAddress, compressed_size, uncompressedAddress, uncompressed_size);
-WB_END
-
-WB_ENTRY(jbyteArray, WB_imageGetStringBytes(JNIEnv *env, jobject wb, jlong id, jlong offset))
- ThreadToNativeFromVM ttn(thread);
- const char* data = JVM_ImageGetStringBytes(env, id, offset);
- // Determine String length.
- size_t size = strlen(data);
- // Allocate byte array.
- jbyteArray byteArray = env->NewByteArray((jsize) size);
- // Get array base address.
- jbyte* rawBytes = env->GetByteArrayElements(byteArray, NULL);
- // Copy bytes from image string table.
- memcpy(rawBytes, data, size);
- // Release byte array base address.
- env->ReleaseByteArrayElements(byteArray, rawBytes, 0);
- return byteArray;
-WB_END
-
-WB_ENTRY(jlong, WB_imageGetStringsSize(JNIEnv *env, jobject wb, jlong id))
- ImageFileReader* reader = ImageFileReader::idToReader(id);
- return reader? reader->strings_size() : 0L;
-WB_END
-
-WB_ENTRY(jlongArray, WB_imageGetAttributes(JNIEnv *env, jobject wb, jlong id, jint offset))
- ThreadToNativeFromVM ttn(thread);
- // Allocate a jlong large enough for all location attributes.
- jlongArray attributes = env->NewLongArray(JVM_ImageGetAttributesCount(env));
- // Get base address for jlong array.
- jlong* rawAttributes = env->GetLongArrayElements(attributes, NULL);
- jlong* ret = JVM_ImageGetAttributes(env, rawAttributes, id, offset);
- // Release jlong array base address.
- env->ReleaseLongArrayElements(attributes, rawAttributes, 0);
- return ret == NULL ? NULL : attributes;
-WB_END
-
-WB_ENTRY(jlongArray, WB_imageFindAttributes(JNIEnv *env, jobject wb, jlong id, jbyteArray utf8))
- ThreadToNativeFromVM ttn(thread);
- // Allocate a jlong large enough for all location attributes.
- jlongArray attributes = env->NewLongArray(JVM_ImageGetAttributesCount(env));
- // Get base address for jlong array.
- jlong* rawAttributes = env->GetLongArrayElements(attributes, NULL);
- jsize size = env->GetArrayLength(utf8);
- jbyte* rawBytes = env->GetByteArrayElements(utf8, NULL);
- jlong* ret = JVM_ImageFindAttributes(env, rawAttributes, rawBytes, size, id);
- env->ReleaseByteArrayElements(utf8, rawBytes, 0);
- env->ReleaseLongArrayElements(attributes, rawAttributes, 0);
- return ret == NULL ? NULL : attributes;
-WB_END
-
-WB_ENTRY(jintArray, WB_imageAttributeOffsets(JNIEnv *env, jobject wb, jlong id))
- ThreadToNativeFromVM ttn(thread);
- unsigned int length = JVM_ImageAttributeOffsetsLength(env, id);
- if (length == 0) {
- return NULL;
- }
- jintArray offsets = env->NewIntArray(length);
- // Get base address of result.
- jint* rawOffsets = env->GetIntArrayElements(offsets, NULL);
- jint* ret = JVM_ImageAttributeOffsets(env, rawOffsets, length, id);
- // Release result base address.
- env->ReleaseIntArrayElements(offsets, rawOffsets, 0);
- return ret == NULL ? NULL : offsets;
-WB_END
-
-WB_ENTRY(jint, WB_imageGetIntAtAddress(JNIEnv *env, jobject wb, jlong address, jint offset, jboolean big_endian))
- unsigned char* arr = (unsigned char*) address + offset;
- jint uraw;
- if (big_endian) {
- uraw = arr[0] << 24 | arr[1]<<16 | (arr[2]<<8) | arr[3];
- } else {
- uraw = arr[0] | arr[1]<<8 | (arr[2]<<16) | arr[3]<<24;
- }
- return uraw;
-WB_END
WB_ENTRY(void, WB_AssertMatchingSafepointCalls(JNIEnv* env, jobject o, jboolean mutexSafepointValue, jboolean attemptedNoSafepointValue))
Monitor::SafepointCheckRequired sfpt_check_required = mutexSafepointValue ?
@@ -1457,6 +1349,7 @@
{CC"getVMPageSize", CC"()I", (void*)&WB_GetVMPageSize },
{CC"getVMAllocationGranularity", CC"()J", (void*)&WB_GetVMAllocationGranularity },
{CC"getVMLargePageSize", CC"()J", (void*)&WB_GetVMLargePageSize},
+ {CC"getHeapSpaceAlignment", CC"()J", (void*)&WB_GetHeapSpaceAlignment},
{CC"isClassAlive0", CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive },
{CC"parseCommandLine0",
CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
@@ -1481,6 +1374,8 @@
{CC"g1StartConcMarkCycle", CC"()Z", (void*)&WB_G1StartMarkCycle },
{CC"g1AuxiliaryMemoryUsage", CC"()Ljava/lang/management/MemoryUsage;",
(void*)&WB_G1AuxiliaryMemoryUsage },
+ {CC"psVirtualSpaceAlignment",CC"()J", (void*)&WB_PSVirtualSpaceAlignment},
+ {CC"psHeapGenerationAlignment",CC"()J", (void*)&WB_PSHeapGenerationAlignment},
#endif // INCLUDE_ALL_GCS
#if INCLUDE_NMT
{CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc },
@@ -1576,21 +1471,6 @@
{CC"getCodeBlob", CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob },
{CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize },
{CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize },
- {CC"readImageFile", CC"(Ljava/lang/String;)Z", (void*)&WB_ReadImageFile },
- {CC"imageOpenImage", CC"(Ljava/lang/String;Z)J",(void*)&WB_imageOpenImage },
- {CC"imageCloseImage", CC"(J)V", (void*)&WB_imageCloseImage },
- {CC"imageGetIndexAddress",CC"(J)J", (void*)&WB_imageGetIndexAddress},
- {CC"imageGetDataAddress",CC"(J)J", (void*)&WB_imageGetDataAddress},
- {CC"imageRead", CC"(JJLjava/nio/ByteBuffer;J)Z",
- (void*)&WB_imageRead },
- {CC"imageReadCompressed",CC"(JJLjava/nio/ByteBuffer;JLjava/nio/ByteBuffer;J)Z",
- (void*)&WB_imageReadCompressed},
- {CC"imageGetStringBytes",CC"(JI)[B", (void*)&WB_imageGetStringBytes},
- {CC"imageGetStringsSize",CC"(J)J", (void*)&WB_imageGetStringsSize},
- {CC"imageGetAttributes", CC"(JI)[J", (void*)&WB_imageGetAttributes},
- {CC"imageFindAttributes",CC"(J[B)[J", (void*)&WB_imageFindAttributes},
- {CC"imageAttributeOffsets",CC"(J)[I", (void*)&WB_imageAttributeOffsets},
- {CC"imageGetIntAtAddress",CC"(JIZ)I", (void*)&WB_imageGetIntAtAddress},
{CC"assertMatchingSafepointCalls", CC"(ZZ)V", (void*)&WB_AssertMatchingSafepointCalls },
{CC"isMonitorInflated0", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsMonitorInflated },
{CC"forceSafepoint", CC"()V", (void*)&WB_ForceSafepoint },
--- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -28,7 +28,6 @@
#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
#include "code/codeCacheExtensions.hpp"
-#include "compiler/compilerOracle.hpp"
#include "gc/shared/cardTableRS.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "gc/shared/referenceProcessor.hpp"
@@ -983,53 +982,61 @@
bool Arguments::add_property(const char* prop) {
const char* eq = strchr(prop, '=');
- char* key;
- // ns must be static--its address may be stored in a SystemProperty object.
- const static char ns[1] = {0};
- char* value = (char *)ns;
-
- size_t key_len = (eq == NULL) ? strlen(prop) : (eq - prop);
- key = AllocateHeap(key_len + 1, mtInternal);
- strncpy(key, prop, key_len);
- key[key_len] = '\0';
-
- if (eq != NULL) {
- size_t value_len = strlen(prop) - key_len - 1;
- value = AllocateHeap(value_len + 1, mtInternal);
- strncpy(value, &prop[key_len + 1], value_len + 1);
+ const char* key;
+ const char* value = "";
+
+ if (eq == NULL) {
+ // property doesn't have a value, thus use passed string
+ key = prop;
+ } else {
+ // property have a value, thus extract it and save to the
+ // allocated string
+ size_t key_len = eq - prop;
+ char* tmp_key = AllocateHeap(key_len + 1, mtInternal);
+
+ strncpy(tmp_key, prop, key_len);
+ tmp_key[key_len] = '\0';
+ key = tmp_key;
+
+ value = &prop[key_len + 1];
}
if (strcmp(key, "java.compiler") == 0) {
process_java_compiler_argument(value);
- FreeHeap(key);
- if (eq != NULL) {
- FreeHeap(value);
- }
- return true;
- } else if (strcmp(key, "sun.java.command") == 0) {
- _java_command = value;
-
// Record value in Arguments, but let it get passed to Java.
} else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0 ||
strcmp(key, "sun.java.launcher.pid") == 0) {
// sun.java.launcher.is_altjvm and sun.java.launcher.pid property are
// private and are processed in process_sun_java_launcher_properties();
// the sun.java.launcher property is passed on to the java application
- FreeHeap(key);
- if (eq != NULL) {
- FreeHeap(value);
- }
- return true;
- } else if (strcmp(key, "java.vendor.url.bug") == 0) {
- // save it in _java_vendor_url_bug, so JVM fatal error handler can access
- // its value without going through the property list or making a Java call.
- _java_vendor_url_bug = value;
} else if (strcmp(key, "sun.boot.library.path") == 0) {
PropertyList_unique_add(&_system_properties, key, value, true);
- return true;
- }
- // Create new property and add at the end of the list
- PropertyList_unique_add(&_system_properties, key, value);
+ } else {
+ if (strcmp(key, "sun.java.command") == 0) {
+ if (_java_command != NULL) {
+ os::free(_java_command);
+ }
+ _java_command = os::strdup_check_oom(value, mtInternal);
+ } else if (strcmp(key, "java.vendor.url.bug") == 0) {
+ if (_java_vendor_url_bug != DEFAULT_VENDOR_URL_BUG) {
+ assert(_java_vendor_url_bug != NULL, "_java_vendor_url_bug is NULL");
+ os::free((void *)_java_vendor_url_bug);
+ }
+ // save it in _java_vendor_url_bug, so JVM fatal error handler can access
+ // its value without going through the property list or making a Java call.
+ _java_vendor_url_bug = os::strdup_check_oom(value, mtInternal);
+ }
+
+ // Create new property and add at the end of the list
+ PropertyList_unique_add(&_system_properties, key, value);
+ }
+
+ if (key != prop) {
+ // SystemProperty copy passed value, thus free previously allocated
+ // memory
+ FreeHeap((void *)key);
+ }
+
return true;
}
@@ -1046,7 +1053,7 @@
// Ensure Agent_OnLoad has the correct initial values.
// This may not be the final mode; mode may change later in onload phase.
PropertyList_unique_add(&_system_properties, "java.vm.info",
- (char*)VM_Version::vm_info_string(), false);
+ VM_Version::vm_info_string(), false);
UseInterpreter = true;
UseCompiler = true;
@@ -1583,9 +1590,6 @@
#endif // _LP64
#endif // !ZERO
- // Set up runtime image flags.
- set_runtime_image_flags();
-
CodeCacheExtensions::set_ergonomics_flags();
}
@@ -1840,16 +1844,6 @@
}
}
- // Set up runtime image flags
-void Arguments::set_runtime_image_flags() {
-#ifdef _LP64
- // Memory map image file by default on 64 bit machines.
- if (FLAG_IS_DEFAULT(MemoryMapImage)) {
- FLAG_SET_ERGO(bool, MemoryMapImage, true);
- }
-#endif
-}
-
// This must be called after ergonomics.
void Arguments::set_bytecode_flags() {
if (!RewriteBytecodes) {
@@ -1858,7 +1852,7 @@
}
// Aggressive optimization flags -XX:+AggressiveOpts
-void Arguments::set_aggressive_opts_flags() {
+jint Arguments::set_aggressive_opts_flags() {
#ifdef COMPILER2
if (AggressiveUnboxing) {
if (FLAG_IS_DEFAULT(EliminateAutoBox)) {
@@ -1885,7 +1879,9 @@
// Feed the cache size setting into the JDK
char buffer[1024];
sprintf(buffer, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax);
- add_property(buffer);
+ if (!add_property(buffer)) {
+ return JNI_ENOMEM;
+ }
}
if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) {
FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500);
@@ -1898,12 +1894,14 @@
// FLAG_SET_DEFAULT(EliminateZeroing, true);
// }
}
+
+ return JNI_OK;
}
//===========================================================================================================
// Parsing of java.compiler property
-void Arguments::process_java_compiler_argument(char* arg) {
+void Arguments::process_java_compiler_argument(const char* arg) {
// For backwards compatibility, Djava.compiler=NONE or ""
// causes us to switch to -Xint mode UNLESS -Xdebug
// is also specified.
@@ -3130,8 +3128,10 @@
jio_fprintf(defaultStream::output_stream(),
"CreateMinidumpOnCrash is replaced by CreateCoredumpOnCrash: CreateCoredumpOnCrash is off\n");
} else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
- // Skip -XX:Flags= since that case has already been handled
- if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
+ // Skip -XX:Flags= and -XX:VMOptionsFile= since those cases have
+ // already been handled
+ if ((strncmp(tail, "Flags=", strlen("Flags=")) != 0) &&
+ (strncmp(tail, "VMOptionsFile=", strlen("VMOptionsFile=")) != 0)) {
if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
return JNI_EINVAL;
}
@@ -3383,6 +3383,7 @@
class ScopedVMInitArgs : public StackObj {
private:
JavaVMInitArgs _args;
+ bool _is_set;
public:
ScopedVMInitArgs() {
@@ -3390,6 +3391,7 @@
_args.nOptions = 0;
_args.options = NULL;
_args.ignoreUnrecognized = false;
+ _is_set = false;
}
// Populates the JavaVMInitArgs object represented by this
@@ -3398,6 +3400,7 @@
// returns anything other than JNI_OK, then this object is in a
// partially constructed state, and should be abandoned.
jint set_args(GrowableArray<JavaVMOption>* options) {
+ _is_set = true;
JavaVMOption* options_arr = NEW_C_HEAP_ARRAY_RETURN_NULL(
JavaVMOption, options->length(), mtInternal);
if (options_arr == NULL) {
@@ -3421,6 +3424,7 @@
}
JavaVMInitArgs* get() { return &_args; }
+ bool is_set() { return _is_set; }
~ScopedVMInitArgs() {
if (_args.options == NULL) return;
@@ -3429,6 +3433,35 @@
}
FREE_C_HEAP_ARRAY(JavaVMOption, _args.options);
}
+
+ // Insert options into this option list, to replace option at
+ // vm_options_file_pos (-XX:VMOptionsFile)
+ jint insert(const JavaVMInitArgs* args,
+ const JavaVMInitArgs* args_to_insert,
+ const int vm_options_file_pos) {
+ assert(_args.options == NULL, "shouldn't be set yet");
+ assert(args_to_insert->nOptions != 0, "there should be args to insert");
+ assert(vm_options_file_pos != -1, "vm_options_file_pos should be set");
+
+ int length = args->nOptions + args_to_insert->nOptions - 1;
+ GrowableArray<JavaVMOption> *options = new (ResourceObj::C_HEAP, mtInternal)
+ GrowableArray<JavaVMOption>(length, true); // Construct new option array
+ for (int i = 0; i < args->nOptions; i++) {
+ if (i == vm_options_file_pos) {
+ // insert the new options starting at the same place as the
+ // -XX:VMOptionsFile option
+ for (int j = 0; j < args_to_insert->nOptions; j++) {
+ options->push(args_to_insert->options[j]);
+ }
+ } else {
+ options->push(args->options[i]);
+ }
+ }
+ // make into options array
+ jint result = set_args(options);
+ delete options;
+ return result;
+ }
};
jint Arguments::parse_java_options_environment_variable(ScopedVMInitArgs* args) {
@@ -3453,54 +3486,137 @@
return JNI_ENOMEM;
}
+ int retcode = parse_options_buffer(name, buffer, strlen(buffer), vm_args);
+
+ os::free(buffer);
+ return retcode;
+}
+
+const int OPTION_BUFFER_SIZE = 1024;
+
+jint Arguments::parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args) {
+ // read file into buffer
+ int fd = ::open(file_name, O_RDONLY);
+ if (fd < 0) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Could not open options file '%s'\n",
+ file_name);
+ return JNI_ERR;
+ }
+
+ // '+ 1' for NULL termination even with max bytes
+ int bytes_alloc = OPTION_BUFFER_SIZE + 1;
+
+ char *buf = NEW_C_HEAP_ARRAY_RETURN_NULL(char, bytes_alloc, mtInternal);
+ if (NULL == buf) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Could not allocate read buffer for options file parse\n");
+ os::close(fd);
+ return JNI_ENOMEM;
+ }
+
+ memset(buf, 0, (unsigned)bytes_alloc);
+
+ // Fill buffer
+ // Use ::read() instead of os::read because os::read()
+ // might do a thread state transition
+ // and it is too early for that here
+
+ int bytes_read = ::read(fd, (void *)buf, (unsigned)bytes_alloc);
+ os::close(fd);
+ if (bytes_read < 0) {
+ FREE_C_HEAP_ARRAY(char, buf);
+ jio_fprintf(defaultStream::error_stream(),
+ "Could not read options file '%s'\n", file_name);
+ return JNI_ERR;
+ }
+
+ if (bytes_read == 0) {
+ // tell caller there is no option data and that is ok
+ FREE_C_HEAP_ARRAY(char, buf);
+ return JNI_OK;
+ }
+
+ // file is larger than OPTION_BUFFER_SIZE
+ if (bytes_read > bytes_alloc - 1) {
+ FREE_C_HEAP_ARRAY(char, buf);
+ jio_fprintf(defaultStream::error_stream(),
+ "Options file '%s' is larger than %d bytes.\n",
+ file_name, bytes_alloc - 1);
+ return JNI_EINVAL;
+ }
+
+ int retcode = parse_options_buffer(file_name, buf, bytes_read, vm_args);
+
+ FREE_C_HEAP_ARRAY(char, buf);
+ return retcode;
+}
+
+jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args) {
GrowableArray<JavaVMOption> *options = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JavaVMOption>(2, true); // Construct option array
- jio_fprintf(defaultStream::error_stream(),
- "Picked up %s: %s\n", name, buffer);
- char* rd = buffer; // pointer to the input string (rd)
- while (true) { // repeat for all options in the input string
- while (isspace(*rd)) rd++; // skip whitespace
- if (*rd == 0) break; // we re done when the input string is read completely
-
- // The output, option string, overwrites the input string.
- // Because of quoting, the pointer to the option string (wrt) may lag the pointer to
- // input string (rd).
- char* wrt = rd;
-
- JavaVMOption option;
- option.optionString = wrt;
- options->append(option); // Fill in option
- while (*rd != 0 && !isspace(*rd)) { // unquoted strings terminate with a space or NULL
+
+ // some pointers to help with parsing
+ char *buffer_end = buffer + buf_len;
+ char *opt_hd = buffer;
+ char *wrt = buffer;
+ char *rd = buffer;
+
+ // parse all options
+ while (rd < buffer_end) {
+ // skip leading white space from the input string
+ while (rd < buffer_end && isspace(*rd)) {
+ rd++;
+ }
+
+ if (rd >= buffer_end) {
+ break;
+ }
+
+ // Remember this is where we found the head of the token.
+ opt_hd = wrt;
+
+ // Tokens are strings of non white space characters separated
+ // by one or more white spaces.
+ while (rd < buffer_end && !isspace(*rd)) {
if (*rd == '\'' || *rd == '"') { // handle a quoted string
int quote = *rd; // matching quote to look for
rd++; // don't copy open quote
- while (*rd != quote) { // include everything (even spaces) up until quote
- if (*rd == 0) { // string termination means unmatched string
- jio_fprintf(defaultStream::error_stream(),
- "Unmatched quote in %s\n", name);
- delete options;
- os::free(buffer);
- return JNI_ERR;
- }
+ while (rd < buffer_end && *rd != quote) {
+ // include everything (even spaces)
+ // up until the close quote
*wrt++ = *rd++; // copy to option string
}
- rd++; // don't copy close quote
+
+ if (rd < buffer_end) {
+ rd++; // don't copy close quote
+ } else {
+ // did not see closing quote
+ jio_fprintf(defaultStream::error_stream(),
+ "Unmatched quote in %s\n", name);
+ delete options;
+ return JNI_ERR;
+ }
} else {
*wrt++ = *rd++; // copy to option string
}
}
- if (*rd != 0) {
- // In this case, the assignment to wrt below will make *rd nul,
- // which will interfere with the next loop iteration.
- rd++;
- }
- *wrt = 0; // Zero terminate option
+
+ // steal a white space character and set it to NULL
+ *wrt++ = '\0';
+ // We now have a complete token
+
+ JavaVMOption option;
+ option.optionString = opt_hd;
+
+ options->append(option); // Fill in option
+
+ rd++; // Advance to next character
}
// Fill out JavaVMInitArgs structure.
jint status = vm_args->set_args(options);
delete options;
- os::free(buffer);
return status;
}
@@ -3582,12 +3698,44 @@
return false;
}
+
#endif // PRODUCT
-static jint match_special_option_and_act(const JavaVMInitArgs* args,
- char** flags_file) {
+jint Arguments::insert_vm_options_file(const JavaVMInitArgs* args,
+ char** flags_file,
+ char** vm_options_file,
+ const int vm_options_file_pos,
+ ScopedVMInitArgs *vm_options_file_args,
+ ScopedVMInitArgs* args_out) {
+ jint code = parse_vm_options_file(*vm_options_file, vm_options_file_args);
+ if (code != JNI_OK) {
+ return code;
+ }
+
+ // Now set global settings from the vm_option file, giving an error if
+ // it has VMOptionsFile in it
+ code = match_special_option_and_act(vm_options_file_args->get(), flags_file,
+ NULL, NULL, NULL);
+ if (code != JNI_OK) {
+ return code;
+ }
+
+ if (vm_options_file_args->get()->nOptions < 1) {
+ return 0;
+ }
+
+ return args_out->insert(args, vm_options_file_args->get(),
+ vm_options_file_pos);
+}
+
+jint Arguments::match_special_option_and_act(const JavaVMInitArgs* args,
+ char ** flags_file,
+ char ** vm_options_file,
+ ScopedVMInitArgs* vm_options_file_args,
+ ScopedVMInitArgs* args_out) {
// Remaining part of option string
const char* tail;
+ int vm_options_file_pos = -1;
for (int index = 0; index < args->nOptions; index++) {
const JavaVMOption* option = args->options + index;
@@ -3596,6 +3744,35 @@
}
if (match_option(option, "-XX:Flags=", &tail)) {
*flags_file = (char *) tail;
+ if (*flags_file == NULL) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Cannot copy flags_file name.\n");
+ return JNI_ENOMEM;
+ }
+ continue;
+ }
+ if (match_option(option, "-XX:VMOptionsFile=", &tail)) {
+ if (vm_options_file != NULL) {
+ // The caller accepts -XX:VMOptionsFile
+ if (*vm_options_file != NULL) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Only one VM Options file is supported "
+ "on the command line\n");
+ return JNI_EINVAL;
+ }
+
+ *vm_options_file = (char *) tail;
+ vm_options_file_pos = index; // save position of -XX:VMOptionsFile
+ if (*vm_options_file == NULL) {
+ jio_fprintf(defaultStream::error_stream(),
+ "Cannot copy vm_options_file name.\n");
+ return JNI_ENOMEM;
+ }
+ } else {
+ jio_fprintf(defaultStream::error_stream(),
+ "VM options file is only supported on the command line\n");
+ return JNI_EINVAL;
+ }
continue;
}
if (match_option(option, "-XX:+PrintVMOptions")) {
@@ -3649,6 +3826,12 @@
}
#endif
}
+
+ // If there's a VMOptionsFile, parse that (also can set flags_file)
+ if ((vm_options_file != NULL) && (*vm_options_file != NULL)) {
+ return insert_vm_options_file(args, flags_file, vm_options_file,
+ vm_options_file_pos, vm_options_file_args, args_out);
+ }
return JNI_OK;
}
@@ -3673,10 +3856,15 @@
// If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
const char* hotspotrc = ".hotspotrc";
char* flags_file = NULL;
+ char* vm_options_file = NULL;
bool settings_file_specified = false;
bool needs_hotspotrc_warning = false;
ScopedVMInitArgs java_tool_options_args;
ScopedVMInitArgs java_options_args;
+ ScopedVMInitArgs modified_cmd_line_args;
+ // Pass in vm_options_file_args to keep memory for flags_file from being
+ // deallocated if found in the vm options file.
+ ScopedVMInitArgs vm_options_file_args;
jint code =
parse_java_tool_options_environment_variable(&java_tool_options_args);
@@ -3689,18 +3877,27 @@
return code;
}
- code =
- match_special_option_and_act(java_tool_options_args.get(), &flags_file);
+ code = match_special_option_and_act(java_tool_options_args.get(),
+ &flags_file, NULL, NULL, NULL);
+ if (code != JNI_OK) {
+ return code;
+ }
+
+ code = match_special_option_and_act(args, &flags_file, &vm_options_file,
+ &vm_options_file_args,
+ &modified_cmd_line_args);
if (code != JNI_OK) {
return code;
}
- code = match_special_option_and_act(args, &flags_file);
- if (code != JNI_OK) {
- return code;
- }
-
- code = match_special_option_and_act(java_options_args.get(), &flags_file);
+
+ // The command line arguments have been modified to include VMOptionsFile arguments.
+ if (modified_cmd_line_args.is_set()) {
+ args = modified_cmd_line_args.get();
+ }
+
+ code = match_special_option_and_act(java_options_args.get(), &flags_file,
+ NULL, NULL, NULL);
if (code != JNI_OK) {
return code;
}
@@ -3741,7 +3938,8 @@
// Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS
jint result = parse_vm_init_args(java_tool_options_args.get(),
- java_options_args.get(), args);
+ java_options_args.get(),
+ args); // command line arguments
if (result != JNI_OK) {
return result;
@@ -3870,7 +4068,10 @@
set_bytecode_flags();
// Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled
- set_aggressive_opts_flags();
+ jint code = set_aggressive_opts_flags();
+ if (code != JNI_OK) {
+ return code;
+ }
// Turn off biased locking for locking debug mode flags,
// which are subtly different from each other but neither works with
@@ -4036,7 +4237,7 @@
}
}
-void Arguments::PropertyList_add(SystemProperty** plist, const char* k, char* v) {
+void Arguments::PropertyList_add(SystemProperty** plist, const char* k, const char* v) {
if (plist == NULL)
return;
@@ -4049,7 +4250,7 @@
}
// This add maintains unique property key in the list.
-void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append) {
+void Arguments::PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v, jboolean append) {
if (plist == NULL)
return;
--- a/hotspot/src/share/vm/runtime/arguments.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -60,7 +60,7 @@
char* value() const { return _value; }
SystemProperty* next() const { return _next; }
void set_next(SystemProperty* next) { _next = next; }
- bool set_value(char *value) {
+ bool set_value(const char *value) {
if (writeable()) {
if (_value != NULL) {
FreeHeap(_value);
@@ -346,8 +346,6 @@
static julong limit_by_allocatable_memory(julong size);
// Setup heap size
static void set_heap_size();
- // Set up runtime image flags
- static void set_runtime_image_flags();
// Based on automatic selection criteria, should the
// low pause collector be used.
static bool should_auto_select_low_pause_collector();
@@ -364,17 +362,31 @@
static bool add_property(const char* prop);
// Aggressive optimization flags.
- static void set_aggressive_opts_flags();
+ static jint set_aggressive_opts_flags();
// Argument parsing
static void do_pd_flag_adjustments();
static bool parse_argument(const char* arg, Flag::Flags origin);
static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin);
static void process_java_launcher_argument(const char*, void*);
- static void process_java_compiler_argument(char* arg);
+ static void process_java_compiler_argument(const char* arg);
static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
+ static jint parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args);
+ static jint parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args);
+ static jint insert_vm_options_file(const JavaVMInitArgs* args,
+ char** flags_file,
+ char** vm_options_file,
+ const int vm_options_file_pos,
+ ScopedVMInitArgs* vm_options_file_args,
+ ScopedVMInitArgs* args_out);
+ static jint match_special_option_and_act(const JavaVMInitArgs* args,
+ char** flags_file,
+ char** vm_options_file,
+ ScopedVMInitArgs* vm_options_file_args,
+ ScopedVMInitArgs* args_out);
+
static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args,
const JavaVMInitArgs *java_options_args,
const JavaVMInitArgs *cmd_line_args);
@@ -561,22 +573,22 @@
// Property List manipulation
static void PropertyList_add(SystemProperty *element);
static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
- static void PropertyList_add(SystemProperty** plist, const char* k, char* v);
- static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v) {
+ static void PropertyList_add(SystemProperty** plist, const char* k, const char* v);
+ static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v) {
PropertyList_unique_add(plist, k, v, false);
}
- static void PropertyList_unique_add(SystemProperty** plist, const char* k, char* v, jboolean append);
+ static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v, jboolean append);
static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
static int PropertyList_count(SystemProperty* pl);
static const char* PropertyList_get_key_at(SystemProperty* pl,int index);
static char* PropertyList_get_value_at(SystemProperty* pl,int index);
// Miscellaneous System property value getter and setters.
- static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
- static void set_java_home(char *value) { _java_home->set_value(value); }
- static void set_library_path(char *value) { _java_library_path->set_value(value); }
+ static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
+ static void set_java_home(const char *value) { _java_home->set_value(value); }
+ static void set_library_path(const char *value) { _java_library_path->set_value(value); }
static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
- static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
+ static void set_sysclasspath(const char *value) { _sun_boot_class_path->set_value(value); }
static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
static char* get_java_home() { return _java_home->value(); }
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -60,8 +60,8 @@
if ((UseConcMarkSweepGC || UseG1GC) && (value > PLAB::max_size())) {
CommandLineError::print(verbose,
"%s (" SIZE_FORMAT ") must be "
- "less than ergonomic PLAB maximum size (" SIZE_FORMAT ")\n",
- name, value, PLAB::min_size());
+ "less than or equal to ergonomic PLAB maximum size (" SIZE_FORMAT ")\n",
+ name, value, PLAB::max_size());
return Flag::VIOLATES_CONSTRAINT;
}
#endif // INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -26,7 +26,6 @@
#include "code/compiledIC.hpp"
#include "code/nmethod.hpp"
#include "code/scopeDesc.hpp"
-#include "compiler/compilerOracle.hpp"
#include "interpreter/interpreter.hpp"
#include "oops/methodData.hpp"
#include "oops/method.hpp"
--- a/hotspot/src/share/vm/runtime/globals.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -638,10 +638,6 @@
experimental(bool, AlwaysSafeConstructors, false, \
"Force safe construction, as if all fields are final.") \
\
- /* Temporary: See 6948537 */ \
- experimental(bool, UseMemSetInBOT, true, \
- "(Unstable) uses memset in BOT updates in GC code") \
- \
diagnostic(bool, UnlockDiagnosticVMOptions, trueInDebug, \
"Enable normal processing of flags relating to field diagnostics")\
\
@@ -820,7 +816,7 @@
\
product(bool, UseSHA1Intrinsics, false, \
"Use intrinsics for SHA-1 crypto hash function. " \
- "Requires that UseSHA is enabled.") \
+ "Requires that UseSHA is enabled.") \
\
product(bool, UseSHA256Intrinsics, false, \
"Use intrinsics for SHA-224 and SHA-256 crypto hash functions. " \
@@ -836,6 +832,9 @@
product(bool, UseCRC32CIntrinsics, false, \
"use intrinsics for java.util.zip.CRC32C") \
\
+ product(bool, UseAdler32Intrinsics, false, \
+ "use intrinsics for java.util.zip.Adler32") \
+ \
diagnostic(ccstrlist, DisableIntrinsic, "", \
"do not expand intrinsics whose (internal) names appear here") \
\
@@ -1091,9 +1090,6 @@
product(bool, AlwaysRestoreFPU, false, \
"Restore the FPU control word after every JNI call (expensive)") \
\
- product(bool, MemoryMapImage, false, \
- "Memory map entire runtime image") \
- \
diagnostic(bool, PrintCompilation2, false, \
"Print additional statistics per compilation") \
\
@@ -1603,7 +1599,7 @@
"(ParallelGC only)") \
\
product(bool, ScavengeBeforeFullGC, true, \
- "Scavenge youngest generation before each full GC.") \
+ "Scavenge young generation before each full GC.") \
\
develop(bool, ScavengeWithObjectsInToSpace, false, \
"Allow scavenges to occur when to-space contains objects") \
@@ -2101,11 +2097,11 @@
"promotion failure") \
\
notproduct(bool, PromotionFailureALot, false, \
- "Use promotion failure handling on every youngest generation " \
+ "Use promotion failure handling on every young generation " \
"collection") \
\
develop(uintx, PromotionFailureALotCount, 1000, \
- "Number of promotion failures occurring at PLAB " \
+ "Number of promotion failures occurring at PLAB " \
"refill attempts (ParNew) or promotion attempts " \
"(other young collectors)") \
\
--- a/hotspot/src/share/vm/runtime/init.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/init.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -83,7 +83,6 @@
// during VM shutdown
void perfMemory_exit();
void ostream_exit();
-bool image_decompressor_init();
void vm_init_globals() {
check_ThreadShadow();
@@ -122,9 +121,6 @@
templateTable_init();
InterfaceSupport_init();
SharedRuntime::generate_stubs();
- if (!image_decompressor_init()) {
- return JNI_ERR;
- }
universe2_init(); // dependent on codeCache_init and stubRoutines_init1
referenceProcessor_init();
jni_handles_init();
--- a/hotspot/src/share/vm/runtime/jniHandles.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -124,8 +124,8 @@
}
-void JNIHandles::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
- _weak_global_handles->weak_oops_do(is_alive, f);
+size_t JNIHandles::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f) {
+ return _weak_global_handles->weak_oops_do(is_alive, f);
}
@@ -380,8 +380,9 @@
}
-void JNIHandleBlock::weak_oops_do(BoolObjectClosure* is_alive,
- OopClosure* f) {
+size_t JNIHandleBlock::weak_oops_do(BoolObjectClosure* is_alive,
+ OopClosure* f) {
+ size_t count = 0;
for (JNIHandleBlock* current = this; current != NULL; current = current->_next) {
assert(current->pop_frame_link() == NULL,
"blocks holding weak global JNI handles should not have pop frame link set");
@@ -390,6 +391,7 @@
oop value = *root;
// traverse heap pointers only, not deleted handles or free list pointers
if (value != NULL && Universe::heap()->is_in_reserved(value)) {
+ count++;
if (is_alive->do_object_b(value)) {
// The weakly referenced object is alive, update pointer
f->do_oop(root);
@@ -412,7 +414,9 @@
* JVMTI data structures may also contain weak oops. The iteration of them
* is placed here so that we don't need to add it to each of the collectors.
*/
- JvmtiExport::weak_oops_do(is_alive, f);
+ count += JvmtiExport::weak_oops_do(is_alive, f);
+
+ return count;
}
--- a/hotspot/src/share/vm/runtime/jniHandles.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/jniHandles.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -85,7 +85,7 @@
// Traversal of regular global handles
static void oops_do(OopClosure* f);
// Traversal of weak global handles. Unreachable oops are cleared.
- static void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
+ static size_t weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
};
@@ -153,7 +153,7 @@
// Traversal of regular handles
void oops_do(OopClosure* f);
// Traversal of weak handles. Unreachable oops are cleared.
- void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
+ size_t weak_oops_do(BoolObjectClosure* is_alive, OopClosure* f);
// Checked JNI support
void set_planned_capacity(size_t planned_capacity) { _planned_capacity = planned_capacity; }
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -100,7 +100,6 @@
Mutex* ExceptionCache_lock = NULL;
Monitor* ObjAllocPost_lock = NULL;
Mutex* OsrList_lock = NULL;
-Mutex* ImageFileReaderTable_lock = NULL;
#ifndef PRODUCT
Mutex* FullGCALot_lock = NULL;
@@ -228,7 +227,6 @@
def(ProfilePrint_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
def(ExceptionCache_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
def(OsrList_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
- def(ImageFileReaderTable_lock , Mutex , nonleaf, false, Monitor::_safepoint_check_always); // synchronize image readers open/close
def(Debug1_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
#ifndef PRODUCT
def(FullGCALot_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -102,7 +102,6 @@
extern Mutex* ProfilePrint_lock; // a lock used to serialize the printing of profiles
extern Mutex* ExceptionCache_lock; // a lock used to synchronize exception cache updates
extern Mutex* OsrList_lock; // a lock used to serialize access to OSR queues
-extern Mutex* ImageFileReaderTable_lock; // a lock used to synchronize image readers open/close
#ifndef PRODUCT
extern Mutex* FullGCALot_lock; // a lock to make FullGCALot MT safe
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -184,7 +184,8 @@
//
// * The monitor entry list operations avoid locks, but strictly speaking
// they're not lock-free. Enter is lock-free, exit is not.
-// See http://j2se.east/~dice/PERSIST/040825-LockFreeQueues.html
+// For a description of 'Methods and apparatus providing non-blocking access
+// to a resource,' see U.S. Pat. No. 7844973.
//
// * The cxq can have multiple concurrent "pushers" but only one concurrent
// detaching thread. This mechanism is immune from the ABA corruption.
@@ -405,9 +406,7 @@
event.commit();
}
- if (ObjectMonitor::_sync_ContendedLockAttempts != NULL) {
- ObjectMonitor::_sync_ContendedLockAttempts->inc();
- }
+ OM_PERFDATA_OP(ContendedLockAttempts, inc());
}
@@ -574,9 +573,9 @@
// That is by design - we trade "lossy" counters which are exposed to
// races during updates for a lower probe effect.
TEVENT(Inflated enter - Futile wakeup);
- if (ObjectMonitor::_sync_FutileWakeups != NULL) {
- ObjectMonitor::_sync_FutileWakeups->inc();
- }
+ // This PerfData object can be used in parallel with a safepoint.
+ // See the work around in PerfDataManager::destroy().
+ OM_PERFDATA_OP(FutileWakeups, inc());
++nWakeups;
// Assuming this is not a spurious wakeup we'll normally find _succ == Self.
@@ -748,9 +747,9 @@
// *must* retry _owner before parking.
OrderAccess::fence();
- if (ObjectMonitor::_sync_FutileWakeups != NULL) {
- ObjectMonitor::_sync_FutileWakeups->inc();
- }
+ // This PerfData object can be used in parallel with a safepoint.
+ // See the work around in PerfDataManager::destroy().
+ OM_PERFDATA_OP(FutileWakeups, inc());
}
// Self has acquired the lock -- Unlink Self from the cxq or EntryList .
@@ -1302,9 +1301,7 @@
Trigger->unpark();
// Maintain stats and report events to JVMTI
- if (ObjectMonitor::_sync_Parks != NULL) {
- ObjectMonitor::_sync_Parks->inc();
- }
+ OM_PERFDATA_OP(Parks, inc());
}
@@ -1765,9 +1762,7 @@
}
DTRACE_MONITOR_PROBE(notify, this, object(), THREAD);
INotify(THREAD);
- if (ObjectMonitor::_sync_Notifications != NULL) {
- ObjectMonitor::_sync_Notifications->inc(1);
- }
+ OM_PERFDATA_OP(Notifications, inc(1));
}
@@ -1792,9 +1787,7 @@
INotify(THREAD);
}
- if (tally != 0 && ObjectMonitor::_sync_Notifications != NULL) {
- ObjectMonitor::_sync_Notifications->inc(tally);
- }
+ OM_PERFDATA_OP(Notifications, inc(tally));
}
// -----------------------------------------------------------------------------
@@ -1816,7 +1809,8 @@
// (duration) or we can fix the count at approximately the duration of
// a context switch and vary the frequency. Of course we could also
// vary both satisfying K == Frequency * Duration, where K is adaptive by monitor.
-// See http://j2se.east/~dice/PERSIST/040824-AdaptiveSpinning.html.
+// For a description of 'Adaptive spin-then-block mutual exclusion in
+// multi-threaded processing,' see U.S. Pat. No. 8046758.
//
// This implementation varies the duration "D", where D varies with
// the success rate of recent spin attempts. (D is capped at approximately
--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -177,6 +177,19 @@
public:
static void Initialize();
+
+ // Only perform a PerfData operation if the PerfData object has been
+ // allocated and if the PerfDataManager has not freed the PerfData
+ // objects which can happen at normal VM shutdown.
+ //
+ #define OM_PERFDATA_OP(f, op_str) \
+ do { \
+ if (ObjectMonitor::_sync_ ## f != NULL && \
+ PerfDataManager::has_PerfData()) { \
+ ObjectMonitor::_sync_ ## f->op_str; \
+ } \
+ } while (0)
+
static PerfCounter * _sync_ContendedLockAttempts;
static PerfCounter * _sync_FutileWakeups;
static PerfCounter * _sync_Parks;
--- a/hotspot/src/share/vm/runtime/perfData.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/perfData.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, 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
@@ -39,6 +39,7 @@
PerfDataList* PerfDataManager::_all = NULL;
PerfDataList* PerfDataManager::_sampled = NULL;
PerfDataList* PerfDataManager::_constants = NULL;
+volatile bool PerfDataManager::_has_PerfData = 0;
/*
* The jvmstat global and subsystem jvmstat counter name spaces. The top
@@ -272,16 +273,22 @@
}
-
-
-
-
void PerfDataManager::destroy() {
if (_all == NULL)
// destroy already called, or initialization never happened
return;
+ // Clear the flag before we free the PerfData counters. Thus begins
+ // the race between this thread and another thread that has just
+ // queried PerfDataManager::has_PerfData() and gotten back 'true'.
+ // The hope is that the other thread will finish its PerfData
+ // manipulation before we free the memory. The two alternatives are
+ // 1) leak the PerfData memory or 2) do some form of synchronized
+ // access or check before every PerfData operation.
+ _has_PerfData = false;
+ os::naked_short_sleep(1); // 1ms sleep to let other thread(s) run
+
for (int index = 0; index < _all->length(); index++) {
PerfData* p = _all->at(index);
delete p;
@@ -302,6 +309,7 @@
if (_all == NULL) {
_all = new PerfDataList(100);
+ _has_PerfData = true;
}
assert(!_all->contains(p->name()), "duplicate name added");
--- a/hotspot/src/share/vm/runtime/perfData.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/perfData.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, 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
@@ -668,6 +668,7 @@
static PerfDataList* _sampled;
static PerfDataList* _constants;
static const char* _name_spaces[];
+ static volatile bool _has_PerfData;
// add a PerfData item to the list(s) of know PerfData objects
static void add_item(PerfData* p, bool sampled);
@@ -869,6 +870,7 @@
}
static void destroy();
+ static bool has_PerfData() { return _has_PerfData; }
};
// Useful macros to create the performance counters
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, 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
@@ -32,6 +32,7 @@
#include "runtime/os.hpp"
#include "runtime/perfData.hpp"
#include "runtime/perfMemory.hpp"
+#include "runtime/safepoint.hpp"
#include "runtime/statSampler.hpp"
#include "utilities/globalDefinitions.hpp"
@@ -64,16 +65,20 @@
if (!UsePerfData) return;
if (!PerfMemory::is_initialized()) return;
- // if the StatSampler is active, then we don't want to remove
- // resources it may be dependent on. Typically, the StatSampler
- // is disengaged from the watcher thread when this method is called,
- // but it is not disengaged if this method is invoked during a
- // VM abort.
+ // Only destroy PerfData objects if we're at a safepoint and the
+ // StatSampler is not active. Otherwise, we risk removing PerfData
+ // objects that are currently being used by running JavaThreads
+ // or the StatSampler. This method is invoked while we are not at
+ // a safepoint during a VM abort so leaving the PerfData objects
+ // around may also help diagnose the failure. In rare cases,
+ // PerfData objects are used in parallel with a safepoint. See
+ // the work around in PerfDataManager::destroy().
//
- if (!StatSampler::is_active())
+ if (SafepointSynchronize::is_at_safepoint() && !StatSampler::is_active()) {
PerfDataManager::destroy();
+ }
- // remove the persistent external resources, if any. this method
+ // Remove the persistent external resources, if any. This method
// does not unmap or invalidate any virtual memory allocated during
// initialization.
//
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -32,7 +32,6 @@
#include "code/vtableStubs.hpp"
#include "compiler/abstractCompiler.hpp"
#include "compiler/compileBroker.hpp"
-#include "compiler/compilerOracle.hpp"
#include "compiler/disassembler.hpp"
#include "gc/shared/gcLocker.inline.hpp"
#include "interpreter/interpreter.hpp"
@@ -2622,7 +2621,7 @@
if (nm != NULL) {
if (PrintCompilation) {
ttyLocker ttyl;
- CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
+ CompileTask::print(tty, nm, method->is_static() ? "(static)" : "");
}
nm->post_compiled_method_load_event();
}
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -139,6 +139,7 @@
address StubRoutines::_crc_table_adr = NULL;
address StubRoutines::_updateBytesCRC32C = NULL;
+address StubRoutines::_updateBytesAdler32 = NULL;
address StubRoutines::_multiplyToLen = NULL;
address StubRoutines::_squareToLen = NULL;
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -198,6 +198,7 @@
static address _crc_table_adr;
static address _updateBytesCRC32C;
+ static address _updateBytesAdler32;
static address _multiplyToLen;
static address _squareToLen;
@@ -364,6 +365,7 @@
static address crc_table_addr() { return _crc_table_adr; }
static address updateBytesCRC32C() { return _updateBytesCRC32C; }
+ static address updateBytesAdler32() { return _updateBytesAdler32; }
static address multiplyToLen() {return _multiplyToLen; }
static address squareToLen() {return _squareToLen; }
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -189,9 +189,7 @@
mon->INotify(self);
++tally;
} while (mon->first_waiter() != NULL && all);
- if (ObjectMonitor::_sync_Notifications != NULL) {
- ObjectMonitor::_sync_Notifications->inc(tally);
- }
+ OM_PERFDATA_OP(Notifications, inc(tally));
}
return true;
}
@@ -1362,7 +1360,7 @@
}
// We've successfully installed INFLATING (0) into the mark-word.
- // This is the only case where 0 will appear in a mark-work.
+ // This is the only case where 0 will appear in a mark-word.
// Only the singular thread that successfully swings the mark-word
// to 0 can perform (or more precisely, complete) inflation.
//
@@ -1413,7 +1411,7 @@
// Hopefully the performance counters are allocated on distinct cache lines
// to avoid false sharing on MP systems ...
- if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc();
+ OM_PERFDATA_OP(Inflations, inc());
TEVENT(Inflate: overwrite stacklock);
if (TraceMonitorInflation) {
if (object->is_instance()) {
@@ -1461,7 +1459,7 @@
// Hopefully the performance counters are allocated on distinct
// cache lines to avoid false sharing on MP systems ...
- if (ObjectMonitor::_sync_Inflations != NULL) ObjectMonitor::_sync_Inflations->inc();
+ OM_PERFDATA_OP(Inflations, inc());
TEVENT(Inflate: overwrite neutral);
if (TraceMonitorInflation) {
if (object->is_instance()) {
@@ -1678,8 +1676,8 @@
}
Thread::muxRelease(&gListLock);
- if (ObjectMonitor::_sync_Deflations != NULL) ObjectMonitor::_sync_Deflations->inc(nScavenged);
- if (ObjectMonitor::_sync_MonExtant != NULL) ObjectMonitor::_sync_MonExtant ->set_value(nInCirculation);
+ OM_PERFDATA_OP(Deflations, inc(nScavenged));
+ OM_PERFDATA_OP(MonExtant, set_value(nInCirculation));
// TODO: Add objectMonitor leak detection.
// Audit/inventory the objectMonitors -- make sure they're all accounted for.
--- a/hotspot/src/share/vm/runtime/thread.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/thread.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -368,9 +368,17 @@
inline void clear_critical_native_unlock();
// Support for Unhandled Oop detection
+ // Add the field for both, fastdebug and debug, builds to keep
+ // Thread's fields layout the same.
+ // Note: CHECK_UNHANDLED_OOPS is defined only for fastdebug build.
#ifdef CHECK_UNHANDLED_OOPS
private:
UnhandledOops* _unhandled_oops;
+#elif defined(ASSERT)
+ private:
+ void* _unhandled_oops;
+#endif
+#ifdef CHECK_UNHANDLED_OOPS
public:
UnhandledOops* unhandled_oops() { return _unhandled_oops; }
// Mark oop safe for gc. It may be stack allocated but won't move.
@@ -383,12 +391,12 @@
}
#endif // CHECK_UNHANDLED_OOPS
+ public:
#ifndef PRODUCT
bool skip_gcalot() { return _skip_gcalot; }
void set_skip_gcalot(bool v) { _skip_gcalot = v; }
#endif
- public:
// Installs a pending exception to be inserted later
static void send_async_exception(oop thread_oop, oop java_throwable);
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -283,17 +283,17 @@
volatile_nonstatic_field(ArrayKlass, _higher_dimension, Klass*) \
volatile_nonstatic_field(ArrayKlass, _lower_dimension, Klass*) \
nonstatic_field(ArrayKlass, _vtable_len, int) \
- nonstatic_field(CompiledICHolder, _holder_method, Method*) \
- nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \
- nonstatic_field(ConstantPool, _tags, Array<u1>*) \
- nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \
- nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \
- nonstatic_field(ConstantPool, _operands, Array<u2>*) \
- nonstatic_field(ConstantPool, _length, int) \
- nonstatic_field(ConstantPool, _resolved_references, jobject) \
- nonstatic_field(ConstantPool, _reference_map, Array<u2>*) \
- nonstatic_field(ConstantPoolCache, _length, int) \
- nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \
+ nonstatic_field(CompiledICHolder, _holder_method, Method*) \
+ nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \
+ nonstatic_field(ConstantPool, _tags, Array<u1>*) \
+ nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \
+ nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \
+ nonstatic_field(ConstantPool, _operands, Array<u2>*) \
+ nonstatic_field(ConstantPool, _length, int) \
+ nonstatic_field(ConstantPool, _resolved_references, jobject) \
+ nonstatic_field(ConstantPool, _reference_map, Array<u2>*) \
+ nonstatic_field(ConstantPoolCache, _length, int) \
+ nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \
nonstatic_field(InstanceKlass, _array_klasses, Klass*) \
nonstatic_field(InstanceKlass, _methods, Array<Method*>*) \
nonstatic_field(InstanceKlass, _default_methods, Array<Method*>*) \
@@ -303,12 +303,12 @@
nonstatic_field(InstanceKlass, _java_fields_count, u2) \
nonstatic_field(InstanceKlass, _constants, ConstantPool*) \
nonstatic_field(InstanceKlass, _class_loader_data, ClassLoaderData*) \
- nonstatic_field(InstanceKlass, _source_file_name_index, u2) \
+ nonstatic_field(InstanceKlass, _source_file_name_index, u2) \
nonstatic_field(InstanceKlass, _source_debug_extension, char*) \
- nonstatic_field(InstanceKlass, _inner_classes, Array<jushort>*) \
+ nonstatic_field(InstanceKlass, _inner_classes, Array<jushort>*) \
nonstatic_field(InstanceKlass, _nonstatic_field_size, int) \
nonstatic_field(InstanceKlass, _static_field_size, int) \
- nonstatic_field(InstanceKlass, _static_oop_field_count, u2) \
+ nonstatic_field(InstanceKlass, _static_oop_field_count, u2) \
nonstatic_field(InstanceKlass, _nonstatic_oop_map_size, int) \
nonstatic_field(InstanceKlass, _is_marked_dependent, bool) \
nonstatic_field(InstanceKlass, _minor_version, u2) \
@@ -346,62 +346,62 @@
nonstatic_field(Klass, _prototype_header, markOop) \
nonstatic_field(Klass, _next_sibling, Klass*) \
nonstatic_field(vtableEntry, _method, Method*) \
- nonstatic_field(MethodData, _size, int) \
- nonstatic_field(MethodData, _method, Method*) \
- nonstatic_field(MethodData, _data_size, int) \
- nonstatic_field(MethodData, _data[0], intptr_t) \
- nonstatic_field(MethodData, _parameters_type_data_di, int) \
- nonstatic_field(MethodData, _nof_decompiles, uint) \
- nonstatic_field(MethodData, _nof_overflow_recompiles, uint) \
- nonstatic_field(MethodData, _nof_overflow_traps, uint) \
- nonstatic_field(MethodData, _trap_hist._array[0], u1) \
- nonstatic_field(MethodData, _eflags, intx) \
- nonstatic_field(MethodData, _arg_local, intx) \
- nonstatic_field(MethodData, _arg_stack, intx) \
- nonstatic_field(MethodData, _arg_returned, intx) \
- nonstatic_field(MethodData, _tenure_traps, uint) \
- nonstatic_field(MethodData, _invoke_mask, int) \
- nonstatic_field(MethodData, _backedge_mask, int) \
- nonstatic_field(DataLayout, _header._struct._tag, u1) \
- nonstatic_field(DataLayout, _header._struct._flags, u1) \
- nonstatic_field(DataLayout, _header._struct._bci, u2) \
- nonstatic_field(DataLayout, _cells[0], intptr_t) \
- nonstatic_field(MethodCounters, _nmethod_age, int) \
- nonstatic_field(MethodCounters, _interpreter_invocation_limit, int) \
- nonstatic_field(MethodCounters, _interpreter_backward_branch_limit, int) \
- nonstatic_field(MethodCounters, _interpreter_profile_limit, int) \
- nonstatic_field(MethodCounters, _invoke_mask, int) \
- nonstatic_field(MethodCounters, _backedge_mask, int) \
- nonstatic_field(MethodCounters, _interpreter_invocation_count, int) \
- nonstatic_field(MethodCounters, _interpreter_throwout_count, u2) \
- nonstatic_field(MethodCounters, _number_of_breakpoints, u2) \
- nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \
- nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \
- nonstatic_field(Method, _constMethod, ConstMethod*) \
- nonstatic_field(Method, _method_data, MethodData*) \
- nonstatic_field(Method, _method_counters, MethodCounters*) \
- nonstatic_field(Method, _access_flags, AccessFlags) \
- nonstatic_field(Method, _vtable_index, int) \
- nonstatic_field(Method, _method_size, u2) \
- nonstatic_field(Method, _intrinsic_id, u1) \
- nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \
- volatile_nonstatic_field(Method, _code, nmethod*) \
- nonstatic_field(Method, _i2i_entry, address) \
- nonstatic_field(Method, _adapter, AdapterHandlerEntry*) \
- volatile_nonstatic_field(Method, _from_compiled_entry, address) \
- volatile_nonstatic_field(Method, _from_interpreted_entry, address) \
- volatile_nonstatic_field(ConstMethod, _fingerprint, uint64_t) \
- nonstatic_field(ConstMethod, _constants, ConstantPool*) \
- nonstatic_field(ConstMethod, _stackmap_data, Array<u1>*) \
- nonstatic_field(ConstMethod, _constMethod_size, int) \
- nonstatic_field(ConstMethod, _flags, u2) \
- nonstatic_field(ConstMethod, _code_size, u2) \
- nonstatic_field(ConstMethod, _name_index, u2) \
- nonstatic_field(ConstMethod, _signature_index, u2) \
- nonstatic_field(ConstMethod, _method_idnum, u2) \
- nonstatic_field(ConstMethod, _max_stack, u2) \
- nonstatic_field(ConstMethod, _max_locals, u2) \
- nonstatic_field(ConstMethod, _size_of_parameters, u2) \
+ nonstatic_field(MethodData, _size, int) \
+ nonstatic_field(MethodData, _method, Method*) \
+ nonstatic_field(MethodData, _data_size, int) \
+ nonstatic_field(MethodData, _data[0], intptr_t) \
+ nonstatic_field(MethodData, _parameters_type_data_di, int) \
+ nonstatic_field(MethodData, _nof_decompiles, uint) \
+ nonstatic_field(MethodData, _nof_overflow_recompiles, uint) \
+ nonstatic_field(MethodData, _nof_overflow_traps, uint) \
+ nonstatic_field(MethodData, _trap_hist._array[0], u1) \
+ nonstatic_field(MethodData, _eflags, intx) \
+ nonstatic_field(MethodData, _arg_local, intx) \
+ nonstatic_field(MethodData, _arg_stack, intx) \
+ nonstatic_field(MethodData, _arg_returned, intx) \
+ nonstatic_field(MethodData, _tenure_traps, uint) \
+ nonstatic_field(MethodData, _invoke_mask, int) \
+ nonstatic_field(MethodData, _backedge_mask, int) \
+ nonstatic_field(DataLayout, _header._struct._tag, u1) \
+ nonstatic_field(DataLayout, _header._struct._flags, u1) \
+ nonstatic_field(DataLayout, _header._struct._bci, u2) \
+ nonstatic_field(DataLayout, _cells[0], intptr_t) \
+ nonstatic_field(MethodCounters, _nmethod_age, int) \
+ nonstatic_field(MethodCounters, _interpreter_invocation_limit, int) \
+ nonstatic_field(MethodCounters, _interpreter_backward_branch_limit, int) \
+ nonstatic_field(MethodCounters, _interpreter_profile_limit, int) \
+ nonstatic_field(MethodCounters, _invoke_mask, int) \
+ nonstatic_field(MethodCounters, _backedge_mask, int) \
+ nonstatic_field(MethodCounters, _interpreter_invocation_count, int) \
+ nonstatic_field(MethodCounters, _interpreter_throwout_count, u2) \
+ nonstatic_field(MethodCounters, _number_of_breakpoints, u2) \
+ nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \
+ nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \
+ nonstatic_field(Method, _constMethod, ConstMethod*) \
+ nonstatic_field(Method, _method_data, MethodData*) \
+ nonstatic_field(Method, _method_counters, MethodCounters*) \
+ nonstatic_field(Method, _access_flags, AccessFlags) \
+ nonstatic_field(Method, _vtable_index, int) \
+ nonstatic_field(Method, _method_size, u2) \
+ nonstatic_field(Method, _intrinsic_id, u1) \
+ nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \
+ volatile_nonstatic_field(Method, _code, nmethod*) \
+ nonstatic_field(Method, _i2i_entry, address) \
+ nonstatic_field(Method, _adapter, AdapterHandlerEntry*) \
+ volatile_nonstatic_field(Method, _from_compiled_entry, address) \
+ volatile_nonstatic_field(Method, _from_interpreted_entry, address) \
+ volatile_nonstatic_field(ConstMethod, _fingerprint, uint64_t) \
+ nonstatic_field(ConstMethod, _constants, ConstantPool*) \
+ nonstatic_field(ConstMethod, _stackmap_data, Array<u1>*) \
+ nonstatic_field(ConstMethod, _constMethod_size, int) \
+ nonstatic_field(ConstMethod, _flags, u2) \
+ nonstatic_field(ConstMethod, _code_size, u2) \
+ nonstatic_field(ConstMethod, _name_index, u2) \
+ nonstatic_field(ConstMethod, _signature_index, u2) \
+ nonstatic_field(ConstMethod, _method_idnum, u2) \
+ nonstatic_field(ConstMethod, _max_stack, u2) \
+ nonstatic_field(ConstMethod, _max_locals, u2) \
+ nonstatic_field(ConstMethod, _size_of_parameters, u2) \
nonstatic_field(ObjArrayKlass, _element_klass, Klass*) \
nonstatic_field(ObjArrayKlass, _bottom_klass, Klass*) \
volatile_nonstatic_field(Symbol, _refcount, short) \
@@ -414,10 +414,10 @@
/* Constant Pool Cache */ \
/***********************/ \
\
- volatile_nonstatic_field(ConstantPoolCacheEntry, _indices, intx) \
- nonstatic_field(ConstantPoolCacheEntry, _f1, volatile Metadata*) \
- volatile_nonstatic_field(ConstantPoolCacheEntry, _f2, intx) \
- volatile_nonstatic_field(ConstantPoolCacheEntry, _flags, intx) \
+ volatile_nonstatic_field(ConstantPoolCacheEntry, _indices, intx) \
+ nonstatic_field(ConstantPoolCacheEntry, _f1, volatile Metadata*) \
+ volatile_nonstatic_field(ConstantPoolCacheEntry, _f2, intx) \
+ volatile_nonstatic_field(ConstantPoolCacheEntry, _flags, intx) \
\
/********************************/ \
/* MethodOop-related structures */ \
@@ -631,83 +631,83 @@
/* SymbolTable */ \
/***************/ \
\
- static_field(SymbolTable, _the_table, SymbolTable*) \
- static_field(SymbolTable, _shared_table, SymbolCompactHashTable) \
+ static_field(SymbolTable, _the_table, SymbolTable*) \
+ static_field(SymbolTable, _shared_table, SymbolCompactHashTable) \
\
/***************/ \
/* StringTable */ \
/***************/ \
\
- static_field(StringTable, _the_table, StringTable*) \
+ static_field(StringTable, _the_table, StringTable*) \
\
/********************/ \
/* CompactHashTable */ \
/********************/ \
\
- nonstatic_field(SymbolCompactHashTable, _base_address, uintx) \
- nonstatic_field(SymbolCompactHashTable, _entry_count, juint) \
- nonstatic_field(SymbolCompactHashTable, _bucket_count, juint) \
- nonstatic_field(SymbolCompactHashTable, _table_end_offset, juint) \
- nonstatic_field(SymbolCompactHashTable, _buckets, juint*) \
+ nonstatic_field(SymbolCompactHashTable, _base_address, uintx) \
+ nonstatic_field(SymbolCompactHashTable, _entry_count, juint) \
+ nonstatic_field(SymbolCompactHashTable, _bucket_count, juint) \
+ nonstatic_field(SymbolCompactHashTable, _table_end_offset, juint) \
+ nonstatic_field(SymbolCompactHashTable, _buckets, juint*) \
\
/********************/ \
/* SystemDictionary */ \
/********************/ \
\
- static_field(SystemDictionary, _dictionary, Dictionary*) \
- static_field(SystemDictionary, _placeholders, PlaceholderTable*) \
- static_field(SystemDictionary, _shared_dictionary, Dictionary*) \
- static_field(SystemDictionary, _system_loader_lock_obj, oop) \
- static_field(SystemDictionary, _loader_constraints, LoaderConstraintTable*) \
- static_field(SystemDictionary, WK_KLASS(Object_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(String_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Class_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Cloneable_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(ClassLoader_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Serializable_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(System_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Throwable_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(ThreadDeath_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Error_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Exception_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(RuntimeException_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(ClassNotFoundException_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(NoClassDefFoundError_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(LinkageError_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(ClassCastException_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(ArrayStoreException_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(VirtualMachineError_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(OutOfMemoryError_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(StackOverflowError_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(ProtectionDomain_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(AccessControlContext_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(SecureClassLoader_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Reference_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(SoftReference_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(WeakReference_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(FinalReference_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(PhantomReference_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Cleaner_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Finalizer_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Thread_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(ThreadGroup_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(Properties_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(StringBuffer_klass), Klass*) \
- static_field(SystemDictionary, WK_KLASS(MethodHandle_klass), Klass*) \
- static_field(SystemDictionary, _box_klasses[0], Klass*) \
- static_field(SystemDictionary, _java_system_loader, oop) \
+ static_field(SystemDictionary, _dictionary, Dictionary*) \
+ static_field(SystemDictionary, _placeholders, PlaceholderTable*) \
+ static_field(SystemDictionary, _shared_dictionary, Dictionary*) \
+ static_field(SystemDictionary, _system_loader_lock_obj, oop) \
+ static_field(SystemDictionary, _loader_constraints, LoaderConstraintTable*) \
+ static_field(SystemDictionary, WK_KLASS(Object_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(String_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Class_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Cloneable_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(ClassLoader_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Serializable_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(System_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Throwable_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(ThreadDeath_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Error_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Exception_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(RuntimeException_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(ClassNotFoundException_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(NoClassDefFoundError_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(LinkageError_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(ClassCastException_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(ArrayStoreException_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(VirtualMachineError_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(OutOfMemoryError_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(StackOverflowError_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(ProtectionDomain_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(AccessControlContext_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(SecureClassLoader_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Reference_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(SoftReference_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(WeakReference_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(FinalReference_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(PhantomReference_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Cleaner_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Finalizer_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Thread_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(ThreadGroup_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(Properties_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(StringBuffer_klass), Klass*) \
+ static_field(SystemDictionary, WK_KLASS(MethodHandle_klass), Klass*) \
+ static_field(SystemDictionary, _box_klasses[0], Klass*) \
+ static_field(SystemDictionary, _java_system_loader, oop) \
\
/*************/ \
/* vmSymbols */ \
/*************/ \
\
- static_field(vmSymbols, _symbols[0], Symbol*) \
+ static_field(vmSymbols, _symbols[0], Symbol*) \
\
/*******************/ \
/* HashtableBucket */ \
/*******************/ \
\
- nonstatic_field(HashtableBucket<mtInternal>, _entry, BasicHashtableEntry<mtInternal>*) \
+ nonstatic_field(HashtableBucket<mtInternal>, _entry, BasicHashtableEntry<mtInternal>*) \
\
/******************/ \
/* HashtableEntry */ \
@@ -721,12 +721,12 @@
/* Hashtable */ \
/*************/ \
\
- nonstatic_field(BasicHashtable<mtInternal>, _table_size, int) \
- nonstatic_field(BasicHashtable<mtInternal>, _buckets, HashtableBucket<mtInternal>*) \
- nonstatic_field(BasicHashtable<mtInternal>, _free_list, BasicHashtableEntry<mtInternal>*) \
- nonstatic_field(BasicHashtable<mtInternal>, _first_free_entry, char*) \
- nonstatic_field(BasicHashtable<mtInternal>, _end_block, char*) \
- nonstatic_field(BasicHashtable<mtInternal>, _entry_size, int) \
+ nonstatic_field(BasicHashtable<mtInternal>, _table_size, int) \
+ nonstatic_field(BasicHashtable<mtInternal>, _buckets, HashtableBucket<mtInternal>*) \
+ nonstatic_field(BasicHashtable<mtInternal>, _free_list, BasicHashtableEntry<mtInternal>*) \
+ nonstatic_field(BasicHashtable<mtInternal>, _first_free_entry, char*) \
+ nonstatic_field(BasicHashtable<mtInternal>, _end_block, char*) \
+ nonstatic_field(BasicHashtable<mtInternal>, _entry_size, int) \
\
/*******************/ \
/* DictionaryEntry */ \
@@ -764,7 +764,7 @@
nonstatic_field(ClassLoaderData, _class_loader, oop) \
nonstatic_field(ClassLoaderData, _next, ClassLoaderData*) \
\
- static_field(ClassLoaderDataGraph, _head, ClassLoaderData*) \
+ static_field(ClassLoaderDataGraph, _head, ClassLoaderData*) \
\
/**********/ \
/* Arrays */ \
@@ -786,8 +786,8 @@
/* CodeCache (NOTE: incomplete) */ \
/********************************/ \
\
- static_field(CodeCache, _heaps, GrowableArray<CodeHeap*>*) \
- static_field(CodeCache, _scavenge_root_nmethods, nmethod*) \
+ static_field(CodeCache, _heaps, GrowableArray<CodeHeap*>*) \
+ static_field(CodeCache, _scavenge_root_nmethods, nmethod*) \
\
/*******************************/ \
/* CodeHeap (NOTE: incomplete) */ \
@@ -873,37 +873,37 @@
/* NMethods (NOTE: incomplete, but only a little) */ \
/**************************************************/ \
\
- nonstatic_field(nmethod, _method, Method*) \
- nonstatic_field(nmethod, _entry_bci, int) \
- nonstatic_field(nmethod, _osr_link, nmethod*) \
- nonstatic_field(nmethod, _scavenge_root_link, nmethod*) \
- nonstatic_field(nmethod, _scavenge_root_state, jbyte) \
- nonstatic_field(nmethod, _state, volatile unsigned char) \
- nonstatic_field(nmethod, _exception_offset, int) \
- nonstatic_field(nmethod, _deoptimize_offset, int) \
- nonstatic_field(nmethod, _deoptimize_mh_offset, int) \
- nonstatic_field(nmethod, _orig_pc_offset, int) \
- nonstatic_field(nmethod, _stub_offset, int) \
- nonstatic_field(nmethod, _consts_offset, int) \
- nonstatic_field(nmethod, _oops_offset, int) \
- nonstatic_field(nmethod, _metadata_offset, int) \
- nonstatic_field(nmethod, _scopes_data_offset, int) \
- nonstatic_field(nmethod, _scopes_pcs_offset, int) \
- nonstatic_field(nmethod, _dependencies_offset, int) \
- nonstatic_field(nmethod, _handler_table_offset, int) \
- nonstatic_field(nmethod, _nul_chk_table_offset, int) \
- nonstatic_field(nmethod, _nmethod_end_offset, int) \
- nonstatic_field(nmethod, _entry_point, address) \
- nonstatic_field(nmethod, _verified_entry_point, address) \
- nonstatic_field(nmethod, _osr_entry_point, address) \
- volatile_nonstatic_field(nmethod, _lock_count, jint) \
- nonstatic_field(nmethod, _stack_traversal_mark, long) \
- nonstatic_field(nmethod, _compile_id, int) \
- nonstatic_field(nmethod, _comp_level, int) \
- nonstatic_field(nmethod, _exception_cache, ExceptionCache*) \
- nonstatic_field(nmethod, _marked_for_deoptimization, bool) \
- \
- unchecked_c2_static_field(Deoptimization, _trap_reason_name, void*) \
+ nonstatic_field(nmethod, _method, Method*) \
+ nonstatic_field(nmethod, _entry_bci, int) \
+ nonstatic_field(nmethod, _osr_link, nmethod*) \
+ nonstatic_field(nmethod, _scavenge_root_link, nmethod*) \
+ nonstatic_field(nmethod, _scavenge_root_state, jbyte) \
+ nonstatic_field(nmethod, _state, volatile unsigned char) \
+ nonstatic_field(nmethod, _exception_offset, int) \
+ nonstatic_field(nmethod, _deoptimize_offset, int) \
+ nonstatic_field(nmethod, _deoptimize_mh_offset, int) \
+ nonstatic_field(nmethod, _orig_pc_offset, int) \
+ nonstatic_field(nmethod, _stub_offset, int) \
+ nonstatic_field(nmethod, _consts_offset, int) \
+ nonstatic_field(nmethod, _oops_offset, int) \
+ nonstatic_field(nmethod, _metadata_offset, int) \
+ nonstatic_field(nmethod, _scopes_data_offset, int) \
+ nonstatic_field(nmethod, _scopes_pcs_offset, int) \
+ nonstatic_field(nmethod, _dependencies_offset, int) \
+ nonstatic_field(nmethod, _handler_table_offset, int) \
+ nonstatic_field(nmethod, _nul_chk_table_offset, int) \
+ nonstatic_field(nmethod, _nmethod_end_offset, int) \
+ nonstatic_field(nmethod, _entry_point, address) \
+ nonstatic_field(nmethod, _verified_entry_point, address) \
+ nonstatic_field(nmethod, _osr_entry_point, address) \
+ volatile_nonstatic_field(nmethod, _lock_count, jint) \
+ nonstatic_field(nmethod, _stack_traversal_mark, long) \
+ nonstatic_field(nmethod, _compile_id, int) \
+ nonstatic_field(nmethod, _comp_level, int) \
+ nonstatic_field(nmethod, _exception_cache, ExceptionCache*) \
+ nonstatic_field(nmethod, _marked_for_deoptimization, bool) \
+ \
+ unchecked_c2_static_field(Deoptimization, _trap_reason_name, void*) \
\
/********************************/ \
/* JavaCalls (NOTE: incomplete) */ \
@@ -928,7 +928,7 @@
nonstatic_field(ThreadShadow, _pending_exception, oop) \
nonstatic_field(ThreadShadow, _exception_file, const char*) \
nonstatic_field(ThreadShadow, _exception_line, int) \
- volatile_nonstatic_field(Thread, _suspend_flags, uint32_t) \
+ volatile_nonstatic_field(Thread, _suspend_flags, uint32_t) \
nonstatic_field(Thread, _active_handles, JNIHandleBlock*) \
nonstatic_field(Thread, _tlab, ThreadLocalAllocBuffer) \
nonstatic_field(Thread, _allocated_bytes, jlong) \
@@ -948,7 +948,7 @@
volatile_nonstatic_field(JavaThread, _is_method_handle_return, int) \
nonstatic_field(JavaThread, _special_runtime_exit_condition, JavaThread::AsyncRequests) \
nonstatic_field(JavaThread, _saved_exception_pc, address) \
- volatile_nonstatic_field(JavaThread, _thread_state, JavaThreadState) \
+ volatile_nonstatic_field(JavaThread, _thread_state, JavaThreadState) \
nonstatic_field(JavaThread, _osthread, OSThread*) \
nonstatic_field(JavaThread, _stack_base, address) \
nonstatic_field(JavaThread, _stack_size, size_t) \
@@ -991,7 +991,7 @@
static_field(JNIHandles, _weak_global_handles, JNIHandleBlock*) \
static_field(JNIHandles, _deleted_handle, oop) \
\
- unchecked_nonstatic_field(JNIHandleBlock, _handles, JNIHandleBlock::block_size_in_oops * sizeof(Oop)) /* Note: no type */ \
+ unchecked_nonstatic_field(JNIHandleBlock, _handles, JNIHandleBlock::block_size_in_oops * sizeof(Oop)) /* Note: no type */ \
nonstatic_field(JNIHandleBlock, _top, int) \
nonstatic_field(JNIHandleBlock, _next, JNIHandleBlock*) \
\
@@ -1019,80 +1019,80 @@
/* allocation */ \
/**************/ \
\
- nonstatic_field(Chunk, _next, Chunk*) \
- nonstatic_field(Chunk, _len, const size_t) \
+ nonstatic_field(Chunk, _next, Chunk*) \
+ nonstatic_field(Chunk, _len, const size_t) \
\
- nonstatic_field(Arena, _first, Chunk*) \
- nonstatic_field(Arena, _chunk, Chunk*) \
- nonstatic_field(Arena, _hwm, char*) \
- nonstatic_field(Arena, _max, char*) \
+ nonstatic_field(Arena, _first, Chunk*) \
+ nonstatic_field(Arena, _chunk, Chunk*) \
+ nonstatic_field(Arena, _hwm, char*) \
+ nonstatic_field(Arena, _max, char*) \
\
/************/ \
/* CI */ \
/************/ \
\
- nonstatic_field(ciEnv, _system_dictionary_modification_counter, int) \
- nonstatic_field(ciEnv, _compiler_data, void*) \
- nonstatic_field(ciEnv, _failure_reason, const char*) \
- nonstatic_field(ciEnv, _factory, ciObjectFactory*) \
- nonstatic_field(ciEnv, _dependencies, Dependencies*) \
- nonstatic_field(ciEnv, _task, CompileTask*) \
- nonstatic_field(ciEnv, _arena, Arena*) \
+ nonstatic_field(ciEnv, _system_dictionary_modification_counter, int) \
+ nonstatic_field(ciEnv, _compiler_data, void*) \
+ nonstatic_field(ciEnv, _failure_reason, const char*) \
+ nonstatic_field(ciEnv, _factory, ciObjectFactory*) \
+ nonstatic_field(ciEnv, _dependencies, Dependencies*) \
+ nonstatic_field(ciEnv, _task, CompileTask*) \
+ nonstatic_field(ciEnv, _arena, Arena*) \
\
- nonstatic_field(ciBaseObject, _ident, uint) \
+ nonstatic_field(ciBaseObject, _ident, uint) \
\
- nonstatic_field(ciObject, _handle, jobject) \
- nonstatic_field(ciObject, _klass, ciKlass*) \
+ nonstatic_field(ciObject, _handle, jobject) \
+ nonstatic_field(ciObject, _klass, ciKlass*) \
\
- nonstatic_field(ciMetadata, _metadata, Metadata*) \
+ nonstatic_field(ciMetadata, _metadata, Metadata*) \
\
- nonstatic_field(ciSymbol, _symbol, Symbol*) \
+ nonstatic_field(ciSymbol, _symbol, Symbol*) \
\
- nonstatic_field(ciType, _basic_type, BasicType) \
+ nonstatic_field(ciType, _basic_type, BasicType) \
\
- nonstatic_field(ciKlass, _name, ciSymbol*) \
+ nonstatic_field(ciKlass, _name, ciSymbol*) \
\
- nonstatic_field(ciArrayKlass, _dimension, jint) \
+ nonstatic_field(ciArrayKlass, _dimension, jint) \
\
- nonstatic_field(ciObjArrayKlass, _element_klass, ciKlass*) \
- nonstatic_field(ciObjArrayKlass, _base_element_klass, ciKlass*) \
+ nonstatic_field(ciObjArrayKlass, _element_klass, ciKlass*) \
+ nonstatic_field(ciObjArrayKlass, _base_element_klass, ciKlass*) \
\
- nonstatic_field(ciInstanceKlass, _init_state, InstanceKlass::ClassState) \
- nonstatic_field(ciInstanceKlass, _is_shared, bool) \
+ nonstatic_field(ciInstanceKlass, _init_state, InstanceKlass::ClassState) \
+ nonstatic_field(ciInstanceKlass, _is_shared, bool) \
\
- nonstatic_field(ciMethod, _interpreter_invocation_count, int) \
- nonstatic_field(ciMethod, _interpreter_throwout_count, int) \
- nonstatic_field(ciMethod, _instructions_size, int) \
+ nonstatic_field(ciMethod, _interpreter_invocation_count, int) \
+ nonstatic_field(ciMethod, _interpreter_throwout_count, int) \
+ nonstatic_field(ciMethod, _instructions_size, int) \
\
- nonstatic_field(ciMethodData, _data_size, int) \
- nonstatic_field(ciMethodData, _state, u_char) \
- nonstatic_field(ciMethodData, _extra_data_size, int) \
- nonstatic_field(ciMethodData, _data, intptr_t*) \
- nonstatic_field(ciMethodData, _hint_di, int) \
- nonstatic_field(ciMethodData, _eflags, intx) \
- nonstatic_field(ciMethodData, _arg_local, intx) \
- nonstatic_field(ciMethodData, _arg_stack, intx) \
- nonstatic_field(ciMethodData, _arg_returned, intx) \
- nonstatic_field(ciMethodData, _current_mileage, int) \
- nonstatic_field(ciMethodData, _orig, MethodData) \
+ nonstatic_field(ciMethodData, _data_size, int) \
+ nonstatic_field(ciMethodData, _state, u_char) \
+ nonstatic_field(ciMethodData, _extra_data_size, int) \
+ nonstatic_field(ciMethodData, _data, intptr_t*) \
+ nonstatic_field(ciMethodData, _hint_di, int) \
+ nonstatic_field(ciMethodData, _eflags, intx) \
+ nonstatic_field(ciMethodData, _arg_local, intx) \
+ nonstatic_field(ciMethodData, _arg_stack, intx) \
+ nonstatic_field(ciMethodData, _arg_returned, intx) \
+ nonstatic_field(ciMethodData, _current_mileage, int) \
+ nonstatic_field(ciMethodData, _orig, MethodData) \
\
- nonstatic_field(ciField, _holder, ciInstanceKlass*) \
- nonstatic_field(ciField, _name, ciSymbol*) \
- nonstatic_field(ciField, _signature, ciSymbol*) \
- nonstatic_field(ciField, _offset, int) \
- nonstatic_field(ciField, _is_constant, bool) \
- nonstatic_field(ciField, _constant_value, ciConstant) \
+ nonstatic_field(ciField, _holder, ciInstanceKlass*) \
+ nonstatic_field(ciField, _name, ciSymbol*) \
+ nonstatic_field(ciField, _signature, ciSymbol*) \
+ nonstatic_field(ciField, _offset, int) \
+ nonstatic_field(ciField, _is_constant, bool) \
+ nonstatic_field(ciField, _constant_value, ciConstant) \
\
- nonstatic_field(ciObjectFactory, _ci_metadata, GrowableArray<ciMetadata*>*) \
- nonstatic_field(ciObjectFactory, _symbols, GrowableArray<ciSymbol*>*) \
- nonstatic_field(ciObjectFactory, _unloaded_methods, GrowableArray<ciMethod*>*) \
+ nonstatic_field(ciObjectFactory, _ci_metadata, GrowableArray<ciMetadata*>*) \
+ nonstatic_field(ciObjectFactory, _symbols, GrowableArray<ciSymbol*>*) \
+ nonstatic_field(ciObjectFactory, _unloaded_methods, GrowableArray<ciMethod*>*) \
\
- nonstatic_field(ciConstant, _type, BasicType) \
- nonstatic_field(ciConstant, _value._int, jint) \
- nonstatic_field(ciConstant, _value._long, jlong) \
- nonstatic_field(ciConstant, _value._float, jfloat) \
- nonstatic_field(ciConstant, _value._double, jdouble) \
- nonstatic_field(ciConstant, _value._object, ciObject*) \
+ nonstatic_field(ciConstant, _type, BasicType) \
+ nonstatic_field(ciConstant, _value._int, jint) \
+ nonstatic_field(ciConstant, _value._long, jlong) \
+ nonstatic_field(ciConstant, _value._float, jfloat) \
+ nonstatic_field(ciConstant, _value._double, jdouble) \
+ nonstatic_field(ciConstant, _value._object, ciObject*) \
\
/************/ \
/* Monitors */ \
@@ -1108,7 +1108,7 @@
volatile_nonstatic_field(BasicLock, _displaced_header, markOop) \
nonstatic_field(BasicObjectLock, _lock, BasicLock) \
nonstatic_field(BasicObjectLock, _obj, oop) \
- static_field(ObjectSynchronizer, gBlockList, ObjectMonitor*) \
+ static_field(ObjectSynchronizer, gBlockList, ObjectMonitor*) \
\
/*********************/ \
/* Matcher (C2 only) */ \
@@ -1116,111 +1116,111 @@
\
unchecked_c2_static_field(Matcher, _regEncode, sizeof(Matcher::_regEncode)) /* NOTE: no type */ \
\
- c2_nonstatic_field(Node, _in, Node**) \
- c2_nonstatic_field(Node, _out, Node**) \
- c2_nonstatic_field(Node, _cnt, node_idx_t) \
- c2_nonstatic_field(Node, _max, node_idx_t) \
- c2_nonstatic_field(Node, _outcnt, node_idx_t) \
- c2_nonstatic_field(Node, _outmax, node_idx_t) \
- c2_nonstatic_field(Node, _idx, const node_idx_t) \
- c2_nonstatic_field(Node, _class_id, jushort) \
- c2_nonstatic_field(Node, _flags, jushort) \
+ c2_nonstatic_field(Node, _in, Node**) \
+ c2_nonstatic_field(Node, _out, Node**) \
+ c2_nonstatic_field(Node, _cnt, node_idx_t) \
+ c2_nonstatic_field(Node, _max, node_idx_t) \
+ c2_nonstatic_field(Node, _outcnt, node_idx_t) \
+ c2_nonstatic_field(Node, _outmax, node_idx_t) \
+ c2_nonstatic_field(Node, _idx, const node_idx_t) \
+ c2_nonstatic_field(Node, _class_id, jushort) \
+ c2_nonstatic_field(Node, _flags, jushort) \
\
- c2_nonstatic_field(Compile, _root, RootNode*) \
- c2_nonstatic_field(Compile, _unique, uint) \
- c2_nonstatic_field(Compile, _entry_bci, int) \
- c2_nonstatic_field(Compile, _top, Node*) \
- c2_nonstatic_field(Compile, _cfg, PhaseCFG*) \
- c2_nonstatic_field(Compile, _regalloc, PhaseRegAlloc*) \
- c2_nonstatic_field(Compile, _method, ciMethod*) \
- c2_nonstatic_field(Compile, _compile_id, const int) \
- c2_nonstatic_field(Compile, _save_argument_registers, const bool) \
- c2_nonstatic_field(Compile, _subsume_loads, const bool) \
- c2_nonstatic_field(Compile, _do_escape_analysis, const bool) \
- c2_nonstatic_field(Compile, _eliminate_boxing, const bool) \
- c2_nonstatic_field(Compile, _ilt, InlineTree*) \
+ c2_nonstatic_field(Compile, _root, RootNode*) \
+ c2_nonstatic_field(Compile, _unique, uint) \
+ c2_nonstatic_field(Compile, _entry_bci, int) \
+ c2_nonstatic_field(Compile, _top, Node*) \
+ c2_nonstatic_field(Compile, _cfg, PhaseCFG*) \
+ c2_nonstatic_field(Compile, _regalloc, PhaseRegAlloc*) \
+ c2_nonstatic_field(Compile, _method, ciMethod*) \
+ c2_nonstatic_field(Compile, _compile_id, const int) \
+ c2_nonstatic_field(Compile, _save_argument_registers, const bool) \
+ c2_nonstatic_field(Compile, _subsume_loads, const bool) \
+ c2_nonstatic_field(Compile, _do_escape_analysis, const bool) \
+ c2_nonstatic_field(Compile, _eliminate_boxing, const bool) \
+ c2_nonstatic_field(Compile, _ilt, InlineTree*) \
\
- c2_nonstatic_field(InlineTree, _caller_jvms, JVMState*) \
- c2_nonstatic_field(InlineTree, _method, ciMethod*) \
- c2_nonstatic_field(InlineTree, _caller_tree, InlineTree*) \
- c2_nonstatic_field(InlineTree, _subtrees, GrowableArray<InlineTree*>) \
+ c2_nonstatic_field(InlineTree, _caller_jvms, JVMState*) \
+ c2_nonstatic_field(InlineTree, _method, ciMethod*) \
+ c2_nonstatic_field(InlineTree, _caller_tree, InlineTree*) \
+ c2_nonstatic_field(InlineTree, _subtrees, GrowableArray<InlineTree*>) \
\
- c2_nonstatic_field(OptoRegPair, _first, short) \
- c2_nonstatic_field(OptoRegPair, _second, short) \
+ c2_nonstatic_field(OptoRegPair, _first, short) \
+ c2_nonstatic_field(OptoRegPair, _second, short) \
\
- c2_nonstatic_field(JVMState, _caller, JVMState*) \
- c2_nonstatic_field(JVMState, _depth, uint) \
- c2_nonstatic_field(JVMState, _locoff, uint) \
- c2_nonstatic_field(JVMState, _stkoff, uint) \
- c2_nonstatic_field(JVMState, _monoff, uint) \
- c2_nonstatic_field(JVMState, _scloff, uint) \
- c2_nonstatic_field(JVMState, _endoff, uint) \
- c2_nonstatic_field(JVMState, _sp, uint) \
- c2_nonstatic_field(JVMState, _bci, int) \
- c2_nonstatic_field(JVMState, _method, ciMethod*) \
- c2_nonstatic_field(JVMState, _map, SafePointNode*) \
+ c2_nonstatic_field(JVMState, _caller, JVMState*) \
+ c2_nonstatic_field(JVMState, _depth, uint) \
+ c2_nonstatic_field(JVMState, _locoff, uint) \
+ c2_nonstatic_field(JVMState, _stkoff, uint) \
+ c2_nonstatic_field(JVMState, _monoff, uint) \
+ c2_nonstatic_field(JVMState, _scloff, uint) \
+ c2_nonstatic_field(JVMState, _endoff, uint) \
+ c2_nonstatic_field(JVMState, _sp, uint) \
+ c2_nonstatic_field(JVMState, _bci, int) \
+ c2_nonstatic_field(JVMState, _method, ciMethod*) \
+ c2_nonstatic_field(JVMState, _map, SafePointNode*) \
\
- c2_nonstatic_field(SafePointNode, _jvms, JVMState* const) \
+ c2_nonstatic_field(SafePointNode, _jvms, JVMState* const) \
\
- c2_nonstatic_field(MachSafePointNode, _jvms, JVMState*) \
- c2_nonstatic_field(MachSafePointNode, _jvmadj, uint) \
+ c2_nonstatic_field(MachSafePointNode, _jvms, JVMState*) \
+ c2_nonstatic_field(MachSafePointNode, _jvmadj, uint) \
\
- c2_nonstatic_field(MachIfNode, _prob, jfloat) \
- c2_nonstatic_field(MachIfNode, _fcnt, jfloat) \
+ c2_nonstatic_field(MachIfNode, _prob, jfloat) \
+ c2_nonstatic_field(MachIfNode, _fcnt, jfloat) \
\
- c2_nonstatic_field(CallNode, _entry_point, address) \
+ c2_nonstatic_field(CallNode, _entry_point, address) \
\
- c2_nonstatic_field(CallJavaNode, _method, ciMethod*) \
+ c2_nonstatic_field(CallJavaNode, _method, ciMethod*) \
\
- c2_nonstatic_field(CallRuntimeNode, _name, const char*) \
+ c2_nonstatic_field(CallRuntimeNode, _name, const char*) \
\
- c2_nonstatic_field(CallStaticJavaNode, _name, const char*) \
+ c2_nonstatic_field(CallStaticJavaNode, _name, const char*) \
\
- c2_nonstatic_field(MachCallJavaNode, _method, ciMethod*) \
- c2_nonstatic_field(MachCallJavaNode, _bci, int) \
+ c2_nonstatic_field(MachCallJavaNode, _method, ciMethod*) \
+ c2_nonstatic_field(MachCallJavaNode, _bci, int) \
\
- c2_nonstatic_field(MachCallStaticJavaNode, _name, const char*) \
+ c2_nonstatic_field(MachCallStaticJavaNode, _name, const char*) \
\
- c2_nonstatic_field(MachCallRuntimeNode, _name, const char*) \
+ c2_nonstatic_field(MachCallRuntimeNode, _name, const char*) \
\
- c2_nonstatic_field(PhaseCFG, _number_of_blocks, uint) \
- c2_nonstatic_field(PhaseCFG, _blocks, Block_List) \
- c2_nonstatic_field(PhaseCFG, _node_to_block_mapping, Block_Array) \
- c2_nonstatic_field(PhaseCFG, _root_block, Block*) \
+ c2_nonstatic_field(PhaseCFG, _number_of_blocks, uint) \
+ c2_nonstatic_field(PhaseCFG, _blocks, Block_List) \
+ c2_nonstatic_field(PhaseCFG, _node_to_block_mapping, Block_Array) \
+ c2_nonstatic_field(PhaseCFG, _root_block, Block*) \
\
- c2_nonstatic_field(PhaseRegAlloc, _node_regs, OptoRegPair*) \
- c2_nonstatic_field(PhaseRegAlloc, _node_regs_max_index, uint) \
- c2_nonstatic_field(PhaseRegAlloc, _framesize, uint) \
- c2_nonstatic_field(PhaseRegAlloc, _max_reg, OptoReg::Name) \
+ c2_nonstatic_field(PhaseRegAlloc, _node_regs, OptoRegPair*) \
+ c2_nonstatic_field(PhaseRegAlloc, _node_regs_max_index, uint) \
+ c2_nonstatic_field(PhaseRegAlloc, _framesize, uint) \
+ c2_nonstatic_field(PhaseRegAlloc, _max_reg, OptoReg::Name) \
\
- c2_nonstatic_field(PhaseChaitin, _trip_cnt, int) \
- c2_nonstatic_field(PhaseChaitin, _alternate, int) \
- c2_nonstatic_field(PhaseChaitin, _lo_degree, uint) \
- c2_nonstatic_field(PhaseChaitin, _lo_stk_degree, uint) \
- c2_nonstatic_field(PhaseChaitin, _hi_degree, uint) \
- c2_nonstatic_field(PhaseChaitin, _simplified, uint) \
+ c2_nonstatic_field(PhaseChaitin, _trip_cnt, int) \
+ c2_nonstatic_field(PhaseChaitin, _alternate, int) \
+ c2_nonstatic_field(PhaseChaitin, _lo_degree, uint) \
+ c2_nonstatic_field(PhaseChaitin, _lo_stk_degree, uint) \
+ c2_nonstatic_field(PhaseChaitin, _hi_degree, uint) \
+ c2_nonstatic_field(PhaseChaitin, _simplified, uint) \
\
- c2_nonstatic_field(Block, _nodes, Node_List) \
- c2_nonstatic_field(Block, _succs, Block_Array) \
- c2_nonstatic_field(Block, _num_succs, uint) \
- c2_nonstatic_field(Block, _pre_order, uint) \
- c2_nonstatic_field(Block, _dom_depth, uint) \
- c2_nonstatic_field(Block, _idom, Block*) \
- c2_nonstatic_field(Block, _freq, jdouble) \
+ c2_nonstatic_field(Block, _nodes, Node_List) \
+ c2_nonstatic_field(Block, _succs, Block_Array) \
+ c2_nonstatic_field(Block, _num_succs, uint) \
+ c2_nonstatic_field(Block, _pre_order, uint) \
+ c2_nonstatic_field(Block, _dom_depth, uint) \
+ c2_nonstatic_field(Block, _idom, Block*) \
+ c2_nonstatic_field(Block, _freq, jdouble) \
\
- c2_nonstatic_field(CFGElement, _freq, jdouble) \
+ c2_nonstatic_field(CFGElement, _freq, jdouble) \
\
- c2_nonstatic_field(Block_List, _cnt, uint) \
+ c2_nonstatic_field(Block_List, _cnt, uint) \
\
- c2_nonstatic_field(Block_Array, _size, uint) \
- c2_nonstatic_field(Block_Array, _blocks, Block**) \
- c2_nonstatic_field(Block_Array, _arena, Arena*) \
+ c2_nonstatic_field(Block_Array, _size, uint) \
+ c2_nonstatic_field(Block_Array, _blocks, Block**) \
+ c2_nonstatic_field(Block_Array, _arena, Arena*) \
\
- c2_nonstatic_field(Node_List, _cnt, uint) \
+ c2_nonstatic_field(Node_List, _cnt, uint) \
\
- c2_nonstatic_field(Node_Array, _max, uint) \
- c2_nonstatic_field(Node_Array, _nodes, Node**) \
- c2_nonstatic_field(Node_Array, _a, Arena*) \
+ c2_nonstatic_field(Node_Array, _max, uint) \
+ c2_nonstatic_field(Node_Array, _nodes, Node**) \
+ c2_nonstatic_field(Node_Array, _a, Arena*) \
\
\
/*********************/ \
@@ -1231,22 +1231,22 @@
nonstatic_field(Flag, _name, const char*) \
unchecked_nonstatic_field(Flag, _addr, sizeof(void*)) /* NOTE: no type */ \
nonstatic_field(Flag, _flags, Flag::Flags) \
- static_field(Flag, flags, Flag*) \
- static_field(Flag, numFlags, size_t) \
+ static_field(Flag, flags, Flag*) \
+ static_field(Flag, numFlags, size_t) \
\
/*************************/ \
/* JDK / VM version info */ \
/*************************/ \
\
- static_field(Abstract_VM_Version, _s_vm_release, const char*) \
- static_field(Abstract_VM_Version, _s_internal_vm_info_string, const char*) \
- static_field(Abstract_VM_Version, _vm_major_version, int) \
- static_field(Abstract_VM_Version, _vm_minor_version, int) \
- static_field(Abstract_VM_Version, _vm_micro_version, int) \
- static_field(Abstract_VM_Version, _vm_build_number, int) \
- static_field(Abstract_VM_Version, _reserve_for_allocation_prefetch, int) \
+ static_field(Abstract_VM_Version, _s_vm_release, const char*) \
+ static_field(Abstract_VM_Version, _s_internal_vm_info_string, const char*) \
+ static_field(Abstract_VM_Version, _vm_major_version, int) \
+ static_field(Abstract_VM_Version, _vm_minor_version, int) \
+ static_field(Abstract_VM_Version, _vm_micro_version, int) \
+ static_field(Abstract_VM_Version, _vm_build_number, int) \
+ static_field(Abstract_VM_Version, _reserve_for_allocation_prefetch, int) \
\
- static_field(JDK_Version, _current, JDK_Version) \
+ static_field(JDK_Version, _current, JDK_Version) \
nonstatic_field(JDK_Version, _partially_initialized, bool) \
nonstatic_field(JDK_Version, _major, unsigned char) \
\
@@ -1260,65 +1260,65 @@
/* Arguments */ \
/*************/ \
\
- static_field(Arguments, _jvm_flags_array, char**) \
- static_field(Arguments, _num_jvm_flags, int) \
- static_field(Arguments, _jvm_args_array, char**) \
- static_field(Arguments, _num_jvm_args, int) \
- static_field(Arguments, _java_command, char*) \
+ static_field(Arguments, _jvm_flags_array, char**) \
+ static_field(Arguments, _num_jvm_flags, int) \
+ static_field(Arguments, _jvm_args_array, char**) \
+ static_field(Arguments, _num_jvm_args, int) \
+ static_field(Arguments, _java_command, char*) \
\
/************/ \
/* Array<T> */ \
/************/ \
\
- nonstatic_field(Array<int>, _length, int) \
- unchecked_nonstatic_field(Array<int>, _data, sizeof(int)) \
- unchecked_nonstatic_field(Array<u1>, _data, sizeof(u1)) \
- unchecked_nonstatic_field(Array<u2>, _data, sizeof(u2)) \
- unchecked_nonstatic_field(Array<Method*>, _data, sizeof(Method*)) \
- unchecked_nonstatic_field(Array<Klass*>, _data, sizeof(Klass*)) \
+ nonstatic_field(Array<int>, _length, int) \
+ unchecked_nonstatic_field(Array<int>, _data, sizeof(int)) \
+ unchecked_nonstatic_field(Array<u1>, _data, sizeof(u1)) \
+ unchecked_nonstatic_field(Array<u2>, _data, sizeof(u2)) \
+ unchecked_nonstatic_field(Array<Method*>, _data, sizeof(Method*)) \
+ unchecked_nonstatic_field(Array<Klass*>, _data, sizeof(Klass*)) \
\
/*********************************/ \
/* java_lang_Class fields */ \
/*********************************/ \
\
- static_field(java_lang_Class, _klass_offset, int) \
- static_field(java_lang_Class, _array_klass_offset, int) \
- static_field(java_lang_Class, _oop_size_offset, int) \
- static_field(java_lang_Class, _static_oop_field_count_offset, int) \
+ static_field(java_lang_Class, _klass_offset, int) \
+ static_field(java_lang_Class, _array_klass_offset, int) \
+ static_field(java_lang_Class, _oop_size_offset, int) \
+ static_field(java_lang_Class, _static_oop_field_count_offset, int) \
\
/************************/ \
/* Miscellaneous fields */ \
/************************/ \
\
- nonstatic_field(CompileTask, _method, Method*) \
- nonstatic_field(CompileTask, _osr_bci, int) \
- nonstatic_field(CompileTask, _comp_level, int) \
- nonstatic_field(CompileTask, _compile_id, uint) \
- nonstatic_field(CompileTask, _next, CompileTask*) \
- nonstatic_field(CompileTask, _prev, CompileTask*) \
+ nonstatic_field(CompileTask, _method, Method*) \
+ nonstatic_field(CompileTask, _osr_bci, int) \
+ nonstatic_field(CompileTask, _comp_level, int) \
+ nonstatic_field(CompileTask, _compile_id, uint) \
+ nonstatic_field(CompileTask, _next, CompileTask*) \
+ nonstatic_field(CompileTask, _prev, CompileTask*) \
\
- nonstatic_field(vframeArray, _next, vframeArray*) \
- nonstatic_field(vframeArray, _original, frame) \
- nonstatic_field(vframeArray, _caller, frame) \
- nonstatic_field(vframeArray, _frames, int) \
+ nonstatic_field(vframeArray, _next, vframeArray*) \
+ nonstatic_field(vframeArray, _original, frame) \
+ nonstatic_field(vframeArray, _caller, frame) \
+ nonstatic_field(vframeArray, _frames, int) \
\
- nonstatic_field(vframeArrayElement, _frame, frame) \
- nonstatic_field(vframeArrayElement, _bci, int) \
- nonstatic_field(vframeArrayElement, _method, Method*) \
+ nonstatic_field(vframeArrayElement, _frame, frame) \
+ nonstatic_field(vframeArrayElement, _bci, int) \
+ nonstatic_field(vframeArrayElement, _method, Method*) \
\
- nonstatic_field(PtrQueue, _active, bool) \
- nonstatic_field(PtrQueue, _buf, void**) \
- nonstatic_field(PtrQueue, _index, size_t) \
+ nonstatic_field(PtrQueue, _active, bool) \
+ nonstatic_field(PtrQueue, _buf, void**) \
+ nonstatic_field(PtrQueue, _index, size_t) \
\
- nonstatic_field(AccessFlags, _flags, jint) \
- nonstatic_field(elapsedTimer, _counter, jlong) \
- nonstatic_field(elapsedTimer, _active, bool) \
- nonstatic_field(InvocationCounter, _counter, unsigned int) \
- volatile_nonstatic_field(FreeChunk, _size, size_t) \
- nonstatic_field(FreeChunk, _next, FreeChunk*) \
- nonstatic_field(FreeChunk, _prev, FreeChunk*) \
- nonstatic_field(AdaptiveFreeList<FreeChunk>, _size, size_t) \
- nonstatic_field(AdaptiveFreeList<FreeChunk>, _count, ssize_t)
+ nonstatic_field(AccessFlags, _flags, jint) \
+ nonstatic_field(elapsedTimer, _counter, jlong) \
+ nonstatic_field(elapsedTimer, _active, bool) \
+ nonstatic_field(InvocationCounter, _counter, unsigned int) \
+ volatile_nonstatic_field(FreeChunk, _size, size_t) \
+ nonstatic_field(FreeChunk, _next, FreeChunk*) \
+ nonstatic_field(FreeChunk, _prev, FreeChunk*) \
+ nonstatic_field(AdaptiveFreeList<FreeChunk>, _size, size_t) \
+ nonstatic_field(AdaptiveFreeList<FreeChunk>, _count, ssize_t)
//--------------------------------------------------------------------------------
@@ -2253,6 +2253,7 @@
\
declare_constant(BarrierSet::ModRef) \
declare_constant(BarrierSet::CardTableModRef) \
+ declare_constant(BarrierSet::CardTableForRS) \
declare_constant(BarrierSet::CardTableExtension) \
declare_constant(BarrierSet::G1SATBCT) \
declare_constant(BarrierSet::G1SATBCTLogging) \
--- a/hotspot/src/share/vm/services/memoryPool.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/services/memoryPool.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -204,21 +204,21 @@
return MemoryUsage(initial_size(), used, committed, maxSize);
}
-SurvivorContiguousSpacePool::SurvivorContiguousSpacePool(DefNewGeneration* gen,
+SurvivorContiguousSpacePool::SurvivorContiguousSpacePool(DefNewGeneration* young_gen,
const char* name,
PoolType type,
size_t max_size,
bool support_usage_threshold) :
- CollectedMemoryPool(name, type, gen->from()->capacity(), max_size,
- support_usage_threshold), _gen(gen) {
+ CollectedMemoryPool(name, type, young_gen->from()->capacity(), max_size,
+ support_usage_threshold), _young_gen(young_gen) {
}
size_t SurvivorContiguousSpacePool::used_in_bytes() {
- return _gen->from()->used();
+ return _young_gen->from()->used();
}
size_t SurvivorContiguousSpacePool::committed_in_bytes() {
- return _gen->from()->capacity();
+ return _young_gen->from()->capacity();
}
MemoryUsage SurvivorContiguousSpacePool::get_memory_usage() {
--- a/hotspot/src/share/vm/services/memoryPool.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/services/memoryPool.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -163,10 +163,10 @@
class SurvivorContiguousSpacePool : public CollectedMemoryPool {
private:
- DefNewGeneration* _gen;
+ DefNewGeneration* _young_gen;
public:
- SurvivorContiguousSpacePool(DefNewGeneration* gen,
+ SurvivorContiguousSpacePool(DefNewGeneration* young_gen,
const char* name,
PoolType type,
size_t max_size,
--- a/hotspot/src/share/vm/services/memoryService.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/services/memoryService.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -212,13 +212,13 @@
return (MemoryPool*) pool;
}
-MemoryPool* MemoryService::add_survivor_spaces(DefNewGeneration* gen,
+MemoryPool* MemoryService::add_survivor_spaces(DefNewGeneration* young_gen,
const char* name,
bool is_heap,
size_t max_size,
bool support_usage_threshold) {
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap);
- SurvivorContiguousSpacePool* pool = new SurvivorContiguousSpacePool(gen, name, type, max_size, support_usage_threshold);
+ SurvivorContiguousSpacePool* pool = new SurvivorContiguousSpacePool(young_gen, name, type, max_size, support_usage_threshold);
_pools_list->append(pool);
return (MemoryPool*) pool;
@@ -328,18 +328,18 @@
#if INCLUDE_ALL_GCS
-void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) {
+void MemoryService::add_psYoung_memory_pool(PSYoungGen* young_gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) {
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers");
// Add a memory pool for each space and young gen doesn't
// support low memory detection as it is expected to get filled up.
- EdenMutableSpacePool* eden = new EdenMutableSpacePool(gen,
- gen->eden_space(),
+ EdenMutableSpacePool* eden = new EdenMutableSpacePool(young_gen,
+ young_gen->eden_space(),
"PS Eden Space",
MemoryPool::Heap,
false /* support_usage_threshold */);
- SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(gen,
+ SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(young_gen,
"PS Survivor Space",
MemoryPool::Heap,
false /* support_usage_threshold */);
@@ -352,13 +352,13 @@
_pools_list->append(survivor);
}
-void MemoryService::add_psOld_memory_pool(PSOldGen* gen, MemoryManager* mgr) {
- PSGenerationPool* old_gen = new PSGenerationPool(gen,
- "PS Old Gen",
- MemoryPool::Heap,
- true /* support_usage_threshold */);
- mgr->add_pool(old_gen);
- _pools_list->append(old_gen);
+void MemoryService::add_psOld_memory_pool(PSOldGen* old_gen, MemoryManager* mgr) {
+ PSGenerationPool* old_gen_pool = new PSGenerationPool(old_gen,
+ "PS Old Gen",
+ MemoryPool::Heap,
+ true /* support_usage_threshold */);
+ mgr->add_pool(old_gen_pool);
+ _pools_list->append(old_gen_pool);
}
void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
@@ -548,7 +548,7 @@
}
//
// GC manager type depends on the type of Generation. Depending on the space
-// availablity and vm options the gc uses major gc manager or minor gc
+// availability and vm options the gc uses major gc manager or minor gc
// manager or both. The type of gc manager depends on the generation kind.
// For DefNew and ParNew generation doing scavenge gc uses minor gc manager (so
// _fullGC is set to false ) and for other generation kinds doing
--- a/hotspot/src/share/vm/services/memoryService.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/services/memoryService.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -80,10 +80,10 @@
}
- static void add_psYoung_memory_pool(PSYoungGen* gen,
+ static void add_psYoung_memory_pool(PSYoungGen* young_gen,
MemoryManager* major_mgr,
MemoryManager* minor_mgr);
- static void add_psOld_memory_pool(PSOldGen* gen,
+ static void add_psOld_memory_pool(PSOldGen* old_gen,
MemoryManager* mgr);
static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
@@ -97,7 +97,7 @@
bool is_heap,
size_t max_size,
bool support_usage_threshold);
- static MemoryPool* add_survivor_spaces(DefNewGeneration* gen,
+ static MemoryPool* add_survivor_spaces(DefNewGeneration* young_gen,
const char* name,
bool is_heap,
size_t max_size,
@@ -162,7 +162,6 @@
bool recordGCEndTime, bool countCollection,
GCCause::Cause cause);
-
static void oops_do(OopClosure* f);
static bool get_verbose() { return PrintGC; }
--- a/hotspot/src/share/vm/services/psMemoryPool.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/services/psMemoryPool.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, 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
@@ -33,18 +33,18 @@
#include "services/memoryManager.hpp"
#include "services/psMemoryPool.hpp"
-PSGenerationPool::PSGenerationPool(PSOldGen* gen,
+PSGenerationPool::PSGenerationPool(PSOldGen* old_gen,
const char* name,
PoolType type,
bool support_usage_threshold) :
- CollectedMemoryPool(name, type, gen->capacity_in_bytes(),
- gen->reserved().byte_size(), support_usage_threshold), _gen(gen) {
+ CollectedMemoryPool(name, type, old_gen->capacity_in_bytes(),
+ old_gen->reserved().byte_size(), support_usage_threshold), _old_gen(old_gen) {
}
MemoryUsage PSGenerationPool::get_memory_usage() {
size_t maxSize = (available_for_allocation() ? max_size() : 0);
size_t used = used_in_bytes();
- size_t committed = _gen->capacity_in_bytes();
+ size_t committed = _old_gen->capacity_in_bytes();
return MemoryUsage(initial_size(), used, committed, maxSize);
}
@@ -55,15 +55,16 @@
// Max size of PS eden space is changing due to ergonomic.
// PSYoungGen, PSOldGen, Eden, Survivor spaces are all resizable.
//
-EdenMutableSpacePool::EdenMutableSpacePool(PSYoungGen* gen,
+EdenMutableSpacePool::EdenMutableSpacePool(PSYoungGen* young_gen,
MutableSpace* space,
const char* name,
PoolType type,
bool support_usage_threshold) :
CollectedMemoryPool(name, type, space->capacity_in_bytes(),
- (gen->max_size() - gen->from_space()->capacity_in_bytes() - gen->to_space()->capacity_in_bytes()),
+ (young_gen->max_size() - young_gen->from_space()->capacity_in_bytes() - young_gen->to_space()->capacity_in_bytes()),
support_usage_threshold),
- _gen(gen), _space(space) {
+ _young_gen(young_gen),
+ _space(space) {
}
MemoryUsage EdenMutableSpacePool::get_memory_usage() {
@@ -79,13 +80,13 @@
//
// PS from and to survivor spaces could have different sizes.
//
-SurvivorMutableSpacePool::SurvivorMutableSpacePool(PSYoungGen* gen,
+SurvivorMutableSpacePool::SurvivorMutableSpacePool(PSYoungGen* young_gen,
const char* name,
PoolType type,
bool support_usage_threshold) :
- CollectedMemoryPool(name, type, gen->from_space()->capacity_in_bytes(),
- gen->from_space()->capacity_in_bytes(),
- support_usage_threshold), _gen(gen) {
+ CollectedMemoryPool(name, type, young_gen->from_space()->capacity_in_bytes(),
+ young_gen->from_space()->capacity_in_bytes(),
+ support_usage_threshold), _young_gen(young_gen) {
}
MemoryUsage SurvivorMutableSpacePool::get_memory_usage() {
--- a/hotspot/src/share/vm/services/psMemoryPool.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/services/psMemoryPool.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -39,23 +39,23 @@
class PSGenerationPool : public CollectedMemoryPool {
private:
- PSOldGen* _gen;
+ PSOldGen* _old_gen;
public:
PSGenerationPool(PSOldGen* pool, const char* name, PoolType type, bool support_usage_threshold);
MemoryUsage get_memory_usage();
- size_t used_in_bytes() { return _gen->used_in_bytes(); }
- size_t max_size() const { return _gen->reserved().byte_size(); }
+ size_t used_in_bytes() { return _old_gen->used_in_bytes(); }
+ size_t max_size() const { return _old_gen->reserved().byte_size(); }
};
class EdenMutableSpacePool : public CollectedMemoryPool {
private:
- PSYoungGen* _gen;
+ PSYoungGen* _young_gen;
MutableSpace* _space;
public:
- EdenMutableSpacePool(PSYoungGen* gen,
+ EdenMutableSpacePool(PSYoungGen* young_gen,
MutableSpace* space,
const char* name,
PoolType type,
@@ -66,16 +66,16 @@
size_t used_in_bytes() { return space()->used_in_bytes(); }
size_t max_size() const {
// Eden's max_size = max_size of Young Gen - the current committed size of survivor spaces
- return _gen->max_size() - _gen->from_space()->capacity_in_bytes() - _gen->to_space()->capacity_in_bytes();
+ return _young_gen->max_size() - _young_gen->from_space()->capacity_in_bytes() - _young_gen->to_space()->capacity_in_bytes();
}
};
class SurvivorMutableSpacePool : public CollectedMemoryPool {
private:
- PSYoungGen* _gen;
+ PSYoungGen* _young_gen;
public:
- SurvivorMutableSpacePool(PSYoungGen* gen,
+ SurvivorMutableSpacePool(PSYoungGen* young_gen,
const char* name,
PoolType type,
bool support_usage_threshold);
@@ -83,14 +83,14 @@
MemoryUsage get_memory_usage();
size_t used_in_bytes() {
- return _gen->from_space()->used_in_bytes();
+ return _young_gen->from_space()->used_in_bytes();
}
size_t committed_in_bytes() {
- return _gen->from_space()->capacity_in_bytes();
+ return _young_gen->from_space()->capacity_in_bytes();
}
size_t max_size() const {
// Return current committed size of the from-space
- return _gen->from_space()->capacity_in_bytes();
+ return _young_gen->from_space()->capacity_in_bytes();
}
};
--- a/hotspot/src/share/vm/shark/sharkBuilder.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -440,8 +440,10 @@
// HotSpot memory barriers
void SharkBuilder::CreateUpdateBarrierSet(BarrierSet* bs, Value* field) {
- if (bs->kind() != BarrierSet::CardTableModRef)
+ if (bs->kind() != BarrierSet::CardTableForRS &&
+ bs->kind() != BarrierSet::CardTableExtension) {
Unimplemented();
+ }
CreateStore(
LLVMValue::jbyte_constant(CardTableModRefBS::dirty_card_val()),
--- a/hotspot/src/share/vm/utilities/endian.cpp Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "utilities/endian.hpp"
-#include "utilities/bytes.hpp"
-
-#ifndef bswap_16
-extern "C" inline u2 bswap_16(u2 x) {
- return ((x & 0xFF) << 8) |
- ((x >> 8) & 0xFF);
-}
-#endif
-
-#ifndef bswap_32
-extern "C" inline u4 bswap_32(u4 x) {
- return ((x & 0xFF) << 24) |
- ((x & 0xFF00) << 8) |
- ((x >> 8) & 0xFF00) |
- ((x >> 24) & 0xFF);
-}
-#endif
-
-#ifndef bswap_64
-extern "C" inline u8 bswap_64(u8 x) {
- return (u8)bswap_32((u4)x) << 32 |
- (u8)bswap_32((u4)(x >> 32));
-}
-#endif
-
-u2 NativeEndian::get(u2 x) { return x; }
-u4 NativeEndian::get(u4 x) { return x; }
-u8 NativeEndian::get(u8 x) { return x; }
-s2 NativeEndian::get(s2 x) { return x; }
-s4 NativeEndian::get(s4 x) { return x; }
-s8 NativeEndian::get(s8 x) { return x; }
-
-void NativeEndian::set(u2& x, u2 y) { x = y; }
-void NativeEndian::set(u4& x, u4 y) { x = y; }
-void NativeEndian::set(u8& x, u8 y) { x = y; }
-void NativeEndian::set(s2& x, s2 y) { x = y; }
-void NativeEndian::set(s4& x, s4 y) { x = y; }
-void NativeEndian::set(s8& x, s8 y) { x = y; }
-
-NativeEndian NativeEndian::_native;
-
-u2 SwappingEndian::get(u2 x) { return bswap_16(x); }
-u4 SwappingEndian::get(u4 x) { return bswap_32(x); }
-u8 SwappingEndian::get(u8 x) { return bswap_64(x); }
-s2 SwappingEndian::get(s2 x) { return bswap_16(x); }
-s4 SwappingEndian::get(s4 x) { return bswap_32(x); }
-s8 SwappingEndian::get(s8 x) { return bswap_64(x); }
-
-void SwappingEndian::set(u2& x, u2 y) { x = bswap_16(y); }
-void SwappingEndian::set(u4& x, u4 y) { x = bswap_32(y); }
-void SwappingEndian::set(u8& x, u8 y) { x = bswap_64(y); }
-void SwappingEndian::set(s2& x, s2 y) { x = bswap_16(y); }
-void SwappingEndian::set(s4& x, s4 y) { x = bswap_32(y); }
-void SwappingEndian::set(s8& x, s8 y) { x = bswap_64(y); }
-
-SwappingEndian SwappingEndian::_swapping;
-
-Endian* Endian::get_handler(bool big_endian) {
- // If requesting little endian on a little endian machine or
- // big endian on a big endian machine use native handler
- if (big_endian == is_big_endian()) {
- return NativeEndian::get_native();
- } else {
- // Use swapping handler.
- return SwappingEndian::get_swapping();
- }
-}
-
-Endian* Endian::get_native_handler() {
- return NativeEndian::get_native();
-}
--- a/hotspot/src/share/vm/utilities/endian.hpp Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- */
-
-#ifndef SHARE_VM_UTILITIES_ENDIAN_HPP
-#define SHARE_VM_UTILITIES_ENDIAN_HPP
-
-#include "utilities/globalDefinitions.hpp"
-
-// Selectable endian handling. Endian handlers are used when accessing values
-// that are of unknown (until runtime) endian. The only requirement of the values
-// accessed are that they are aligned to proper size boundaries (no misalignment.)
-// To select an endian handler, one should call Endian::get_handler(big_endian);
-// Where big_endian is true if big endian is required and false otherwise. The
-// native endian handler can be fetched with Endian::get_native_handler();
-// To retrieve a value using the approprate endian, use one of the overloaded
-// calls to get. To set a value, then use one of the overloaded set calls.
-// Ex.
-// s4 value; // Imported value;
-// ...
-// Endian* endian = Endian::get_handler(true); // Use big endian
-// s4 corrected = endian->get(value);
-// endian->set(value, 1);
-//
-class Endian {
-public:
- virtual u2 get(u2 x) = 0;
- virtual u4 get(u4 x) = 0;
- virtual u8 get(u8 x) = 0;
- virtual s2 get(s2 x) = 0;
- virtual s4 get(s4 x) = 0;
- virtual s8 get(s8 x) = 0;
-
- virtual void set(u2& x, u2 y) = 0;
- virtual void set(u4& x, u4 y) = 0;
- virtual void set(u8& x, u8 y) = 0;
- virtual void set(s2& x, s2 y) = 0;
- virtual void set(s4& x, s4 y) = 0;
- virtual void set(s8& x, s8 y) = 0;
-
- // Quick little endian test.
- static bool is_little_endian() { u4 x = 1; return *(u1 *)&x != 0; }
-
- // Quick big endian test.
- static bool is_big_endian() { return !is_little_endian(); }
-
- // Select an appropriate endian handler.
- static Endian* get_handler(bool big_endian);
-
- // Return the native endian handler.
- static Endian* get_native_handler();
-};
-
-// Normal endian handling.
-class NativeEndian : public Endian {
-private:
- static NativeEndian _native;
-
-public:
- u2 get(u2 x);
- u4 get(u4 x);
- u8 get(u8 x);
- s2 get(s2 x);
- s4 get(s4 x);
- s8 get(s8 x);
-
- void set(u2& x, u2 y);
- void set(u4& x, u4 y);
- void set(u8& x, u8 y);
- void set(s2& x, s2 y);
- void set(s4& x, s4 y);
- void set(s8& x, s8 y);
-
- static Endian* get_native() { return &_native; }
-};
-
-// Swapping endian handling.
-class SwappingEndian : public Endian {
-private:
- static SwappingEndian _swapping;
-
-public:
- u2 get(u2 x);
- u4 get(u4 x);
- u8 get(u8 x);
- s2 get(s2 x);
- s4 get(s4 x);
- s8 get(s8 x);
-
- void set(u2& x, u2 y);
- void set(u4& x, u4 y);
- void set(u8& x, u8 y);
- void set(s2& x, s2 y);
- void set(s4& x, s4 y);
- void set(s8& x, s8 y);
-
- static Endian* get_swapping() { return &_swapping; }
-};
-#endif // SHARE_VM_UTILITIES_ENDIAN_HPP
--- a/hotspot/src/share/vm/utilities/stack.inline.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/utilities/stack.inline.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -27,6 +27,17 @@
#include "utilities/stack.hpp"
+// Stack is used by the GC code and in some hot paths a lot of the Stack
+// code gets inlined. This is generally good, but when too much code has
+// been inlined, no further inlining is allowed by GCC. Therefore we need
+// to prevent parts of the slow path in Stack to be inlined to allow other
+// code to be.
+#if defined(TARGET_COMPILER_gcc)
+#define NOINLINE __attribute__((noinline))
+#else
+#define NOINLINE
+#endif
+
template <MEMFLAGS F> StackBase<F>::StackBase(size_t segment_size, size_t max_cache_size,
size_t max_size):
_seg_size(segment_size),
@@ -141,7 +152,7 @@
}
template <class E, MEMFLAGS F>
-void Stack<E, F>::push_segment()
+NOINLINE void Stack<E, F>::push_segment()
{
assert(this->_cur_seg_size == this->_seg_size, "current segment is not full");
E* next;
@@ -269,4 +280,6 @@
return _cur_seg + --_cur_seg_size;
}
+#undef NOINLINE
+
#endif // SHARE_VM_UTILITIES_STACK_INLINE_HPP
--- a/hotspot/src/share/vm/utilities/vmError.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -231,7 +231,7 @@
if (signame) {
jio_snprintf(buf, buflen,
- "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" INTPTR_FORMAT,
+ "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT,
signame, _id, _pc,
os::current_process_id(), os::current_thread_id());
} else if (_filename != NULL && _lineno > 0) {
@@ -239,7 +239,7 @@
char separator = os::file_separator()[0];
const char *p = strrchr(_filename, separator);
int n = jio_snprintf(buf, buflen,
- "Internal Error at %s:%d, pid=%d, tid=" INTPTR_FORMAT,
+ "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT,
p ? p + 1 : _filename, _lineno,
os::current_process_id(), os::current_thread_id());
if (n >= 0 && n < buflen && _message) {
@@ -253,7 +253,7 @@
}
} else {
jio_snprintf(buf, buflen,
- "Internal Error (0x%x), pid=%d, tid=" INTPTR_FORMAT,
+ "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT,
_id, os::current_process_id(), os::current_thread_id());
}
@@ -486,7 +486,7 @@
// process id, thread id
st->print(", pid=%d", os::current_process_id());
- st->print(", tid=" INTPTR_FORMAT, os::current_thread_id());
+ st->print(", tid=" UINTX_FORMAT, os::current_thread_id());
st->cr();
STEP(80, "(printing error message)")
--- a/hotspot/test/compiler/arguments/CheckCICompilerCount.java Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/test/compiler/arguments/CheckCICompilerCount.java Tue Sep 22 11:01:54 2015 -0700
@@ -75,7 +75,7 @@
"intx CICompilerCount := 1 {product}"
},
{
- "CICompilerCount=0 must be at least 1",
+ "CICompilerCount (0) must be at least 1",
"Improperly specified VM option 'CICompilerCount=0'"
},
{
@@ -130,7 +130,7 @@
"intx CICompilerCount := 2 {product}"
},
{
- "CICompilerCount=1 must be at least 2",
+ "CICompilerCount (1) must be at least 2",
"Improperly specified VM option 'CICompilerCount=1'"
},
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyOverflowInBoundChecks.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, 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
+ * @bug 8134468
+ * @summary test that checks whether an array load falls into the range of an arraycopy is incorrect on 32bits
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyOverflowInBoundChecks
+ *
+ */
+public class TestArrayCopyOverflowInBoundChecks {
+
+ static byte[] src_array = { 'a', 'b', 'c', 'd', 'e' };
+
+ static byte test(int copy_len) {
+ byte[] dst_array = new byte[10];
+ System.arraycopy(src_array, 0, dst_array, 1, copy_len);
+ return dst_array[1];
+ }
+
+ static public void main(String[] args) {
+ for (int i = 0; i < 20000; i++) {
+ if (test(src_array.length - 1) != src_array[0]) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/escapeAnalysis/TestEABadMergeMem.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, 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
+ * @bug 8134031
+ * @summary Bad rewiring of memory edges when we split unique types during EA
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEABadMergeMem::m_notinlined TestEABadMergeMem
+ *
+ */
+
+public class TestEABadMergeMem {
+
+ static class Box {
+ int i;
+ }
+
+ static void m_notinlined() {
+ }
+
+ static float dummy1;
+ static float dummy2;
+
+ static int test(Box a, Box c, int i, int j, int k, boolean flag1, boolean flag2) {
+ Box b = new Box(); // non escaping
+ a.i = i;
+ b.i = j;
+ c.i = k;
+
+ m_notinlined();
+
+ boolean flag3 = false;
+ if (flag1) {
+ for (int ii = 0; ii < 100; ii++) {
+ if (flag2) {
+ dummy1 = (float)ii;
+ } else {
+ dummy2 = (float)ii;
+ }
+ }
+ flag3 = true;
+ }
+ // Memory Phi here with projection of not inlined call as one edge, MergeMem as other
+
+ if (flag3) { // will split through Phi during loopopts
+ int res = c.i + b.i;
+ m_notinlined(); // prevents split through phi during igvn
+ return res;
+ } else {
+ return 44 + 43;
+ }
+ }
+
+ static public void main(String[] args) {
+ for (int i = 0; i < 20000; i++) {
+ // m(2);
+ Box a = new Box();
+ Box c = new Box();
+ int res = test(a, c, 42, 43, 44, (i%2) == 0, (i%3) == 0);
+ if (res != 44 + 43) {
+ throw new RuntimeException("Bad result " + res);
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/adler32/TestAdler32.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2015, 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
+ * @bug 8132081
+ * @summary C2 support for Adler32 on SPARC
+ *
+ * @run main/othervm/timeout=600 -Xbatch TestAdler32 -m
+ */
+
+import java.nio.ByteBuffer;
+import java.util.zip.Checksum;
+import java.util.zip.Adler32;
+
+public class TestAdler32 {
+ public static void main(String[] args) {
+ int offset = Integer.getInteger("offset", 0);
+ int msgSize = Integer.getInteger("msgSize", 512);
+ boolean multi = false;
+ int iters = 20000;
+ int warmupIters = 20000;
+
+ if (args.length > 0) {
+ if (args[0].equals("-m")) {
+ multi = true;
+ } else {
+ iters = Integer.valueOf(args[0]);
+ }
+ if (args.length > 1) {
+ warmupIters = Integer.valueOf(args[1]);
+ }
+ }
+
+ if (multi) {
+ test_multi(warmupIters);
+ return;
+ }
+
+ System.out.println(" offset = " + offset);
+ System.out.println("msgSize = " + msgSize + " bytes");
+ System.out.println(" iters = " + iters);
+
+ byte[] b = initializedBytes(msgSize, offset);
+
+ Adler32 adler0 = new Adler32();
+ Adler32 adler1 = new Adler32();
+ Adler32 adler2 = new Adler32();
+
+ adler0.update(b, offset, msgSize);
+
+ System.out.println("-------------------------------------------------------");
+
+ /* warm up */
+ for (int i = 0; i < warmupIters; i++) {
+ adler1.reset();
+ adler1.update(b, offset, msgSize);
+ }
+
+ /* measure performance */
+ long start = System.nanoTime();
+ for (int i = 0; i < iters; i++) {
+ adler1.reset();
+ adler1.update(b, offset, msgSize);
+ }
+ long end = System.nanoTime();
+ double total = (double)(end - start)/1e9; // in seconds
+ double thruput = (double)msgSize*iters/1e6/total; // in MB/s
+ System.out.println("Adler32.update(byte[]) runtime = " + total + " seconds");
+ System.out.println("Adler32.update(byte[]) throughput = " + thruput + " MB/s");
+
+ /* check correctness */
+ for (int i = 0; i < iters; i++) {
+ adler1.reset();
+ adler1.update(b, offset, msgSize);
+ if (!check(adler0, adler1)) break;
+ }
+ report("Adlers", adler0, adler1);
+
+ System.out.println("-------------------------------------------------------");
+
+ ByteBuffer buf = ByteBuffer.allocateDirect(msgSize);
+ buf.put(b, offset, msgSize);
+ buf.flip();
+
+ /* warm up */
+ for (int i = 0; i < warmupIters; i++) {
+ adler2.reset();
+ adler2.update(buf);
+ buf.rewind();
+ }
+
+ /* measure performance */
+ start = System.nanoTime();
+ for (int i = 0; i < iters; i++) {
+ adler2.reset();
+ adler2.update(buf);
+ buf.rewind();
+ }
+ end = System.nanoTime();
+ total = (double)(end - start)/1e9; // in seconds
+ thruput = (double)msgSize*iters/1e6/total; // in MB/s
+ System.out.println("Adler32.update(ByteBuffer) runtime = " + total + " seconds");
+ System.out.println("Adler32.update(ByteBuffer) throughput = " + thruput + " MB/s");
+
+ /* check correctness */
+ for (int i = 0; i < iters; i++) {
+ adler2.reset();
+ adler2.update(buf);
+ buf.rewind();
+ if (!check(adler0, adler2)) break;
+ }
+ report("Adlers", adler0, adler1);
+
+ System.out.println("-------------------------------------------------------");
+ }
+
+ private static void report(String s, Checksum adler0, Checksum adler1) {
+ System.out.printf("%s: adler0 = %08x, adler1 = %08x\n",
+ s, adler0.getValue(), adler1.getValue());
+ }
+
+ private static boolean check(Checksum adler0, Checksum adler1) {
+ if (adler0.getValue() != adler1.getValue()) {
+ System.err.printf("ERROR: adler0 = %08x, adler1 = %08x\n",
+ adler0.getValue(), adler1.getValue());
+ return false;
+ }
+ return true;
+ }
+
+ private static byte[] initializedBytes(int M, int offset) {
+ byte[] bytes = new byte[M + offset];
+ for (int i = 0; i < offset; i++) {
+ bytes[i] = (byte) i;
+ }
+ for (int i = offset; i < bytes.length; i++) {
+ bytes[i] = (byte) (i - offset);
+ }
+ return bytes;
+ }
+
+ private static void test_multi(int iters) {
+ int len1 = 8; // the 8B/iteration loop
+ int len2 = 32; // the 32B/iteration loop
+ int len3 = 4096; // the 4KB/iteration loop
+
+ byte[] b = initializedBytes(len3*16, 0);
+ int[] offsets = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 16, 32, 64, 128, 256, 512 };
+ int[] sizes = { 0, 1, 2, 3, 4, 5, 6, 7,
+ len1, len1+1, len1+2, len1+3, len1+4, len1+5, len1+6, len1+7,
+ len1*2, len1*2+1, len1*2+3, len1*2+5, len1*2+7,
+ len2, len2+1, len2+3, len2+5, len2+7,
+ len2*2, len2*4, len2*8, len2*16, len2*32, len2*64,
+ len3, len3+1, len3+3, len3+5, len3+7,
+ len3*2, len3*4, len3*8,
+ len1+len2, len1+len2+1, len1+len2+3, len1+len2+5, len1+len2+7,
+ len1+len3, len1+len3+1, len1+len3+3, len1+len3+5, len1+len3+7,
+ len2+len3, len2+len3+1, len2+len3+3, len2+len3+5, len2+len3+7,
+ len1+len2+len3, len1+len2+len3+1, len1+len2+len3+3,
+ len1+len2+len3+5, len1+len2+len3+7,
+ (len1+len2+len3)*2, (len1+len2+len3)*2+1, (len1+len2+len3)*2+3,
+ (len1+len2+len3)*2+5, (len1+len2+len3)*2+7,
+ (len1+len2+len3)*3, (len1+len2+len3)*3-1, (len1+len2+len3)*3-3,
+ (len1+len2+len3)*3-5, (len1+len2+len3)*3-7 };
+ Adler32[] adler0 = new Adler32[offsets.length*sizes.length];
+ Adler32[] adler1 = new Adler32[offsets.length*sizes.length];
+ int i, j, k;
+
+ System.out.printf("testing %d cases ...\n", offsets.length*sizes.length);
+
+ /* set the result from interpreter as reference */
+ for (i = 0; i < offsets.length; i++) {
+ for (j = 0; j < sizes.length; j++) {
+ adler0[i*sizes.length + j] = new Adler32();
+ adler1[i*sizes.length + j] = new Adler32();
+ adler0[i*sizes.length + j].update(b, offsets[i], sizes[j]);
+ }
+ }
+
+ /* warm up the JIT compiler and get result */
+ for (k = 0; k < iters; k++) {
+ for (i = 0; i < offsets.length; i++) {
+ for (j = 0; j < sizes.length; j++) {
+ adler1[i*sizes.length + j].reset();
+ adler1[i*sizes.length + j].update(b, offsets[i], sizes[j]);
+ }
+ }
+ }
+
+ /* check correctness */
+ for (i = 0; i < offsets.length; i++) {
+ for (j = 0; j < sizes.length; j++) {
+ if (!check(adler0[i*sizes.length + j], adler1[i*sizes.length + j])) {
+ System.out.printf("offsets[%d] = %d", i, offsets[i]);
+ System.out.printf("\tsizes[%d] = %d\n", j, sizes[j]);
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/GCTypes.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2015, 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.
+*/
+
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * Helper class with enum representation of GC types.
+ */
+public final class GCTypes {
+
+ private static <T extends GCType> T getCurrentGCType(Class<T> type) {
+ return ManagementFactory.getGarbageCollectorMXBeans().stream()
+ .map(bean -> getGCTypeByName(type, bean.getName()))
+ .filter(Objects::nonNull)
+ .findFirst()
+ .orElse(null);
+ }
+
+ private static <T extends GCType> T getGCTypeByName(Class<T> type, String name) {
+ return Arrays.stream(type.getEnumConstants())
+ .filter(e -> e.getGCName().equals(name))
+ .findFirst()
+ .orElse(null);
+ }
+
+ private static <T extends GCType> GarbageCollectorMXBean getGCBeanByType(Class<T> type) {
+ return ManagementFactory.getGarbageCollectorMXBeans().stream()
+ .filter(bean -> Arrays.stream(type.getEnumConstants())
+ .filter(enumName -> enumName.getGCName().equals(bean.getName()))
+ .findFirst()
+ .isPresent()
+ )
+ .findFirst()
+ .orElse(null);
+ }
+
+ /**
+ * Helper interface used by GCTypes static methods
+ * to get gcTypeName field of *GCType classes.
+ */
+ private interface GCType {
+
+ String getGCName();
+ }
+
+ public static enum YoungGCType implements GCType {
+ DefNew("Copy"),
+ ParNew("ParNew"),
+ PSNew("PS Scavenge"),
+ G1("G1 Young Generation");
+
+ @Override
+ public String getGCName() {
+ return gcTypeName;
+ }
+ private final String gcTypeName;
+
+ private YoungGCType(String name) {
+ gcTypeName = name;
+ }
+
+ public static YoungGCType getYoungGCType() {
+ return GCTypes.getCurrentGCType(YoungGCType.class);
+ }
+
+ public static GarbageCollectorMXBean getYoungGCBean() {
+ return GCTypes.getGCBeanByType(YoungGCType.class);
+ }
+ }
+
+ public static enum OldGCType implements GCType {
+ Serial("MarkSweepCompact"),
+ CMS("ConcurrentMarkSweep"),
+ PSOld("PS MarkSweep"),
+ G1("G1 Old Generation");
+
+ private final String gcTypeName;
+
+ private OldGCType(String name) {
+ gcTypeName = name;
+ }
+
+ public static OldGCType getOldGCType() {
+ return GCTypes.getCurrentGCType(OldGCType.class);
+ }
+
+ @Override
+ public String getGCName() {
+ return gcTypeName;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,299 @@
+/*
+* Copyright (c) 2015, 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 TestMaxMinHeapFreeRatioFlags
+ * @key gc
+ * @summary Verify that heap size changes according to max and min heap free ratios.
+ * @library /testlibrary
+ * @modules java.base/sun.misc
+ * java.management
+ * @build TestMaxMinHeapFreeRatioFlags
+ * @run driver/timeout=240 TestMaxMinHeapFreeRatioFlags
+ */
+
+import java.util.LinkedList;
+import java.util.Arrays;
+import java.util.Collections;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.Utils;
+import jdk.test.lib.HeapRegionUsageTool;
+import sun.misc.Unsafe;
+
+public class TestMaxMinHeapFreeRatioFlags {
+
+ public static final long M = 1024 * 1024;
+ public static final long MAX_HEAP_SIZE = 200 * M;
+ public static final long HEAP_SIZE = 10 * M;
+ public static final long MAX_NEW_SIZE = 20 * M;
+ public static final long NEW_SIZE = 5 * M;
+
+ public static void main(String args[]) throws Exception {
+ LinkedList<String> options = new LinkedList<>(
+ Arrays.asList(Utils.getFilteredTestJavaOpts("-XX:[^ ]*HeapFreeRatio","-XX:\\+ExplicitGCInvokesConcurrent"))
+ );
+
+ negativeTest(20, false, 10, true, options);
+ negativeTest(100, true, 0, false, options);
+ negativeTest(101, false, 50, false, options);
+ negativeTest(49, true, 102, true, options);
+ negativeTest(-1, false, 50, false, options);
+ negativeTest(50, true, -1, true, options);
+
+ positiveTest(10, false, 90, false, options);
+ positiveTest(10, true, 80, false, options);
+ positiveTest(20, false, 70, true, options);
+ positiveTest(25, true, 65, true, options);
+ positiveTest(40, false, 50, false, options);
+ }
+
+ /**
+ * Verify that heap size will be changed to conform
+ * min and max heap free ratios.
+ *
+ * @param minRatio value of MinHeapFreeRatio option
+ * @param useXminf used Xminf option instead of MinHeapFreeRatio
+ * @param maxRatio value of MaxHeapFreeRatio option
+ * @param useXmaxf used Xmaxf option instead of MaxHeapFreeRatio
+ * @param options additional options for JVM
+ */
+ public static void positiveTest(int minRatio, boolean useXminf,
+ int maxRatio, boolean useXmaxf,
+ LinkedList<String> options) throws Exception {
+
+ LinkedList<String> vmOptions = new LinkedList<>(options);
+ Collections.addAll(vmOptions,
+ (useXminf ? "-Xminf" + minRatio / 100.0 : "-XX:MinHeapFreeRatio=" + minRatio),
+ (useXmaxf ? "-Xmaxf" + maxRatio / 100.0 : "-XX:MaxHeapFreeRatio=" + maxRatio),
+ "-Xmx" + MAX_HEAP_SIZE,
+ "-Xms" + HEAP_SIZE,
+ "-XX:NewSize=" + NEW_SIZE,
+ "-XX:MaxNewSize=" + MAX_NEW_SIZE,
+ RatioVerifier.class.getName(),
+ Integer.toString(minRatio),
+ Integer.toString(maxRatio)
+ );
+
+ ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
+ OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
+ analyzer.shouldHaveExitValue(0);
+ }
+
+ /**
+ * Verify that VM will fail to start with specified ratios.
+ *
+ * @param minRatio value of MinHeapFreeRatio option
+ * @param useXminf used Xminf option instead of MinHeapFreeRatio
+ * @param maxRatio value of MaxHeapFreeRatio option
+ * @param useXmaxf used Xmaxf option instead of MaxHeapFreeRatio
+ * @param options additional options for JVM
+ */
+ public static void negativeTest(int minRatio, boolean useXminf,
+ int maxRatio, boolean useXmaxf,
+ LinkedList<String> options) throws Exception {
+
+ LinkedList<String> vmOptions = new LinkedList<>(options);
+ Collections.addAll(vmOptions,
+ (useXminf ? "-Xminf" + minRatio / 100.0 : "-XX:MinHeapFreeRatio=" + minRatio),
+ (useXmaxf ? "-Xmaxf" + maxRatio / 100.0 : "-XX:MaxHeapFreeRatio=" + maxRatio),
+ "-version"
+ );
+ ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
+ OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
+ analyzer.shouldHaveExitValue(1);
+ analyzer.shouldContain("Error: Could not create the Java Virtual Machine.");
+ }
+
+ /**
+ * RatioVerifier will be executed in the tested VM.
+ * It will check that real heap usage after collection lies between MinHeapFreeRatio and MaxHeapFreeRatio.
+ */
+ public static class RatioVerifier {
+
+ private static final Unsafe unsafe = Utils.getUnsafe();
+
+ // Size of byte array that will be allocated
+ public static final int CHUNK_SIZE = 1024;
+ // Length of byte array, that will be added to "garbage" list.
+ public static final int ARRAY_LENGTH = CHUNK_SIZE - Unsafe.ARRAY_BYTE_BASE_OFFSET;
+ // Amount of tries to force heap shrinking/expansion using GC
+ public static final int GC_TRIES = 10;
+
+ // Value that will be added/substracted from expected min/max heap free ratio
+ // during memory allocation to make sure that specified limit will be exceeded.
+ public static final double OVERLOAD = 0.05;
+ // Acceptable heap free ratio limit exceedance: verification will fail if
+ // actual ratio is lower than expected min heap free ratio - VARIANCE or
+ // higher than expected max heap free ratio + VARIANCE.
+ public static final double VARIANCE = 0.025;
+
+ public static LinkedList<Object> garbage = new LinkedList<>();
+
+ public static void main(String args[]) throws Exception {
+ if (args.length != 2) {
+ throw new IllegalArgumentException("Expected 2 args: <minRatio> <maxRatio>");
+ }
+ if (GCTypes.OldGCType.getOldGCType() == GCTypes.OldGCType.PSOld) {
+ System.out.println("Test is not applicable to parallel GC");
+ return;
+ }
+
+ double minRatio = Integer.valueOf(args[0]) / 100.0;
+ double maxRatio = Integer.valueOf(args[1]) / 100.0;
+
+ long maxHeapSize = getMax();
+
+ // commit 0.5 of total heap size to have enough space
+ // to both shink and expand
+ while (getCommitted() < maxHeapSize / 2) {
+ garbage.add(new byte[ARRAY_LENGTH]);
+ }
+
+ forceGC();
+ // Verify that current heap free ratio lies between specified limits
+ verifyRatio(minRatio, maxRatio);
+
+ // Estimate how much memory we have to allocate to force expansion
+ long memoryToFill = (long) (getCommitted() * (1 - minRatio + OVERLOAD))
+ - getUsed();
+
+ long previouslyCommitted = getCommitted();
+
+ while (memoryToFill > 0) {
+ garbage.add(new byte[CHUNK_SIZE]);
+ memoryToFill -= CHUNK_SIZE;
+ }
+
+ forceGC();
+ // Verify that after memory allocation heap free ratio is still conforming specified limits
+ verifyRatio(minRatio, maxRatio);
+ // Verify that heap was actually expanded
+ if (previouslyCommitted >= getCommitted()) {
+ throw new RuntimeException("Heap was not expanded.");
+ }
+
+ // Estimate how much memory we have to free to force shrinking
+ long memoryToFree = getUsed()
+ - (long) (getCommitted() * (1 - maxRatio - OVERLOAD));
+
+ previouslyCommitted = getCommitted();
+
+ while (memoryToFree > 0 && garbage.size() > 0) {
+ garbage.remove(garbage.size() - 1);
+ memoryToFree -= CHUNK_SIZE;
+ }
+
+ forceGC();
+ // Verify that heap free ratio is still conforming specified limits
+ verifyRatio(minRatio, maxRatio);
+ // Verify that heap was actually shrinked
+ if (previouslyCommitted <= getCommitted()) {
+ throw new RuntimeException("Heap was not shrinked.");
+ }
+
+ }
+
+ public static void forceGC() {
+ for (int i = 0; i < GC_TRIES; i++) {
+ System.gc();
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException ie) {
+ }
+ }
+ }
+
+ /**
+ * Verify that heap free ratio is conforming specified limits.
+ * Actual heap free ratio may be very close to one of specified limits,
+ * but exceed for more then VARIANCE.
+ * Verification will also pass if actual ratio is not conforming limits,
+ * but it is not possible to shrink/expand heap.
+ */
+ public static void verifyRatio(double minRatio, double maxRatio) {
+ double ratio = getHeapFreeRatio();
+ System.out.println(minRatio + " " + ratio + " " + maxRatio);
+ if (minRatio - ratio > VARIANCE
+ && getCommitted() < getMax()) {
+ throw new RuntimeException("Current heap free ratio is lower than "
+ + "MinHeapFreeRatio (" + ratio + " vs " + minRatio + ").");
+ }
+ if (ratio - maxRatio > VARIANCE
+ && getUsed() > getInit()) {
+ throw new RuntimeException("Current heap free ratio is higher than "
+ + "MaxHeapFreeRatio (" + ratio + " vs " + maxRatio + ").");
+ }
+ }
+
+ /*
+ * Obtain information about heap size.
+ *
+ * For G1 information summed up for all type of regions,
+ * because tested options affect overall heap sizing.
+ *
+ * For all other GCs return information only for old gen.
+ */
+ public static long getMax() {
+ return HeapRegionUsageTool.getOldUsage().getMax();
+ }
+
+ public static long getInit() {
+ if (GCTypes.OldGCType.getOldGCType() == GCTypes.OldGCType.G1) {
+ return HeapRegionUsageTool.getEdenUsage().getInit()
+ + HeapRegionUsageTool.getSurvivorUsage().getInit()
+ + HeapRegionUsageTool.getOldUsage().getInit();
+ } else {
+ return HeapRegionUsageTool.getOldUsage().getInit();
+ }
+ }
+
+ public static long getUsed() {
+ if (GCTypes.OldGCType.getOldGCType() == GCTypes.OldGCType.G1) {
+ return HeapRegionUsageTool.getEdenUsage().getUsed()
+ + HeapRegionUsageTool.getSurvivorUsage().getUsed()
+ + HeapRegionUsageTool.getOldUsage().getUsed();
+ } else {
+ return HeapRegionUsageTool.getOldUsage().getUsed();
+ }
+ }
+
+ public static long getCommitted() {
+ if (GCTypes.OldGCType.getOldGCType() == GCTypes.OldGCType.G1) {
+ return HeapRegionUsageTool.getEdenUsage().getCommitted()
+ + HeapRegionUsageTool.getSurvivorUsage().getCommitted()
+ + HeapRegionUsageTool.getOldUsage().getCommitted();
+ } else {
+ return HeapRegionUsageTool.getOldUsage().getCommitted();
+ }
+ }
+
+ public static long getFree() {
+ return getCommitted() - getUsed();
+ }
+
+ public static double getHeapFreeRatio() {
+ return getFree() / (double) getCommitted();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2015, 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 TestMinAndInitialSurvivorRatioFlags
+ * @key gc
+ * @summary Verify that MinSurvivorRatio and InitialSurvivorRatio flags work
+ * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ * java.management
+ * @build TestMinAndInitialSurvivorRatioFlags
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver TestMinAndInitialSurvivorRatioFlags
+ */
+
+import jdk.test.lib.AllocationHelper;
+import java.lang.management.MemoryUsage;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import jdk.test.lib.HeapRegionUsageTool;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.Utils;
+import sun.hotspot.WhiteBox;
+
+/* Test verifies that VM can start with any GC when MinSurvivorRatio and
+ * InitialSurvivorRatio flags passed and for Parallel GC it verifies that
+ * after start up survivor ratio equal to InitialSurvivorRatio value and
+ * that actual survivor ratio will never be less than MinSurvivorRatio.
+ */
+public class TestMinAndInitialSurvivorRatioFlags {
+
+ public static final long M = 1024 * 1024;
+ public static final long HEAP_SIZE = 200 * M;
+ public static final long NEW_SIZE = 100 * M;
+
+ public static void main(String args[]) throws Exception {
+ LinkedList<String> options = new LinkedList<>(
+ Arrays.asList(Utils.getFilteredTestJavaOpts("-XX:[^ ]*SurvivorRatio=[^ ]+"))
+ );
+
+ testSurvivorRatio(5, -1, -1, options, true);
+ testSurvivorRatio(10, -1, -1, options, true);
+ testSurvivorRatio(-1, 5, 3, options, true);
+ testSurvivorRatio(-1, 15, 3, options, true);
+ testSurvivorRatio(-1, 15, 3, options, false);
+ testSurvivorRatio(-1, 10, 10, options, true);
+ testSurvivorRatio(-1, 3, 15, options, true);
+ testSurvivorRatio(-1, 3, 15, options, false);
+ }
+
+ /**
+ * Test that MinSurvivorRatio and InitialSurvivorRatio flags work.
+ *
+ * @param survivorRatio value for -XX:SurvivorRatio option, omitted if negative
+ * @param initRatio value for -XX:InitialSurvivorRatio option, omitted if negative
+ * @param minRatio value for -XX:MinSurvivorRatio option, omitted if negative
+ * @param options additional options for VM
+ * @param useAdaptiveSizePolicy turn on or off UseAdaptiveSizePolicy option
+ */
+ public static void testSurvivorRatio(int survivorRatio,
+ int initRatio,
+ int minRatio,
+ LinkedList<String> options,
+ boolean useAdaptiveSizePolicy) throws Exception {
+
+ LinkedList<String> vmOptions = new LinkedList<>(options);
+ Collections.addAll(vmOptions,
+ "-Xbootclasspath/a:.",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+WhiteBoxAPI",
+ "-XX:MaxNewSize=" + NEW_SIZE, "-XX:NewSize=" + NEW_SIZE,
+ "-Xmx" + HEAP_SIZE, "-Xms" + HEAP_SIZE,
+ (survivorRatio >= 0 ? "-XX:SurvivorRatio=" + survivorRatio : ""),
+ (initRatio >= 0 ? "-XX:InitialSurvivorRatio=" + initRatio : ""),
+ (minRatio >= 0 ? "-XX:MinSurvivorRatio=" + minRatio : ""),
+ (useAdaptiveSizePolicy ? "-XX:+UseAdaptiveSizePolicy" : "-XX:-UseAdaptiveSizePolicy"),
+ SurvivorRatioVerifier.class.getName(),
+ Integer.toString(survivorRatio),
+ Integer.toString(initRatio),
+ Integer.toString(minRatio),
+ Boolean.toString(useAdaptiveSizePolicy)
+ );
+ vmOptions.removeIf((String p) -> p.isEmpty());
+ ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
+ OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
+ analyzer.shouldHaveExitValue(0);
+ }
+
+ /**
+ * Class that verifies survivor ratio.
+ * Will be executed in tested VM. Checks initial size of eden and survivor paces with alignment.
+ */
+ public static class SurvivorRatioVerifier {
+
+ public static WhiteBox wb = WhiteBox.getWhiteBox();
+
+ public static final int MAX_ITERATIONS = 10;
+ public static final int ARRAY_LENGTH = 10000;
+ public static final int CHUNK_SIZE = 10000;
+
+ public static byte garbage[][] = new byte[ARRAY_LENGTH][];
+
+ public static void main(String args[]) throws Exception {
+ if (args.length != 4) {
+ throw new IllegalArgumentException("Expected 4 args: <survivorRatio> <initRatio> <minRatio> <useAdaptiveSizePolicy>");
+ }
+ final int survivorRatio = Integer.valueOf(args[0]);
+ final int initRatio = Integer.valueOf(args[1]);
+ final int minRatio = Integer.valueOf(args[2]);
+ final boolean useAdaptiveSizePolicy = Boolean.valueOf(args[3]);
+
+ // we stop testing only here to ensure that JVM will accept
+ // both MinSurvivorRatio and InitialSurvivorRatio regardles to GC
+ if (GCTypes.YoungGCType.getYoungGCType() != GCTypes.YoungGCType.PSNew) {
+ System.out.println("Test is only applicable to Parallel GC");
+ return;
+ }
+
+ // verify initial survivor ratio
+ verifySurvivorRatio(survivorRatio, initRatio, minRatio, useAdaptiveSizePolicy, true);
+
+ // force GC
+ AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE,
+ () -> (verifySurvivorRatio(survivorRatio, initRatio, minRatio, useAdaptiveSizePolicy, false)));
+ allocator.allocateMemoryAndVerify();
+ }
+
+ /**
+ * Verify actual survivor ratio.
+ *
+ * @param survivorRatio value of SurvivorRatio option, omitted if negative
+ * @param initRatio value of InitialSurvivorRatio option, omitted if negative
+ * @param minRatio value of MinSurvivorRatio option, omitted if negative
+ * @param useAdaptiveSizePolicy value of UseAdaptiveSizePolicy option
+ * @param verifyInitialRatio true if we are going to verify initial ratio
+ */
+ public static Void verifySurvivorRatio(int survivorRatio,
+ int initRatio,
+ int minRatio,
+ boolean useAdaptiveSizePolicy,
+ boolean verifyInitialRatio) {
+
+ MemoryUsage edenUsage = HeapRegionUsageTool.getEdenUsage();
+ MemoryUsage survivorUsage = HeapRegionUsageTool.getSurvivorUsage();
+
+ long alignedNewSize = edenUsage.getMax() + 2 * survivorUsage.getMax();
+ long generationAlignment = wb.psHeapGenerationAlignment();
+
+ if (survivorRatio >= 0) {
+ // -XX:SurvivorRatio was passed to JVM, actual ratio should be SurvivorRatio + 2
+ long expectedSize = HeapRegionUsageTool.alignDown(alignedNewSize / (survivorRatio + 2),
+ generationAlignment);
+
+ if (survivorUsage.getCommitted() != expectedSize) {
+ throw new RuntimeException("Expected survivor size is: " + expectedSize
+ + ", but observed size is: " + survivorUsage.getCommitted());
+ }
+ } else if (verifyInitialRatio || !useAdaptiveSizePolicy) {
+ // In case of initial ratio verification or disabled adaptive size policy
+ // ratio should be equal to InitialSurvivorRatio value
+ long expectedSize = HeapRegionUsageTool.alignDown(alignedNewSize / initRatio,
+ generationAlignment);
+ if (survivorUsage.getCommitted() != expectedSize) {
+ throw new RuntimeException("Expected survivor size is: " + expectedSize
+ + ", but observed size is: " + survivorUsage.getCommitted());
+ }
+ } else {
+ // In any other case actual survivor ratio should not be lower than MinSurvivorRatio
+ // or is should be equal to InitialSurvivorRatio
+ long expectedMinSize = HeapRegionUsageTool.alignDown(alignedNewSize / minRatio,
+ generationAlignment);
+ long expectedInitSize = HeapRegionUsageTool.alignDown(alignedNewSize / initRatio,
+ generationAlignment);
+ if (survivorUsage.getCommitted() != expectedInitSize
+ && survivorUsage.getCommitted() < expectedMinSize) {
+ throw new RuntimeException("Expected survivor size should be " + expectedMinSize
+ + " or should be greater then " + expectedMinSize
+ + ", but observer survivor size is " + survivorUsage.getCommitted());
+ }
+ }
+ return null;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestNewRatioFlag.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2015, 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 TestNewRatioFlag
+ * @key gc
+ * @bug 8025166
+ * @summary Verify that heap devided among generations according to NewRatio
+ * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ * java.management
+ * @build TestNewRatioFlag
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver TestNewRatioFlag
+ */
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import jdk.test.lib.HeapRegionUsageTool;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.Utils;
+import sun.hotspot.WhiteBox;
+
+public class TestNewRatioFlag {
+
+ public static final long M = 1024 * 1024;
+ public static final long HEAP_SIZE = 100 * M;
+
+ public static void main(String args[]) throws Exception {
+ LinkedList<String> options = new LinkedList<>(
+ Arrays.asList(Utils.getFilteredTestJavaOpts("(-XX:[^ ]*NewSize=[^ ]+)|(-Xm[ns][^ ]+)"))
+ );
+
+ testNewRatio(4, options);
+ testNewRatio(6, options);
+ testNewRatio(10, options);
+ testNewRatio(15, options);
+ testNewRatio(20, options);
+ }
+
+ /**
+ * Verify that actual size of young gen conforms specified NewRatio
+ *
+ * @param ratio value of NewRatio option
+ * @param options additional options for VM
+ */
+ public static void testNewRatio(int ratio, LinkedList<String> options) throws Exception {
+ LinkedList<String> vmOptions = new LinkedList<>(options);
+ Collections.addAll(vmOptions,
+ "-Xbootclasspath/a:.",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+WhiteBoxAPI",
+ "-XX:GCLockerEdenExpansionPercent=0",
+ "-Xmx" + HEAP_SIZE,
+ "-Xms" + HEAP_SIZE,
+ "-XX:NewRatio=" + ratio,
+ "-XX:-UseLargePages",
+ NewRatioVerifier.class.getName(),
+ Integer.toString(ratio)
+ );
+
+ ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
+ OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
+ analyzer.shouldHaveExitValue(0);
+ System.out.println(analyzer.getOutput());
+ }
+
+ public static class NewRatioVerifier {
+
+ static WhiteBox wb = WhiteBox.getWhiteBox();
+
+ public static void main(String args[]) {
+ if (args.length != 1) {
+ throw new IllegalArgumentException("Expected 1 arg: <expectedRatio>");
+ }
+ int expectedRatio = Integer.valueOf(args[0]);
+ switch (GCTypes.YoungGCType.getYoungGCType()) {
+ case DefNew:
+ case ParNew:
+ verifyDefNewNewRatio(expectedRatio);
+ break;
+ case PSNew:
+ verifyPSNewRatio(expectedRatio);
+ break;
+ case G1:
+ verifyG1NewRatio(expectedRatio);
+ break;
+ default:
+ throw new RuntimeException("Unexpected young GC type");
+ }
+ }
+
+ /**
+ * Verify NewSize for DefNew and ParNew collectors.
+ *
+ * Compare expected NewSize calculated according to sizing policies used by DefNew
+ * with NewSize value reported by MemoryPoolMXBeans.
+ */
+ public static void verifyDefNewNewRatio(int expectedRatio) {
+ long initEden = HeapRegionUsageTool.getEdenUsage().getInit();
+ long initSurv = HeapRegionUsageTool.getSurvivorUsage().getInit();
+ long initOld = HeapRegionUsageTool.getOldUsage().getInit();
+
+ long newSize = initEden + 2 * initSurv;
+
+ long expectedNewSize = HeapRegionUsageTool.alignDown(initOld / expectedRatio,
+ wb.getHeapSpaceAlignment());
+
+ if (expectedNewSize != newSize) {
+ throw new RuntimeException("Expected young gen size is: " + expectedNewSize
+ + ", but observed new size is: " + newSize);
+ }
+ }
+
+ /**
+ * Verify NewSize for PS collector.
+ * Expected NewSize calculated according to alignment policies used by PS
+ * and then compared with actual NewSize obtained from MemoryPoolMXBeans.
+ */
+ public static void verifyPSNewRatio(int expectedRatio) {
+ long initEden = HeapRegionUsageTool.getEdenUsage().getInit();
+ long initSurv = HeapRegionUsageTool.getSurvivorUsage().getInit();
+ long initOld = HeapRegionUsageTool.getOldUsage().getInit();
+
+ long newSize = initEden + 2 * initSurv;
+
+ long alignedDownNewSize = HeapRegionUsageTool.alignDown(initOld / expectedRatio,
+ wb.getHeapSpaceAlignment());
+ long expectedNewSize = HeapRegionUsageTool.alignUp(alignedDownNewSize,
+ wb.psVirtualSpaceAlignment());
+
+ if (expectedNewSize != newSize) {
+ throw new RuntimeException("Expected young gen size is: " + expectedNewSize
+ + ", but observed new size is: " + newSize);
+ }
+ }
+
+ /**
+ * Verify NewSize for G1 GC.
+ * Amount of young regions calculated according to sizing policies used by G1
+ * and then compared with actual number of young regions derived from
+ * values reported by MemoryPoolMXBeans and region size.
+ */
+ public static void verifyG1NewRatio(int expectedRatio) {
+ long initEden = HeapRegionUsageTool.getEdenUsage().getInit();
+ long initSurv = HeapRegionUsageTool.getSurvivorUsage().getInit();
+ long maxOld = HeapRegionUsageTool.getOldUsage().getMax();
+
+ int regionSize = wb.g1RegionSize();
+ int youngListLength = (int) ((initEden + initSurv) / regionSize);
+ int maxRegions = (int) (maxOld / regionSize);
+ int expectedYoungListLength = (int) (maxRegions / (double) (expectedRatio + 1));
+
+ if (youngListLength != expectedYoungListLength) {
+ throw new RuntimeException("Expected G1 young list length is: " + expectedYoungListLength
+ + ", but observed young list length is: " + youngListLength);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestNewSizeFlags.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2015, 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 TestNewSizeFlags
+ * @key gc
+ * @bug 8025166
+ * @summary Verify that young gen size conforms values specified by NewSize, MaxNewSize and Xmn options
+ * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ * java.management
+ * @build TestNewSizeFlags
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver/timeout=240 TestNewSizeFlags
+ */
+
+import jdk.test.lib.AllocationHelper;
+import java.io.IOException;
+import java.lang.management.MemoryUsage;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import jdk.test.lib.HeapRegionUsageTool;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.Utils;
+import sun.hotspot.WhiteBox;
+
+public class TestNewSizeFlags {
+
+ public static final long M = 1024 * 1024;
+
+ public static void main(String args[]) throws Exception {
+ LinkedList<String> options = new LinkedList<>(
+ Arrays.asList(Utils.getFilteredTestJavaOpts("(-Xm[nsx][^ ]+)|"
+ + "(-XX:(Max)?((New)|"
+ + "(Heap))((Size)|"
+ + "(Ratio))=[^ ]+)"))
+ );
+
+ // Test NewSize and MaxNewSize
+ testNewSizeFlags(20 * M, 10 * M, 30 * M, 40 * M, options, false);
+ testNewSizeFlags(10 * M, 20 * M, 30 * M, 40 * M, options, false);
+ testNewSizeFlags(-1, 20 * M, 30 * M, 40 * M, options, false);
+ testNewSizeFlags(10 * M, -1, 30 * M, 40 * M, options, false);
+ testNewSizeFlags(20 * M, 20 * M, 30 * M, 40 * M, options, false);
+ testNewSizeFlags(20 * M, 30 * M, 40 * M, 50 * M, options, false);
+ testNewSizeFlags(30 * M, 100 * M, 150 * M, 200 * M, options, false);
+ testNewSizeFlags(0, -1, 30 * M, 40 * M, options, false);
+
+ // Test -Xmn
+ testXmnFlags(0, 30 * M, 40 * M, options, true);
+ testXmnFlags(20 * M, 30 * M, 40 * M, options, false);
+ testXmnFlags(50 * M, 70 * M, 100 * M, options, false);
+ }
+
+ /**
+ * Verify that NewSize and MaxNewSize flags affect young gen size.
+ *
+ * @param newSize value of NewSize option, omitted if negative
+ * @param maxNewSize value of MaxNewSize option, omitted if negative
+ * @param heapSize value of HeapSize option
+ * @param maxHeapSize value of MaxHeapSize option
+ * @param options additional options for JVM
+ * @param failureExpected true if JVM should fail with passed heap size options
+ */
+ public static void testNewSizeFlags(long newSize, long maxNewSize,
+ long heapSize, long maxHeapSize,
+ LinkedList<String> options,
+ boolean failureExpected) throws Exception {
+ testVMOptions(newSize, maxNewSize,
+ heapSize, maxHeapSize,
+ newSize, (maxNewSize >= 0 ? Math.max(maxNewSize, newSize) : maxNewSize),
+ options, failureExpected);
+ }
+
+ /**
+ * Verify that -Xmn flag affect young gen size.
+ *
+ * @param mnValue value of -Xmn option
+ * @param heapSize value of HeapSize option
+ * @param maxHeapSize value of MaxHeapSize option
+ * @param options additional options for JVM
+ * @param failureExpected true if JVM should fail with passed heap size options
+ */
+ public static void testXmnFlags(long mnValue,
+ long heapSize, long maxHeapSize,
+ LinkedList<String> options,
+ boolean failureExpected) throws Exception {
+ LinkedList<String> newOptions = new LinkedList<>(options);
+ newOptions.add("-Xmn" + mnValue);
+ testVMOptions(-1, -1,
+ heapSize, maxHeapSize,
+ mnValue, mnValue,
+ newOptions, failureExpected);
+ }
+
+ /**
+ * Verify that NewSize and MaxNewSize flags affect young gen size.
+ *
+ * @param newSize value of NewSize option, omitted if negative
+ * @param maxNewSize value of MaxNewSize option, omitted if negative
+ * @param heapSize value of HeapSize option
+ * @param maxHeapSize value of MaxHeapSize option
+ * @param expectedNewSize expected initial young gen size
+ * @param expectedMaxNewSize expected max young gen size
+ * @param options additional options for JVM
+ * @param failureExpected true if JVM should fail with passed heap size options
+ */
+ public static void testVMOptions(long newSize, long maxNewSize,
+ long heapSize, long maxHeapSize,
+ long expectedNewSize, long expectedMaxNewSize,
+ LinkedList<String> options, boolean failureExpected) throws Exception {
+ OutputAnalyzer analyzer = startVM(options, newSize, maxNewSize, heapSize, maxHeapSize, expectedNewSize, expectedMaxNewSize);
+
+ if (failureExpected) {
+ analyzer.shouldHaveExitValue(1);
+ analyzer.shouldMatch("(Error occurred during initialization of VM)|"
+ + "(Error: Could not create the Java Virtual Machine.)");
+ } else {
+ analyzer.shouldHaveExitValue(0);
+ }
+ }
+
+ private static OutputAnalyzer startVM(LinkedList<String> options,
+ long newSize, long maxNewSize,
+ long heapSize, long maxHeapSize,
+ long expectedNewSize, long expectedMaxNewSize) throws Exception, IOException {
+ LinkedList<String> vmOptions = new LinkedList<>(options);
+ Collections.addAll(vmOptions,
+ "-Xbootclasspath/a:.",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+WhiteBoxAPI",
+ (newSize >= 0 ? "-XX:NewSize=" + newSize : ""),
+ (maxNewSize >= 0 ? "-XX:MaxNewSize=" + maxNewSize : ""),
+ "-Xmx" + maxHeapSize,
+ "-Xms" + heapSize,
+ "-XX:GCLockerEdenExpansionPercent=0",
+ "-XX:-UseLargePages",
+ NewSizeVerifier.class.getName(),
+ Long.toString(expectedNewSize),
+ Long.toString(expectedMaxNewSize)
+ );
+ vmOptions.removeIf(String::isEmpty);
+ ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
+ OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
+ return analyzer;
+ }
+
+ /**
+ * NewSizeVerifier checks that initial young gen size is equal to expected
+ * regardful to alignment and that young gen size will not be greater than
+ * expected max size.
+ * In order to verify that young gen size will not be greater then expected
+ * max size, NewSizeVerifier do some object allocation to force garbage
+ * collection and heap expansion.
+ */
+ public static class NewSizeVerifier {
+
+ static WhiteBox wb = WhiteBox.getWhiteBox();
+
+ public static final int ARRAY_LENGTH = 100;
+ public static final int CHUNK_SIZE = 1024;
+ public static final int MAX_ITERATIONS = 10;
+ public static byte garbage[][] = new byte[ARRAY_LENGTH][];
+
+ public static void main(String args[]) throws Exception {
+ if (args.length != 2) {
+ throw new IllegalArgumentException("Expected 2 args: <expectedNewSize> <expectedMaxNewSize>");
+ }
+ final long newSize = Long.valueOf(args[0]);
+ final long maxNewSize = Long.valueOf(args[1]);
+
+ // verify initial size
+ verifyNewSize(newSize, maxNewSize);
+
+ // force GC and verify that size is still correct
+ AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE, () -> (verifyNewSize(newSize, maxNewSize)));
+ allocator.allocateMemoryAndVerifyNoOOME();
+ }
+
+ /**
+ * Verify that actual young gen size conforms NewSize and MaxNewSize values.
+ */
+ public static Void verifyNewSize(long newSize, long maxNewSize) {
+ long alignedNewSize = alignNewSize(newSize);
+ long alignedMaxNewSize = alignNewSize(maxNewSize);
+
+ MemoryUsage youngGenUsage = getYoungGenUsage();
+
+ if (newSize != -1) {
+ if (youngGenUsage.getInit() < alignedNewSize) {
+ throw new RuntimeException("initial new size < NewSize value: "
+ + youngGenUsage.getInit() + " < " + alignedNewSize);
+ }
+
+ if (youngGenUsage.getCommitted() < alignedNewSize) {
+ throw new RuntimeException("actual new size < NewSize value: "
+ + youngGenUsage.getCommitted() + " < " + alignedNewSize);
+ }
+
+ // for G1 max new size == committed new size
+ if (GCTypes.YoungGCType.getYoungGCType() != GCTypes.YoungGCType.G1
+ && youngGenUsage.getMax() < alignedNewSize) {
+ throw new RuntimeException("max new size < NewSize value: "
+ + youngGenUsage.getMax() + " < " + alignedNewSize);
+ }
+ }
+
+ if (maxNewSize != -1) {
+ if (youngGenUsage.getInit() > alignedMaxNewSize) {
+ throw new RuntimeException("initial new size > MaxNewSize value: "
+ + youngGenUsage.getInit() + " > " + alignedMaxNewSize);
+ }
+
+ if (youngGenUsage.getCommitted() > alignedMaxNewSize) {
+ throw new RuntimeException("actual new size > MaxNewSize value: "
+ + youngGenUsage.getCommitted() + " > " + alignedMaxNewSize);
+ }
+
+ if (GCTypes.YoungGCType.getYoungGCType() != GCTypes.YoungGCType.G1
+ && youngGenUsage.getMax() != alignedMaxNewSize) {
+ throw new RuntimeException("max new size != MaxNewSize value: "
+ + youngGenUsage.getMax() + " != " + alignedMaxNewSize);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get young gen memory usage.
+ *
+ * For G1 it is EdenUsage + SurvivorUsage,
+ * for other GCs it is EdenUsage + 2 * SurvivorUsage.
+ * For G1 max value is just LONG_MAX.
+ * For all GCs used value is 0.
+ */
+ private static MemoryUsage getYoungGenUsage() {
+ if (GCTypes.YoungGCType.getYoungGCType() == GCTypes.YoungGCType.G1) {
+ return new MemoryUsage(HeapRegionUsageTool.getEdenUsage().getInit()
+ + HeapRegionUsageTool.getSurvivorUsage().getInit(),
+ 0,
+ HeapRegionUsageTool.getEdenUsage().getCommitted()
+ + HeapRegionUsageTool.getSurvivorUsage().getCommitted(),
+ Long.MAX_VALUE);
+ } else {
+ return new MemoryUsage(HeapRegionUsageTool.getEdenUsage().getInit()
+ + HeapRegionUsageTool.getSurvivorUsage().getInit() * 2,
+ 0,
+ HeapRegionUsageTool.getEdenUsage().getCommitted()
+ + HeapRegionUsageTool.getSurvivorUsage().getCommitted() * 2,
+ HeapRegionUsageTool.getEdenUsage().getMax()
+ + HeapRegionUsageTool.getSurvivorUsage().getMax() * 2);
+ }
+ }
+
+ /**
+ * Align value regardful to used young GC.
+ */
+ public static long alignNewSize(long value) {
+ switch (GCTypes.YoungGCType.getYoungGCType()) {
+ case DefNew:
+ case ParNew:
+ return HeapRegionUsageTool.alignDown(value, wb.getHeapSpaceAlignment());
+ case PSNew:
+ return HeapRegionUsageTool.alignUp(HeapRegionUsageTool.alignDown(value,
+ wb.getHeapSpaceAlignment()),
+ wb.psVirtualSpaceAlignment());
+ case G1:
+ return HeapRegionUsageTool.alignUp(value, wb.g1RegionSize());
+ default:
+ throw new RuntimeException("Unexpected young GC type");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2015, 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 TestSurvivorRatioFlag
+ * @key gc
+ * @summary Verify that actual survivor ratio is equal to specified SurvivorRatio value
+ * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ * java.management
+ * @build TestSurvivorRatioFlag
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver TestSurvivorRatioFlag
+ */
+
+import jdk.test.lib.AllocationHelper;
+import java.lang.management.MemoryUsage;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import jdk.test.lib.HeapRegionUsageTool;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.Utils;
+import sun.hotspot.WhiteBox;
+
+public class TestSurvivorRatioFlag {
+
+ public static final long M = 1024 * 1024;
+ public static final long HEAP_SIZE = 200 * M;
+ public static final long NEW_SIZE = 100 * M;
+
+ public static void main(String args[]) throws Exception {
+ LinkedList<String> options = new LinkedList<>(
+ Arrays.asList(Utils.getFilteredTestJavaOpts("-XX:[^ ]*SurvivorRatio=[^ ]+"))
+ );
+
+ testSurvivorRatio(3, options);
+ testSurvivorRatio(6, options);
+ testSurvivorRatio(10, options);
+ testSurvivorRatio(15, options);
+ testSurvivorRatio(20, options);
+ }
+
+ /**
+ * Verify that actual survivor ratio equal to specified.
+ *
+ * @param ratio survivor ratio that be verified
+ * @param options additional options to JVM
+ */
+ public static void testSurvivorRatio(int ratio, LinkedList<String> options) throws Exception {
+
+ LinkedList<String> vmOptions = new LinkedList<>(options);
+
+ Collections.addAll(vmOptions,
+ "-Xbootclasspath/a:.",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+WhiteBoxAPI",
+ "-XX:GCLockerEdenExpansionPercent=0",
+ "-XX:MaxNewSize=" + NEW_SIZE,
+ "-XX:NewSize=" + NEW_SIZE,
+ "-Xmx" + HEAP_SIZE,
+ "-Xms" + HEAP_SIZE,
+ "-XX:SurvivorRatio=" + ratio,
+ SurvivorRatioVerifier.class.getName(),
+ Integer.toString(ratio)
+ );
+
+ ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
+ OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
+ analyzer.shouldHaveExitValue(0);
+ }
+
+ /**
+ * Class that verifies survivor ratio.
+ */
+ public static class SurvivorRatioVerifier {
+
+ static WhiteBox wb = WhiteBox.getWhiteBox();
+
+ public static final int MAX_ITERATIONS = 10;
+ public static final int ARRAY_LENGTH = 10000;
+ public static final int CHUNK_SIZE = 10000;
+
+ public static void main(String args[]) throws Exception {
+ if (args.length != 1) {
+ throw new IllegalArgumentException("Expected 1 arg: <ratio>");
+ }
+ final int ratio = Integer.valueOf(args[0]);
+
+ AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE, () -> (verifySurvivorRatio(ratio)));
+ allocator.allocateMemoryAndVerify();
+ }
+
+ /**
+ * Verify that actual survivor ratio is equal to expected.
+ * Depending on selected young GC we verify that:
+ * - for DefNew and ParNew: eden_size / survivor_size is close to expectedRatio;
+ * - for PSNew: survivor_size equal to young_gen_size / expectedRatio;
+ * - for G1: survivor_regions <= young_list_length / expectedRatio.
+ */
+ public static Void verifySurvivorRatio(int expectedRatio) {
+ GCTypes.YoungGCType type = GCTypes.YoungGCType.getYoungGCType();
+ switch (type) {
+ case DefNew:
+ case ParNew:
+ verifyDefNewSurvivorRatio(expectedRatio);
+ break;
+ case PSNew:
+ verifyPSSurvivorRatio(expectedRatio);
+ break;
+ case G1:
+ verifyG1SurvivorRatio(expectedRatio);
+ break;
+ default:
+ throw new RuntimeException("Unexpected young GC type");
+ }
+ return null;
+ }
+
+ private static void verifyDefNewSurvivorRatio(int expectedRatio) {
+ MemoryUsage edenUsage = HeapRegionUsageTool.getEdenUsage();
+ MemoryUsage survivorUsage = HeapRegionUsageTool.getSurvivorUsage();
+
+ int actualRatio = (int) (edenUsage.getCommitted() / survivorUsage.getCommitted());
+ if (Math.abs(actualRatio - expectedRatio) > 1) {
+ throw new RuntimeException("Expected survivor ratio is: " + expectedRatio
+ + ", but observed ratio is: " + actualRatio);
+ }
+ }
+
+ private static void verifyPSSurvivorRatio(int expectedRatio) {
+ MemoryUsage edenUsage = HeapRegionUsageTool.getEdenUsage();
+ MemoryUsage survivorUsage = HeapRegionUsageTool.getSurvivorUsage();
+
+ long youngGenSize = edenUsage.getMax() + 2 * survivorUsage.getMax();
+ // for Paralle GC Min/InitialSurvivorRatio = SurvivorRatio + 2
+ long expectedSize = HeapRegionUsageTool.alignDown(youngGenSize / (expectedRatio + 2),
+ wb.psHeapGenerationAlignment());
+
+ if (expectedSize != survivorUsage.getCommitted()) {
+ throw new RuntimeException("Expected survivor size is: " + expectedSize
+ + ", but observed size is: " + survivorUsage.getCommitted());
+ }
+ }
+
+ private static void verifyG1SurvivorRatio(int expectedRatio) {
+ MemoryUsage survivorUsage = HeapRegionUsageTool.getSurvivorUsage();
+
+ int regionSize = wb.g1RegionSize();
+ int youngListLength = (int) Math.max(NEW_SIZE / regionSize, 1);
+ int expectedSurvivorRegions = (int) Math.ceil(youngListLength / (double) expectedRatio);
+ int observedSurvivorRegions = (int) (survivorUsage.getCommitted() / regionSize);
+
+ if (expectedSurvivorRegions < observedSurvivorRegions) {
+ throw new RuntimeException("Expected amount of G1 survivor regions is "
+ + expectedSurvivorRegions + ", but observed "
+ + observedSurvivorRegions);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,319 @@
+/*
+* Copyright (c) 2015, 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 TestTargetSurvivorRatioFlag
+ * @key gc
+ * @summary Verify that option TargetSurvivorRatio affects survivor space occupancy after minor GC.
+ * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ * java.management
+ * @build TestTargetSurvivorRatioFlag
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver TestTargetSurvivorRatioFlag
+ */
+
+import jdk.test.lib.AllocationHelper;
+import java.lang.management.GarbageCollectorMXBean;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import jdk.test.lib.HeapRegionUsageTool;
+import sun.misc.Unsafe;
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.Utils;
+import sun.hotspot.WhiteBox;
+
+/* In order to test that TargetSurvivorRatio affects survivor space occupancy
+ * we setup fixed MaxTenuringThreshold and then verifying that if size of allocated
+ * objects is lower than (survivor_size * TargetSurvivorRatio / 100) then objects
+ * will stay in survivor space until MaxTenuringThreshold minor GC cycles.
+ * If more than (survivor_size * TargetSurvivorRatio / 100) objects were allocated,
+ * then we verify that after MaxTenuringThreshold minor GC cycles survivor space
+ * is almost empty.
+ */
+public class TestTargetSurvivorRatioFlag {
+
+ public static final long M = 1024 * 1024;
+
+ // VM option values
+ public static final long MAX_NEW_SIZE = 40 * M;
+ public static final int SURVIVOR_RATIO = 8;
+ public static final int MAX_TENURING_THRESHOLD = 15;
+
+ // Value used to estimate amount of memory that should be allocated
+ // and placed in survivor space.
+ public static final double DELTA = 0.25;
+
+ // Max variance of observed ratio
+ public static double VARIANCE = 1;
+
+ // Messages used by debuggee
+ public static final String UNSUPPORTED_GC = "Unsupported GC";
+ public static final String START_TEST = "Start test";
+ public static final String END_TEST = "End test";
+
+ // Patterns used during log parsing
+ public static final String TENURING_DISTRIBUTION = "Desired survivor size";
+ public static final String AGE_TABLE_ENTRY = "-[\\s]+age[\\s]+([0-9]+):[\\s]+([0-9]+)[\\s]+bytes,[\\s]+([0-9]+)[\\s]+total";
+ public static final String MAX_SURVIVOR_SIZE = "Max survivor size: ([0-9]+)";
+
+ public static void main(String args[]) throws Exception {
+
+ LinkedList<String> options = new LinkedList<>(Arrays.asList(Utils.getTestJavaOpts()));
+
+ // Need to consider the effect of TargetPLABWastePct=1 for G1 GC
+ if (options.contains("-XX:+UseG1GC")) {
+ VARIANCE = 2;
+ } else {
+ VARIANCE = 1;
+ }
+
+ negativeTest(-1, options);
+ negativeTest(101, options);
+
+ positiveTest(20, options);
+ positiveTest(30, options);
+ positiveTest(55, options);
+ positiveTest(70, options);
+ }
+
+ /**
+ * Verify that VM will fail to start with specified TargetSurvivorRatio
+ *
+ * @param ratio value of TargetSurvivorRatio
+ * @param options additional VM options
+ */
+ public static void negativeTest(int ratio, LinkedList<String> options) throws Exception {
+ LinkedList<String> vmOptions = new LinkedList<>(options);
+ vmOptions.add("-XX:TargetSurvivorRatio=" + ratio);
+ vmOptions.add("-version");
+
+ ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
+ OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
+
+ analyzer.shouldHaveExitValue(1);
+ analyzer.shouldContain("Error: Could not create the Java Virtual Machine.");
+ }
+
+ /**
+ * Verify that actual survivor space usage ratio conforms specified TargetSurvivorRatio
+ *
+ * @param ratio value of TargetSurvivorRatio
+ * @param options additional VM options
+ */
+ public static void positiveTest(int ratio, LinkedList<String> options) throws Exception {
+ LinkedList<String> vmOptions = new LinkedList<>(options);
+ Collections.addAll(vmOptions,
+ "-Xbootclasspath/a:.",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+WhiteBoxAPI",
+ "-XX:+UseAdaptiveSizePolicy",
+ "-XX:+PrintTenuringDistribution",
+ "-XX:MaxTenuringThreshold=" + MAX_TENURING_THRESHOLD,
+ "-XX:NewSize=" + MAX_NEW_SIZE,
+ "-XX:MaxNewSize=" + MAX_NEW_SIZE,
+ "-XX:InitialHeapSize=" + 2 * MAX_NEW_SIZE,
+ "-XX:MaxHeapSize=" + 2 * MAX_NEW_SIZE,
+ "-XX:SurvivorRatio=" + SURVIVOR_RATIO,
+ "-XX:TargetSurvivorRatio=" + ratio,
+ // For reducing variance of survivor size.
+ "-XX:TargetPLABWastePct=" + 1,
+ TargetSurvivorRatioVerifier.class.getName(),
+ Integer.toString(ratio)
+ );
+
+ ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()]));
+ OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
+
+ analyzer.shouldHaveExitValue(0);
+
+ String output = analyzer.getOutput();
+
+ // Test avoids verification for parallel GC
+ if (!output.contains(UNSUPPORTED_GC)) {
+ // Two tests should be done - when actual ratio is lower than TargetSurvivorRatio
+ // and when it is higher. We chech that output contains results for exactly two tests.
+ List<Double> ratios = parseTestOutput(output);
+
+ if (ratios.size() != 2) {
+ System.out.println(output);
+ throw new RuntimeException("Expected number of ratios extraced for output is 2,"
+ + " but " + ratios.size() + " ratios were extracted");
+ }
+
+ // At the end of the first test survivor space usage ratio should lies between
+ // TargetSurvivorRatio and TargetSurvivorRatio - 2*DELTA
+ if (ratio < ratios.get(0) || ratio - ratios.get(0) > VARIANCE) {
+ System.out.println(output);
+ throw new RuntimeException("Survivor space usage ratio expected to be close to "
+ + ratio + ", but observed ratio is: " + ratios.get(0));
+ }
+
+ // After second test survivor space should be almost empty.
+ if (ratios.get(1) > VARIANCE) {
+ System.out.println(output);
+ throw new RuntimeException("Survivor space expected to be empty due to "
+ + "TargetSurvivorRatio overlimit, however observed "
+ + "survivor space usage ratio is: " + ratios.get(1));
+ }
+ } else {
+ System.out.println("Selected GC does not support TargetSurvivorRatio option.");
+ }
+ }
+
+ /**
+ * Parse output produced by TargetSurvivorRatioVerifier.
+ *
+ * @param output output obtained from TargetSurvivorRatioVerifier
+ * @return list of parsed test results, where each result is an actual
+ * survivor ratio after MaxTenuringThreshold minor GC cycles.
+ */
+ public static List<Double> parseTestOutput(String output) {
+ List<Double> ratios = new LinkedList<Double>();
+ String lines[] = output.split("[\n\r]");
+ boolean testStarted = false;
+ long survivorSize = 0;
+ long survivorOccupancy = 0;
+ int gcCount = 0;
+ Pattern ageTableEntry = Pattern.compile(AGE_TABLE_ENTRY);
+ Pattern maxSurvivorSize = Pattern.compile(MAX_SURVIVOR_SIZE);
+ for (String line : lines) {
+ if (Pattern.matches(MAX_SURVIVOR_SIZE, line)) {
+ // We found estimated survivor space size
+ Matcher m = maxSurvivorSize.matcher(line);
+ m.find();
+ survivorSize = Long.valueOf(m.group(1));
+ } else if (line.contains(START_TEST) && !testStarted) {
+ // Start collecting test results
+ testStarted = true;
+ gcCount = 0;
+ } else if (testStarted) {
+ if (line.contains(TENURING_DISTRIBUTION)) {
+ // We found start of output emitted by -XX:+PrintTenuringDistribution
+ // If it is associated with "MaxTenuringThreshold" GC cycle, then it's
+ // time to report observed survivor usage ratio
+ gcCount++;
+ double survivorRatio = survivorOccupancy / (double) survivorSize;
+ if (gcCount == MAX_TENURING_THRESHOLD || gcCount == MAX_TENURING_THRESHOLD * 2) {
+ ratios.add(survivorRatio * 100.0);
+ testStarted = false;
+ }
+ survivorOccupancy = 0;
+ } else if (Pattern.matches(AGE_TABLE_ENTRY, line)) {
+ // Obtain survivor space usage from "total" age table log entry
+ Matcher m = ageTableEntry.matcher(line);
+ m.find();
+ survivorOccupancy = Long.valueOf(m.group(3));
+ } else if (line.contains(END_TEST)) {
+ // It is expected to find at least MaxTenuringThreshold GC events
+ // until test end
+ if (gcCount < MAX_TENURING_THRESHOLD) {
+ throw new RuntimeException("Observed " + gcCount + " GC events, "
+ + "while it is expected to see at least "
+ + MAX_TENURING_THRESHOLD);
+ }
+ testStarted = false;
+ }
+ }
+ }
+ return ratios;
+ }
+
+ public static class TargetSurvivorRatioVerifier {
+
+ static final WhiteBox wb = WhiteBox.getWhiteBox();
+ static final Unsafe unsafe = Utils.getUnsafe();
+
+ // Desired size of memory allocated at once
+ public static final int CHUNK_SIZE = 1024;
+ // Length of byte[] array that will have occupy CHUNK_SIZE bytes in heap
+ public static final int ARRAY_LENGTH = CHUNK_SIZE - Unsafe.ARRAY_BYTE_BASE_OFFSET;
+
+ public static void main(String args[]) throws Exception {
+ if (args.length != 1) {
+ throw new IllegalArgumentException("Expected 1 arg: <ratio>");
+ }
+ if (GCTypes.YoungGCType.getYoungGCType() == GCTypes.YoungGCType.PSNew) {
+ System.out.println(UNSUPPORTED_GC);
+ return;
+ }
+
+ int ratio = Integer.valueOf(args[0]);
+ long maxSurvivorSize = getMaxSurvivorSize();
+ System.out.println("Max survivor size: " + maxSurvivorSize);
+
+ allocateMemory(ratio - DELTA, maxSurvivorSize);
+ allocateMemory(ratio + DELTA, maxSurvivorSize);
+ }
+
+ /**
+ * Allocate (<b>ratio</b> * <b>maxSize</b> / 100) bytes of objects
+ * and force at least "MaxTenuringThreshold" minor GCs.
+ *
+ * @param ratio ratio used to calculate how many objects should be allocated
+ * @param maxSize estimated max survivor space size
+ */
+ public static void allocateMemory(double ratio, long maxSize) throws Exception {
+ GarbageCollectorMXBean youngGCBean = GCTypes.YoungGCType.getYoungGCBean();
+ long garbageSize = (long) (maxSize * (ratio / 100.0));
+ int arrayLength = (int) (garbageSize / CHUNK_SIZE);
+ AllocationHelper allocator = new AllocationHelper(1, arrayLength, ARRAY_LENGTH, null);
+
+ System.out.println(START_TEST);
+ System.gc();
+ final long initialGcId = youngGCBean.getCollectionCount();
+ // allocate memory
+ allocator.allocateMemoryAndVerify();
+
+ // force minor GC
+ while (youngGCBean.getCollectionCount() <= initialGcId + MAX_TENURING_THRESHOLD * 2) {
+ byte b[] = new byte[ARRAY_LENGTH];
+ }
+
+ allocator.release();
+ System.out.println(END_TEST);
+ }
+
+ /**
+ * Estimate max survivor space size.
+ *
+ * For non-G1 GC returns value reported by MemoryPoolMXBean
+ * associated with survivor space.
+ * For G1 GC return max number of survivor regions * region size.
+ * Number if survivor regions estimated from MaxNewSize and SurvivorRatio.
+ */
+ public static long getMaxSurvivorSize() {
+ if (GCTypes.YoungGCType.getYoungGCType() == GCTypes.YoungGCType.G1) {
+ int youngLength = (int) Math.max(MAX_NEW_SIZE / wb.g1RegionSize(), 1);
+ return (long) Math.ceil(youngLength / (double) SURVIVOR_RATIO) * wb.g1RegionSize();
+ } else {
+ return HeapRegionUsageTool.getSurvivorUsage().getMax();
+ }
+ }
+ }
+}
--- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java Tue Sep 22 11:01:54 2015 -0700
@@ -58,6 +58,10 @@
public static void main(String[] args) {
+ if (HUMON_COUNT == 0) {
+ System.out.println("Skipped. Heap is too small");
+ return;
+ }
System.out.format("Running with %s max heap size. "
+ "Will allocate humongous object of %s size %d times.%n",
MemoryUsagePrinter.humanReadableByteCount(AVAILABLE_MEMORY, false),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestPLABSizeBounds.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2015, 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 TestPLABSizeBounds
+ * @bug 8134857
+ * @summary Regression test to ensure that G1 supports PLAB sizes of half a region size.
+ * @requires vm.gc=="G1" | vm.gc=="null"
+ * @key gc
+ * @library /testlibrary
+ * @modules java.base/sun.misc
+ * java.management
+ */
+
+import java.util.ArrayList;
+
+import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.Platform;
+import jdk.test.lib.ProcessTools;
+
+public class TestPLABSizeBounds {
+
+ public static final int M = 1024 * 1024;
+
+ /**
+ * Starts the VM with the given region size and the given PLAB size arguments. The VM start should
+ * succeed if shouldSucceed is true, otherwise it should fail.
+ *
+ * @param regionSize The region size the VM should be started with in bytes.
+ * @param plabSize The young and old gen PLAB sizes the VM should be started with in machine words.
+ * @param shouldSucceed The expected result of the VM invocation.
+ */
+ public static void runTest(int regionSize, int plabSize, boolean shouldSucceed) throws Exception {
+ ArrayList<String> testArguments = new ArrayList<String>();
+
+ testArguments.add("-XX:+UseG1GC");
+ testArguments.add("-Xmx256M");
+ testArguments.add("-XX:G1HeapRegionSize=" + regionSize);
+ testArguments.add("-XX:YoungPLABSize=" + plabSize);
+ testArguments.add("-XX:OldPLABSize=" + plabSize);
+ testArguments.add(GCTest.class.getName());
+
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testArguments.toArray(new String[0]));
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+ if (shouldSucceed) {
+ output.shouldHaveExitValue(0);
+ } else {
+ output.shouldHaveExitValue(1);
+ }
+ }
+
+ public static void runRegionTest(int regionSize) throws Exception {
+ final int regionSizeInBytes = regionSize * M;
+ final int wordSize = Platform.is32bit() ? 4 : 8;
+
+ runTest(regionSizeInBytes, (regionSizeInBytes / wordSize) / 2 - 1, true);
+ runTest(regionSizeInBytes, (regionSizeInBytes / wordSize) / 2, true);
+ runTest(regionSizeInBytes, (regionSizeInBytes / wordSize) / 2 + 1, false);
+ }
+
+ public static void main(String[] args) throws Exception {
+ runRegionTest(1);
+ runRegionTest(2);
+ runRegionTest(4);
+ runRegionTest(8);
+ runRegionTest(16);
+ runRegionTest(32);
+ }
+
+ static class GCTest {
+ public static void main(String [] args) {
+ System.out.println("Test completed.");
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/humongousObjects/Helpers.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, 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 gc.g1.humongousObjects;
+
+import sun.hotspot.WhiteBox;
+
+public class Helpers {
+
+ // In case of 128 byte padding
+ private static final int MAX_PADDING_SIZE = 128;
+
+ /**
+ * Detects amount of extra bytes required to allocate a byte array.
+ * Allocating a byte[n] array takes more then just n bytes in the heap.
+ * Extra bytes are required to store object reference and the length.
+ * This amount depends on bitness and other factors.
+ *
+ * @return byte[] memory overhead
+ */
+ public static int detectByteArrayAllocationOverhead() {
+
+ WhiteBox whiteBox = WhiteBox.getWhiteBox();
+
+ int zeroLengthByteArraySize = (int) whiteBox.getObjectSize(new byte[0]);
+
+ // Since we do not know is there any padding in zeroLengthByteArraySize we cannot just take byte[0] size as overhead
+ for (int i = 1; i < MAX_PADDING_SIZE + 1; ++i) {
+ int realAllocationSize = (int) whiteBox.getObjectSize(new byte[i]);
+ if (realAllocationSize != zeroLengthByteArraySize) {
+ // It means we did not have any padding on previous step
+ return zeroLengthByteArraySize - (i - 1);
+ }
+ }
+ throw new Error("We cannot find byte[] memory overhead - should not reach here");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2015, 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 gc.g1.humongousObjects;
+
+import jdk.test.lib.Asserts;
+import sun.hotspot.WhiteBox;
+
+/**
+ * @test TestHumongousThreshold
+ * @summary Checks that objects larger than half a region are allocated as humongous
+ * @requires vm.gc=="G1" | vm.gc=="null"
+ * @library /testlibrary /../../test/lib
+ * @modules java.management
+ * @build sun.hotspot.WhiteBox
+ * gc.g1.humongousObjects.Helpers
+ * gc.g1.humongousObjects.TestHumongousThreshold
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ *
+ * @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:G1HeapRegionSize=1M
+ * gc.g1.humongousObjects.TestHumongousThreshold
+ *
+ * @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:G1HeapRegionSize=2M
+ * gc.g1.humongousObjects.TestHumongousThreshold
+ *
+ * @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:G1HeapRegionSize=4M
+ * gc.g1.humongousObjects.TestHumongousThreshold
+ *
+ * @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:G1HeapRegionSize=8M
+ * gc.g1.humongousObjects.TestHumongousThreshold
+ *
+ * @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:G1HeapRegionSize=16M
+ * gc.g1.humongousObjects.TestHumongousThreshold
+ *
+ * @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:G1HeapRegionSize=32M
+ * gc.g1.humongousObjects.TestHumongousThreshold
+ *
+ */
+
+public class TestHumongousThreshold {
+ private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+ private static final int REGION_SIZE = WHITE_BOX.g1RegionSize();
+ private static final int MAX_CONTINUOUS_SIZE_CHECK = 129;
+ private static final int NON_HUMONGOUS_DIVIDER = 10;
+
+ /**
+ * The method allocates byte[] with specified size and checks that:
+ * 1. byte[] is allocated as we specified in expectedHumongous.
+ * 2. byte[] is allocated as humongous if its size is large than a half of region and non-humongous otherwise.
+ * It uses WB to obtain the size of created byte[]. Only objects larger than half of region are expected
+ * to be humongous.
+ *
+ * @param arraySize size of allocation
+ * @param expectedHumongous expected humongous/non-humongous allocation
+ * @return allocated byte array
+ */
+
+ private static byte[] allocateAndCheck(int arraySize, boolean expectedHumongous) {
+ byte[] storage = new byte[arraySize];
+ long objectSize = WHITE_BOX.getObjectSize(storage);
+ boolean shouldBeHumongous = objectSize > (REGION_SIZE / 2);
+
+ Asserts.assertEquals(expectedHumongous, shouldBeHumongous, "Despite we expected this object to be "
+ + (expectedHumongous ? "humongous" : "non-humongous") + " it appeared otherwise when we checked "
+ + "object size - likely test bug; Allocation size = " + arraySize + "; Object size = " + objectSize
+ + "; region size = " + REGION_SIZE);
+
+ Asserts.assertEquals(WHITE_BOX.g1IsHumongous(storage), shouldBeHumongous,
+ "Object should be allocated as " + (shouldBeHumongous ? "humongous"
+ : "non-humongous") + " but it wasn't; Allocation size = " + arraySize + "; Object size = "
+ + objectSize + "; region size = " + REGION_SIZE);
+ return storage;
+ }
+
+ public static void main(String[] args) {
+ int byteArrayMemoryOverhead = Helpers.detectByteArrayAllocationOverhead();
+
+ // Largest non-humongous byte[]
+ int maxByteArrayNonHumongousSize = (REGION_SIZE / 2) - byteArrayMemoryOverhead;
+
+ // Increment for non-humongous testing
+ int nonHumongousStep = maxByteArrayNonHumongousSize / NON_HUMONGOUS_DIVIDER;
+
+ // Maximum byte[] that takes one region
+ int maxByteArrayOneRegionSize = REGION_SIZE - byteArrayMemoryOverhead;
+
+ // Sizes in regions
+ // i,e, 1.0f means one region, 1.5f means one and half region etc
+ float[] humongousFactors = {0.8f, 1.0f, 1.2f, 1.5f, 1.7f, 2.0f, 2.5f};
+
+ // Some diagnostic output
+ System.out.format("%s started%n", TestHumongousThreshold.class.getName());
+ System.out.format("Actual G1 region size %d%n", REGION_SIZE);
+ System.out.format("byte[] memory overhead %d%n", byteArrayMemoryOverhead);
+
+ // Non-humongous allocations
+ System.out.format("Doing non-humongous allocations%n");
+
+ // Testing allocations with byte[] with length from 0 to MAX_CONTINUOUS_SIZE_CHECK
+ System.out.format("Testing allocations with byte[] with length from 0 to %d%n", MAX_CONTINUOUS_SIZE_CHECK);
+ for (int i = 0; i < MAX_CONTINUOUS_SIZE_CHECK; ++i) {
+ allocateAndCheck(i, false);
+ }
+
+ // Testing allocations with byte[] with length from 0 to nonHumongousStep * NON_HUMONGOUS_DIVIDER
+ System.out.format("Testing allocations with byte[] with length from 0 to %d with step %d%n",
+ nonHumongousStep * NON_HUMONGOUS_DIVIDER, nonHumongousStep);
+ for (int i = 0; i < NON_HUMONGOUS_DIVIDER; ++i) {
+ allocateAndCheck(i * nonHumongousStep, false);
+ }
+
+ // Testing allocations with byte[] of maximum non-humongous length
+ System.out.format("Testing allocations with byte[] of maximum non-humongous length %d%n",
+ maxByteArrayNonHumongousSize);
+ allocateAndCheck(maxByteArrayNonHumongousSize, false);
+
+ // Humongous allocations
+ System.out.format("Doing humongous allocations%n");
+ // Testing with minimum humongous object
+ System.out.format("Testing with byte[] of minimum humongous object %d%n", maxByteArrayNonHumongousSize + 1);
+ allocateAndCheck(maxByteArrayNonHumongousSize + 1, true);
+
+ // Testing allocations with byte[] with length from (maxByteArrayNonHumongousSize + 1) to
+ // (maxByteArrayNonHumongousSize + 1 + MAX_CONTINUOUS_SIZE_CHECK)
+ System.out.format("Testing allocations with byte[] with length from %d to %d%n",
+ maxByteArrayNonHumongousSize + 1, maxByteArrayNonHumongousSize + 1 + MAX_CONTINUOUS_SIZE_CHECK);
+ for (int i = 0; i < MAX_CONTINUOUS_SIZE_CHECK; ++i) {
+ allocateAndCheck(maxByteArrayNonHumongousSize + 1 + i, true);
+ }
+
+ // Checking that large (more than a half of region size) objects are humongous
+ System.out.format("Checking that large (more than a half of region size) objects are humongous%n");
+ for (float factor : humongousFactors) {
+ allocateAndCheck((int) (maxByteArrayOneRegionSize * factor), true);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/logging/TestPrintReferences.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, 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 TestPrintReferences
+ * @bug 8133818
+ * @summary Validate the reference processing logging
+ * @key gc
+ * @library /testlibrary
+ * @modules java.base/sun.misc
+ * java.management
+ */
+
+import jdk.test.lib.ProcessTools;
+import jdk.test.lib.OutputAnalyzer;
+
+public class TestPrintReferences {
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb_enabled =
+ ProcessTools.createJavaProcessBuilder("-XX:+PrintGCDetails", "-XX:+PrintReferenceGC", "-Xmx10M", GCTest.class.getName());
+ OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start());
+
+ output.shouldMatch(
+ "#[0-9]+: \\[SoftReference, [0-9]+ refs, [0-9]+\\.[0-9]+ secs\\]" +
+ "#[0-9]+: \\[WeakReference, [0-9]+ refs, [0-9]+\\.[0-9]+ secs\\]" +
+ "#[0-9]+: \\[FinalReference, [0-9]+ refs, [0-9]+\\.[0-9]+ secs\\]" +
+ "#[0-9]+: \\[PhantomReference, [0-9]+ refs, [0-9]+\\.[0-9]+ secs\\]" +
+ "#[0-9]+: \\[Cleaners, [0-9]+ refs, [0-9]+\\.[0-9]+ secs\\]" +
+ "#[0-9]+: \\[JNI Weak Reference, [0-9]+ refs, [0-9]+\\.[0-9]+ secs\\]");
+
+ output.shouldHaveExitValue(0);
+ }
+
+ static class GCTest {
+ public static void main(String [] args) {
+ System.gc();
+ }
+ }
+}
--- a/hotspot/test/runtime/SharedArchiveFile/BasicJarBuilder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/BasicJarBuilder.java Tue Sep 22 11:01:54 2015 -0700
@@ -35,14 +35,14 @@
import java.util.ArrayList;
import sun.tools.jar.Main;
+// Using JarBuilder requires that all to-be-jarred classes should be placed
+// in the current working directory, aka "."
public class BasicJarBuilder {
private static final String classDir = System.getProperty("test.classes");
- public static void build(String jarName, String ...classNames)
- throws Exception {
-
- createSimpleJar(classDir, classDir + File.separator + jarName +
- ".jar", classNames);
+ public static void build(String jarName, String ...classNames) throws Exception {
+ createSimpleJar(".", classDir + File.separator + jarName + ".jar",
+ classNames);
}
private static void createSimpleJar(String jarclassDir, String jarName,
@@ -71,7 +71,7 @@
}
}
- // helpers
+ // Get full path to the test jar
public static String getTestJar(String jar) {
File dir = new File(System.getProperty("test.classes", "."));
File jarFile = new File(dir, jar);
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java Tue Sep 22 11:01:54 2015 -0700
@@ -32,12 +32,10 @@
* @library /testlibrary /../../test/lib
* @modules java.base/sun.misc
* java.management
- * @ignore - 8133180
- * @build SharedStringsWb SharedStrings BasicJarBuilder
+ * @build SharedStringsWb SharedStrings BasicJarBuilder sun.hotspot.WhiteBox
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main SharedStrings
*/
-
import jdk.test.lib.*;
public class SharedStrings {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015, 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 SharedStringsAuto
+ * @summary Test -Xshare:auto with shared strings.
+ * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
+ * @requires (sun.arch.data.model != "32") & (os.family != "windows")
+ * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires (vm.gc=="G1" | vm.gc=="null")
+ * @library /testlibrary
+ * @modules java.base/sun.misc
+ * java.management
+ * @run main SharedStringsRunAuto
+ */
+
+import jdk.test.lib.*;
+import java.io.File;
+
+public class SharedStringsRunAuto {
+ public static void main(String[] args) throws Exception {
+ // Dump
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:SharedArchiveFile=./SharedStringsRunAuto.jsa",
+ "-XX:+UseCompressedOops", "-XX:+UseG1GC",
+ "-XX:+PrintSharedSpaces",
+ "-Xshare:dump");
+
+ new OutputAnalyzer(pb.start())
+ .shouldContain("Loading classes to share")
+ .shouldContain("Shared string table stats")
+ .shouldHaveExitValue(0);
+
+ // Run with -Xshare:auto
+ pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:SharedArchiveFile=./SharedStringsRunAuto.jsa",
+ "-XX:+UseCompressedOops", "-XX:+UseG1GC",
+ "-Xshare:auto",
+ "-version");
+
+ new OutputAnalyzer(pb.start())
+ .shouldMatch("(java|openjdk) version")
+ .shouldHaveExitValue(0);
+ }
+}
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStringsWb.java Thu Sep 17 09:19:40 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStringsWb.java Tue Sep 22 11:01:54 2015 -0700
@@ -34,8 +34,8 @@
return;
}
- // The string "java" is known to be interened and added to CDS archive
- String s = "java";
+ // The string below is known to be added to CDS archive
+ String s = "<init>";
String internedS = s.intern();
if (wb.isShared(internedS)) {
--- a/hotspot/test/runtime/modules/ImageFile/ImageAttributeOffsetsTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-/*
- * Retrieves the array of offsets once with MemoryMapImage enabled once disabled.
- * @test ImageAttributeOffsetsTest
- * @summary Unit test for JVM_ImageAttributeOffsets() method
- * @library /testlibrary /../../test/lib
- * @build ImageAttributeOffsetsTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+MemoryMapImage ImageAttributeOffsetsTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-MemoryMapImage ImageAttributeOffsetsTest
- */
-
-import java.io.File;
-import java.nio.ByteOrder;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageAttributeOffsetsTest {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String imageFile = javaHome + File.separator + "lib" + File.separator
- + "modules" + File.separator + "bootmodules.jimage";
-
- if (!(new File(imageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
- long id = wb.imageOpenImage(imageFile, bigEndian);
- boolean passed = true;
- // Get offsets
- int[] array = wb.imageAttributeOffsets(id);
- assertNotNull(array, "Could not retrieve offsets of array");
-
- wb.imageCloseImage(id);
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageCloseTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2015, 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 closing image opened multiple time. Test closing mutiple time an image.
- * @test ImageCloseTest
- * @summary Unit test for JVM_ImageClose() method
- * @library /testlibrary /../../test/lib
- * @build ImageCloseTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ImageCloseTest
- */
-
-import java.io.File;
-import java.nio.ByteOrder;
-import sun.hotspot.WhiteBox;
-
-public class ImageCloseTest {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String imageFile = javaHome + File.separator + "lib" + File.separator
- + "modules" + File.separator + "bootmodules.jimage";
-
- if (!(new File(imageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
- long id = 0;
-
- // too many opens
- for (int i = 0; i < 100; i++) {
- id = wb.imageOpenImage(imageFile, bigEndian);
- }
- wb.imageCloseImage(id);
-
- // too many closes
- id = wb.imageOpenImage(imageFile, bigEndian);
- for (int i = 0; i < 100; i++) {
- wb.imageCloseImage(id);
- }
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageFileHeaderTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2015, 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 that opening image containing wrong headers fails.
- * @test ImageFileHeaderTest
- * @library /testlibrary /../../test/lib
- * @build ImageFileHeaderTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ImageFileHeaderTest
- */
-
-import java.nio.*;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageFileHeaderTest {
-
- public static final int MAGIC = 0xCAFEDADA;
- public static final short MAJOR = 0;
- public static final short MINOR = 1;
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
- public static ByteBuffer buf;
-
- public static void main(String... args) throws Exception {
-
- ByteOrder endian = getEndian();
-
- // Try to read a non-existing file
- assertFalse(wb.readImageFile("bogus"));
-
- // Incomplete header, only include the correct magic
- buf = ByteBuffer.allocate(100);
- buf.order(endian);
- buf.putInt(MAGIC);
- assertFalse(testImageFile("invalidheader.jimage"));
-
- // Build a complete header but reverse the endian
- buf = ByteBuffer.allocate(100);
- buf.order(endian == ByteOrder.LITTLE_ENDIAN ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
- buf.putInt(MAGIC);
- buf.putShort(MAJOR);
- buf.putShort(MINOR);
- assertFalse(testImageFile("wrongendian.jimage"));
-
- // Use the wrong magic
- buf = ByteBuffer.allocate(100);
- buf.order(endian);
- buf.putInt(0xBEEFCACE);
- buf.putShort(MAJOR);
- buf.putShort(MINOR);
- assertFalse(testImageFile("wrongmagic.jimage"));
-
- // Wrong major version (current + 1)
- buf = ByteBuffer.allocate(100);
- buf.order(endian);
- buf.putInt(MAGIC);
- buf.putShort((short)(MAJOR + 1));
- buf.putShort((short)MINOR);
- assertFalse(testImageFile("wrongmajorversion.jimage"));
-
- // Wrong major version (negative)
- buf = ByteBuffer.allocate(100);
- buf.order(endian);
- buf.putInt(MAGIC);
- buf.putShort((short) -17);
- buf.putShort((short)MINOR);
- assertFalse(testImageFile("negativemajorversion.jimage"));
-
- // Wrong minor version (current + 1)
- buf = ByteBuffer.allocate(100);
- buf.order(endian);
- buf.putInt(MAGIC);
- buf.putShort((short)MAJOR);
- buf.putShort((short)(MINOR + 1));
- assertFalse(testImageFile("wrongminorversion.jimage"));
-
- // Wrong minor version (negative)
- buf = ByteBuffer.allocate(100);
- buf.order(endian);
- buf.putInt(MAGIC);
- buf.putShort((short)MAJOR);
- buf.putShort((short) -17);
- assertFalse(testImageFile("negativeminorversion.jimage"));
- }
-
- public static boolean testImageFile(String filename) throws Exception {
- Files.write(Paths.get(filename), buf.array());
- System.out.println("Calling ReadImageFile on " + filename);
- return wb.readImageFile(filename);
- }
-
- public static ByteOrder getEndian() {
- String endian = System.getProperty("sun.cpu.endian");
- if (endian.equalsIgnoreCase("little")) {
- return ByteOrder.LITTLE_ENDIAN;
- } else if (endian.equalsIgnoreCase("big")) {
- return ByteOrder.BIG_ENDIAN;
- }
- throw new RuntimeException("Unexpected sun.cpu.endian value: " + endian);
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageFindAttributesTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-/*
- * Find the attributes of existing and invalid classes.
- * @test ImageFindAttributesTest
- * @summary Unit test for JVM_ImageFindAttributes() method
- * @library /testlibrary /../../test/lib
- * @build ImageFindAttributesTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ImageFindAttributesTest
- */
-
-import java.io.File;
-import java.nio.ByteOrder;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageFindAttributesTest {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String imageFile = javaHome + File.separator + "lib" + File.separator
- + "modules" + File.separator + "bootmodules.jimage";
-
- if (!(new File(imageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
- long id = wb.imageOpenImage(imageFile, bigEndian);
-
- // class resource
- String className = "/java.base/java/lang/String.class";
- long[] longArr = wb.imageFindAttributes(id, className.getBytes());
-
- assertNotNull(longArr, "Could not retrieve attributes of class " + className);
-
- // non-existent resource
- String neClassName = "/java.base/java/lang/NonExistentClass.class";
- longArr = wb.imageFindAttributes(id, neClassName.getBytes());
-
- assertNull(longArr, "Failed. Returned not null for non-existent " + neClassName);
-
- // garbage byte array
- byte[] buf = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- longArr = wb.imageFindAttributes(id, buf);
-
- assertNull(longArr, "Found attributes for garbage class");
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageGetAttributesTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2015, 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 getting all attributes,
- * @test ImageGetAttributesTest
- * @summary Unit test for JVM_ImageGetAttributes() method
- * @library /testlibrary /../../test/lib
- * @build LocationConstants ImageGetAttributesTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ImageGetAttributesTest
- */
-
-import java.io.File;
-import java.nio.ByteOrder;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageGetAttributesTest implements LocationConstants {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String imageFile = javaHome + File.separator + "lib" + File.separator
- + "modules" + File.separator + "bootmodules.jimage";
-
- if (!(new File(imageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- testImageGetAttributes(imageFile);
- }
-
- private static void testImageGetAttributes(String imageFile) {
-
- boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
- long id = wb.imageOpenImage(imageFile, bigEndian);
- try {
- long stringsSize = wb.imageGetStringsSize(id);
- assertNE(stringsSize, 0, "strings size is 0");
-
- int[] array = wb.imageAttributeOffsets(id);
- assertNotNull(array, "Could not retrieve offsets of array");
-
- // Get non-null attributes
- boolean attFound = false;
- int[] idx = {-1, -1, -1};
- // first non-null attribute
- for (int i = 0; i < array.length; i++) {
- if (array[i] != 0) {
- attFound = true;
- idx[0] = i;
- break;
- }
- }
-
- // middle non-null attribute
- for (int i = array.length / 2; i < array.length; i++) {
- if (array[i] != 0) {
- attFound = true;
- idx[1] = i;
- break;
- }
- }
-
- // last non-null attribute
- for (int i = array.length - 1; i >= 0; i--) {
- if (array[i] != 0) {
- attFound = true;
- idx[2] = i;
- break;
- }
- }
- assertTrue(attFound, "Failed. No non-null offset attributes");
- // test cases above
- for (int i = 0; i < 3; i++) {
- if (idx[i] != -1) {
- long[] attrs = wb.imageGetAttributes(id, (int) array[idx[i]]);
- long module = attrs[LOCATION_ATTRIBUTE_MODULE];
- long parent = attrs[LOCATION_ATTRIBUTE_PARENT];
- long base = attrs[LOCATION_ATTRIBUTE_BASE];
- long ext = attrs[LOCATION_ATTRIBUTE_EXTENSION];
-
- if ((module >= 0) && (module < stringsSize)
- && (parent >= 0) && (parent < stringsSize)
- && (base != 0)
- && (ext >= 0) && (ext < stringsSize)) {
- } else {
- System.out.printf("Failed. Read attribute offset %d (position %d) but wrong offsets\n",
- array[idx[i]], idx[i]);
- System.out.printf(" offsets: module = %d parent = %d base = %d extention = %d\n",
- module, parent, base, ext);
- throw new RuntimeException("Read attribute offset error");
- }
- } else {
- System.out.printf("Failed. Could not read attribute offset %d (position %d)\n",
- array[idx[i]], idx[i]);
- throw new RuntimeException("Read attribute offset error");
- }
- }
- } finally {
- wb.imageCloseImage(id);
- }
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageGetDataAddressTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2015, 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 accessing the data address of a jimage. This only makes sense when the
- * entire jimage is mapped into memory.
- * @test ImageGetDataAddressTest
- * @summary Unit test for JVM_ImageGetDataAddress() method
- * @library /testlibrary /../../test/lib
- * @build ImageGetDataAddressTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+MemoryMapImage ImageGetDataAddressTest +
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-MemoryMapImage ImageGetDataAddressTest -
- */
-
-import java.io.File;
-import java.nio.ByteOrder;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageGetDataAddressTest {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String imageFile = javaHome + File.separator + "lib" + File.separator
- + "modules" + File.separator + "bootmodules.jimage";
-
- if (!(new File(imageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- boolean isMMap = args[0].equals("+");
-
- boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
- long id = wb.imageOpenImage(imageFile, bigEndian);
-
- // get data for valid id
- long dataAddr = wb.imageGetDataAddress(id);
- assertFalse((dataAddr == 0) && isMMap, "Failed. Data address is " + dataAddr + " for valid id\n");
-
- // get data for invalid id == 0
- dataAddr = wb.imageGetDataAddress(0);
- assertTrue(dataAddr == 0, "Failed. Data address is " + dataAddr + " for zero id\n");
-
- wb.imageCloseImage(id);
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageGetIndexAddressTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2015, 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 the address of the jimage index.
- * @test ImageGetIndexAddressTest
- * @summary Unit test for JVM_ImageGetIndexAddress() method
- * @library /testlibrary /../../test/lib
- * @build ImageGetIndexAddressTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ImageGetIndexAddressTest
- */
-
-import java.io.File;
-import java.nio.ByteOrder;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageGetIndexAddressTest {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String imageFile = javaHome + File.separator + "lib" + File.separator
- + "modules" + File.separator + "bootmodules.jimage";
-
- if (!(new File(imageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
- long id = wb.imageOpenImage(imageFile, bigEndian);
-
- // get index for valid id
- long indexAddr = wb.imageGetIndexAddress(id);
- assertFalse(indexAddr == 0, "Failed. Index address is zero for valid id");
-
- // get index for invalid id == 0
- indexAddr = wb.imageGetIndexAddress(0);
- assertTrue(indexAddr == 0, "Failed. Index address is" + indexAddr + " for zero id\n");
-
- wb.imageCloseImage(id);
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageGetStringBytesTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2015, 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 that the string referenced by an attribute is retrieved.
- * @test ImageGetStringBytesTest
- * @summary Unit test for JVM_ImageGetStringBytes() method
- * @library /testlibrary /../../test/lib
- * @build LocationConstants ImageGetStringBytesTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ImageGetStringBytesTest
- */
-
-import java.io.File;
-import java.nio.ByteOrder;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageGetStringBytesTest implements LocationConstants {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String imageFile = javaHome + File.separator + "lib" + File.separator
- + "modules" + File.separator + "bootmodules.jimage";
-
- if (!(new File(imageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
- long id = wb.imageOpenImage(imageFile, bigEndian);
-
- String className = "/java.base/java/lang/String.class";
- long[] offsetArr = wb.imageFindAttributes(id, className.getBytes());
-
- // Module
- assertTrue(checkAttribute(id, offsetArr, LOCATION_ATTRIBUTE_MODULE, "Module"));
-
- // Parent
- assertTrue(checkAttribute(id, offsetArr, LOCATION_ATTRIBUTE_PARENT, "Parent"));
-
- // Base
- assertTrue(checkAttribute(id, offsetArr, LOCATION_ATTRIBUTE_BASE, "Base"));
-
- // Extension
- assertTrue(checkAttribute(id, offsetArr, LOCATION_ATTRIBUTE_EXTENSION, "Extension"));
-
- wb.imageCloseImage(id);
- }
-
- private static boolean checkAttribute(long id, long[] offsetArr, int attrId, String attrName) {
- long offset = offsetArr[attrId];
- return wb.imageGetStringBytes(id, (int) offset) != null;
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageOpenTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2015, 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 image opening/closing
- * @test ImageOpenTest
- * @summary Unit test for JVM_ImageOpen() method
- * @library /testlibrary /../../test/lib
- * @build ImageOpenTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ImageOpenTest
- */
-
-import java.io.File;
-import java.nio.ByteOrder;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageOpenTest {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String nonexistentImageFile = javaHome + "/lib/modules/nonexistent.jimage";
- String bootmodulesImageFile = javaHome + File.separator + "lib" + File.separator
- + "modules" + File.separator + "bootmodules.jimage";
-
- if (!(new File(bootmodulesImageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
-
- // open nonexistent image
- long id = wb.imageOpenImage(nonexistentImageFile, bigEndian);
- assertTrue(id == 0L, "Failed. Get id " + id + "instead of 0 on opening nonexistent file\n");
- wb.imageCloseImage(id);
-
- // open bootmodules image
- id = wb.imageOpenImage(bootmodulesImageFile, bigEndian);
- assertFalse(id == 0, "Failed. Get id 0 on opening bootmodules.jimage");
- wb.imageCloseImage(id);
-
- // non-native endian
- id = wb.imageOpenImage(bootmodulesImageFile, !bigEndian);
- assertFalse(id == 0, "Failed. Get id 0 on opening bootmodules.jimage with non-native endian");
- wb.imageCloseImage(id);
-
- //
- // open several times
- //
- id = wb.imageOpenImage(bootmodulesImageFile, bigEndian);
- long id1 = wb.imageOpenImage(bootmodulesImageFile, bigEndian);
- long id2 = wb.imageOpenImage(bootmodulesImageFile, bigEndian);
- assertTrue((id == id1) && (id == id2), "Failed. Open thee times with ids " + id + " " + id1 + " " + id1);
-
- wb.imageCloseImage(id);
- wb.imageCloseImage(id1);
- wb.imageCloseImage(id2);
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/ImageReadTest.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2015, 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 reading resource content.
- * @test ImageReadTest
- * @summary Unit test for JVM_ImageRead() method
- * @library /testlibrary /../../test/lib
- * @build LocationConstants ImageReadTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+MemoryMapImage ImageReadTest +
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-MemoryMapImage ImageReadTest -
- */
-
-import java.io.File;
-import java.nio.ByteBuffer;
-import sun.hotspot.WhiteBox;
-import static jdk.test.lib.Asserts.*;
-
-public class ImageReadTest implements LocationConstants {
-
- public static final WhiteBox wb = WhiteBox.getWhiteBox();
-
- public static void main(String... args) throws Exception {
- String javaHome = System.getProperty("java.home");
- String imageFile = javaHome + File.separator + "lib"
- + File.separator + "modules" + File.separator
- + "bootmodules.jimage";
-
- if (!(new File(imageFile)).exists()) {
- System.out.printf("Test skipped.");
- return;
- }
-
- boolean isMMap = args[0].equals("+");
-
- long id = wb.imageOpenImage(imageFile, isMMap);
-
- final String mm = isMMap ? "-XX:+MemoryMapImage" : "-XX:-MemoryMapImage";
- final int magic = 0xCAFEBABE;
-
- String className = "/java.base/java/lang/String.class";
- long[] offsetArr = wb.imageFindAttributes(id, className.getBytes());
- long offset = offsetArr[LOCATION_ATTRIBUTE_OFFSET];
- long size = offsetArr[LOCATION_ATTRIBUTE_UNCOMPRESSED];
-
- // positive: read
- ByteBuffer buf = ByteBuffer.allocateDirect((int) size);
- assertTrue(wb.imageRead(id, offset, buf, size), "Failed. Read operation returned false, should be true");
- int m = buf.getInt();
- assertTrue(m == magic, "Failed. Read operation returned true but wrong magic = " + magic);
-
- // positive: mmap
- if (isMMap) {
- long dataAddr = wb.imageGetDataAddress(id);
- assertFalse(dataAddr == 0L, "Failed. Did not obtain data address on mmapped test");
- int data = wb.imageGetIntAtAddress(dataAddr, (int) offset, true);
- assertTrue(data == magic, "Failed. MMap operation returned true but wrong magic = " + data);
- }
-
- // negative: wrong offset
- boolean success = wb.imageRead(id, -100, buf, size);
- assertFalse(success, "Failed. Read operation (wrong offset): returned true");
-
- // negative: too big offset
- long filesize = new File(imageFile).length();
- success = wb.imageRead(id, filesize + 1, buf, size);
- assertFalse(success, "Failed. Read operation (offset > file size) returned true");
-
- // negative: negative size
- success = wb.imageRead(id, offset, buf, -100);
- assertFalse(success, "Failed. Read operation (negative size) returned true");
-
- wb.imageCloseImage(id);
- }
-}
--- a/hotspot/test/runtime/modules/ImageFile/LocationConstants.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-public interface LocationConstants {
- // keep this in sync with enum in ImageLocation C++ class in the
- // hotspot's C++ header file imageFile.hpp
- public static final int LOCATION_ATTRIBUTE_END = 0; // End of attribute stream marker
- public static final int LOCATION_ATTRIBUTE_MODULE = 1; // String table offset of module name
- public static final int LOCATION_ATTRIBUTE_PARENT = 2; // String table offset of resource path parent
- public static final int LOCATION_ATTRIBUTE_BASE = 3; // String table offset of resource path base
- public static final int LOCATION_ATTRIBUTE_EXTENSION = 4; // String table offset of resource path extension
- public static final int LOCATION_ATTRIBUTE_OFFSET = 5; // Container byte offset of resource
- public static final int LOCATION_ATTRIBUTE_COMPRESSED = 6; // In image byte size of the compressed resource
- public static final int LOCATION_ATTRIBUTE_UNCOMPRESSED = 7; // In memory byte size of the uncompressed resource
- public static final int LOCATION_ATTRIBUTE_COUNT = 8; // Number of attribute kinds
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/jdk/test/lib/AllocationHelper.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2015, 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 jdk.test.lib;
+
+import java.util.LinkedList;
+import java.util.concurrent.Callable;
+
+/**
+ * Helper class which allocates memory.
+ *
+ * Typical usage:
+ * <pre>
+ * {@code
+ * AllocationHelper allocator = new AllocationHelper(MAX_ITERATIONS, ARRAY_LENGTH, CHUNK_SIZE,
+ * () -> (verifier()));
+ * // Allocate byte[CHUNK_SIZE] ARRAY_LENGTH times. Total allocated bytes will be CHUNK_SIZE * ARRAY_LENGTH + refs length.
+ * // Then invoke verifier and iterate MAX_ITERATIONS times.
+ * allocator.allocateMemoryAndVerify();
+ * }
+ * </pre>
+ */
+public final class AllocationHelper {
+
+ private final int arrayLength;
+ private final int maxIterations;
+ private final int chunkSize;
+
+ // garbageStorage is used to store link to garbage to prevent optimization.
+ private static Object garbageStorage;
+ private byte garbage[][];
+ private final Callable<?> verifierInstance;
+
+ /**
+ * Create an AllocationHelper with specified iteration count, array length, chunk size and verifier.
+ *
+ * @param maxIterations
+ * @param arrayLength
+ * @param chunkSize
+ * @param verifier - Callable instance which will be invoked after all allocation cycle. Can be null;
+ */
+ public AllocationHelper(int maxIterations, int arrayLength, int chunkSize, Callable<?> verifier) {
+ if ((arrayLength <= 0) || (maxIterations <= 0) || (chunkSize <= 0)) {
+ throw new IllegalArgumentException("maxIterations, arrayLength and chunkSize should be greater then 0.");
+ }
+ this.arrayLength = arrayLength;
+ this.maxIterations = maxIterations;
+ this.chunkSize = chunkSize;
+ verifierInstance = verifier;
+ garbage = new byte[this.arrayLength][];
+ garbageStorage = garbage;
+ }
+
+ private void allocateMemoryOneIteration() {
+ for (int j = 0; j < arrayLength; j++) {
+ garbage[j] = new byte[chunkSize];
+ }
+ }
+
+ /**
+ * Allocate memory and invoke Verifier during all iteration.
+ *
+ * @throws java.lang.Exception
+ */
+ public void allocateMemoryAndVerify() throws Exception {
+ for (int i = 0; i < maxIterations; i++) {
+ allocateMemoryOneIteration();
+ if (verifierInstance != null) {
+ verifierInstance.call();
+ }
+ }
+ }
+
+ /**
+ * The same as allocateMemoryAndVerify() but hides OOME
+ *
+ * @throws Exception
+ */
+ public void allocateMemoryAndVerifyNoOOME() throws Exception {
+ try {
+ allocateMemoryAndVerify();
+ } catch (OutOfMemoryError e) {
+ // exit on OOME
+ }
+ }
+
+ /**
+ * Release link to allocated garbage to make it available for further GC
+ */
+ public void release() {
+ if (garbage != null) {
+ garbage = null;
+ garbageStorage = null;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/jdk/test/lib/HeapRegionUsageTool.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2015, 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 jdk.test.lib;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryUsage;
+
+/**
+ * Utility class used by tests to get heap region usage.
+ */
+public final class HeapRegionUsageTool {
+
+ /**
+ * Get MemoryUsage from MemoryPoolMXBean which name matches passed string.
+ *
+ * @param name
+ * @return MemoryUsage
+ */
+ private static MemoryUsage getUsage(String name){
+ for (MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) {
+ if (pool.getName().matches(name)) {
+ return pool.getUsage();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get MemoryUsage of Eden space.
+ *
+ * @return MemoryUsage
+ */
+ public static MemoryUsage getEdenUsage() {
+ return getUsage(".*Eden.*");
+ }
+
+ /**
+ * Get MemoryUsage of Survivor space.
+ *
+ * @return MemoryUsage
+ */
+ public static MemoryUsage getSurvivorUsage() {
+ return getUsage(".*Survivor.*");
+ }
+
+ /**
+ * Get memory usage of Tenured space
+ *
+ * @return MemoryUsage
+ */
+ public static MemoryUsage getOldUsage() {
+ return getUsage(".*(Old|Tenured).*");
+ }
+
+ /**
+ * Get heap usage.
+ *
+ * @return MemoryUsage
+ */
+ public static MemoryUsage getHeapUsage() {
+ return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+ }
+
+ /**
+ * Helper function to align up.
+ *
+ * @param value
+ * @param alignment
+ * @return aligned value
+ */
+ public static long alignUp(long value, long alignment) {
+ return (value + alignment - 1) & ~(alignment - 1);
+ }
+
+ /**
+ * Helper function to align down.
+ *
+ * @param value
+ * @param alignment
+ * @return aligned value
+ */
+ public static long alignDown(long value, long alignment) {
+ return value & ~(alignment - 1);
+ }
+}
--- a/jaxp/.hgtags Thu Sep 17 09:19:40 2015 -0700
+++ b/jaxp/.hgtags Tue Sep 22 11:01:54 2015 -0700
@@ -324,3 +324,4 @@
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
f464f9b2fb1178f6a957e5730b4b5252c6149ed9 jdk9-b80
6a418934997fc4b56664b88f8417e2f0fe658091 jdk9-b81
+53fe3c103b6fdf48e2b2676c0c4818ef5a10fa21 jdk9-b82
--- a/jaxws/.hgtags Thu Sep 17 09:19:40 2015 -0700
+++ b/jaxws/.hgtags Tue Sep 22 11:01:54 2015 -0700
@@ -327,3 +327,4 @@
42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
e9940bf1c8ddaa6f1f5f1813846b080f0ccaf50b jdk9-b80
139338618c77d793ab8b550f06819ddb8381316f jdk9-b81
+52d9ad2536ba6c6f1cc5561c0a0ee2b4847fd62c jdk9-b82
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/package-info.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2005, 2010, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+/**
+ * This package contains the core JAX-WS APIs.
+ */
+package javax.xml.ws;
--- a/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/package.html Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<!--
- Copyright (c) 2005, 2012, 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. Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- 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.
--->
-
-<html>
-<body>
-This package contains the core JAX-WS APIs.
-</body>
-</html>
--- a/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/spi/FactoryFinder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/spi/FactoryFinder.java Tue Sep 22 11:01:54 2015 -0700
@@ -27,33 +27,25 @@
import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.xml.ws.WebServiceException;
class FactoryFinder {
- /**
- * Creates an instance of the specified class using the specified
- * {@code ClassLoader} object.
- *
- * @exception WebServiceException if the given class could not be found
- * or could not be instantiated
- */
- private static Object newInstance(String className,
- ClassLoader classLoader)
- {
- try {
- Class spiClass = safeLoadClass(className, classLoader);
- return spiClass.newInstance();
- } catch (ClassNotFoundException x) {
- throw new WebServiceException(
- "Provider " + className + " not found", x);
- } catch (Exception x) {
- throw new WebServiceException(
- "Provider " + className + " could not be instantiated: " + x,
- x);
- }
- }
+ private static final Logger logger = Logger.getLogger("javax.xml.ws");
+
+ private static final ServiceLoaderUtil.ExceptionHandler<WebServiceException> EXCEPTION_HANDLER =
+ new ServiceLoaderUtil.ExceptionHandler<WebServiceException>() {
+ @Override
+ public WebServiceException createException(Throwable throwable, String message) {
+ return new WebServiceException(message, throwable);
+ }
+ };
/**
* Finds the implementation {@code Class} object for the given
@@ -67,7 +59,7 @@
* @return the {@code Class} object of the specified message factory;
* may not be {@code null}
*
- * @param factoryId the name of the factory to find, which is
+ * @param factoryClass the name of the factory to find, which is
* a system property
* @param fallbackClassName the implementation class name, which is
* to be used only if nothing else
@@ -75,72 +67,26 @@
* there is no fallback class name
* @exception WebServiceException if there is an error
*/
- static Object find(String factoryId, String fallbackClassName)
- {
- if (isOsgi()) {
- return lookupUsingOSGiServiceLoader(factoryId);
- }
- ClassLoader classLoader;
- try {
- classLoader = Thread.currentThread().getContextClassLoader();
- } catch (Exception x) {
- throw new WebServiceException(x.toString(), x);
- }
+ @SuppressWarnings("unchecked")
+ static <T> T find(Class<T> factoryClass, String fallbackClassName) {
+ ClassLoader classLoader = ServiceLoaderUtil.contextClassLoader(EXCEPTION_HANDLER);
- String serviceId = "META-INF/services/" + factoryId;
- // try to find services in CLASSPATH
- BufferedReader rd = null;
- try {
- InputStream is;
- if (classLoader == null) {
- is=ClassLoader.getSystemResourceAsStream(serviceId);
- } else {
- is=classLoader.getResourceAsStream(serviceId);
- }
+ T provider = ServiceLoaderUtil.firstByServiceLoader(factoryClass, logger, EXCEPTION_HANDLER);
+ if (provider != null) return provider;
- if( is!=null ) {
- rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
-
- String factoryClassName = rd.readLine();
-
- if (factoryClassName != null &&
- ! "".equals(factoryClassName)) {
- return newInstance(factoryClassName, classLoader);
- }
- }
- } catch( Exception ignored) {
- } finally {
- close(rd);
- }
-
+ String factoryId = factoryClass.getName();
// try to read from $java.home/lib/jaxws.properties
- FileInputStream inStream = null;
- try {
- String javah=System.getProperty( "java.home" );
- String configFile = javah + File.separator +
- "lib" + File.separator + "jaxws.properties";
- File f=new File( configFile );
- if( f.exists()) {
- Properties props=new Properties();
- inStream = new FileInputStream(f);
- props.load(inStream);
- String factoryClassName = props.getProperty(factoryId);
- return newInstance(factoryClassName, classLoader);
- }
- } catch(Exception ignored) {
- } finally {
- close(inStream);
- }
+ provider = (T) fromJDKProperties(factoryId, fallbackClassName, classLoader);
+ if (provider != null) return provider;
// Use the system property
- try {
- String systemProp =
- System.getProperty( factoryId );
- if( systemProp!=null) {
- return newInstance(systemProp, classLoader);
- }
- } catch (SecurityException ignored) {
+ provider = (T) fromSystemProperty(factoryId, fallbackClassName, classLoader);
+ if (provider != null) return provider;
+
+ // handling Glassfish (platform specific default)
+ if (isOsgi()) {
+ return (T) lookupUsingOSGiServiceLoader(factoryId);
}
if (fallbackClassName == null) {
@@ -148,43 +94,51 @@
"Provider for " + factoryId + " cannot be found", null);
}
- return newInstance(fallbackClassName, classLoader);
+ return (T) ServiceLoaderUtil.newInstance(fallbackClassName,
+ fallbackClassName, classLoader, EXCEPTION_HANDLER);
}
- private static void close(Closeable closeable) {
- if (closeable != null) {
- try {
- closeable.close();
- } catch (IOException ignored) {
+ private static Object fromSystemProperty(String factoryId,
+ String fallbackClassName,
+ ClassLoader classLoader) {
+ try {
+ String systemProp = System.getProperty(factoryId);
+ if (systemProp != null) {
+ return ServiceLoaderUtil.newInstance(systemProp,
+ fallbackClassName, classLoader, EXCEPTION_HANDLER);
}
+ } catch (SecurityException ignored) {
}
+ return null;
}
-
- /**
- * Loads the class, provided that the calling thread has an access to the class being loaded.
- */
- private static Class safeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
+ private static Object fromJDKProperties(String factoryId,
+ String fallbackClassName,
+ ClassLoader classLoader) {
+ Path path = null;
try {
- // make sure that the current thread has an access to the package of the given name.
- SecurityManager s = System.getSecurityManager();
- if (s != null) {
- int i = className.lastIndexOf('.');
- if (i != -1) {
- s.checkPackageAccess(className.substring(0, i));
- }
+ String JAVA_HOME = System.getProperty("java.home");
+ path = Paths.get(JAVA_HOME, "conf", "jaxws.properties");
+
+ // to ensure backwards compatibility
+ if (!Files.exists(path)) {
+ path = Paths.get(JAVA_HOME, "lib", "jaxws.properties");
}
- if (classLoader == null)
- return Class.forName(className);
- else
- return classLoader.loadClass(className);
- } catch (SecurityException se) {
- // anyone can access the platform default factory class without permission
- if (Provider.DEFAULT_JAXWSPROVIDER.equals(className))
- return Class.forName(className);
- throw se;
+ if (!Files.exists(path)) {
+ Properties props = new Properties();
+ try (InputStream inStream = Files.newInputStream(path)) {
+ props.load(inStream);
+ }
+ String factoryClassName = props.getProperty(factoryId);
+ return ServiceLoaderUtil.newInstance(factoryClassName,
+ fallbackClassName, classLoader, EXCEPTION_HANDLER);
+ }
+ } catch (Exception ignored) {
+ logger.log(Level.SEVERE, "Error reading JAX-WS configuration from [" + path +
+ "] file. Check it is accessible and has correct format.", ignored);
}
+ return null;
}
private static final String OSGI_SERVICE_LOADER_CLASS_NAME = "com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader";
--- a/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/spi/Provider.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/spi/Provider.java Tue Sep 22 11:01:54 2015 -0700
@@ -45,19 +45,12 @@
public abstract class Provider {
/**
- * A constant representing the property used to lookup the
- * name of a {@code Provider} implementation
- * class.
- */
- static public final String JAXWSPROVIDER_PROPERTY = "javax.xml.ws.spi.Provider";
-
- /**
* A constant representing the name of the default
* {@code Provider} implementation class.
**/
// Using two strings so that package renaming doesn't change it
- static final String DEFAULT_JAXWSPROVIDER
- = "com.sun"+".xml.internal.ws.spi.ProviderImpl";
+ private static final String DEFAULT_JAXWSPROVIDER =
+ "com.sun"+".xml.internal.ws.spi.ProviderImpl";
/**
* Creates a new instance of Provider
@@ -72,47 +65,22 @@
* The algorithm used to locate the provider subclass to use consists
* of the following steps:
* <ul>
- * <li>
- * If a resource with the name of
- * {@code META-INF/services/javax.xml.ws.spi.Provider}
- * exists, then its first line, if present, is used as the UTF-8 encoded
- * name of the implementation class.
- * </li>
- * <li>
- * If the $java.home/lib/jaxws.properties file exists and it is readable by
- * the {@code java.util.Properties.load(InputStream)} method and it contains
- * an entry whose key is {@code javax.xml.ws.spi.Provider}, then the value of
- * that entry is used as the name of the implementation class.
- * </li>
- * <li>
- * If a system property with the name {@code javax.xml.ws.spi.Provider}
- * is defined, then its value is used as the name of the implementation class.
- * </li>
- * <li>
- * Finally, a default implementation class name is used.
- * </li>
+ * <li> Use the service-provider loading facilities, defined by the {@link java.util.ServiceLoader} class,
+ * to attempt to locate and load an implementation of {@link javax.xml.ws.spi.Provider} service using
+ * the {@linkplain java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}.
+ * <li>Use the configuration file "jaxws.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key {@code javax.xml.ws.spi.Provider}.
+ * <li> If a system property with the name {@code javax.xml.ws.spi.Provider}
+ * is defined, then its value is used as the name of the implementation class.
+ * <li> Finally, a platform default implementation is used.
* </ul>
*
*/
public static Provider provider() {
try {
- Object provider = getProviderUsingServiceLoader();
- if (provider == null) {
- provider = FactoryFinder.find(JAXWSPROVIDER_PROPERTY, DEFAULT_JAXWSPROVIDER);
- }
- if (!(provider instanceof Provider)) {
- Class pClass = Provider.class;
- String classnameAsResource = pClass.getName().replace('.', '/') + ".class";
- ClassLoader loader = pClass.getClassLoader();
- if(loader == null) {
- loader = ClassLoader.getSystemClassLoader();
- }
- URL targetTypeURL = loader.getResource(classnameAsResource);
- throw new LinkageError("ClassCastException: attempting to cast" +
- provider.getClass().getClassLoader().getResource(classnameAsResource) +
- "to" + targetTypeURL.toString() );
- }
- return (Provider) provider;
+ return FactoryFinder.find(Provider.class, DEFAULT_JAXWSPROVIDER);
} catch (WebServiceException ex) {
throw ex;
} catch (Exception ex) {
@@ -120,18 +88,6 @@
}
}
- private static Provider getProviderUsingServiceLoader() {
- ServiceLoader<Provider> sl;
- Iterator<Provider> it;
- try {
- sl = ServiceLoader.load(Provider.class);
- it = (Iterator<Provider>)sl.iterator();
- } catch (Exception e) {
- throw new WebServiceException("Cannot invoke java.util.ServiceLoader#iterator()", e);
- }
- return ((it != null) && it.hasNext()) ? it.next() : null;
- }
-
/**
* Creates a service delegate object.
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/spi/ServiceLoaderUtil.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 javax.xml.ws.spi;
+
+import java.util.ServiceLoader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Shared ServiceLoader/FactoryFinder Utils shared among SAAJ, JAXB and JAXWS
+ * Class duplicated to all those projects.
+ *
+ * @author Miroslav.Kos@oracle.com
+ */
+class ServiceLoaderUtil {
+
+ static <P, T extends Exception> P firstByServiceLoader(Class<P> spiClass,
+ Logger logger,
+ ExceptionHandler<T> handler) throws T {
+ logger.log(Level.FINE, "Using java.util.ServiceLoader to find {0}", spiClass.getName());
+ // service discovery
+ try {
+ ServiceLoader<P> serviceLoader = ServiceLoader.load(spiClass);
+
+ for (P impl : serviceLoader) {
+ logger.fine("ServiceProvider loading Facility used; returning object [" +
+ impl.getClass().getName() + "]");
+
+ return impl;
+ }
+ } catch (Throwable t) {
+ throw handler.createException(t, "Error while searching for service [" + spiClass.getName() + "]");
+ }
+ return null;
+ }
+
+ static void checkPackageAccess(String className) {
+ // make sure that the current thread has an access to the package of the given name.
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ int i = className.lastIndexOf('.');
+ if (i != -1) {
+ s.checkPackageAccess(className.substring(0, i));
+ }
+ }
+ }
+
+ static Class nullSafeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
+ if (classLoader == null) {
+ return Class.forName(className);
+ } else {
+ return classLoader.loadClass(className);
+ }
+ }
+
+ // Returns instance of required class. It checks package access (security)
+ // unless it is defaultClassname. It means if you are trying to instantiate
+ // default implementation (fallback), pass the class name to both first and second parameter.
+ static <T extends Exception> Object newInstance(String className,
+ String defaultImplClassName, ClassLoader classLoader,
+ final ExceptionHandler<T> handler) throws T {
+ try {
+ return safeLoadClass(className, defaultImplClassName, classLoader).newInstance();
+ } catch (ClassNotFoundException x) {
+ throw handler.createException(x, "Provider " + className + " not found");
+ } catch (Exception x) {
+ throw handler.createException(x, "Provider " + className + " could not be instantiated: " + x);
+ }
+ }
+
+ static Class safeLoadClass(String className,
+ String defaultImplClassName,
+ ClassLoader classLoader) throws ClassNotFoundException {
+
+ try {
+ checkPackageAccess(className);
+ } catch (SecurityException se) {
+ // anyone can access the platform default factory class without permission
+ if (defaultImplClassName != null && defaultImplClassName.equals(className)) {
+ return Class.forName(className);
+ }
+ // not platform default implementation ...
+ throw se;
+ }
+ return nullSafeLoadClass(className, classLoader);
+ }
+
+ static <T extends Exception> ClassLoader contextClassLoader(ExceptionHandler<T> exceptionHandler) throws T {
+ try {
+ return Thread.currentThread().getContextClassLoader();
+ } catch (Exception x) {
+ throw exceptionHandler.createException(x, x.toString());
+ }
+ }
+
+ static abstract class ExceptionHandler<T extends Exception> {
+
+ public abstract T createException(Throwable throwable, String message);
+
+ }
+
+}
--- a/jdk/.hgtags Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/.hgtags Tue Sep 22 11:01:54 2015 -0700
@@ -324,3 +324,4 @@
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79
4947810137ae53abba3028cc366af953d90fa81a jdk9-b80
fdc13a2d32867ca3c57b7fa2620c6b59c83168cb jdk9-b81
+b10b64263b563e21f055c881444f625ec618b826 jdk9-b82
--- a/jdk/make/lib/CoreLibraries.gmk Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/make/lib/CoreLibraries.gmk Tue Sep 22 11:01:54 2015 -0700
@@ -239,8 +239,13 @@
##########################################################################################
+ifeq ($(OPENJDK_TARGET_OS), aix)
+ LIBJIMAGE_TOOLCHAIN := TOOLCHAIN_LINK_CXX
+endif # OPENJDK_TARGET_OS aix
+
$(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \
LIBRARY := jimage, \
+ TOOLCHAIN := $(LIBJIMAGE_TOOLCHAIN), \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
OPTIMIZATION := LOW, \
SRC := $(JDK_TOPDIR)/src/java.base/share/native/libjimage \
--- a/jdk/make/mapfiles/libjava/mapfile-vers Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Tue Sep 22 11:01:54 2015 -0700
@@ -150,7 +150,6 @@
Java_java_lang_StrictMath_exp;
Java_java_lang_StrictMath_log;
Java_java_lang_StrictMath_log10;
- Java_java_lang_StrictMath_pow;
Java_java_lang_StrictMath_sin;
Java_java_lang_StrictMath_sqrt;
Java_java_lang_StrictMath_cbrt;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/FdLibm.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,383 @@
+/*
+ * Copyright (c) 1998, 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 java.lang;
+
+/**
+ * Port of the "Freely Distributable Math Library", version 5.3, from C to Java.
+ *
+ * <p>The C version of fdlibm relied on the idiom of pointer aliasing
+ * a 64-bit double floating-point value as a two-element array of
+ * 32-bit integers and reading and writing the two halves of the
+ * double independently. This coding pattern was problematic to C
+ * optimizers and not directly expressible in Java. Therefore, rather
+ * than a memory level overlay, if portions of a double need to be
+ * operated on as integer values, the standard library methods for
+ * bitwise floating-point to integer conversion,
+ * Double.longBitsToDouble and Double.doubleToRawLongBits, are directly
+ * or indirectly used .
+ *
+ * <p>The C version of fdlibm also took some pains to signal the
+ * correct IEEE 754 exceptional conditions divide by zero, invalid,
+ * overflow and underflow. For example, overflow would be signaled by
+ * {@code huge * huge} where {@code huge} was a large constant that
+ * would overflow when squared. Since IEEE floating-point exceptional
+ * handling is not supported natively in the JVM, such coding patterns
+ * have been omitted from this port. For example, rather than {@code
+ * return huge * huge}, this port will use {@code return INFINITY}.
+ */
+class FdLibm {
+ // Constants used by multiple algorithms
+ private static final double INFINITY = Double.POSITIVE_INFINITY;
+
+ private FdLibm() {
+ throw new UnsupportedOperationException("No instances for you.");
+ }
+
+ /**
+ * Return the low-order 32 bits of the double argument as an int.
+ */
+ private static int __LO(double x) {
+ long transducer = Double.doubleToRawLongBits(x);
+ return (int)transducer;
+ }
+
+ /**
+ * Return a double with its low-order bits of the second argument
+ * and the high-order bits of the first argument..
+ */
+ private static double __LO(double x, int low) {
+ long transX = Double.doubleToRawLongBits(x);
+ return Double.longBitsToDouble((transX & 0xFFFF_FFFF_0000_0000L)|low );
+ }
+
+ /**
+ * Return the high-order 32 bits of the double argument as an int.
+ */
+ private static int __HI(double x) {
+ long transducer = Double.doubleToRawLongBits(x);
+ return (int)(transducer >> 32);
+ }
+
+ /**
+ * Return a double with its high-order bits of the second argument
+ * and the low-order bits of the first argument..
+ */
+ private static double __HI(double x, int high) {
+ long transX = Double.doubleToRawLongBits(x);
+ return Double.longBitsToDouble((transX & 0x0000_0000_FFFF_FFFFL)|( ((long)high)) << 32 );
+ }
+
+ /**
+ * Compute x**y
+ * n
+ * Method: Let x = 2 * (1+f)
+ * 1. Compute and return log2(x) in two pieces:
+ * log2(x) = w1 + w2,
+ * where w1 has 53 - 24 = 29 bit trailing zeros.
+ * 2. Perform y*log2(x) = n+y' by simulating muti-precision
+ * arithmetic, where |y'| <= 0.5.
+ * 3. Return x**y = 2**n*exp(y'*log2)
+ *
+ * Special cases:
+ * 1. (anything) ** 0 is 1
+ * 2. (anything) ** 1 is itself
+ * 3. (anything) ** NAN is NAN
+ * 4. NAN ** (anything except 0) is NAN
+ * 5. +-(|x| > 1) ** +INF is +INF
+ * 6. +-(|x| > 1) ** -INF is +0
+ * 7. +-(|x| < 1) ** +INF is +0
+ * 8. +-(|x| < 1) ** -INF is +INF
+ * 9. +-1 ** +-INF is NAN
+ * 10. +0 ** (+anything except 0, NAN) is +0
+ * 11. -0 ** (+anything except 0, NAN, odd integer) is +0
+ * 12. +0 ** (-anything except 0, NAN) is +INF
+ * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF
+ * 14. -0 ** (odd integer) = -( +0 ** (odd integer) )
+ * 15. +INF ** (+anything except 0,NAN) is +INF
+ * 16. +INF ** (-anything except 0,NAN) is +0
+ * 17. -INF ** (anything) = -0 ** (-anything)
+ * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
+ * 19. (-anything except 0 and inf) ** (non-integer) is NAN
+ *
+ * Accuracy:
+ * pow(x,y) returns x**y nearly rounded. In particular
+ * pow(integer,integer)
+ * always returns the correct integer provided it is
+ * representable.
+ */
+ public static class Pow {
+ public static strictfp double compute(final double x, final double y) {
+ double z;
+ double r, s, t, u, v, w;
+ int i, j, k, n;
+
+ // y == zero: x**0 = 1
+ if (y == 0.0)
+ return 1.0;
+
+ // +/-NaN return x + y to propagate NaN significands
+ if (Double.isNaN(x) || Double.isNaN(y))
+ return x + y;
+
+ final double y_abs = Math.abs(y);
+ double x_abs = Math.abs(x);
+ // Special values of y
+ if (y == 2.0) {
+ return x * x;
+ } else if (y == 0.5) {
+ if (x >= -Double.MAX_VALUE) // Handle x == -infinity later
+ return Math.sqrt(x + 0.0); // Add 0.0 to properly handle x == -0.0
+ } else if (y_abs == 1.0) { // y is +/-1
+ return (y == 1.0) ? x : 1.0 / x;
+ } else if (y_abs == INFINITY) { // y is +/-infinity
+ if (x_abs == 1.0)
+ return y - y; // inf**+/-1 is NaN
+ else if (x_abs > 1.0) // (|x| > 1)**+/-inf = inf, 0
+ return (y >= 0) ? y : 0.0;
+ else // (|x| < 1)**-/+inf = inf, 0
+ return (y < 0) ? -y : 0.0;
+ }
+
+ final int hx = __HI(x);
+ int ix = hx & 0x7fffffff;
+
+ /*
+ * When x < 0, determine if y is an odd integer:
+ * y_is_int = 0 ... y is not an integer
+ * y_is_int = 1 ... y is an odd int
+ * y_is_int = 2 ... y is an even int
+ */
+ int y_is_int = 0;
+ if (hx < 0) {
+ if (y_abs >= 0x1.0p53) // |y| >= 2^53 = 9.007199254740992E15
+ y_is_int = 2; // y is an even integer since ulp(2^53) = 2.0
+ else if (y_abs >= 1.0) { // |y| >= 1.0
+ long y_abs_as_long = (long) y_abs;
+ if ( ((double) y_abs_as_long) == y_abs) {
+ y_is_int = 2 - (int)(y_abs_as_long & 0x1L);
+ }
+ }
+ }
+
+ // Special value of x
+ if (x_abs == 0.0 ||
+ x_abs == INFINITY ||
+ x_abs == 1.0) {
+ z = x_abs; // x is +/-0, +/-inf, +/-1
+ if (y < 0.0)
+ z = 1.0/z; // z = (1/|x|)
+ if (hx < 0) {
+ if (((ix - 0x3ff00000) | y_is_int) == 0) {
+ z = (z-z)/(z-z); // (-1)**non-int is NaN
+ } else if (y_is_int == 1)
+ z = -1.0 * z; // (x < 0)**odd = -(|x|**odd)
+ }
+ return z;
+ }
+
+ n = (hx >> 31) + 1;
+
+ // (x < 0)**(non-int) is NaN
+ if ((n | y_is_int) == 0)
+ return (x-x)/(x-x);
+
+ s = 1.0; // s (sign of result -ve**odd) = -1 else = 1
+ if ( (n | (y_is_int - 1)) == 0)
+ s = -1.0; // (-ve)**(odd int)
+
+ double p_h, p_l, t1, t2;
+ // |y| is huge
+ if (y_abs > 0x1.0p31) { // if |y| > 2**31
+ final double INV_LN2 = 0x1.7154_7652_b82fep0; // 1.44269504088896338700e+00 = 1/ln2
+ final double INV_LN2_H = 0x1.715476p0; // 1.44269502162933349609e+00 = 24 bits of 1/ln2
+ final double INV_LN2_L = 0x1.4ae0_bf85_ddf44p-26; // 1.92596299112661746887e-08 = 1/ln2 tail
+
+ // Over/underflow if x is not close to one
+ if (x_abs < 0x1.fffffp-1) // |x| < 0.9999995231628418
+ return (y < 0.0) ? s * INFINITY : s * 0.0;
+ if (x_abs > 1.0) // |x| > 1.0
+ return (y > 0.0) ? s * INFINITY : s * 0.0;
+ /*
+ * now |1-x| is tiny <= 2**-20, sufficient to compute
+ * log(x) by x - x^2/2 + x^3/3 - x^4/4
+ */
+ t = x_abs - 1.0; // t has 20 trailing zeros
+ w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25));
+ u = INV_LN2_H * t; // INV_LN2_H has 21 sig. bits
+ v = t * INV_LN2_L - w * INV_LN2;
+ t1 = u + v;
+ t1 =__LO(t1, 0);
+ t2 = v - (t1 - u);
+ } else {
+ final double CP = 0x1.ec70_9dc3_a03fdp-1; // 9.61796693925975554329e-01 = 2/(3ln2)
+ final double CP_H = 0x1.ec709ep-1; // 9.61796700954437255859e-01 = (float)cp
+ final double CP_L = -0x1.e2fe_0145_b01f5p-28; // -7.02846165095275826516e-09 = tail of CP_H
+
+ double z_h, z_l, ss, s2, s_h, s_l, t_h, t_l;
+ n = 0;
+ // Take care of subnormal numbers
+ if (ix < 0x00100000) {
+ x_abs *= 0x1.0p53; // 2^53 = 9007199254740992.0
+ n -= 53;
+ ix = __HI(x_abs);
+ }
+ n += ((ix) >> 20) - 0x3ff;
+ j = ix & 0x000fffff;
+ // Determine interval
+ ix = j | 0x3ff00000; // Normalize ix
+ if (j <= 0x3988E)
+ k = 0; // |x| <sqrt(3/2)
+ else if (j < 0xBB67A)
+ k = 1; // |x| <sqrt(3)
+ else {
+ k = 0;
+ n += 1;
+ ix -= 0x00100000;
+ }
+ x_abs = __HI(x_abs, ix);
+
+ // Compute ss = s_h + s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5)
+
+ final double BP[] = {1.0,
+ 1.5};
+ final double DP_H[] = {0.0,
+ 0x1.2b80_34p-1}; // 5.84962487220764160156e-01
+ final double DP_L[] = {0.0,
+ 0x1.cfde_b43c_fd006p-27};// 1.35003920212974897128e-08
+
+ // Poly coefs for (3/2)*(log(x)-2s-2/3*s**3
+ final double L1 = 0x1.3333_3333_33303p-1; // 5.99999999999994648725e-01
+ final double L2 = 0x1.b6db_6db6_fabffp-2; // 4.28571428578550184252e-01
+ final double L3 = 0x1.5555_5518_f264dp-2; // 3.33333329818377432918e-01
+ final double L4 = 0x1.1746_0a91_d4101p-2; // 2.72728123808534006489e-01
+ final double L5 = 0x1.d864_a93c_9db65p-3; // 2.30660745775561754067e-01
+ final double L6 = 0x1.a7e2_84a4_54eefp-3; // 2.06975017800338417784e-01
+ u = x_abs - BP[k]; // BP[0]=1.0, BP[1]=1.5
+ v = 1.0 / (x_abs + BP[k]);
+ ss = u * v;
+ s_h = ss;
+ s_h = __LO(s_h, 0);
+ // t_h=x_abs + BP[k] High
+ t_h = 0.0;
+ t_h = __HI(t_h, ((ix >> 1) | 0x20000000) + 0x00080000 + (k << 18) );
+ t_l = x_abs - (t_h - BP[k]);
+ s_l = v * ((u - s_h * t_h) - s_h * t_l);
+ // Compute log(x_abs)
+ s2 = ss * ss;
+ r = s2 * s2* (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6)))));
+ r += s_l * (s_h + ss);
+ s2 = s_h * s_h;
+ t_h = 3.0 + s2 + r;
+ t_h = __LO(t_h, 0);
+ t_l = r - ((t_h - 3.0) - s2);
+ // u+v = ss*(1+...)
+ u = s_h * t_h;
+ v = s_l * t_h + t_l * ss;
+ // 2/(3log2)*(ss + ...)
+ p_h = u + v;
+ p_h = __LO(p_h, 0);
+ p_l = v - (p_h - u);
+ z_h = CP_H * p_h; // CP_H + CP_L = 2/(3*log2)
+ z_l = CP_L * p_h + p_l * CP + DP_L[k];
+ // log2(x_abs) = (ss + ..)*2/(3*log2) = n + DP_H + z_h + z_l
+ t = (double)n;
+ t1 = (((z_h + z_l) + DP_H[k]) + t);
+ t1 = __LO(t1, 0);
+ t2 = z_l - (((t1 - t) - DP_H[k]) - z_h);
+ }
+
+ // Split up y into (y1 + y2) and compute (y1 + y2) * (t1 + t2)
+ double y1 = y;
+ y1 = __LO(y1, 0);
+ p_l = (y - y1) * t1 + y * t2;
+ p_h = y1 * t1;
+ z = p_l + p_h;
+ j = __HI(z);
+ i = __LO(z);
+ if (j >= 0x40900000) { // z >= 1024
+ if (((j - 0x40900000) | i)!=0) // if z > 1024
+ return s * INFINITY; // Overflow
+ else {
+ final double OVT = 8.0085662595372944372e-0017; // -(1024-log2(ovfl+.5ulp))
+ if (p_l + OVT > z - p_h)
+ return s * INFINITY; // Overflow
+ }
+ } else if ((j & 0x7fffffff) >= 0x4090cc00 ) { // z <= -1075
+ if (((j - 0xc090cc00) | i)!=0) // z < -1075
+ return s * 0.0; // Underflow
+ else {
+ if (p_l <= z - p_h)
+ return s * 0.0; // Underflow
+ }
+ }
+ /*
+ * Compute 2**(p_h+p_l)
+ */
+ // Poly coefs for (3/2)*(log(x)-2s-2/3*s**3
+ final double P1 = 0x1.5555_5555_5553ep-3; // 1.66666666666666019037e-01
+ final double P2 = -0x1.6c16_c16b_ebd93p-9; // -2.77777777770155933842e-03
+ final double P3 = 0x1.1566_aaf2_5de2cp-14; // 6.61375632143793436117e-05
+ final double P4 = -0x1.bbd4_1c5d_26bf1p-20; // -1.65339022054652515390e-06
+ final double P5 = 0x1.6376_972b_ea4d0p-25; // 4.13813679705723846039e-08
+ final double LG2 = 0x1.62e4_2fef_a39efp-1; // 6.93147180559945286227e-01
+ final double LG2_H = 0x1.62e43p-1; // 6.93147182464599609375e-01
+ final double LG2_L = -0x1.05c6_10ca_86c39p-29; // -1.90465429995776804525e-09
+ i = j & 0x7fffffff;
+ k = (i >> 20) - 0x3ff;
+ n = 0;
+ if (i > 0x3fe00000) { // if |z| > 0.5, set n = [z + 0.5]
+ n = j + (0x00100000 >> (k + 1));
+ k = ((n & 0x7fffffff) >> 20) - 0x3ff; // new k for n
+ t = 0.0;
+ t = __HI(t, (n & ~(0x000fffff >> k)) );
+ n = ((n & 0x000fffff) | 0x00100000) >> (20 - k);
+ if (j < 0)
+ n = -n;
+ p_h -= t;
+ }
+ t = p_l + p_h;
+ t = __LO(t, 0);
+ u = t * LG2_H;
+ v = (p_l - (t - p_h)) * LG2 + t * LG2_L;
+ z = u + v;
+ w = v - (z - u);
+ t = z * z;
+ t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));
+ r = (z * t1)/(t1 - 2.0) - (w + z * w);
+ z = 1.0 - (r - z);
+ j = __HI(z);
+ j += (n << 20);
+ if ((j >> 20) <= 0)
+ z = Math.scalb(z, n); // subnormal output
+ else {
+ int z_hi = __HI(z);
+ z_hi += (n << 20);
+ z = __HI(z, z_hi);
+ }
+ return s * z;
+ }
+ }
+}
--- a/jdk/src/java.base/share/classes/java/lang/StrictMath.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StrictMath.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -643,7 +643,9 @@
* @param b the exponent.
* @return the value {@code a}<sup>{@code b}</sup>.
*/
- public static native double pow(double a, double b);
+ public static double pow(double a, double b) {
+ return FdLibm.Pow.compute(a, b);
+ }
/**
* Returns the closest {@code int} to the argument, with ties
--- a/jdk/src/java.base/share/classes/java/util/stream/Collectors.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/Collectors.java Tue Sep 22 11:01:54 2015 -0700
@@ -504,7 +504,7 @@
*/
public static <T> Collector<T, ?, Long>
counting() {
- return reducing(0L, e -> 1L, Long::sum);
+ return summingLong(e -> 1L);
}
/**
--- a/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/util/KeyStoreDelegator.java Tue Sep 22 11:01:54 2015 -0700
@@ -210,62 +210,60 @@
} else {
// First try the primary keystore then try the secondary keystore
- try (InputStream bufferedStream = new BufferedInputStream(stream)) {
- bufferedStream.mark(Integer.MAX_VALUE);
+ InputStream bufferedStream = new BufferedInputStream(stream);
+ bufferedStream.mark(Integer.MAX_VALUE);
+
+ try {
+ keystore = primaryKeyStore.newInstance();
+ type = primaryType;
+ keystore.engineLoad(bufferedStream, password);
+
+ } catch (Exception e) {
+
+ // incorrect password
+ if (e instanceof IOException &&
+ e.getCause() instanceof UnrecoverableKeyException) {
+ throw (IOException)e;
+ }
try {
- keystore = primaryKeyStore.newInstance();
- type = primaryType;
- keystore.engineLoad(bufferedStream, password);
-
- } catch (Exception e) {
-
- // incorrect password
- if (e instanceof IOException &&
- e.getCause() instanceof UnrecoverableKeyException) {
- throw (IOException)e;
+ // Ignore secondary keystore when no compatibility mode
+ if (!compatModeEnabled) {
+ throw e;
}
- try {
- // Ignore secondary keystore when no compatibility mode
- if (!compatModeEnabled) {
- throw e;
- }
+ keystore = secondaryKeyStore.newInstance();
+ type = secondaryType;
+ bufferedStream.reset();
+ keystore.engineLoad(bufferedStream, password);
- keystore = secondaryKeyStore.newInstance();
- type = secondaryType;
- bufferedStream.reset();
- keystore.engineLoad(bufferedStream, password);
+ if (debug != null) {
+ debug.println("WARNING: switching from " +
+ primaryType + " to " + secondaryType +
+ " keystore file format has altered the " +
+ "keystore security level");
+ }
- if (debug != null) {
- debug.println("WARNING: switching from " +
- primaryType + " to " + secondaryType +
- " keystore file format has altered the " +
- "keystore security level");
- }
+ } catch (InstantiationException |
+ IllegalAccessException e2) {
+ // can safely ignore
- } catch (InstantiationException |
- IllegalAccessException e2) {
- // can safely ignore
-
- } catch (IOException |
- NoSuchAlgorithmException |
- CertificateException e3) {
+ } catch (IOException |
+ NoSuchAlgorithmException |
+ CertificateException e3) {
- // incorrect password
- if (e3 instanceof IOException &&
- e3.getCause() instanceof
- UnrecoverableKeyException) {
- throw (IOException)e3;
- }
- // rethrow the outer exception
- if (e instanceof IOException) {
- throw (IOException)e;
- } else if (e instanceof CertificateException) {
- throw (CertificateException)e;
- } else if (e instanceof NoSuchAlgorithmException) {
- throw (NoSuchAlgorithmException)e;
- }
+ // incorrect password
+ if (e3 instanceof IOException &&
+ e3.getCause() instanceof UnrecoverableKeyException) {
+ throw (IOException)e3;
+ }
+ // rethrow the outer exception
+ if (e instanceof IOException) {
+ throw (IOException)e;
+ } else if (e instanceof CertificateException) {
+ throw (CertificateException)e;
+ } else if (e instanceof NoSuchAlgorithmException) {
+ throw (NoSuchAlgorithmException)e;
}
}
}
--- a/jdk/src/java.base/share/native/libfdlibm/e_pow.c Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,320 +0,0 @@
-
-/*
- * Copyright (c) 1998, 2004, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-
-/* __ieee754_pow(x,y) return x**y
- *
- * n
- * Method: Let x = 2 * (1+f)
- * 1. Compute and return log2(x) in two pieces:
- * log2(x) = w1 + w2,
- * where w1 has 53-24 = 29 bit trailing zeros.
- * 2. Perform y*log2(x) = n+y' by simulating muti-precision
- * arithmetic, where |y'|<=0.5.
- * 3. Return x**y = 2**n*exp(y'*log2)
- *
- * Special cases:
- * 1. (anything) ** 0 is 1
- * 2. (anything) ** 1 is itself
- * 3. (anything) ** NAN is NAN
- * 4. NAN ** (anything except 0) is NAN
- * 5. +-(|x| > 1) ** +INF is +INF
- * 6. +-(|x| > 1) ** -INF is +0
- * 7. +-(|x| < 1) ** +INF is +0
- * 8. +-(|x| < 1) ** -INF is +INF
- * 9. +-1 ** +-INF is NAN
- * 10. +0 ** (+anything except 0, NAN) is +0
- * 11. -0 ** (+anything except 0, NAN, odd integer) is +0
- * 12. +0 ** (-anything except 0, NAN) is +INF
- * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF
- * 14. -0 ** (odd integer) = -( +0 ** (odd integer) )
- * 15. +INF ** (+anything except 0,NAN) is +INF
- * 16. +INF ** (-anything except 0,NAN) is +0
- * 17. -INF ** (anything) = -0 ** (-anything)
- * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
- * 19. (-anything except 0 and inf) ** (non-integer) is NAN
- *
- * Accuracy:
- * pow(x,y) returns x**y nearly rounded. In particular
- * pow(integer,integer)
- * always returns the correct integer provided it is
- * representable.
- *
- * Constants :
- * The hexadecimal values are the intended ones for the following
- * constants. The decimal values may be used, provided that the
- * compiler will convert from decimal to binary accurately enough
- * to produce the hexadecimal values shown.
- */
-
-#include "fdlibm.h"
-
-#ifdef __STDC__
-static const double
-#else
-static double
-#endif
-bp[] = {1.0, 1.5,},
-dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
-dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
-zero = 0.0,
-one = 1.0,
-two = 2.0,
-two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */
-huge = 1.0e300,
-tiny = 1.0e-300,
- /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */
-L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */
-L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */
-L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */
-L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */
-L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */
-L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */
-P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */
-P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */
-P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
-P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
-P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */
-lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
-lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */
-lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */
-ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */
-cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */
-cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */
-cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/
-ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */
-ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/
-ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
-
-#ifdef __STDC__
- double __ieee754_pow(double x, double y)
-#else
- double __ieee754_pow(x,y)
- double x, y;
-#endif
-{
- double z,ax,z_h,z_l,p_h,p_l;
- double y1,t1,t2,r,s,t,u,v,w;
- int i0,i1,i,j,k,yisint,n;
- int hx,hy,ix,iy;
- unsigned lx,ly;
-
- i0 = ((*(int*)&one)>>29)^1; i1=1-i0;
- hx = __HI(x); lx = __LO(x);
- hy = __HI(y); ly = __LO(y);
- ix = hx&0x7fffffff; iy = hy&0x7fffffff;
-
- /* y==zero: x**0 = 1 */
- if((iy|ly)==0) return one;
-
- /* +-NaN return x+y */
- if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
- iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0)))
- return x+y;
-
- /* determine if y is an odd int when x < 0
- * yisint = 0 ... y is not an integer
- * yisint = 1 ... y is an odd int
- * yisint = 2 ... y is an even int
- */
- yisint = 0;
- if(hx<0) {
- if(iy>=0x43400000) yisint = 2; /* even integer y */
- else if(iy>=0x3ff00000) {
- k = (iy>>20)-0x3ff; /* exponent */
- if(k>20) {
- j = ly>>(52-k);
- if((j<<(52-k))==ly) yisint = 2-(j&1);
- } else if(ly==0) {
- j = iy>>(20-k);
- if((j<<(20-k))==iy) yisint = 2-(j&1);
- }
- }
- }
-
- /* special value of y */
- if(ly==0) {
- if (iy==0x7ff00000) { /* y is +-inf */
- if(((ix-0x3ff00000)|lx)==0)
- return y - y; /* inf**+-1 is NaN */
- else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */
- return (hy>=0)? y: zero;
- else /* (|x|<1)**-,+inf = inf,0 */
- return (hy<0)?-y: zero;
- }
- if(iy==0x3ff00000) { /* y is +-1 */
- if(hy<0) return one/x; else return x;
- }
- if(hy==0x40000000) return x*x; /* y is 2 */
- if(hy==0x3fe00000) { /* y is 0.5 */
- if(hx>=0) /* x >= +0 */
- return sqrt(x);
- }
- }
-
- ax = fabs(x);
- /* special value of x */
- if(lx==0) {
- if(ix==0x7ff00000||ix==0||ix==0x3ff00000){
- z = ax; /*x is +-0,+-inf,+-1*/
- if(hy<0) z = one/z; /* z = (1/|x|) */
- if(hx<0) {
- if(((ix-0x3ff00000)|yisint)==0) {
- z = (z-z)/(z-z); /* (-1)**non-int is NaN */
- } else if(yisint==1)
- z = -1.0*z; /* (x<0)**odd = -(|x|**odd) */
- }
- return z;
- }
- }
-
- n = (hx>>31)+1;
-
- /* (x<0)**(non-int) is NaN */
- if((n|yisint)==0) return (x-x)/(x-x);
-
- s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
- if((n|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */
-
- /* |y| is huge */
- if(iy>0x41e00000) { /* if |y| > 2**31 */
- if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */
- if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
- if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
- }
- /* over/underflow if x is not close to one */
- if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny;
- if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny;
- /* now |1-x| is tiny <= 2**-20, suffice to compute
- log(x) by x-x^2/2+x^3/3-x^4/4 */
- t = ax-one; /* t has 20 trailing zeros */
- w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
- u = ivln2_h*t; /* ivln2_h has 21 sig. bits */
- v = t*ivln2_l-w*ivln2;
- t1 = u+v;
- __LO(t1) = 0;
- t2 = v-(t1-u);
- } else {
- double ss,s2,s_h,s_l,t_h,t_l;
- n = 0;
- /* take care subnormal number */
- if(ix<0x00100000)
- {ax *= two53; n -= 53; ix = __HI(ax); }
- n += ((ix)>>20)-0x3ff;
- j = ix&0x000fffff;
- /* determine interval */
- ix = j|0x3ff00000; /* normalize ix */
- if(j<=0x3988E) k=0; /* |x|<sqrt(3/2) */
- else if(j<0xBB67A) k=1; /* |x|<sqrt(3) */
- else {k=0;n+=1;ix -= 0x00100000;}
- __HI(ax) = ix;
-
- /* compute ss = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
- u = ax-bp[k]; /* bp[0]=1.0, bp[1]=1.5 */
- v = one/(ax+bp[k]);
- ss = u*v;
- s_h = ss;
- __LO(s_h) = 0;
- /* t_h=ax+bp[k] High */
- t_h = zero;
- __HI(t_h)=((ix>>1)|0x20000000)+0x00080000+(k<<18);
- t_l = ax - (t_h-bp[k]);
- s_l = v*((u-s_h*t_h)-s_h*t_l);
- /* compute log(ax) */
- s2 = ss*ss;
- r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6)))));
- r += s_l*(s_h+ss);
- s2 = s_h*s_h;
- t_h = 3.0+s2+r;
- __LO(t_h) = 0;
- t_l = r-((t_h-3.0)-s2);
- /* u+v = ss*(1+...) */
- u = s_h*t_h;
- v = s_l*t_h+t_l*ss;
- /* 2/(3log2)*(ss+...) */
- p_h = u+v;
- __LO(p_h) = 0;
- p_l = v-(p_h-u);
- z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */
- z_l = cp_l*p_h+p_l*cp+dp_l[k];
- /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */
- t = (double)n;
- t1 = (((z_h+z_l)+dp_h[k])+t);
- __LO(t1) = 0;
- t2 = z_l-(((t1-t)-dp_h[k])-z_h);
- }
-
- /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
- y1 = y;
- __LO(y1) = 0;
- p_l = (y-y1)*t1+y*t2;
- p_h = y1*t1;
- z = p_l+p_h;
- j = __HI(z);
- i = __LO(z);
- if (j>=0x40900000) { /* z >= 1024 */
- if(((j-0x40900000)|i)!=0) /* if z > 1024 */
- return s*huge*huge; /* overflow */
- else {
- if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */
- }
- } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */
- if(((j-0xc090cc00)|i)!=0) /* z < -1075 */
- return s*tiny*tiny; /* underflow */
- else {
- if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */
- }
- }
- /*
- * compute 2**(p_h+p_l)
- */
- i = j&0x7fffffff;
- k = (i>>20)-0x3ff;
- n = 0;
- if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */
- n = j+(0x00100000>>(k+1));
- k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */
- t = zero;
- __HI(t) = (n&~(0x000fffff>>k));
- n = ((n&0x000fffff)|0x00100000)>>(20-k);
- if(j<0) n = -n;
- p_h -= t;
- }
- t = p_l+p_h;
- __LO(t) = 0;
- u = t*lg2_h;
- v = (p_l-(t-p_h))*lg2+t*lg2_l;
- z = u+v;
- w = v-(z-u);
- t = z*z;
- t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
- r = (z*t1)/(t1-two)-(w+z*w);
- z = one-(r-z);
- j = __HI(z);
- j += (n<<20);
- if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */
- else __HI(z) += (n<<20);
- return s*z;
-}
--- a/jdk/src/java.base/share/native/libfdlibm/fdlibm.h Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libfdlibm/fdlibm.h Tue Sep 22 11:01:54 2015 -0700
@@ -133,7 +133,6 @@
extern double log10 __P((double));
extern double modf __P((double, double *));
-extern double pow __P((double, double));
extern double sqrt __P((double));
extern double ceil __P((double));
@@ -187,7 +186,6 @@
extern double __ieee754_exp __P((double));
extern double __ieee754_cosh __P((double));
extern double __ieee754_fmod __P((double,double));
-extern double __ieee754_pow __P((double,double));
extern double __ieee754_log10 __P((double));
extern double __ieee754_sinh __P((double));
extern double __ieee754_hypot __P((double,double));
--- a/jdk/src/java.base/share/native/libfdlibm/w_pow.c Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-
-
-/*
- * Copyright (c) 1998, 2001, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-
-/*
- * wrapper pow(x,y) return x**y
- */
-
-#include "fdlibm.h"
-
-
-#ifdef __STDC__
- double pow(double x, double y) /* wrapper pow */
-#else
- double pow(x,y) /* wrapper pow */
- double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
- return __ieee754_pow(x,y);
-#else
- double z;
- z=__ieee754_pow(x,y);
- if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;
- if(isnan(x)) {
- if(y==0.0)
- return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
- else
- return z;
- }
- if(x==0.0){
- if(y==0.0)
- return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
- if(finite(y)&&y<0.0)
- return __kernel_standard(x,y,23); /* pow(0.0,negative) */
- return z;
- }
- if(!finite(z)) {
- if(finite(x)&&finite(y)) {
- if(isnan(z))
- return __kernel_standard(x,y,24); /* pow neg**non-int */
- else
- return __kernel_standard(x,y,21); /* pow overflow */
- }
- }
- if(z==0.0&&finite(x)&&finite(y))
- return __kernel_standard(x,y,22); /* pow underflow */
- return z;
-#endif
-}
--- a/jdk/src/java.base/share/native/libjava/StrictMath.c Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjava/StrictMath.c Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2015, 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
@@ -101,12 +101,6 @@
}
JNIEXPORT jdouble JNICALL
-Java_java_lang_StrictMath_pow(JNIEnv *env, jclass unused, jdouble d1, jdouble d2)
-{
- return (jdouble) jpow((double)d1, (double)d2);
-}
-
-JNIEXPORT jdouble JNICALL
Java_java_lang_StrictMath_IEEEremainder(JNIEnv *env, jclass unused,
jdouble dividend,
jdouble divisor)
--- a/jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,7 +4,9 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -19,7 +21,6 @@
* 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.
- *
*/
#include <string.h>
--- a/jdk/src/java.base/share/native/libjimage/endian.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/endian.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,11 +4,13 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* 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
+ * 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).
*
@@ -19,7 +21,6 @@
* 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.
- *
*/
#include "endian.hpp"
@@ -27,20 +28,20 @@
// Most modern compilers optimize the bswap routines to native instructions.
inline static u2 bswap_16(u2 x) {
- return ((x & 0xFF) << 8) |
- ((x >> 8) & 0xFF);
+ return ((x & 0xFF) << 8) |
+ ((x >> 8) & 0xFF);
}
inline static u4 bswap_32(u4 x) {
- return ((x & 0xFF) << 24) |
- ((x & 0xFF00) << 8) |
- ((x >> 8) & 0xFF00) |
- ((x >> 24) & 0xFF);
+ return ((x & 0xFF) << 24) |
+ ((x & 0xFF00) << 8) |
+ ((x >> 8) & 0xFF00) |
+ ((x >> 24) & 0xFF);
}
inline static u8 bswap_64(u8 x) {
- return (u8)bswap_32((u4)x) << 32 |
- (u8)bswap_32((u4)(x >> 32));
+ return (u8)bswap_32((u4)x) << 32 |
+ (u8)bswap_32((u4)(x >> 32));
}
u2 NativeEndian::get(u2 x) { return x; }
@@ -76,27 +77,27 @@
SwappingEndian SwappingEndian::_swapping;
Endian* Endian::get_handler(bool big_endian) {
- // If requesting little endian on a little endian machine or
- // big endian on a big endian machine use native handler
- if (big_endian == is_big_endian()) {
- return NativeEndian::get_native();
- } else {
- // Use swapping handler.
- return SwappingEndian::get_swapping();
- }
+ // If requesting little endian on a little endian machine or
+ // big endian on a big endian machine use native handler
+ if (big_endian == is_big_endian()) {
+ return NativeEndian::get_native();
+ } else {
+ // Use swapping handler.
+ return SwappingEndian::get_swapping();
+ }
}
// Return a platform u2 from an array in which Big Endian is applied.
u2 Endian::get_java(u1* x) {
- return (u2) (x[0]<<8 | x[1]);
+ return (u2) (x[0]<<8 | x[1]);
}
// Add a platform u2 to the array as a Big Endian u2
void Endian::set_java(u1* p, u2 x) {
- p[0] = (x >> 8) & 0xff;
- p[1] = x & 0xff;
+ p[0] = (x >> 8) & 0xff;
+ p[1] = x & 0xff;
}
Endian* Endian::get_native_handler() {
- return NativeEndian::get_native();
+ return NativeEndian::get_native();
}
--- a/jdk/src/java.base/share/native/libjimage/endian.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/endian.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,11 +4,13 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* 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
+ * 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).
*
@@ -19,7 +21,6 @@
* 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.
- *
*/
#ifndef LIBJIMAGE_ENDIAN_HPP
@@ -36,89 +37,89 @@
// To retrieve a value using the approprate endian, use one of the overloaded
// calls to get. To set a value, then use one of the overloaded set calls.
// Ex.
-// s4 value; // Imported value;
-// ...
-// Endian* endian = Endian::get_handler(true); // Use big endian
-// s4 corrected = endian->get(value);
-// endian->set(value, 1);
+// s4 value; // Imported value;
+// ...
+// Endian* endian = Endian::get_handler(true); // Use big endian
+// s4 corrected = endian->get(value);
+// endian->set(value, 1);
//
class Endian {
public:
- virtual u2 get(u2 x) = 0;
- virtual u4 get(u4 x) = 0;
- virtual u8 get(u8 x) = 0;
- virtual s2 get(s2 x) = 0;
- virtual s4 get(s4 x) = 0;
- virtual s8 get(s8 x) = 0;
+ virtual u2 get(u2 x) = 0;
+ virtual u4 get(u4 x) = 0;
+ virtual u8 get(u8 x) = 0;
+ virtual s2 get(s2 x) = 0;
+ virtual s4 get(s4 x) = 0;
+ virtual s8 get(s8 x) = 0;
- virtual void set(u2& x, u2 y) = 0;
- virtual void set(u4& x, u4 y) = 0;
- virtual void set(u8& x, u8 y) = 0;
- virtual void set(s2& x, s2 y) = 0;
- virtual void set(s4& x, s4 y) = 0;
- virtual void set(s8& x, s8 y) = 0;
+ virtual void set(u2& x, u2 y) = 0;
+ virtual void set(u4& x, u4 y) = 0;
+ virtual void set(u8& x, u8 y) = 0;
+ virtual void set(s2& x, s2 y) = 0;
+ virtual void set(s4& x, s4 y) = 0;
+ virtual void set(s8& x, s8 y) = 0;
- // Quick little endian test.
- static bool is_little_endian() { u4 x = 1; return *(u1 *)&x != 0; }
+ // Quick little endian test.
+ static bool is_little_endian() { u4 x = 1; return *(u1 *)&x != 0; }
- // Quick big endian test.
- static bool is_big_endian() { return !is_little_endian(); }
+ // Quick big endian test.
+ static bool is_big_endian() { return !is_little_endian(); }
- // Select an appropriate endian handler.
- static Endian* get_handler(bool big_endian);
+ // Select an appropriate endian handler.
+ static Endian* get_handler(bool big_endian);
- // Return the native endian handler.
- static Endian* get_native_handler();
+ // Return the native endian handler.
+ static Endian* get_native_handler();
- // get platform u2 from Java Big endian
- static u2 get_java(u1* x);
- // set platform u2 to Java Big endian
- static void set_java(u1* p, u2 x);
+ // get platform u2 from Java Big endian
+ static u2 get_java(u1* x);
+ // set platform u2 to Java Big endian
+ static void set_java(u1* p, u2 x);
};
// Normal endian handling.
class NativeEndian : public Endian {
private:
- static NativeEndian _native;
+ static NativeEndian _native;
public:
- u2 get(u2 x);
- u4 get(u4 x);
- u8 get(u8 x);
- s2 get(s2 x);
- s4 get(s4 x);
- s8 get(s8 x);
+ u2 get(u2 x);
+ u4 get(u4 x);
+ u8 get(u8 x);
+ s2 get(s2 x);
+ s4 get(s4 x);
+ s8 get(s8 x);
- void set(u2& x, u2 y);
- void set(u4& x, u4 y);
- void set(u8& x, u8 y);
- void set(s2& x, s2 y);
- void set(s4& x, s4 y);
- void set(s8& x, s8 y);
+ void set(u2& x, u2 y);
+ void set(u4& x, u4 y);
+ void set(u8& x, u8 y);
+ void set(s2& x, s2 y);
+ void set(s4& x, s4 y);
+ void set(s8& x, s8 y);
- static Endian* get_native() { return &_native; }
+ static Endian* get_native() { return &_native; }
};
// Swapping endian handling.
class SwappingEndian : public Endian {
private:
- static SwappingEndian _swapping;
+ static SwappingEndian _swapping;
public:
- u2 get(u2 x);
- u4 get(u4 x);
- u8 get(u8 x);
- s2 get(s2 x);
- s4 get(s4 x);
- s8 get(s8 x);
+ u2 get(u2 x);
+ u4 get(u4 x);
+ u8 get(u8 x);
+ s2 get(s2 x);
+ s4 get(s4 x);
+ s8 get(s8 x);
- void set(u2& x, u2 y);
- void set(u4& x, u4 y);
- void set(u8& x, u8 y);
- void set(s2& x, s2 y);
- void set(s4& x, s4 y);
- void set(s8& x, s8 y);
+ void set(u2& x, u2 y);
+ void set(u4& x, u4 y);
+ void set(u8& x, u8 y);
+ void set(s2& x, s2 y);
+ void set(s4& x, s4 y);
+ void set(s8& x, s8 y);
- static Endian* get_swapping() { return &_swapping; }
+ static Endian* get_swapping() { return &_swapping; }
};
#endif // LIBJIMAGE_ENDIAN_HPP
--- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,11 +4,13 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* 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
+ * 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).
*
@@ -19,10 +21,8 @@
* 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.
- *
*/
-
#include "jni.h"
#include "imageDecompressor.hpp"
#include "endian.hpp"
@@ -32,16 +32,17 @@
#include <dlfcn.h>
#endif
-typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
-static ZipInflateFully_t ZipInflateFully = NULL;
+typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen,
+ void *outBuf, jlong outLen, char **pmsg);
+static ZipInflateFully_t ZipInflateFully = NULL;
#ifndef WIN32
- #define JNI_LIB_PREFIX "lib"
- #ifdef __APPLE__
- #define JNI_LIB_SUFFIX ".dylib"
- #else
- #define JNI_LIB_SUFFIX ".so"
- #endif
+ #define JNI_LIB_PREFIX "lib"
+ #ifdef __APPLE__
+ #define JNI_LIB_SUFFIX ".dylib"
+ #else
+ #define JNI_LIB_SUFFIX ".so"
+ #endif
#endif
/**
@@ -50,21 +51,21 @@
* @return the address of the entry point or NULL
*/
static void* findEntry(const char* name) {
- void *addr = NULL;
+ void *addr = NULL;
#ifdef WIN32
- HMODULE handle = GetModuleHandle("zip.dll");
- if (handle == NULL) {
- return NULL;
- }
- addr = (void*) GetProcAddress(handle, name);
- return addr;
+ HMODULE handle = GetModuleHandle("zip.dll");
+ if (handle == NULL) {
+ return NULL;
+ }
+ addr = (void*) GetProcAddress(handle, name);
+ return addr;
#else
- addr = dlopen(JNI_LIB_PREFIX "zip" JNI_LIB_SUFFIX, RTLD_GLOBAL|RTLD_LAZY);
- if (addr == NULL) {
- return NULL;
- }
- addr = dlsym(addr, name);
- return addr;
+ addr = dlopen(JNI_LIB_PREFIX "zip" JNI_LIB_SUFFIX, RTLD_GLOBAL|RTLD_LAZY);
+ if (addr == NULL) {
+ return NULL;
+ }
+ addr = dlsym(addr, name);
+ return addr;
#endif
}
@@ -74,87 +75,87 @@
int ImageDecompressor::_decompressors_num = 0;
ImageDecompressor** ImageDecompressor::_decompressors = NULL;
void ImageDecompressor::image_decompressor_init() {
- if (_decompressors == NULL) {
- ZipInflateFully = (ZipInflateFully_t) findEntry("ZIP_InflateFully");
- assert(ZipInflateFully != NULL && "ZIP decompressor not found.");
- _decompressors_num = 2;
- _decompressors = new ImageDecompressor*[_decompressors_num];
- _decompressors[0] = new ZipDecompressor("zip");
- _decompressors[1] = new SharedStringDecompressor("compact-cp");
- }
+ if (_decompressors == NULL) {
+ ZipInflateFully = (ZipInflateFully_t) findEntry("ZIP_InflateFully");
+ assert(ZipInflateFully != NULL && "ZIP decompressor not found.");
+ _decompressors_num = 2;
+ _decompressors = new ImageDecompressor*[_decompressors_num];
+ _decompressors[0] = new ZipDecompressor("zip");
+ _decompressors[1] = new SharedStringDecompressor("compact-cp");
+ }
}
void ImageDecompressor::image_decompressor_close() {
- delete _decompressors;
+ delete _decompressors;
}
/*
* Locate decompressor.
*/
ImageDecompressor* ImageDecompressor::get_decompressor(const char * decompressor_name) {
- image_decompressor_init();
- for (int i = 0; i < _decompressors_num; i++) {
- ImageDecompressor* decompressor = _decompressors[i];
- assert(decompressor != NULL && "Decompressors not initialized.");
- if (strcmp(decompressor->get_name(), decompressor_name) == 0) {
- return decompressor;
+ image_decompressor_init();
+ for (int i = 0; i < _decompressors_num; i++) {
+ ImageDecompressor* decompressor = _decompressors[i];
+ assert(decompressor != NULL && "Decompressors not initialized.");
+ if (strcmp(decompressor->get_name(), decompressor_name) == 0) {
+ return decompressor;
+ }
}
- }
- assert(false && "No decompressor found.");
- return NULL;
+ assert(false && "No decompressor found.");
+ return NULL;
}
/*
* Decompression entry point. Called from ImageFileReader::get_resource.
*/
void ImageDecompressor::decompress_resource(u1* compressed, u1* uncompressed,
- u4 uncompressed_size, const ImageStrings* strings) {
- bool has_header = false;
- u1* decompressed_resource = compressed;
- u1* compressed_resource = compressed;
+ u4 uncompressed_size, const ImageStrings* strings) {
+ bool has_header = false;
+ u1* decompressed_resource = compressed;
+ u1* compressed_resource = compressed;
- // Resource could have been transformed by a stack of decompressors.
- // Iterate and decompress resources until there is no more header.
- do {
- ResourceHeader _header;
- memcpy(&_header, compressed_resource, sizeof (ResourceHeader));
- has_header = _header._magic == ResourceHeader::resource_header_magic;
- if (has_header) {
- // decompressed_resource array contains the result of decompression
- decompressed_resource = new u1[_header._uncompressed_size];
- // Retrieve the decompressor name
- const char* decompressor_name = strings->get(_header._decompressor_name_offset);
- assert(decompressor_name && "image decompressor not found");
- // Retrieve the decompressor instance
- ImageDecompressor* decompressor = get_decompressor(decompressor_name);
- assert(decompressor && "image decompressor not found");
- u1* compressed_resource_base = compressed_resource;
- compressed_resource += ResourceHeader::resource_header_length;
- // Ask the decompressor to decompress the compressed content
- decompressor->decompress_resource(compressed_resource, decompressed_resource,
- &_header, strings);
- if (compressed_resource_base != compressed) {
- delete compressed_resource_base;
- }
- compressed_resource = decompressed_resource;
- }
- } while (has_header);
- memcpy(uncompressed, decompressed_resource, uncompressed_size);
- delete decompressed_resource;
+ // Resource could have been transformed by a stack of decompressors.
+ // Iterate and decompress resources until there is no more header.
+ do {
+ ResourceHeader _header;
+ memcpy(&_header, compressed_resource, sizeof (ResourceHeader));
+ has_header = _header._magic == ResourceHeader::resource_header_magic;
+ if (has_header) {
+ // decompressed_resource array contains the result of decompression
+ decompressed_resource = new u1[_header._uncompressed_size];
+ // Retrieve the decompressor name
+ const char* decompressor_name = strings->get(_header._decompressor_name_offset);
+ assert(decompressor_name && "image decompressor not found");
+ // Retrieve the decompressor instance
+ ImageDecompressor* decompressor = get_decompressor(decompressor_name);
+ assert(decompressor && "image decompressor not found");
+ u1* compressed_resource_base = compressed_resource;
+ compressed_resource += ResourceHeader::resource_header_length;
+ // Ask the decompressor to decompress the compressed content
+ decompressor->decompress_resource(compressed_resource, decompressed_resource,
+ &_header, strings);
+ if (compressed_resource_base != compressed) {
+ delete compressed_resource_base;
+ }
+ compressed_resource = decompressed_resource;
+ }
+ } while (has_header);
+ memcpy(uncompressed, decompressed_resource, uncompressed_size);
+ delete decompressed_resource;
}
// Zip decompressor
void ZipDecompressor::decompress_resource(u1* data, u1* uncompressed,
- ResourceHeader* header, const ImageStrings* strings) {
- char* msg = NULL;
- jboolean res = ZipDecompressor::decompress(data, header->_size, uncompressed,
- header->_uncompressed_size, &msg);
- assert(res && "decompression failed");
+ ResourceHeader* header, const ImageStrings* strings) {
+ char* msg = NULL;
+ jboolean res = ZipDecompressor::decompress(data, header->_size, uncompressed,
+ header->_uncompressed_size, &msg);
+ assert(res && "decompression failed");
}
jboolean ZipDecompressor::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
- return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
+ return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
}
// END Zip Decompressor
@@ -163,141 +164,143 @@
// array index is the constant pool tag. value is size.
// eg: array[5] = 8; means size of long is 8 bytes.
-const u1 SharedStringDecompressor::sizes[] = {0, 0, 0, 4, 4, 8, 8, 2, 2, 4, 4, 4, 4, 0, 0, 3, 2, 0, 4};
+const u1 SharedStringDecompressor::sizes[] = {
+ 0, 0, 0, 4, 4, 8, 8, 2, 2, 4, 4, 4, 4, 0, 0, 3, 2, 0, 4
+};
/**
* Recreate the class by reconstructing the constant pool.
*/
void SharedStringDecompressor::decompress_resource(u1* data,
- u1* uncompressed_resource,
- ResourceHeader* header, const ImageStrings* strings) {
- u1* uncompressed_base = uncompressed_resource;
- u1* data_base = data;
- int header_size = 8; // magic + major + minor
- memcpy(uncompressed_resource, data, header_size + 2); //+ cp count
- uncompressed_resource += header_size + 2;
- data += header_size;
- u2 cp_count = Endian::get_java(data);
- data += 2;
- for (int i = 1; i < cp_count; i++) {
- u1 tag = *data;
- data += 1;
- switch (tag) {
+ u1* uncompressed_resource,
+ ResourceHeader* header, const ImageStrings* strings) {
+ u1* uncompressed_base = uncompressed_resource;
+ u1* data_base = data;
+ int header_size = 8; // magic + major + minor
+ memcpy(uncompressed_resource, data, header_size + 2); //+ cp count
+ uncompressed_resource += header_size + 2;
+ data += header_size;
+ u2 cp_count = Endian::get_java(data);
+ data += 2;
+ for (int i = 1; i < cp_count; i++) {
+ u1 tag = *data;
+ data += 1;
+ switch (tag) {
- case externalized_string:
- { // String in Strings table
- *uncompressed_resource = 1;
- uncompressed_resource += 1;
- int i = decompress_int(data);
- const char * string = strings->get(i);
- int str_length = (int) strlen(string);
- Endian::set_java(uncompressed_resource, str_length);
- uncompressed_resource += 2;
- memcpy(uncompressed_resource, string, str_length);
- uncompressed_resource += str_length;
- break;
- }
- // Descriptor String has been split and types added to Strings table
- case externalized_string_descriptor:
- {
- *uncompressed_resource = 1;
- uncompressed_resource += 1;
- int descriptor_index = decompress_int(data);
- int indexes_length = decompress_int(data);
- u1* length_address = uncompressed_resource;
- uncompressed_resource += 2;
- int desc_length = 0;
- const char * desc_string = strings->get(descriptor_index);
- if (indexes_length > 0) {
- u1* indexes_base = data;
- data += indexes_length;
- char c = *desc_string;
- do {
- *uncompressed_resource = c;
- uncompressed_resource++;
- desc_length += 1;
- /*
- * Every L character is the marker we are looking at in order
- * to reconstruct the descriptor. Each time an L is found, then
- * we retrieve the couple token/token at the current index and
- * add it to the descriptor.
- * "(L;I)V" and "java/lang","String" couple of tokens,
- * this becomes "(Ljava/lang/String;I)V"
- */
- if (c == 'L') {
- int index = decompress_int(indexes_base);
- const char * pkg = strings->get(index);
- int str_length = (int) strlen(pkg);
- // the case where we have a package.
- // reconstruct the type full name
- if (str_length > 0) {
- int len = str_length + 1;
- char* fullpkg = new char[len];
- char* pkg_base = fullpkg;
- memcpy(fullpkg, pkg, str_length);
- fullpkg += str_length;
- *fullpkg = '/';
- memcpy(uncompressed_resource, pkg_base, len);
+ case externalized_string:
+ { // String in Strings table
+ *uncompressed_resource = 1;
+ uncompressed_resource += 1;
+ int i = decompress_int(data);
+ const char * string = strings->get(i);
+ int str_length = (int) strlen(string);
+ Endian::set_java(uncompressed_resource, str_length);
+ uncompressed_resource += 2;
+ memcpy(uncompressed_resource, string, str_length);
+ uncompressed_resource += str_length;
+ break;
+ }
+ // Descriptor String has been split and types added to Strings table
+ case externalized_string_descriptor:
+ {
+ *uncompressed_resource = 1;
+ uncompressed_resource += 1;
+ int descriptor_index = decompress_int(data);
+ int indexes_length = decompress_int(data);
+ u1* length_address = uncompressed_resource;
+ uncompressed_resource += 2;
+ int desc_length = 0;
+ const char * desc_string = strings->get(descriptor_index);
+ if (indexes_length > 0) {
+ u1* indexes_base = data;
+ data += indexes_length;
+ char c = *desc_string;
+ do {
+ *uncompressed_resource = c;
+ uncompressed_resource++;
+ desc_length += 1;
+ /*
+ * Every L character is the marker we are looking at in order
+ * to reconstruct the descriptor. Each time an L is found, then
+ * we retrieve the couple token/token at the current index and
+ * add it to the descriptor.
+ * "(L;I)V" and "java/lang","String" couple of tokens,
+ * this becomes "(Ljava/lang/String;I)V"
+ */
+ if (c == 'L') {
+ int index = decompress_int(indexes_base);
+ const char * pkg = strings->get(index);
+ int str_length = (int) strlen(pkg);
+ // the case where we have a package.
+ // reconstruct the type full name
+ if (str_length > 0) {
+ int len = str_length + 1;
+ char* fullpkg = new char[len];
+ char* pkg_base = fullpkg;
+ memcpy(fullpkg, pkg, str_length);
+ fullpkg += str_length;
+ *fullpkg = '/';
+ memcpy(uncompressed_resource, pkg_base, len);
+ uncompressed_resource += len;
+ delete pkg_base;
+ desc_length += len;
+ } else { // Empty package
+ // Nothing to do.
+ }
+ int classIndex = decompress_int(indexes_base);
+ const char * clazz = strings->get(classIndex);
+ int clazz_length = (int) strlen(clazz);
+ memcpy(uncompressed_resource, clazz, clazz_length);
+ uncompressed_resource += clazz_length;
+ desc_length += clazz_length;
+ }
+ desc_string += 1;
+ c = *desc_string;
+ } while (c != '\0');
+ } else {
+ desc_length = (int) strlen(desc_string);
+ memcpy(uncompressed_resource, desc_string, desc_length);
+ uncompressed_resource += desc_length;
+ }
+ Endian::set_java(length_address, desc_length);
+ break;
+ }
+
+ case constant_utf8:
+ { // UTF-8
+ *uncompressed_resource = tag;
+ uncompressed_resource += 1;
+ u2 str_length = Endian::get_java(data);
+ int len = str_length + 2;
+ memcpy(uncompressed_resource, data, len);
uncompressed_resource += len;
- delete pkg_base;
- desc_length += len;
- } else { // Empty package
- // Nothing to do.
- }
- int classIndex = decompress_int(indexes_base);
- const char * clazz = strings->get(classIndex);
- int clazz_length = (int) strlen(clazz);
- memcpy(uncompressed_resource, clazz, clazz_length);
- uncompressed_resource += clazz_length;
- desc_length += clazz_length;
+ data += len;
+ break;
}
- desc_string += 1;
- c = *desc_string;
- } while (c != '\0');
- } else {
- desc_length = (int) strlen(desc_string);
- memcpy(uncompressed_resource, desc_string, desc_length);
- uncompressed_resource += desc_length;
- }
- Endian::set_java(length_address, desc_length);
- break;
- }
- case constant_utf8:
- { // UTF-8
- *uncompressed_resource = tag;
- uncompressed_resource += 1;
- u2 str_length = Endian::get_java(data);
- int len = str_length + 2;
- memcpy(uncompressed_resource, data, len);
- uncompressed_resource += len;
- data += len;
- break;
- }
-
- case constant_long:
- case constant_double:
- {
- i++;
- }
- default:
- {
- *uncompressed_resource = tag;
- uncompressed_resource += 1;
- int size = sizes[tag];
- memcpy(uncompressed_resource, data, size);
- uncompressed_resource += size;
- data += size;
- }
+ case constant_long:
+ case constant_double:
+ {
+ i++;
+ }
+ default:
+ {
+ *uncompressed_resource = tag;
+ uncompressed_resource += 1;
+ int size = sizes[tag];
+ memcpy(uncompressed_resource, data, size);
+ uncompressed_resource += size;
+ data += size;
+ }
+ }
}
- }
- u4 remain = header->_size - (int)(data - data_base);
- u4 computed = (u4)(uncompressed_resource - uncompressed_base) + remain;
- if (header->_uncompressed_size != computed)
- printf("Failure, expecting %d but getting %d\n", header->_uncompressed_size,
- computed);
- assert(header->_uncompressed_size == computed &&
- "Constant Pool reconstruction failed");
- memcpy(uncompressed_resource, data, remain);
+ u4 remain = header->_size - (int)(data - data_base);
+ u4 computed = (u4)(uncompressed_resource - uncompressed_base) + remain;
+ if (header->_uncompressed_size != computed)
+ printf("Failure, expecting %d but getting %d\n", header->_uncompressed_size,
+ computed);
+ assert(header->_uncompressed_size == computed &&
+ "Constant Pool reconstruction failed");
+ memcpy(uncompressed_resource, data, remain);
}
/*
@@ -308,25 +311,25 @@
* Example of compression: 1 is compressed on 1 byte: 10100001
*/
int SharedStringDecompressor::decompress_int(unsigned char*& value) {
- int len = 4;
- int res = 0;
- char b1 = *value;
- if (is_compressed((signed char)b1)) { // compressed
- len = get_compressed_length(b1);
- char clearedValue = b1 &= 0x1F;
- if (len == 1) {
- res = clearedValue;
+ int len = 4;
+ int res = 0;
+ char b1 = *value;
+ if (is_compressed((signed char)b1)) { // compressed
+ len = get_compressed_length(b1);
+ char clearedValue = b1 &= 0x1F;
+ if (len == 1) {
+ res = clearedValue;
+ } else {
+ res = (clearedValue & 0xFF) << 8 * (len - 1);
+ for (int i = 1; i < len; i++) {
+ res |= (value[i]&0xFF) << 8 * (len - i - 1);
+ }
+ }
} else {
- res = (clearedValue & 0xFF) << 8 * (len - 1);
- for (int i = 1; i < len; i++) {
- res |= (value[i]&0xFF) << 8 * (len - i - 1);
- }
+ res = (value[0] & 0xFF) << 24 | (value[1]&0xFF) << 16 |
+ (value[2]&0xFF) << 8 | (value[3]&0xFF);
}
- } else {
- res = (value[0] & 0xFF) << 24 | (value[1]&0xFF) << 16 |
- (value[2]&0xFF) << 8 | (value[3]&0xFF);
- }
- value += len;
- return res;
+ value += len;
+ return res;
}
// END Shared String decompressor
--- a/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/imageDecompressor.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,11 +4,13 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* 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
+ * 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).
*
@@ -19,7 +21,6 @@
* 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.
- *
*/
#ifndef LIBJIMAGE_IMAGEDECOMPRESSOR_HPP
@@ -47,16 +48,16 @@
* have been used to compress the resource.
*/
struct ResourceHeader {
- /* Length of header, needed to retrieve content offset */
- static const u1 resource_header_length = 21;
- /* magic bytes that identifies a compressed resource header*/
- static const u4 resource_header_magic = 0xCAFEFAFA;
- u4 _magic; // Resource header
- u4 _size; // Resource size
- u4 _uncompressed_size; // Expected uncompressed size
- u4 _decompressor_name_offset; // Strings table decompressor offset
- u4 _decompressor_config_offset; // Strings table config offset
- u1 _is_terminal; // Last decompressor 1, otherwise 0.
+ /* Length of header, needed to retrieve content offset */
+ static const u1 resource_header_length = 21;
+ /* magic bytes that identifies a compressed resource header*/
+ static const u4 resource_header_magic = 0xCAFEFAFA;
+ u4 _magic; // Resource header
+ u4 _size; // Resource size
+ u4 _uncompressed_size; // Expected uncompressed size
+ u4 _decompressor_name_offset; // Strings table decompressor offset
+ u4 _decompressor_config_offset; // Strings table config offset
+ u1 _is_terminal; // Last decompressor 1, otherwise 0.
};
/*
@@ -77,36 +78,36 @@
class ImageDecompressor {
private:
- const char* _name;
+ const char* _name;
- /*
- * Array of concrete decompressors. This array is used to retrieve the decompressor
- * that can handle resource decompression.
- */
- static ImageDecompressor** _decompressors;
- /**
- * Num of decompressors
- */
- static int _decompressors_num;
- /*
- * Identifier of a decompressor. This name is the identification key to retrieve
- * decompressor from a resource header.
- */
- inline const char* get_name() const { return _name; }
+ /*
+ * Array of concrete decompressors. This array is used to retrieve the decompressor
+ * that can handle resource decompression.
+ */
+ static ImageDecompressor** _decompressors;
+ /**
+ * Num of decompressors
+ */
+ static int _decompressors_num;
+ /*
+ * Identifier of a decompressor. This name is the identification key to retrieve
+ * decompressor from a resource header.
+ */
+ inline const char* get_name() const { return _name; }
protected:
- ImageDecompressor(const char* name) : _name(name) {
- }
- virtual void decompress_resource(u1* data, u1* uncompressed,
- ResourceHeader* header, const ImageStrings* strings) = 0;
+ ImageDecompressor(const char* name) : _name(name) {
+ }
+ virtual void decompress_resource(u1* data, u1* uncompressed,
+ ResourceHeader* header, const ImageStrings* strings) = 0;
public:
- static void image_decompressor_init();
- static void image_decompressor_close();
- static ImageDecompressor* get_decompressor(const char * decompressor_name) ;
- static void decompress_resource(u1* compressed, u1* uncompressed,
- u4 uncompressed_size, const ImageStrings* strings);
+ static void image_decompressor_init();
+ static void image_decompressor_close();
+ static ImageDecompressor* get_decompressor(const char * decompressor_name) ;
+ static void decompress_resource(u1* compressed, u1* uncompressed,
+ u4 uncompressed_size, const ImageStrings* strings);
};
/**
@@ -114,10 +115,10 @@
*/
class ZipDecompressor : public ImageDecompressor {
public:
- ZipDecompressor(const char* sym) : ImageDecompressor(sym) { }
- void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
- const ImageStrings* strings);
- static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
+ ZipDecompressor(const char* sym) : ImageDecompressor(sym) { }
+ void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
+ const ImageStrings* strings);
+ static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
};
/*
@@ -131,32 +132,34 @@
*/
class SharedStringDecompressor : public ImageDecompressor {
private:
- // the constant pool tag for UTF8 string located in strings table
- static const int externalized_string = 23;
- // the constant pool tag for UTF8 descriptors string located in strings table
- static const int externalized_string_descriptor = 25;
- // the constant pool tag for UTF8
- static const int constant_utf8 = 1;
- // the constant pool tag for long
- static const int constant_long = 5;
- // the constant pool tag for double
- static const int constant_double = 6;
- // array index is the constant pool tag. value is size.
- // eg: array[5] = 8; means size of long is 8 bytes.
- static const u1 sizes[];
- // bit 5 and 6 are used to store the length of the compressed integer.
- // size can be 1 (01), 2 (10), 3 (11).
- // 0x60 ==> 0110000
- static const int compressed_index_size_mask = 0x60;
- /*
- * mask the length bits (5 and 6) and move to the right 5 bits.
- */
- inline static int get_compressed_length(char c) { return ((char) (c & compressed_index_size_mask) >> 5); }
- inline static bool is_compressed(signed char b1) { return b1 < 0; }
- static int decompress_int(unsigned char*& value);
+ // the constant pool tag for UTF8 string located in strings table
+ static const int externalized_string = 23;
+ // the constant pool tag for UTF8 descriptors string located in strings table
+ static const int externalized_string_descriptor = 25;
+ // the constant pool tag for UTF8
+ static const int constant_utf8 = 1;
+ // the constant pool tag for long
+ static const int constant_long = 5;
+ // the constant pool tag for double
+ static const int constant_double = 6;
+ // array index is the constant pool tag. value is size.
+ // eg: array[5] = 8; means size of long is 8 bytes.
+ static const u1 sizes[];
+ // bit 5 and 6 are used to store the length of the compressed integer.
+ // size can be 1 (01), 2 (10), 3 (11).
+ // 0x60 ==> 0110000
+ static const int compressed_index_size_mask = 0x60;
+ /*
+ * mask the length bits (5 and 6) and move to the right 5 bits.
+ */
+ inline static int get_compressed_length(char c) {
+ return ((char) (c & compressed_index_size_mask) >> 5);
+ }
+ inline static bool is_compressed(signed char b1) { return b1 < 0; }
+ static int decompress_int(unsigned char*& value);
public:
- SharedStringDecompressor(const char* sym) : ImageDecompressor(sym){}
- void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
- const ImageStrings* strings);
+ SharedStringDecompressor(const char* sym) : ImageDecompressor(sym){}
+ void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header,
+ const ImageStrings* strings);
};
#endif // LIBJIMAGE_IMAGEDECOMPRESSOR_HPP
--- a/jdk/src/java.base/share/native/libjimage/imageFile.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/imageFile.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,11 +4,13 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* 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
+ * 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).
*
@@ -19,7 +21,6 @@
* 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.
- *
*/
#include <assert.h>
@@ -50,268 +51,268 @@
// Compute the Perfect Hashing hash code for the supplied UTF-8 string.
s4 ImageStrings::hash_code(const char* string, s4 seed) {
- // Access bytes as unsigned.
- u1* bytes = (u1*)string;
- // Compute hash code.
- for (u1 byte = *bytes++; byte; byte = *bytes++) {
- seed = (seed * HASH_MULTIPLIER) ^ byte;
- }
- // Ensure the result is not signed.
- return seed & 0x7FFFFFFF;
+ // Access bytes as unsigned.
+ u1* bytes = (u1*)string;
+ // Compute hash code.
+ for (u1 byte = *bytes++; byte; byte = *bytes++) {
+ seed = (seed * HASH_MULTIPLIER) ^ byte;
+ }
+ // Ensure the result is not signed.
+ return seed & 0x7FFFFFFF;
}
// Match up a string in a perfect hash table.
// Returns the index where the name should be.
// Result still needs validation for precise match (false positive.)
s4 ImageStrings::find(Endian* endian, const char* name, s4* redirect, u4 length) {
- // If the table is empty, then short cut.
- if (!redirect || !length) {
+ // If the table is empty, then short cut.
+ if (!redirect || !length) {
+ return NOT_FOUND;
+ }
+ // Compute the basic perfect hash for name.
+ s4 hash_code = ImageStrings::hash_code(name);
+ // Modulo table size.
+ s4 index = hash_code % length;
+ // Get redirect entry.
+ // value == 0 then not found
+ // value < 0 then -1 - value is true index
+ // value > 0 then value is seed for recomputing hash.
+ s4 value = endian->get(redirect[index]);
+ // if recompute is required.
+ if (value > 0 ) {
+ // Entry collision value, need to recompute hash.
+ hash_code = ImageStrings::hash_code(name, value);
+ // Modulo table size.
+ return hash_code % length;
+ } else if (value < 0) {
+ // Compute direct index.
+ return -1 - value;
+ }
+ // No entry found.
return NOT_FOUND;
- }
- // Compute the basic perfect hash for name.
- s4 hash_code = ImageStrings::hash_code(name);
- // Modulo table size.
- s4 index = hash_code % length;
- // Get redirect entry.
- // value == 0 then not found
- // value < 0 then -1 - value is true index
- // value > 0 then value is seed for recomputing hash.
- s4 value = endian->get(redirect[index]);
- // if recompute is required.
- if (value > 0 ) {
- // Entry collision value, need to recompute hash.
- hash_code = ImageStrings::hash_code(name, value);
- // Modulo table size.
- return hash_code % length;
- } else if (value < 0) {
- // Compute direct index.
- return -1 - value;
- }
- // No entry found.
- return NOT_FOUND;
}
// Test to see if UTF-8 string begins with the start UTF-8 string. If so,
// return non-NULL address of remaining portion of string. Otherwise, return
-// NULL. Used to test sections of a path without copying from image string
+// NULL. Used to test sections of a path without copying from image string
// table.
const char* ImageStrings::starts_with(const char* string, const char* start) {
- char ch1, ch2;
- // Match up the strings the best we can.
- while ((ch1 = *string) && (ch2 = *start)) {
- if (ch1 != ch2) {
- // Mismatch, return NULL.
- return NULL;
+ char ch1, ch2;
+ // Match up the strings the best we can.
+ while ((ch1 = *string) && (ch2 = *start)) {
+ if (ch1 != ch2) {
+ // Mismatch, return NULL.
+ return NULL;
+ }
+ // Next characters.
+ string++, start++;
}
- // Next characters.
- string++, start++;
- }
- // Return remainder of string.
- return string;
+ // Return remainder of string.
+ return string;
}
// Inflates the attribute stream into individual values stored in the long
// array _attributes. This allows an attribute value to be quickly accessed by
// direct indexing. Unspecified values default to zero (from constructor.)
void ImageLocation::set_data(u1* data) {
- // Deflate the attribute stream into an array of attributes.
- u1 byte;
- // Repeat until end header is found.
- while ((byte = *data)) {
- // Extract kind from header byte.
- u1 kind = attribute_kind(byte);
- assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute");
- // Extract length of data (in bytes).
- u1 n = attribute_length(byte);
- // Read value (most significant first.)
- _attributes[kind] = attribute_value(data + 1, n);
- // Position to next attribute by skipping attribute header and data bytes.
- data += n + 1;
- }
+ // Deflate the attribute stream into an array of attributes.
+ u1 byte;
+ // Repeat until end header is found.
+ while ((byte = *data)) {
+ // Extract kind from header byte.
+ u1 kind = attribute_kind(byte);
+ assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute");
+ // Extract length of data (in bytes).
+ u1 n = attribute_length(byte);
+ // Read value (most significant first.)
+ _attributes[kind] = attribute_value(data + 1, n);
+ // Position to next attribute by skipping attribute header and data bytes.
+ data += n + 1;
+ }
}
// Zero all attribute values.
void ImageLocation::clear_data() {
- // Set defaults to zero.
- memset(_attributes, 0, sizeof(_attributes));
+ // Set defaults to zero.
+ memset(_attributes, 0, sizeof(_attributes));
}
// ImageModuleData constructor maps out sub-tables for faster access.
ImageModuleData::ImageModuleData(const ImageFileReader* image_file,
- const char* module_data_name) :
- _image_file(image_file),
- _endian(image_file->endian()),
- _strings(image_file->get_strings()) {
- // Retrieve the resource containing the module data for the image file.
- ImageLocation location;
- bool found = image_file->find_location(module_data_name, location);
- if (found) {
- u8 data_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
- _data = new u1[(size_t)data_size];
- _image_file->get_resource(location, _data);
- // Map out the header.
- _header = (Header*)_data;
- // Get the package to module entry count.
- u4 ptm_count = _header->ptm_count(_endian);
- // Get the module to package entry count.
- u4 mtp_count = _header->mtp_count(_endian);
- // Compute the offset of the package to module perfect hash redirect.
- u4 ptm_redirect_offset = sizeof(Header);
- // Compute the offset of the package to module data.
- u4 ptm_data_offset = ptm_redirect_offset + ptm_count * sizeof(s4);
- // Compute the offset of the module to package perfect hash redirect.
- u4 mtp_redirect_offset = ptm_data_offset + ptm_count * sizeof(PTMData);
- // Compute the offset of the module to package data.
- u4 mtp_data_offset = mtp_redirect_offset + mtp_count * sizeof(s4);
- // Compute the offset of the module to package tables.
- u4 mtp_packages_offset = mtp_data_offset + mtp_count * sizeof(MTPData);
- // Compute the address of the package to module perfect hash redirect.
- _ptm_redirect = (s4*)(_data + ptm_redirect_offset);
- // Compute the address of the package to module data.
- _ptm_data = (PTMData*)(_data + ptm_data_offset);
- // Compute the address of the module to package perfect hash redirect.
- _mtp_redirect = (s4*)(_data + mtp_redirect_offset);
- // Compute the address of the module to package data.
- _mtp_data = (MTPData*)(_data + mtp_data_offset);
- // Compute the address of the module to package tables.
- _mtp_packages = (s4*)(_data + mtp_packages_offset);
- } else {
- // No module data present.
- _data = NULL;
- _header = NULL;
- _ptm_redirect = NULL;
- _ptm_data = NULL;
- _mtp_redirect = NULL;
- _mtp_data = NULL;
- _mtp_packages = NULL;
- }
+ const char* module_data_name) :
+ _image_file(image_file),
+ _endian(image_file->endian()),
+ _strings(image_file->get_strings()) {
+ // Retrieve the resource containing the module data for the image file.
+ ImageLocation location;
+ bool found = image_file->find_location(module_data_name, location);
+ if (found) {
+ u8 data_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ _data = new u1[(size_t)data_size];
+ _image_file->get_resource(location, _data);
+ // Map out the header.
+ _header = (Header*)_data;
+ // Get the package to module entry count.
+ u4 ptm_count = _header->ptm_count(_endian);
+ // Get the module to package entry count.
+ u4 mtp_count = _header->mtp_count(_endian);
+ // Compute the offset of the package to module perfect hash redirect.
+ u4 ptm_redirect_offset = sizeof(Header);
+ // Compute the offset of the package to module data.
+ u4 ptm_data_offset = ptm_redirect_offset + ptm_count * sizeof(s4);
+ // Compute the offset of the module to package perfect hash redirect.
+ u4 mtp_redirect_offset = ptm_data_offset + ptm_count * sizeof(PTMData);
+ // Compute the offset of the module to package data.
+ u4 mtp_data_offset = mtp_redirect_offset + mtp_count * sizeof(s4);
+ // Compute the offset of the module to package tables.
+ u4 mtp_packages_offset = mtp_data_offset + mtp_count * sizeof(MTPData);
+ // Compute the address of the package to module perfect hash redirect.
+ _ptm_redirect = (s4*)(_data + ptm_redirect_offset);
+ // Compute the address of the package to module data.
+ _ptm_data = (PTMData*)(_data + ptm_data_offset);
+ // Compute the address of the module to package perfect hash redirect.
+ _mtp_redirect = (s4*)(_data + mtp_redirect_offset);
+ // Compute the address of the module to package data.
+ _mtp_data = (MTPData*)(_data + mtp_data_offset);
+ // Compute the address of the module to package tables.
+ _mtp_packages = (s4*)(_data + mtp_packages_offset);
+ } else {
+ // No module data present.
+ _data = NULL;
+ _header = NULL;
+ _ptm_redirect = NULL;
+ _ptm_data = NULL;
+ _mtp_redirect = NULL;
+ _mtp_data = NULL;
+ _mtp_packages = NULL;
+ }
}
// Release module data resource.
ImageModuleData::~ImageModuleData() {
- if (_data) {
- delete _data;
- }
+ if (_data) {
+ delete _data;
+ }
}
// Return the name of the module data resource. Ex. "./lib/modules/file.jimage"
// yields "file.jdata"
void ImageModuleData::module_data_name(char* buffer, const char* image_file_name) {
- // Locate the last slash in the file name path.
- const char* slash = strrchr(image_file_name, FileSeparator);
- // Trim the path to name and extension.
- const char* name = slash ? slash + 1 : (char *)image_file_name;
- // Locate the extension period.
- const char* dot = strrchr(name, '.');
- assert(dot && "missing extension on jimage name");
- // Trim to only base name.
- int length = (int)(dot - name);
- strncpy(buffer, name, length);
- buffer[length] = '\0';
- // Append extension.
- strcat(buffer, ".jdata");
+ // Locate the last slash in the file name path.
+ const char* slash = strrchr(image_file_name, FileSeparator);
+ // Trim the path to name and extension.
+ const char* name = slash ? slash + 1 : (char *)image_file_name;
+ // Locate the extension period.
+ const char* dot = strrchr(name, '.');
+ assert(dot && "missing extension on jimage name");
+ // Trim to only base name.
+ int length = (int)(dot - name);
+ strncpy(buffer, name, length);
+ buffer[length] = '\0';
+ // Append extension.
+ strcat(buffer, ".jdata");
}
-// Return the module in which a package resides. Returns NULL if not found.
+// Return the module in which a package resides. Returns NULL if not found.
const char* ImageModuleData::package_to_module(const char* package_name) {
- // Test files may contain no module data.
- if (_data != NULL) {
- // Search the package to module table.
- s4 index = ImageStrings::find(_endian, package_name, _ptm_redirect,
- _header->ptm_count(_endian));
- // If entry is found.
- if (index != ImageStrings::NOT_FOUND) {
- // Retrieve the package to module entry.
- PTMData* data = _ptm_data + index;
- // Verify that it is the correct data.
- if (strcmp(package_name, get_string(data->name_offset(_endian))) != 0) {
- return NULL;
- }
- // Return the module name.
- return get_string(data->module_name_offset(_endian));
+ // Test files may contain no module data.
+ if (_data != NULL) {
+ // Search the package to module table.
+ s4 index = ImageStrings::find(_endian, package_name, _ptm_redirect,
+ _header->ptm_count(_endian));
+ // If entry is found.
+ if (index != ImageStrings::NOT_FOUND) {
+ // Retrieve the package to module entry.
+ PTMData* data = _ptm_data + index;
+ // Verify that it is the correct data.
+ if (strcmp(package_name, get_string(data->name_offset(_endian))) != 0) {
+ return NULL;
+ }
+ // Return the module name.
+ return get_string(data->module_name_offset(_endian));
+ }
}
- }
- return NULL;
+ return NULL;
}
// Returns all the package names in a module in a NULL terminated array.
// Returns NULL if module not found.
const char** ImageModuleData::module_to_packages(const char* module_name) {
- // Test files may contain no module data.
- if (_data != NULL) {
- // Search the module to package table.
- s4 index = ImageStrings::find(_endian, module_name, _mtp_redirect,
- _header->mtp_count(_endian));
- // If entry is found.
- if (index != ImageStrings::NOT_FOUND) {
- // Retrieve the module to package entry.
- MTPData* data = _mtp_data + index;
- // Verify that it is the correct data.
- if (strcmp(module_name, get_string(data->name_offset(_endian))) != 0) {
- return NULL;
- }
- // Construct an array of all the package entries.
- u4 count = data->package_count(_endian);
- const char** packages = new const char*[count + 1];
- s4 package_offset = data->package_offset(_endian);
- for (u4 i = 0; i < count; i++) {
- u4 package_name_offset = mtp_package(package_offset + i);
- const char* package_name = get_string(package_name_offset);
- packages[i] = package_name;
- }
- packages[count] = NULL;
- return packages;
+ // Test files may contain no module data.
+ if (_data != NULL) {
+ // Search the module to package table.
+ s4 index = ImageStrings::find(_endian, module_name, _mtp_redirect,
+ _header->mtp_count(_endian));
+ // If entry is found.
+ if (index != ImageStrings::NOT_FOUND) {
+ // Retrieve the module to package entry.
+ MTPData* data = _mtp_data + index;
+ // Verify that it is the correct data.
+ if (strcmp(module_name, get_string(data->name_offset(_endian))) != 0) {
+ return NULL;
+ }
+ // Construct an array of all the package entries.
+ u4 count = data->package_count(_endian);
+ const char** packages = new const char*[count + 1];
+ s4 package_offset = data->package_offset(_endian);
+ for (u4 i = 0; i < count; i++) {
+ u4 package_name_offset = mtp_package(package_offset + i);
+ const char* package_name = get_string(package_name_offset);
+ packages[i] = package_name;
+ }
+ packages[count] = NULL;
+ return packages;
+ }
}
- }
- return NULL;
+ return NULL;
}
// Manage a table of open image files. This table allows multiple access points
// to share an open image.
ImageFileReaderTable::ImageFileReaderTable() : _count(0), _max(_growth) {
- _table = new ImageFileReader*[_max];
+ _table = new ImageFileReader*[_max];
}
ImageFileReaderTable::~ImageFileReaderTable() {
- delete _table;
+ delete _table;
}
// Add a new image entry to the table.
void ImageFileReaderTable::add(ImageFileReader* image) {
- if (_count == _max) {
- _max += _growth;
- _table = static_cast<ImageFileReader**>(realloc(_table, _max * sizeof(ImageFileReader*)));
- }
- _table[_count++] = image;
+ if (_count == _max) {
+ _max += _growth;
+ _table = static_cast<ImageFileReader**>(realloc(_table, _max * sizeof(ImageFileReader*)));
+ }
+ _table[_count++] = image;
}
// Remove an image entry from the table.
void ImageFileReaderTable::remove(ImageFileReader* image) {
- s4 last = _count - 1;
- for (s4 i = 0; _count; i++) {
- if (_table[i] == image) {
- if (i != last) {
- _table[i] = _table[last];
- _count = last;
- }
- break;
+ s4 last = _count - 1;
+ for (s4 i = 0; _count; i++) {
+ if (_table[i] == image) {
+ if (i != last) {
+ _table[i] = _table[last];
+ _count = last;
+ }
+ break;
+ }
}
- }
- if (_count != 0 && _count == _max - _growth) {
- _max -= _growth;
- _table = static_cast<ImageFileReader**>(realloc(_table, _max * sizeof(ImageFileReader*)));
- }
+ if (_count != 0 && _count == _max - _growth) {
+ _max -= _growth;
+ _table = static_cast<ImageFileReader**>(realloc(_table, _max * sizeof(ImageFileReader*)));
+ }
}
// Determine if image entry is in table.
bool ImageFileReaderTable::contains(ImageFileReader* image) {
- for (s4 i = 0; _count; i++) {
- if (_table[i] == image) {
- return true;
+ for (s4 i = 0; _count; i++) {
+ if (_table[i] == image) {
+ return true;
+ }
}
- }
- return false;
+ return false;
}
// Table to manage multiple opens of an image file.
@@ -321,362 +322,362 @@
// Open an image file, reuse structure if file already open.
ImageFileReader* ImageFileReader::open(const char* name, bool big_endian) {
- {
- // Lock out _reader_table.
+ {
+ // Lock out _reader_table.
+ SimpleCriticalSectionLock cs(&_reader_table_lock);
+ // Search for an exist image file.
+ for (u4 i = 0; i < _reader_table.count(); i++) {
+ // Retrieve table entry.
+ ImageFileReader* reader = _reader_table.get(i);
+ // If name matches, then reuse (bump up use count.)
+ if (strcmp(reader->name(), name) == 0) {
+ reader->inc_use();
+ return reader;
+ }
+ }
+ } // Unlock the mutex
+
+ // Need a new image reader.
+ ImageFileReader* reader = new ImageFileReader(name, big_endian);
+ bool opened = reader->open();
+ // If failed to open.
+ if (!opened) {
+ delete reader;
+ return NULL;
+ }
+
+ // Lock to update
SimpleCriticalSectionLock cs(&_reader_table_lock);
// Search for an exist image file.
for (u4 i = 0; i < _reader_table.count(); i++) {
- // Retrieve table entry.
- ImageFileReader* reader = _reader_table.get(i);
- // If name matches, then reuse (bump up use count.)
- if (strcmp(reader->name(), name) == 0) {
- reader->inc_use();
- return reader;
- }
+ // Retrieve table entry.
+ ImageFileReader* existing_reader = _reader_table.get(i);
+ // If name matches, then reuse (bump up use count.)
+ if (strcmp(existing_reader->name(), name) == 0) {
+ existing_reader->inc_use();
+ reader->close();
+ delete reader;
+ return existing_reader;
+ }
}
- } // Unlock the mutex
-
- // Need a new image reader.
- ImageFileReader* reader = new ImageFileReader(name, big_endian);
- bool opened = reader->open();
- // If failed to open.
- if (!opened) {
- delete reader;
- return NULL;
- }
-
- // Lock to update
- SimpleCriticalSectionLock cs(&_reader_table_lock);
- // Search for an exist image file.
- for (u4 i = 0; i < _reader_table.count(); i++) {
- // Retrieve table entry.
- ImageFileReader* existing_reader = _reader_table.get(i);
- // If name matches, then reuse (bump up use count.)
- if (strcmp(existing_reader->name(), name) == 0) {
- existing_reader->inc_use();
- reader->close();
- delete reader;
- return existing_reader;
- }
- }
- // Bump use count and add to table.
- reader->inc_use();
- _reader_table.add(reader);
- return reader;
+ // Bump use count and add to table.
+ reader->inc_use();
+ _reader_table.add(reader);
+ return reader;
}
// Close an image file if the file is not in use elsewhere.
void ImageFileReader::close(ImageFileReader *reader) {
- // Lock out _reader_table.
- SimpleCriticalSectionLock cs(&_reader_table_lock);
- // If last use then remove from table and then close.
- if (reader->dec_use()) {
- _reader_table.remove(reader);
- delete reader;
- }
+ // Lock out _reader_table.
+ SimpleCriticalSectionLock cs(&_reader_table_lock);
+ // If last use then remove from table and then close.
+ if (reader->dec_use()) {
+ _reader_table.remove(reader);
+ delete reader;
+ }
}
// Return an id for the specifed ImageFileReader.
u8 ImageFileReader::readerToID(ImageFileReader *reader) {
- // ID is just the cloaked reader address.
- return (u8)reader;
+ // ID is just the cloaked reader address.
+ return (u8)reader;
}
// Validate the image id.
bool ImageFileReader::idCheck(u8 id) {
- // Make sure the ID is a managed (_reader_table) reader.
- SimpleCriticalSectionLock cs(&_reader_table_lock);
- return _reader_table.contains((ImageFileReader*)id);
+ // Make sure the ID is a managed (_reader_table) reader.
+ SimpleCriticalSectionLock cs(&_reader_table_lock);
+ return _reader_table.contains((ImageFileReader*)id);
}
// Return an id for the specifed ImageFileReader.
ImageFileReader* ImageFileReader::idToReader(u8 id) {
- assert(idCheck(id) && "invalid image id");
- return (ImageFileReader*)id;
+ assert(idCheck(id) && "invalid image id");
+ return (ImageFileReader*)id;
}
// Constructor intializes to a closed state.
ImageFileReader::ImageFileReader(const char* name, bool big_endian) {
- // Copy the image file name.
- int len = (int) strlen(name) + 1;
- _name = new char[len];
- strncpy(_name, name, len);
- // Initialize for a closed file.
- _fd = -1;
- _endian = Endian::get_handler(big_endian);
- _index_data = NULL;
+ // Copy the image file name.
+ int len = (int) strlen(name) + 1;
+ _name = new char[len];
+ strncpy(_name, name, len);
+ // Initialize for a closed file.
+ _fd = -1;
+ _endian = Endian::get_handler(big_endian);
+ _index_data = NULL;
}
// Close image and free up data structures.
ImageFileReader::~ImageFileReader() {
- // Ensure file is closed.
- close();
- // Free up name.
- if (_name) {
- delete _name;
- _name = NULL;
- }
+ // Ensure file is closed.
+ close();
+ // Free up name.
+ if (_name) {
+ delete _name;
+ _name = NULL;
+ }
}
// Open image file for read access.
bool ImageFileReader::open() {
- char buffer[IMAGE_MAX_PATH];
+ char buffer[IMAGE_MAX_PATH];
- // If file exists open for reading.
- _fd = osSupport::openReadOnly(_name);
- if (_fd == -1) {
- return false;
- }
- // Retrieve the file size.
- _file_size = osSupport::size(_name);
- // Read image file header and verify it has a valid header.
- size_t header_size = sizeof(ImageHeader);
- if (_file_size < header_size ||
- !read_at((u1*)&_header, header_size, 0) ||
- _header.magic(_endian) != IMAGE_MAGIC ||
- _header.major_version(_endian) != MAJOR_VERSION ||
- _header.minor_version(_endian) != MINOR_VERSION) {
- close();
- return false;
- }
- // Size of image index.
- _index_size = index_size();
- // Make sure file is large enough to contain the index.
- if (_file_size < _index_size) {
- return false;
- }
- // Determine how much of the image is memory mapped.
- size_t map_size = (size_t)(MemoryMapImage ? _file_size : _index_size);
- // Memory map image (minimally the index.)
- _index_data = (u1*)osSupport::map_memory(_fd, _name, 0, map_size);
- assert(_index_data && "image file not memory mapped");
- // Retrieve length of index perfect hash table.
- u4 length = table_length();
- // Compute offset of the perfect hash table redirect table.
- u4 redirect_table_offset = (u4)header_size;
- // Compute offset of index attribute offsets.
- u4 offsets_table_offset = redirect_table_offset + length * sizeof(s4);
- // Compute offset of index location attribute data.
- u4 location_bytes_offset = offsets_table_offset + length * sizeof(u4);
- // Compute offset of index string table.
- u4 string_bytes_offset = location_bytes_offset + locations_size();
- // Compute address of the perfect hash table redirect table.
- _redirect_table = (s4*)(_index_data + redirect_table_offset);
- // Compute address of index attribute offsets.
- _offsets_table = (u4*)(_index_data + offsets_table_offset);
- // Compute address of index location attribute data.
- _location_bytes = _index_data + location_bytes_offset;
- // Compute address of index string table.
- _string_bytes = _index_data + string_bytes_offset;
+ // If file exists open for reading.
+ _fd = osSupport::openReadOnly(_name);
+ if (_fd == -1) {
+ return false;
+ }
+ // Retrieve the file size.
+ _file_size = osSupport::size(_name);
+ // Read image file header and verify it has a valid header.
+ size_t header_size = sizeof(ImageHeader);
+ if (_file_size < header_size ||
+ !read_at((u1*)&_header, header_size, 0) ||
+ _header.magic(_endian) != IMAGE_MAGIC ||
+ _header.major_version(_endian) != MAJOR_VERSION ||
+ _header.minor_version(_endian) != MINOR_VERSION) {
+ close();
+ return false;
+ }
+ // Size of image index.
+ _index_size = index_size();
+ // Make sure file is large enough to contain the index.
+ if (_file_size < _index_size) {
+ return false;
+ }
+ // Determine how much of the image is memory mapped.
+ size_t map_size = (size_t)(MemoryMapImage ? _file_size : _index_size);
+ // Memory map image (minimally the index.)
+ _index_data = (u1*)osSupport::map_memory(_fd, _name, 0, map_size);
+ assert(_index_data && "image file not memory mapped");
+ // Retrieve length of index perfect hash table.
+ u4 length = table_length();
+ // Compute offset of the perfect hash table redirect table.
+ u4 redirect_table_offset = (u4)header_size;
+ // Compute offset of index attribute offsets.
+ u4 offsets_table_offset = redirect_table_offset + length * sizeof(s4);
+ // Compute offset of index location attribute data.
+ u4 location_bytes_offset = offsets_table_offset + length * sizeof(u4);
+ // Compute offset of index string table.
+ u4 string_bytes_offset = location_bytes_offset + locations_size();
+ // Compute address of the perfect hash table redirect table.
+ _redirect_table = (s4*)(_index_data + redirect_table_offset);
+ // Compute address of index attribute offsets.
+ _offsets_table = (u4*)(_index_data + offsets_table_offset);
+ // Compute address of index location attribute data.
+ _location_bytes = _index_data + location_bytes_offset;
+ // Compute address of index string table.
+ _string_bytes = _index_data + string_bytes_offset;
- // Initialize the module data
- ImageModuleData::module_data_name(buffer, _name);
- module_data = new ImageModuleData(this, buffer);
- // Successful open.
- return true;
+ // Initialize the module data
+ ImageModuleData::module_data_name(buffer, _name);
+ module_data = new ImageModuleData(this, buffer);
+ // Successful open.
+ return true;
}
// Close image file.
void ImageFileReader::close() {
- // Deallocate the index.
- if (_index_data) {
- osSupport::unmap_memory((char*)_index_data, _index_size);
- _index_data = NULL;
- }
- // Close file.
- if (_fd != -1) {
- osSupport::close(_fd);
- _fd = -1;
- }
+ // Deallocate the index.
+ if (_index_data) {
+ osSupport::unmap_memory((char*)_index_data, _index_size);
+ _index_data = NULL;
+ }
+ // Close file.
+ if (_fd != -1) {
+ osSupport::close(_fd);
+ _fd = -1;
+ }
}
// Read directly from the file.
bool ImageFileReader::read_at(u1* data, u8 size, u8 offset) const {
- return (u8)osSupport::read(_fd, (char*)data, size, offset) == size;
+ return (u8)osSupport::read(_fd, (char*)data, size, offset) == size;
}
-// Find the location attributes associated with the path. Returns true if
+// Find the location attributes associated with the path. Returns true if
// the location is found, false otherwise.
bool ImageFileReader::find_location(const char* path, ImageLocation& location) const {
- // Locate the entry in the index perfect hash table.
- s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
- // If is found.
- if (index != ImageStrings::NOT_FOUND) {
- // Get address of first byte of location attribute stream.
- u1* data = get_location_data(index);
- // Expand location attributes.
- location.set_data(data);
- // Make sure result is not a false positive.
- return verify_location(location, path);
- }
- return false;
+ // Locate the entry in the index perfect hash table.
+ s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
+ // If is found.
+ if (index != ImageStrings::NOT_FOUND) {
+ // Get address of first byte of location attribute stream.
+ u1* data = get_location_data(index);
+ // Expand location attributes.
+ location.set_data(data);
+ // Make sure result is not a false positive.
+ return verify_location(location, path);
+ }
+ return false;
}
// Find the location index and size associated with the path.
// Returns the location index and size if the location is found, 0 otherwise.
u4 ImageFileReader::find_location_index(const char* path, u8 *size) const {
- // Locate the entry in the index perfect hash table.
- s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
- // If found.
- if (index != ImageStrings::NOT_FOUND) {
- // Get address of first byte of location attribute stream.
- u4 offset = get_location_offset(index);
- u1* data = get_location_offset_data(offset);
- // Expand location attributes.
- ImageLocation location(data);
- // Make sure result is not a false positive.
- if (verify_location(location, path)) {
- *size = (jlong)location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
- return offset;
+ // Locate the entry in the index perfect hash table.
+ s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length());
+ // If found.
+ if (index != ImageStrings::NOT_FOUND) {
+ // Get address of first byte of location attribute stream.
+ u4 offset = get_location_offset(index);
+ u1* data = get_location_offset_data(offset);
+ // Expand location attributes.
+ ImageLocation location(data);
+ // Make sure result is not a false positive.
+ if (verify_location(location, path)) {
+ *size = (jlong)location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ return offset;
+ }
}
- }
- return 0; // not found
+ return 0; // not found
}
// Assemble the location path from the string fragments indicated in the location attributes.
void ImageFileReader::location_path(ImageLocation& location, char* path, size_t max) const {
- // Manage the image string table.
- ImageStrings strings(_string_bytes, _header.strings_size(_endian));
- // Position to first character of the path buffer.
- char* next = path;
- // Temp for string length.
- size_t length;
- // Get module string.
- const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
- // If module string is not empty string.
- if (*module != '\0') {
- // Get length of module name.
- length = strlen(module);
- // Make sure there is no buffer overflow.
- assert(next - path + length + 2 < max && "buffer overflow");
- // Append '/module/'.
- *next++ = '/';
- strncpy(next, module, length); next += length;
- *next++ = '/';
- }
- // Get parent (package) string.
- const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
- // If parent string is not empty string.
- if (*parent != '\0') {
- // Get length of module string.
- length = strlen(parent);
+ // Manage the image string table.
+ ImageStrings strings(_string_bytes, _header.strings_size(_endian));
+ // Position to first character of the path buffer.
+ char* next = path;
+ // Temp for string length.
+ size_t length;
+ // Get module string.
+ const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
+ // If module string is not empty string.
+ if (*module != '\0') {
+ // Get length of module name.
+ length = strlen(module);
+ // Make sure there is no buffer overflow.
+ assert(next - path + length + 2 < max && "buffer overflow");
+ // Append '/module/'.
+ *next++ = '/';
+ strncpy(next, module, length); next += length;
+ *next++ = '/';
+ }
+ // Get parent (package) string.
+ const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+ // If parent string is not empty string.
+ if (*parent != '\0') {
+ // Get length of module string.
+ length = strlen(parent);
+ // Make sure there is no buffer overflow.
+ assert(next - path + length + 1 < max && "buffer overflow");
+ // Append 'patent/' .
+ strncpy(next, parent, length); next += length;
+ *next++ = '/';
+ }
+ // Get base name string.
+ const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+ // Get length of base name.
+ length = strlen(base);
// Make sure there is no buffer overflow.
- assert(next - path + length + 1 < max && "buffer overflow");
- // Append 'patent/' .
- strncpy(next, parent, length); next += length;
- *next++ = '/';
- }
- // Get base name string.
- const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
- // Get length of base name.
- length = strlen(base);
- // Make sure there is no buffer overflow.
- assert(next - path + length < max && "buffer overflow");
- // Append base name.
- strncpy(next, base, length); next += length;
- // Get extension string.
- const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
- // If extension string is not empty string.
- if (*extension != '\0') {
- // Get length of extension string.
- length = strlen(extension);
+ assert(next - path + length < max && "buffer overflow");
+ // Append base name.
+ strncpy(next, base, length); next += length;
+ // Get extension string.
+ const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+ // If extension string is not empty string.
+ if (*extension != '\0') {
+ // Get length of extension string.
+ length = strlen(extension);
+ // Make sure there is no buffer overflow.
+ assert(next - path + length + 1 < max && "buffer overflow");
+ // Append '.extension' .
+ *next++ = '.';
+ strncpy(next, extension, length); next += length;
+ }
// Make sure there is no buffer overflow.
- assert(next - path + length + 1 < max && "buffer overflow");
- // Append '.extension' .
- *next++ = '.';
- strncpy(next, extension, length); next += length;
- }
- // Make sure there is no buffer overflow.
- assert((size_t)(next - path) < max && "buffer overflow");
- // Terminate string.
- *next = '\0';
+ assert((size_t)(next - path) < max && "buffer overflow");
+ // Terminate string.
+ *next = '\0';
}
// Verify that a found location matches the supplied path (without copying.)
bool ImageFileReader::verify_location(ImageLocation& location, const char* path) const {
- // Manage the image string table.
- ImageStrings strings(_string_bytes, _header.strings_size(_endian));
- // Position to first character of the path string.
- const char* next = path;
- // Get module name string.
- const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
- // If module string is not empty.
- if (*module != '\0') {
- // Compare '/module/' .
- if (*next++ != '/') return false;
- if (!(next = ImageStrings::starts_with(next, module))) return false;
- if (*next++ != '/') return false;
- }
- // Get parent (package) string
- const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
- // If parent string is not empty string.
- if (*parent != '\0') {
- // Compare 'parent/' .
- if (!(next = ImageStrings::starts_with(next, parent))) return false;
- if (*next++ != '/') return false;
- }
- // Get base name string.
- const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
- // Compare with basne name.
- if (!(next = ImageStrings::starts_with(next, base))) return false;
- // Get extension string.
- const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
- // If extension is not empty.
- if (*extension != '\0') {
- // Compare '.extension' .
- if (*next++ != '.') return false;
- if (!(next = ImageStrings::starts_with(next, extension))) return false;
- }
- // True only if complete match and no more characters.
- return *next == '\0';
+ // Manage the image string table.
+ ImageStrings strings(_string_bytes, _header.strings_size(_endian));
+ // Position to first character of the path string.
+ const char* next = path;
+ // Get module name string.
+ const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings);
+ // If module string is not empty.
+ if (*module != '\0') {
+ // Compare '/module/' .
+ if (*next++ != '/') return false;
+ if (!(next = ImageStrings::starts_with(next, module))) return false;
+ if (*next++ != '/') return false;
+ }
+ // Get parent (package) string
+ const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+ // If parent string is not empty string.
+ if (*parent != '\0') {
+ // Compare 'parent/' .
+ if (!(next = ImageStrings::starts_with(next, parent))) return false;
+ if (*next++ != '/') return false;
+ }
+ // Get base name string.
+ const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+ // Compare with basne name.
+ if (!(next = ImageStrings::starts_with(next, base))) return false;
+ // Get extension string.
+ const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+ // If extension is not empty.
+ if (*extension != '\0') {
+ // Compare '.extension' .
+ if (*next++ != '.') return false;
+ if (!(next = ImageStrings::starts_with(next, extension))) return false;
+ }
+ // True only if complete match and no more characters.
+ return *next == '\0';
}
// Return the resource for the supplied location offset.
void ImageFileReader::get_resource(u4 offset, u1* uncompressed_data) const {
- // Get address of first byte of location attribute stream.
- u1* data = get_location_offset_data(offset);
- // Expand location attributes.
- ImageLocation location(data);
- // Read the data
- get_resource(location, uncompressed_data);
+ // Get address of first byte of location attribute stream.
+ u1* data = get_location_offset_data(offset);
+ // Expand location attributes.
+ ImageLocation location(data);
+ // Read the data
+ get_resource(location, uncompressed_data);
}
// Return the resource for the supplied location.
void ImageFileReader::get_resource(ImageLocation& location, u1* uncompressed_data) const {
- // Retrieve the byte offset and size of the resource.
- u8 offset = location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
- u8 uncompressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
- u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
- // If the resource is compressed.
- if (compressed_size != 0) {
- u1* compressed_data;
- // If not memory mapped read in bytes.
- if (!MemoryMapImage) {
- // Allocate buffer for compression.
- compressed_data = new u1[(u4)compressed_size];
- // Read bytes from offset beyond the image index.
- bool is_read = read_at(compressed_data, compressed_size, _index_size + offset);
- assert(is_read && "error reading from image or short read");
+ // Retrieve the byte offset and size of the resource.
+ u8 offset = location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
+ u8 uncompressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+ u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
+ // If the resource is compressed.
+ if (compressed_size != 0) {
+ u1* compressed_data;
+ // If not memory mapped read in bytes.
+ if (!MemoryMapImage) {
+ // Allocate buffer for compression.
+ compressed_data = new u1[(u4)compressed_size];
+ // Read bytes from offset beyond the image index.
+ bool is_read = read_at(compressed_data, compressed_size, _index_size + offset);
+ assert(is_read && "error reading from image or short read");
+ } else {
+ compressed_data = get_data_address() + offset;
+ }
+ // Get image string table.
+ const ImageStrings strings = get_strings();
+ // Decompress resource.
+ ImageDecompressor::decompress_resource(compressed_data, uncompressed_data, (u4)uncompressed_size,
+ &strings);
+ // If not memory mapped then release temporary buffer.
+ if (!MemoryMapImage) {
+ delete compressed_data;
+ }
} else {
- compressed_data = get_data_address() + offset;
+ // Read bytes from offset beyond the image index.
+ bool is_read = read_at(uncompressed_data, uncompressed_size, _index_size + offset);
+ assert(is_read && "error reading from image or short read");
}
- // Get image string table.
- const ImageStrings strings = get_strings();
- // Decompress resource.
- ImageDecompressor::decompress_resource(compressed_data, uncompressed_data, (u4)uncompressed_size,
- &strings);
- // If not memory mapped then release temporary buffer.
- if (!MemoryMapImage) {
- delete compressed_data;
- }
- } else {
- // Read bytes from offset beyond the image index.
- bool is_read = read_at(uncompressed_data, uncompressed_size, _index_size + offset);
- assert(is_read && "error reading from image or short read");
- }
}
// Return the ImageModuleData for this image
ImageModuleData * ImageFileReader::get_image_module_data() {
- return module_data;
+ return module_data;
}
--- a/jdk/src/java.base/share/native/libjimage/imageFile.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/imageFile.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -1,14 +1,16 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* 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
+ * 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).
*
@@ -19,7 +21,6 @@
* 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.
- *
*/
#ifndef LIBJIMAGE_IMAGEFILE_HPP
@@ -145,52 +146,52 @@
// Manage image file string table.
class ImageStrings {
private:
- u1* _data; // Data bytes for strings.
- u4 _size; // Number of bytes in the string table.
+ u1* _data; // Data bytes for strings.
+ u4 _size; // Number of bytes in the string table.
public:
- enum {
- // Not found result from find routine.
- NOT_FOUND = -1,
- // Prime used to generate hash for Perfect Hashing.
- HASH_MULTIPLIER = 0x01000193
- };
+ enum {
+ // Not found result from find routine.
+ NOT_FOUND = -1,
+ // Prime used to generate hash for Perfect Hashing.
+ HASH_MULTIPLIER = 0x01000193
+ };
- ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
+ ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
- // Return the UTF-8 string beginning at offset.
- inline const char* get(u4 offset) const {
- assert(offset < _size && "offset exceeds string table size");
- return (const char*)(_data + offset);
- }
+ // Return the UTF-8 string beginning at offset.
+ inline const char* get(u4 offset) const {
+ assert(offset < _size && "offset exceeds string table size");
+ return (const char*)(_data + offset);
+ }
- // Compute the Perfect Hashing hash code for the supplied UTF-8 string.
- inline static u4 hash_code(const char* string) {
- return hash_code(string, HASH_MULTIPLIER);
- }
+ // Compute the Perfect Hashing hash code for the supplied UTF-8 string.
+ inline static u4 hash_code(const char* string) {
+ return hash_code(string, HASH_MULTIPLIER);
+ }
- // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
- static s4 hash_code(const char* string, s4 seed);
+ // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
+ static s4 hash_code(const char* string, s4 seed);
- // Match up a string in a perfect hash table. Result still needs validation
- // for precise match.
- static s4 find(Endian* endian, const char* name, s4* redirect, u4 length);
+ // Match up a string in a perfect hash table. Result still needs validation
+ // for precise match.
+ static s4 find(Endian* endian, const char* name, s4* redirect, u4 length);
- // Test to see if UTF-8 string begins with the start UTF-8 string. If so,
- // return non-NULL address of remaining portion of string. Otherwise, return
- // NULL. Used to test sections of a path without copying from image string
- // table.
- static const char* starts_with(const char* string, const char* start);
+ // Test to see if UTF-8 string begins with the start UTF-8 string. If so,
+ // return non-NULL address of remaining portion of string. Otherwise, return
+ // NULL. Used to test sections of a path without copying from image string
+ // table.
+ static const char* starts_with(const char* string, const char* start);
- // Test to see if UTF-8 string begins with start char. If so, return non-NULL
- // address of remaining portion of string. Otherwise, return NULL. Used
- // to test a character of a path without copying.
- inline static const char* starts_with(const char* string, const char ch) {
- return *string == ch ? string + 1 : NULL;
- }
+ // Test to see if UTF-8 string begins with start char. If so, return non-NULL
+ // address of remaining portion of string. Otherwise, return NULL. Used
+ // to test a character of a path without copying.
+ inline static const char* starts_with(const char* string, const char ch) {
+ return *string == ch ? string + 1 : NULL;
+ }
};
-// Manage image file location attribute data. Within an image, a location's
-// attributes are compressed into a stream of bytes. An attribute stream is
+// Manage image file location attribute data. Within an image, a location's
+// attributes are compressed into a stream of bytes. An attribute stream is
// composed of individual attribute sequences. Each attribute sequence begins with
// a header byte containing the attribute 'kind' (upper 5 bits of header) and the
// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
@@ -208,91 +209,91 @@
//
// Notes:
// - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
-// streams will contain zero byte values to represent lesser significant bits.
-// Thus, detecting a zero byte is not sufficient to detect the end of an attribute
-// stream.
+// streams will contain zero byte values to represent lesser significant bits.
+// Thus, detecting a zero byte is not sufficient to detect the end of an attribute
+// stream.
// - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
-// storing the resources. Thus, in an image this represents the number of bytes
-// after the index.
+// storing the resources. Thus, in an image this represents the number of bytes
+// after the index.
// - Currently, compressed resources are represented by having a non-zero
-// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the
-// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
-// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
-// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
-// in memory. In the future, additional compression techniques will be used and
-// represented differently.
+// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the
+// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
+// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
+// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
+// in memory. In the future, additional compression techniques will be used and
+// represented differently.
// - Package strings include trailing slash and extensions include prefix period.
//
class ImageLocation {
public:
- enum {
- ATTRIBUTE_END, // End of attribute stream marker
- ATTRIBUTE_MODULE, // String table offset of module name
- ATTRIBUTE_PARENT, // String table offset of resource path parent
- ATTRIBUTE_BASE, // String table offset of resource path base
- ATTRIBUTE_EXTENSION, // String table offset of resource path extension
- ATTRIBUTE_OFFSET, // Container byte offset of resource
- ATTRIBUTE_COMPRESSED, // In image byte size of the compressed resource
- ATTRIBUTE_UNCOMPRESSED, // In memory byte size of the uncompressed resource
- ATTRIBUTE_COUNT // Number of attribute kinds
- };
+ enum {
+ ATTRIBUTE_END, // End of attribute stream marker
+ ATTRIBUTE_MODULE, // String table offset of module name
+ ATTRIBUTE_PARENT, // String table offset of resource path parent
+ ATTRIBUTE_BASE, // String table offset of resource path base
+ ATTRIBUTE_EXTENSION, // String table offset of resource path extension
+ ATTRIBUTE_OFFSET, // Container byte offset of resource
+ ATTRIBUTE_COMPRESSED, // In image byte size of the compressed resource
+ ATTRIBUTE_UNCOMPRESSED, // In memory byte size of the uncompressed resource
+ ATTRIBUTE_COUNT // Number of attribute kinds
+ };
private:
- // Values of inflated attributes.
- u8 _attributes[ATTRIBUTE_COUNT];
+ // Values of inflated attributes.
+ u8 _attributes[ATTRIBUTE_COUNT];
- // Return the attribute value number of bytes.
- inline static u1 attribute_length(u1 data) {
- return (data & 0x7) + 1;
- }
+ // Return the attribute value number of bytes.
+ inline static u1 attribute_length(u1 data) {
+ return (data & 0x7) + 1;
+ }
- // Return the attribute kind.
- inline static u1 attribute_kind(u1 data) {
- u1 kind = data >> 3;
- assert(kind < ATTRIBUTE_COUNT && "invalid attribute kind");
- return kind;
- }
+ // Return the attribute kind.
+ inline static u1 attribute_kind(u1 data) {
+ u1 kind = data >> 3;
+ assert(kind < ATTRIBUTE_COUNT && "invalid attribute kind");
+ return kind;
+ }
- // Return the attribute length.
- inline static u8 attribute_value(u1* data, u1 n) {
- assert(0 < n && n <= 8 && "invalid attribute value length");
- u8 value = 0;
- // Most significant bytes first.
- for (u1 i = 0; i < n; i++) {
- value <<= 8;
- value |= data[i];
+ // Return the attribute length.
+ inline static u8 attribute_value(u1* data, u1 n) {
+ assert(0 < n && n <= 8 && "invalid attribute value length");
+ u8 value = 0;
+ // Most significant bytes first.
+ for (u1 i = 0; i < n; i++) {
+ value <<= 8;
+ value |= data[i];
+ }
+ return value;
}
- return value;
- }
public:
- ImageLocation() {
- clear_data();
- }
+ ImageLocation() {
+ clear_data();
+ }
- ImageLocation(u1* data) {
- clear_data();
- set_data(data);
- }
+ ImageLocation(u1* data) {
+ clear_data();
+ set_data(data);
+ }
- // Inflates the attribute stream into individual values stored in the long
- // array _attributes. This allows an attribute value to be quickly accessed by
- // direct indexing. Unspecified values default to zero.
- void set_data(u1* data);
+ // Inflates the attribute stream into individual values stored in the long
+ // array _attributes. This allows an attribute value to be quickly accessed by
+ // direct indexing. Unspecified values default to zero.
+ void set_data(u1* data);
- // Zero all attribute values.
- void clear_data();
+ // Zero all attribute values.
+ void clear_data();
- // Retrieve an attribute value from the inflated array.
- inline u8 get_attribute(u1 kind) const {
- assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT && "invalid attribute kind");
- return _attributes[kind];
- }
+ // Retrieve an attribute value from the inflated array.
+ inline u8 get_attribute(u1 kind) const {
+ assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT && "invalid attribute kind");
+ return _attributes[kind];
+ }
- // Retrieve an attribute string value from the inflated array.
- inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
- return strings.get((u4)get_attribute(kind));
- }
+ // Retrieve an attribute string value from the inflated array.
+ inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
+ return strings.get((u4)get_attribute(kind));
+ }
};
//
@@ -306,133 +307,133 @@
// padding for hash table lookup.)
//
// Format:
-// Count of package to module entries
-// Count of module to package entries
-// Perfect Hash redirect table[Count of package to module entries]
-// Package to module entries[Count of package to module entries]
-// Offset to package name in string table
-// Offset to module name in string table
-// Perfect Hash redirect table[Count of module to package entries]
-// Module to package entries[Count of module to package entries]
-// Offset to module name in string table
-// Count of packages in module
-// Offset to first package in packages table
-// Packages[]
-// Offset to package name in string table
+// Count of package to module entries
+// Count of module to package entries
+// Perfect Hash redirect table[Count of package to module entries]
+// Package to module entries[Count of package to module entries]
+// Offset to package name in string table
+// Offset to module name in string table
+// Perfect Hash redirect table[Count of module to package entries]
+// Module to package entries[Count of module to package entries]
+// Offset to module name in string table
+// Count of packages in module
+// Offset to first package in packages table
+// Packages[]
+// Offset to package name in string table
//
// Manage the image module meta data.
class ImageModuleData {
- class Header {
- private:
- u4 _ptm_count; // Count of package to module entries
- u4 _mtp_count; // Count of module to package entries
- public:
- inline u4 ptm_count(Endian* endian) const { return endian->get(_ptm_count); }
- inline u4 mtp_count(Endian* endian) const { return endian->get(_mtp_count); }
- };
+ class Header {
+ private:
+ u4 _ptm_count; // Count of package to module entries
+ u4 _mtp_count; // Count of module to package entries
+ public:
+ inline u4 ptm_count(Endian* endian) const { return endian->get(_ptm_count); }
+ inline u4 mtp_count(Endian* endian) const { return endian->get(_mtp_count); }
+ };
- // Hashtable entry
- class HashData {
- private:
- u4 _name_offset; // Name offset in string table
- public:
- inline s4 name_offset(Endian* endian) const { return endian->get(_name_offset); }
- };
+ // Hashtable entry
+ class HashData {
+ private:
+ u4 _name_offset; // Name offset in string table
+ public:
+ inline s4 name_offset(Endian* endian) const { return endian->get(_name_offset); }
+ };
- // Package to module hashtable entry
- class PTMData : public HashData {
- private:
- u4 _module_name_offset; // Module name offset in string table
- public:
- inline s4 module_name_offset(Endian* endian) const { return endian->get(_module_name_offset); }
- };
+ // Package to module hashtable entry
+ class PTMData : public HashData {
+ private:
+ u4 _module_name_offset; // Module name offset in string table
+ public:
+ inline s4 module_name_offset(Endian* endian) const { return endian->get(_module_name_offset); }
+ };
- // Module to package hashtable entry
- class MTPData : public HashData {
- private:
- u4 _package_count; // Number of packages in module
- u4 _package_offset; // Offset in package list
- public:
- inline u4 package_count(Endian* endian) const { return endian->get(_package_count); }
- inline u4 package_offset(Endian* endian) const { return endian->get(_package_offset); }
- };
+ // Module to package hashtable entry
+ class MTPData : public HashData {
+ private:
+ u4 _package_count; // Number of packages in module
+ u4 _package_offset; // Offset in package list
+ public:
+ inline u4 package_count(Endian* endian) const { return endian->get(_package_count); }
+ inline u4 package_offset(Endian* endian) const { return endian->get(_package_offset); }
+ };
- const ImageFileReader* _image_file; // Source image file
- Endian* _endian; // Endian handler
- ImageStrings _strings; // Image file strings
- u1* _data; // Module data resource data
- u8 _data_size; // Size of resource data
- Header* _header; // Module data header
- s4* _ptm_redirect; // Package to module hashtable redirect
- PTMData* _ptm_data; // Package to module data
- s4* _mtp_redirect; // Module to packages hashtable redirect
- MTPData* _mtp_data; // Module to packages data
- s4* _mtp_packages; // Package data (name offsets)
+ const ImageFileReader* _image_file; // Source image file
+ Endian* _endian; // Endian handler
+ ImageStrings _strings; // Image file strings
+ u1* _data; // Module data resource data
+ u8 _data_size; // Size of resource data
+ Header* _header; // Module data header
+ s4* _ptm_redirect; // Package to module hashtable redirect
+ PTMData* _ptm_data; // Package to module data
+ s4* _mtp_redirect; // Module to packages hashtable redirect
+ MTPData* _mtp_data; // Module to packages data
+ s4* _mtp_packages; // Package data (name offsets)
- // Return a string from the string table.
- inline const char* get_string(u4 offset) {
- return _strings.get(offset);
- }
+ // Return a string from the string table.
+ inline const char* get_string(u4 offset) {
+ return _strings.get(offset);
+ }
- inline u4 mtp_package(u4 index) {
- return _endian->get(_mtp_packages[index]);
- }
+ inline u4 mtp_package(u4 index) {
+ return _endian->get(_mtp_packages[index]);
+ }
public:
- ImageModuleData(const ImageFileReader* image_file, const char* module_data_name);
- ~ImageModuleData();
+ ImageModuleData(const ImageFileReader* image_file, const char* module_data_name);
+ ~ImageModuleData();
- // Return the name of the module data resource.
- static void module_data_name(char* buffer, const char* image_file_name);
+ // Return the name of the module data resource.
+ static void module_data_name(char* buffer, const char* image_file_name);
- // Return the module in which a package resides. Returns NULL if not found.
- const char* package_to_module(const char* package_name);
+ // Return the module in which a package resides. Returns NULL if not found.
+ const char* package_to_module(const char* package_name);
- // Returns all the package names in a module in a NULL terminated array.
- // Returns NULL if module not found.
- const char** module_to_packages(const char* module_name);
+ // Returns all the package names in a module in a NULL terminated array.
+ // Returns NULL if module not found.
+ const char** module_to_packages(const char* module_name);
};
// Image file header, starting at offset 0.
class ImageHeader {
private:
- u4 _magic; // Image file marker
- u4 _version; // Image file major version number
- u4 _flags; // Image file flags
- u4 _resource_count; // Number of resources in file
- u4 _table_length; // Number of slots in index tables
- u4 _locations_size; // Number of bytes in attribute table
- u4 _strings_size; // Number of bytes in string table
+ u4 _magic; // Image file marker
+ u4 _version; // Image file major version number
+ u4 _flags; // Image file flags
+ u4 _resource_count; // Number of resources in file
+ u4 _table_length; // Number of slots in index tables
+ u4 _locations_size; // Number of bytes in attribute table
+ u4 _strings_size; // Number of bytes in string table
public:
- u4 magic() const { return _magic; }
- u4 magic(Endian* endian) const { return endian->get(_magic); }
- void set_magic(Endian* endian, u4 magic) { return endian->set(_magic, magic); }
+ u4 magic() const { return _magic; }
+ u4 magic(Endian* endian) const { return endian->get(_magic); }
+ void set_magic(Endian* endian, u4 magic) { return endian->set(_magic, magic); }
- u4 major_version(Endian* endian) const { return endian->get(_version) >> 16; }
- u4 minor_version(Endian* endian) const { return endian->get(_version) & 0xFFFF; }
- void set_version(Endian* endian, u4 major_version, u4 minor_version) {
- return endian->set(_version, major_version << 16 | minor_version);
- }
+ u4 major_version(Endian* endian) const { return endian->get(_version) >> 16; }
+ u4 minor_version(Endian* endian) const { return endian->get(_version) & 0xFFFF; }
+ void set_version(Endian* endian, u4 major_version, u4 minor_version) {
+ return endian->set(_version, major_version << 16 | minor_version);
+ }
- u4 flags(Endian* endian) const { return endian->get(_flags); }
- void set_flags(Endian* endian, u4 value) { return endian->set(_flags, value); }
+ u4 flags(Endian* endian) const { return endian->get(_flags); }
+ void set_flags(Endian* endian, u4 value) { return endian->set(_flags, value); }
- u4 resource_count(Endian* endian) const { return endian->get(_resource_count); }
- void set_resource_count(Endian* endian, u4 count) { return endian->set(_resource_count, count); }
+ u4 resource_count(Endian* endian) const { return endian->get(_resource_count); }
+ void set_resource_count(Endian* endian, u4 count) { return endian->set(_resource_count, count); }
- u4 table_length(Endian* endian) const { return endian->get(_table_length); }
- void set_table_length(Endian* endian, u4 count) { return endian->set(_table_length, count); }
+ u4 table_length(Endian* endian) const { return endian->get(_table_length); }
+ void set_table_length(Endian* endian, u4 count) { return endian->set(_table_length, count); }
- u4 locations_size(Endian* endian) const { return endian->get(_locations_size); }
- void set_locations_size(Endian* endian, u4 size) { return endian->set(_locations_size, size); }
+ u4 locations_size(Endian* endian) const { return endian->get(_locations_size); }
+ void set_locations_size(Endian* endian, u4 size) { return endian->set(_locations_size, size); }
- u4 strings_size(Endian* endian) const { return endian->get(_strings_size); }
- void set_strings_size(Endian* endian, u4 size) { return endian->set(_strings_size, size); }
+ u4 strings_size(Endian* endian) const { return endian->get(_strings_size); }
+ void set_strings_size(Endian* endian, u4 size) { return endian->set(_strings_size, size); }
};
-// Max path length limit independent of platform. Windows max path is 1024,
-// other platforms use 4096. The JCK fails several tests when 1024 is used.
+// Max path length limit independent of platform. Windows max path is 1024,
+// other platforms use 4096. The JCK fails several tests when 1024 is used.
#define IMAGE_MAX_PATH 4096
class ImageFileReader;
@@ -441,29 +442,29 @@
// to share an open image.
class ImageFileReaderTable {
private:
- const static u4 _growth = 8; // Growth rate of the table
- u4 _count; // Number of entries in the table
- u4 _max; // Maximum number of entries allocated
- ImageFileReader** _table; // Growable array of entries
+ const static u4 _growth = 8; // Growth rate of the table
+ u4 _count; // Number of entries in the table
+ u4 _max; // Maximum number of entries allocated
+ ImageFileReader** _table; // Growable array of entries
public:
- ImageFileReaderTable();
- ~ImageFileReaderTable();
+ ImageFileReaderTable();
+ ~ImageFileReaderTable();
- // Return the number of entries.
- inline u4 count() { return _count; }
+ // Return the number of entries.
+ inline u4 count() { return _count; }
- // Return the ith entry from the table.
- inline ImageFileReader* get(u4 i) { return _table[i]; }
+ // Return the ith entry from the table.
+ inline ImageFileReader* get(u4 i) { return _table[i]; }
- // Add a new image entry to the table.
- void add(ImageFileReader* image);
+ // Add a new image entry to the table.
+ void add(ImageFileReader* image);
- // Remove an image entry from the table.
- void remove(ImageFileReader* image);
+ // Remove an image entry from the table.
+ void remove(ImageFileReader* image);
- // Determine if image entry is in table.
- bool contains(ImageFileReader* image);
+ // Determine if image entry is in table.
+ bool contains(ImageFileReader* image);
};
// Manage the image file.
@@ -473,176 +474,176 @@
// index is then memory mapped to allow load on demand and sharing. The
// -XX:+MemoryMapImage flag determines if the entire file is loaded (server use.)
// An image can be used by Hotspot and multiple reference points in the JDK, thus
-// it is desirable to share a reader. To accomodate sharing, a share table is
+// it is desirable to share a reader. To accomodate sharing, a share table is
// defined (see ImageFileReaderTable in imageFile.cpp) To track the number of
// uses, ImageFileReader keeps a use count (_use). Use is incremented when
-// 'opened' by reference point and decremented when 'closed'. Use of zero
+// 'opened' by reference point and decremented when 'closed'. Use of zero
// leads the ImageFileReader to be actually closed and discarded.
class ImageFileReader {
private:
- // Manage a number of image files such that an image can be shared across
- // multiple uses (ex. loader.)
- static ImageFileReaderTable _reader_table;
+ // Manage a number of image files such that an image can be shared across
+ // multiple uses (ex. loader.)
+ static ImageFileReaderTable _reader_table;
- char* _name; // Name of image
- s4 _use; // Use count
- int _fd; // File descriptor
- Endian* _endian; // Endian handler
- u8 _file_size; // File size in bytes
- ImageHeader _header; // Image header
- size_t _index_size; // Total size of index
- u1* _index_data; // Raw index data
- s4* _redirect_table; // Perfect hash redirect table
- u4* _offsets_table; // Location offset table
- u1* _location_bytes; // Location attributes
- u1* _string_bytes; // String table
- ImageModuleData *module_data; // The ImageModuleData for this image
+ char* _name; // Name of image
+ s4 _use; // Use count
+ int _fd; // File descriptor
+ Endian* _endian; // Endian handler
+ u8 _file_size; // File size in bytes
+ ImageHeader _header; // Image header
+ size_t _index_size; // Total size of index
+ u1* _index_data; // Raw index data
+ s4* _redirect_table; // Perfect hash redirect table
+ u4* _offsets_table; // Location offset table
+ u1* _location_bytes; // Location attributes
+ u1* _string_bytes; // String table
+ ImageModuleData *module_data; // The ImageModuleData for this image
- ImageFileReader(const char* name, bool big_endian);
- ~ImageFileReader();
+ ImageFileReader(const char* name, bool big_endian);
+ ~ImageFileReader();
- // Compute number of bytes in image file index.
- inline size_t index_size() {
- return sizeof(ImageHeader) +
- table_length() * sizeof(u4) * 2 + locations_size() + strings_size();
- }
+ // Compute number of bytes in image file index.
+ inline size_t index_size() {
+ return sizeof(ImageHeader) +
+ table_length() * sizeof(u4) * 2 + locations_size() + strings_size();
+ }
public:
- enum {
- // Image file marker.
- IMAGE_MAGIC = 0xCAFEDADA,
- // Endian inverted Image file marker.
- IMAGE_MAGIC_INVERT = 0xDADAFECA,
- // Image file major version number.
- MAJOR_VERSION = 1,
- // Image file minor version number.
- MINOR_VERSION = 0
- };
+ enum {
+ // Image file marker.
+ IMAGE_MAGIC = 0xCAFEDADA,
+ // Endian inverted Image file marker.
+ IMAGE_MAGIC_INVERT = 0xDADAFECA,
+ // Image file major version number.
+ MAJOR_VERSION = 1,
+ // Image file minor version number.
+ MINOR_VERSION = 0
+ };
- // Open an image file, reuse structure if file already open.
- static ImageFileReader* open(const char* name, bool big_endian = Endian::is_big_endian());
+ // Open an image file, reuse structure if file already open.
+ static ImageFileReader* open(const char* name, bool big_endian = Endian::is_big_endian());
- // Close an image file if the file is not in use elsewhere.
- static void close(ImageFileReader *reader);
+ // Close an image file if the file is not in use elsewhere.
+ static void close(ImageFileReader *reader);
- // Return an id for the specifed ImageFileReader.
- static u8 readerToID(ImageFileReader *reader);
+ // Return an id for the specifed ImageFileReader.
+ static u8 readerToID(ImageFileReader *reader);
- // Validate the image id.
- static bool idCheck(u8 id);
+ // Validate the image id.
+ static bool idCheck(u8 id);
- // Return an id for the specifed ImageFileReader.
- static ImageFileReader* idToReader(u8 id);
+ // Return an id for the specifed ImageFileReader.
+ static ImageFileReader* idToReader(u8 id);
- // Open image file for read access.
- bool open();
+ // Open image file for read access.
+ bool open();
- // Close image file.
- void close();
+ // Close image file.
+ void close();
- // Read directly from the file.
- bool read_at(u1* data, u8 size, u8 offset) const;
+ // Read directly from the file.
+ bool read_at(u1* data, u8 size, u8 offset) const;
- inline Endian* endian() const { return _endian; }
+ inline Endian* endian() const { return _endian; }
- // Retrieve name of image file.
- inline const char* name() const {
- return _name;
- }
+ // Retrieve name of image file.
+ inline const char* name() const {
+ return _name;
+ }
- // Retrieve size of image file.
- inline u8 file_size() const {
- return _file_size;
- }
+ // Retrieve size of image file.
+ inline u8 file_size() const {
+ return _file_size;
+ }
- // Return first address of index data.
- inline u1* get_index_address() const {
- return _index_data;
- }
+ // Return first address of index data.
+ inline u1* get_index_address() const {
+ return _index_data;
+ }
- // Return first address of resource data.
- inline u1* get_data_address() const {
- return _index_data + _index_size;
- }
+ // Return first address of resource data.
+ inline u1* get_data_address() const {
+ return _index_data + _index_size;
+ }
- // Get the size of the index data.
- size_t get_index_size() const {
- return _index_size;
- }
+ // Get the size of the index data.
+ size_t get_index_size() const {
+ return _index_size;
+ }
- inline u4 table_length() const {
- return _header.table_length(_endian);
- }
+ inline u4 table_length() const {
+ return _header.table_length(_endian);
+ }
- inline u4 locations_size() const {
- return _header.locations_size(_endian);
- }
+ inline u4 locations_size() const {
+ return _header.locations_size(_endian);
+ }
- inline u4 strings_size()const {
- return _header.strings_size(_endian);
- }
+ inline u4 strings_size()const {
+ return _header.strings_size(_endian);
+ }
- inline u4* offsets_table() const {
- return _offsets_table;
- }
+ inline u4* offsets_table() const {
+ return _offsets_table;
+ }
- // Increment use count.
- inline void inc_use() {
- _use++;
- }
+ // Increment use count.
+ inline void inc_use() {
+ _use++;
+ }
- // Decrement use count.
- inline bool dec_use() {
- return --_use == 0;
- }
+ // Decrement use count.
+ inline bool dec_use() {
+ return --_use == 0;
+ }
- // Return a string table accessor.
- inline const ImageStrings get_strings() const {
- return ImageStrings(_string_bytes, _header.strings_size(_endian));
- }
+ // Return a string table accessor.
+ inline const ImageStrings get_strings() const {
+ return ImageStrings(_string_bytes, _header.strings_size(_endian));
+ }
- // Return location attribute stream at offset.
- inline u1* get_location_offset_data(u4 offset) const {
- assert((u4)offset < _header.locations_size(_endian) &&
- "offset exceeds location attributes size");
- return offset != 0 ? _location_bytes + offset : NULL;
- }
+ // Return location attribute stream at offset.
+ inline u1* get_location_offset_data(u4 offset) const {
+ assert((u4)offset < _header.locations_size(_endian) &&
+ "offset exceeds location attributes size");
+ return offset != 0 ? _location_bytes + offset : NULL;
+ }
- // Return location attribute stream for location i.
- inline u1* get_location_data(u4 index) const {
- return get_location_offset_data(get_location_offset(index));
- }
+ // Return location attribute stream for location i.
+ inline u1* get_location_data(u4 index) const {
+ return get_location_offset_data(get_location_offset(index));
+ }
- // Return the location offset for index.
- inline u4 get_location_offset(u4 index) const {
- assert((u4)index < _header.table_length(_endian) &&
- "index exceeds location count");
- return _endian->get(_offsets_table[index]);
- }
+ // Return the location offset for index.
+ inline u4 get_location_offset(u4 index) const {
+ assert((u4)index < _header.table_length(_endian) &&
+ "index exceeds location count");
+ return _endian->get(_offsets_table[index]);
+ }
- // Find the location attributes associated with the path. Returns true if
- // the location is found, false otherwise.
- bool find_location(const char* path, ImageLocation& location) const;
+ // Find the location attributes associated with the path. Returns true if
+ // the location is found, false otherwise.
+ bool find_location(const char* path, ImageLocation& location) const;
- // Find the location index and size associated with the path.
- // Returns the location index and size if the location is found,
- // ImageFileReader::NOT_FOUND otherwise.
- u4 find_location_index(const char* path, u8 *size) const;
+ // Find the location index and size associated with the path.
+ // Returns the location index and size if the location is found,
+ // ImageFileReader::NOT_FOUND otherwise.
+ u4 find_location_index(const char* path, u8 *size) const;
- // Assemble the location path.
- void location_path(ImageLocation& location, char* path, size_t max) const;
+ // Assemble the location path.
+ void location_path(ImageLocation& location, char* path, size_t max) const;
- // Verify that a found location matches the supplied path.
- bool verify_location(ImageLocation& location, const char* path) const;
+ // Verify that a found location matches the supplied path.
+ bool verify_location(ImageLocation& location, const char* path) const;
- // Return the resource for the supplied location index.
- void get_resource(u4 index, u1* uncompressed_data) const;
+ // Return the resource for the supplied location index.
+ void get_resource(u4 index, u1* uncompressed_data) const;
- // Return the resource for the supplied path.
- void get_resource(ImageLocation& location, u1* uncompressed_data) const;
+ // Return the resource for the supplied path.
+ void get_resource(ImageLocation& location, u1* uncompressed_data) const;
- // Return the ImageModuleData for this image
- ImageModuleData * get_image_module_data();
+ // Return the ImageModuleData for this image
+ ImageModuleData * get_image_module_data();
};
#endif // LIBJIMAGE_IMAGEFILE_HPP
--- a/jdk/src/java.base/share/native/libjimage/inttypes.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/inttypes.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,7 +4,9 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -19,7 +21,6 @@
* 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.
- *
*/
#ifndef LIBJIMAGE_INTTYPES_HPP
--- a/jdk/src/java.base/share/native/libjimage/jimage.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/jimage.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -1,10 +1,12 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -19,7 +21,6 @@
* 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.
- *
*/
#include <string.h>
@@ -97,7 +98,8 @@
*
* Ex.
* jlong size;
- * JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ * JImageLocationRef location = (*JImageFindResource)(image,
+ * "java.base", "9.0", "java/lang/String.class", &size);
*/
extern "C" JImageLocationRef JIMAGE_FindResource(JImageFile* image,
const char* module_name, const char* version, const char* name,
@@ -129,7 +131,8 @@
*
* Ex.
* jlong size;
- * JImageLocationRef* location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ * JImageLocationRef location = (*JImageFindResource)(image,
+ * "java.base", "9.0", "java/lang/String.class", &size);
* char* buffer = new char[size];
* (*JImageGetResource)(image, location, buffer, size);
*/
@@ -148,7 +151,8 @@
* required. All strings are utf-8, zero byte terminated.file.
*
* Ex.
- * bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, const char* name, const char* extension, void* arg) {
+ * bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version,
+ * const char* package, const char* name, const char* extension, void* arg) {
* if (strcmp(extension, “class”) == 0) {
* char path[JIMAGE_MAX_PATH];
* Thread* THREAD = Thread::current();
--- a/jdk/src/java.base/share/native/libjimage/jimage.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/jimage.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,7 +4,9 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -19,7 +21,6 @@
* 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.
- *
*/
#include "jni.h"
@@ -111,7 +112,8 @@
*
* Ex.
* jlong size;
- * JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ * JImageLocationRef location = (*JImageFindResource)(image,
+ * "java.base", "9.0", "java/lang/String.class", &size);
*/
extern "C" JImageLocationRef JIMAGE_FindResource(JImageFile* jimage,
const char* module_name, const char* version, const char* name,
@@ -132,7 +134,8 @@
*
* Ex.
* jlong size;
- * JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
+ * JImageLocationRef location = (*JImageFindResource)(image,
+ * "java.base", "9.0", "java/lang/String.class", &size);
* char* buffer = new char[size];
* (*JImageGetResource)(image, location, buffer, size);
*/
@@ -152,7 +155,8 @@
* required. All strings are utf-8, zero byte terminated.file.
*
* Ex.
- * bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, const char* name, const char* extension, void* arg) {
+ * bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version,
+ * const char* package, const char* name, const char* extension, void* arg) {
* if (strcmp(extension, “class”) == 0) {
* char path[JIMAGE_MAX_PATH];
* Thread* THREAD = Thread::current();
--- a/jdk/src/java.base/share/native/libjimage/osSupport.hpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/share/native/libjimage/osSupport.hpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,7 +4,9 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -19,7 +21,6 @@
* 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.
- *
*/
#ifndef LIBJIMAGE_OSSUPPORT_HPP
--- a/jdk/src/java.base/unix/native/libjimage/osSupport_unix.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjimage/osSupport_unix.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,7 +4,9 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -19,10 +21,8 @@
* 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.
- *
*/
-
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
--- a/jdk/src/java.base/windows/native/libjimage/osSupport_windows.cpp Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjimage/osSupport_windows.cpp Tue Sep 22 11:01:54 2015 -0700
@@ -4,7 +4,9 @@
*
* 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.
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -19,7 +21,6 @@
* 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.
- *
*/
#include <windows.h>
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaCaret.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaCaret.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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,19 +36,27 @@
import javax.swing.text.*;
@SuppressWarnings("serial") // Superclass is not serializable across versions
-public class AquaCaret extends DefaultCaret implements UIResource, PropertyChangeListener {
- final boolean isMultiLineEditor;
- final JTextComponent c;
-
- boolean mFocused = false;
+public class AquaCaret extends DefaultCaret
+ implements UIResource, PropertyChangeListener {
- public AquaCaret(final Window inParentWindow, final JTextComponent inComponent) {
- super();
- c = inComponent;
- isMultiLineEditor = (c instanceof JTextArea || c instanceof JEditorPane);
- inComponent.addPropertyChangeListener(this);
+ private boolean isMultiLineEditor;
+ private boolean mFocused = false;
+ private boolean fPainting = false;
+
+ @Override
+ public void install(final JTextComponent c) {
+ super.install(c);
+ isMultiLineEditor = c instanceof JTextArea || c instanceof JEditorPane;
+ c.addPropertyChangeListener(this);
}
+ @Override
+ public void deinstall(final JTextComponent c) {
+ c.removePropertyChangeListener(this);
+ super.deinstall(c);
+ }
+
+ @Override
protected Highlighter.HighlightPainter getSelectionPainter() {
return AquaHighlighter.getInstance();
}
@@ -56,11 +64,13 @@
/**
* Only show the flashing caret if the selection range is zero
*/
+ @Override
public void setVisible(boolean e) {
if (e) e = getDot() == getMark();
super.setVisible(e);
}
+ @Override
protected void fireStateChanged() {
// If we have focus the caret should only flash if the range length is zero
if (mFocused) setVisible(getComponent().isEditable());
@@ -68,6 +78,7 @@
super.fireStateChanged();
}
+ @Override
public void propertyChange(final PropertyChangeEvent evt) {
final String propertyName = evt.getPropertyName();
@@ -87,6 +98,7 @@
// --- FocusListener methods --------------------------
private boolean shouldSelectAllOnFocus = true;
+ @Override
public void focusGained(final FocusEvent e) {
final JTextComponent component = getComponent();
if (!component.isEnabled() || !component.isEditable()) {
@@ -122,12 +134,13 @@
super.focusGained(e);
}
+ @Override
public void focusLost(final FocusEvent e) {
mFocused = false;
shouldSelectAllOnFocus = true;
if (isMultiLineEditor) {
setVisible(false);
- c.repaint();
+ getComponent().repaint();
} else {
super.focusLost(e);
}
@@ -136,6 +149,7 @@
// This fixes the problem where when on the mac you have to ctrl left click to
// get popup triggers the caret has code that only looks at button number.
// see radar # 3125390
+ @Override
public void mousePressed(final MouseEvent e) {
if (!e.isPopupTrigger()) {
super.mousePressed(e);
@@ -153,6 +167,7 @@
* @param r the current location of the caret
* @see #paint
*/
+ @Override
protected synchronized void damage(final Rectangle r) {
if (r == null || fPainting) return;
@@ -182,12 +197,12 @@
repaint();
}
- boolean fPainting = false;
-
- // See <rdar://problem/3833837> 1.4.2_05-141.3: JTextField performance with Aqua L&F
- // We are getting into a circular condition with the BasicCaret paint code since it doesn't know about the fact that our
- // damage routine above elminates the border. Sadly we can't easily change either one, so we will
- // add a painting flag and not damage during a repaint.
+ // See <rdar://problem/3833837> 1.4.2_05-141.3: JTextField performance with
+ // Aqua L&F. We are getting into a circular condition with the BasicCaret
+ // paint code since it doesn't know about the fact that our damage routine
+ // above elminates the border. Sadly we can't easily change either one, so
+ // we will add a painting flag and not damage during a repaint.
+ @Override
public void paint(final Graphics g) {
if (isVisible()) {
fPainting = true;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaEditorPaneUI.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaEditorPaneUI.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -39,6 +39,7 @@
}
boolean oldDragState = false;
+ @Override
protected void installDefaults(){
super.installDefaults();
if(!GraphicsEnvironment.isHeadless()){
@@ -47,6 +48,7 @@
}
}
+ @Override
protected void uninstallDefaults(){
if(!GraphicsEnvironment.isHeadless()){
getComponent().setDragEnabled(oldDragState);
@@ -55,12 +57,14 @@
}
FocusListener focusListener;
+ @Override
protected void installListeners(){
super.installListeners();
focusListener = createFocusListener();
getComponent().addFocusListener(focusListener);
}
+ @Override
protected void installKeyboardActions() {
super.installKeyboardActions();
AquaKeyBindings bindings = AquaKeyBindings.instance();
@@ -69,6 +73,7 @@
bindings.installAquaUpDownActions(c);
}
+ @Override
protected void uninstallListeners(){
getComponent().removeFocusListener(focusListener);
super.uninstallListeners();
@@ -78,12 +83,12 @@
return new AquaFocusHandler();
}
- protected Caret createCaret(){
- final Window owningWindow = SwingUtilities.getWindowAncestor(getComponent());
- final AquaCaret returnValue = new AquaCaret(owningWindow, getComponent());
- return returnValue;
+ @Override
+ protected Caret createCaret() {
+ return new AquaCaret();
}
+ @Override
protected Highlighter createHighlighter(){
return new AquaHighlighter();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java Tue Sep 22 11:01:54 2015 -0700
@@ -46,7 +46,7 @@
import com.apple.laf.AquaIcon.SystemIcon;
import com.apple.laf.AquaUtils.RecyclableObject;
import com.apple.laf.AquaUtils.RecyclableSingleton;
-import sun.awt.image.MultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
import sun.awt.image.MultiResolutionCachedImage;
public class AquaImageFactory {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameUI.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameUI.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -66,6 +66,7 @@
protected Color fNotSelectedTextColor;
AquaInternalFrameBorder fAquaBorder;
+ private ResizeBox resizeBox;
// for button tracking
boolean fMouseOverPressedButton;
@@ -96,6 +97,7 @@
}
/// Inherit (but be careful to check everything they call):
+ @Override
public void installUI(final JComponent c) {
// super.installUI(c); // Swing 1.1.1 has a bug in installUI - it doesn't check for null northPane
frame = (JInternalFrame)c;
@@ -125,12 +127,14 @@
c.setBorder(new CompoundUIBorder(fIsPallet ? paletteWindowShadow.get() : documentWindowShadow.get(), c.getBorder()));
}
+ @Override
protected void installDefaults() {
super.installDefaults();
fSelectedTextColor = UIManager.getColor("InternalFrame.activeTitleForeground");
fNotSelectedTextColor = UIManager.getColor("InternalFrame.inactiveTitleForeground");
}
+ @Override
public void setSouthPane(final JComponent c) {
if (southPane != null) {
frame.remove(southPane);
@@ -144,6 +148,7 @@
}
static final RecyclableSingleton<Icon> closeIcon = new RecyclableSingleton<Icon>() {
+ @Override
protected Icon getInstance() {
return new AquaInternalFrameButtonIcon(Widget.TITLE_BAR_CLOSE_BOX);
}
@@ -153,6 +158,7 @@
}
static final RecyclableSingleton<Icon> minimizeIcon = new RecyclableSingleton<Icon>() {
+ @Override
protected Icon getInstance() {
return new AquaInternalFrameButtonIcon(Widget.TITLE_BAR_COLLAPSE_BOX);
}
@@ -162,6 +168,7 @@
}
static final RecyclableSingleton<Icon> zoomIcon = new RecyclableSingleton<Icon>() {
+ @Override
protected Icon getInstance() {
return new AquaInternalFrameButtonIcon(Widget.TITLE_BAR_ZOOM_BOX);
}
@@ -175,6 +182,7 @@
painter.state.set(widget);
}
+ @Override
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
painter.state.set(getStateFor(c));
super.paintIcon(c, g, x, y);
@@ -184,28 +192,24 @@
return State.ROLLOVER;
}
+ @Override
public int getIconWidth() {
return 19;
}
+ @Override
public int getIconHeight() {
return 19;
}
}
+ @Override
protected void installKeyboardActions() {
} //$ Not Mac-ish - should we support?
- protected ResizeBox resizeBox;
+ @Override
protected void installComponents() {
final JLayeredPane layeredPane = frame.getLayeredPane();
- if (resizeBox != null) {
- resizeBox.removeListeners();
- layeredPane.removeComponentListener(resizeBox);
- layeredPane.remove(resizeBox);
- resizeBox = null;
- }
-
resizeBox = new ResizeBox(layeredPane);
resizeBox.repositionResizeBox();
@@ -218,6 +222,7 @@
}
/// Inherit all the listeners - that's the main reason we subclass Basic!
+ @Override
protected void installListeners() {
fPropertyListener = new PropertyListener();
frame.addPropertyChangeListener(fPropertyListener);
@@ -225,22 +230,36 @@
}
// uninstallDefaults
- // uninstallComponents
+
+ @Override
+ protected void uninstallComponents() {
+ super.uninstallComponents();
+ final JLayeredPane layeredPane = frame.getLayeredPane();
+ resizeBox.removeListeners();
+ layeredPane.removeComponentListener(resizeBox);
+ layeredPane.remove(resizeBox);
+ resizeBox = null;
+ }
+
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
frame.removePropertyChangeListener(fPropertyListener);
}
+ @Override
protected void uninstallKeyboardActions() {
}
// Called when a DesktopIcon replaces an InternalFrame & vice versa
//protected void replacePane(JComponent currentPane, JComponent newPane) {}
+ @Override
protected void installMouseHandlers(final JComponent c) {
c.addMouseListener(borderListener);
c.addMouseMotionListener(borderListener);
}
+ @Override
protected void deinstallMouseHandlers(final JComponent c) {
c.removeMouseListener(borderListener);
c.removeMouseMotionListener(borderListener);
@@ -256,6 +275,7 @@
return map;
}
+ @Override
public Dimension getPreferredSize(JComponent x) {
Dimension preferredSize = super.getPreferredSize(x);
Dimension minimumSize = frame.getMinimumSize();
@@ -268,6 +288,7 @@
return preferredSize;
}
+ @Override
public void setNorthPane(final JComponent c) {
replacePane(northPane, c);
northPane = c;
@@ -278,6 +299,7 @@
* and adds it to the frame.
* Reverse process for the <code>currentPane</code>.
*/
+ @Override
protected void replacePane(final JComponent currentPane, final JComponent newPane) {
if (currentPane != null) {
deinstallMouseHandlers(currentPane);
@@ -290,6 +312,7 @@
}
// Our "Border" listener is shared by the AquaDesktopIcon
+ @Override
protected MouseInputAdapter createBorderListener(final JInternalFrame w) {
return new AquaBorderListener();
}
@@ -374,6 +397,7 @@
protected final int RESIZE_NONE = 0;
private boolean discardRelease = false;
+ @Override
public void mouseClicked(final MouseEvent e) {
if (didForwardEvent(e)) return;
@@ -406,6 +430,7 @@
fAquaBorder.repaintButtonArea(frame);
}
+ @Override
public void mouseReleased(final MouseEvent e) {
if (didForwardEvent(e)) return;
@@ -461,6 +486,7 @@
resizeDir = RESIZE_NONE;
}
+ @Override
public void mousePressed(final MouseEvent e) {
if (didForwardEvent(e)) return;
@@ -527,6 +553,7 @@
return true;
}
+ @Override
public void mouseDragged(final MouseEvent e) {
// do not forward drags
// if (didForwardEvent(e)) return;
@@ -576,6 +603,7 @@
return;
}
+ @Override
public void mouseMoved(final MouseEvent e) {
if (didForwardEvent(e)) return;
updateRollover(e);
@@ -614,7 +642,11 @@
if (hitComponent == null || hitComponent == frame) return false;
final Point hitComponentPoint = SwingUtilities.convertPoint(pane, parentPoint, hitComponent);
- hitComponent.dispatchEvent(new MouseEvent(hitComponent, e.getID(), e.getWhen(), e.getModifiers(), hitComponentPoint.x, hitComponentPoint.y, e.getClickCount(), e.isPopupTrigger(), e.getButton()));
+ hitComponent.dispatchEvent(
+ new MouseEvent(hitComponent, e.getID(), e.getWhen(),
+ e.getModifiers(), hitComponentPoint.x,
+ hitComponentPoint.y, e.getClickCount(),
+ e.isPopupTrigger(), e.getButton()));
return true;
}
@@ -668,6 +700,7 @@
}
class PropertyListener implements PropertyChangeListener {
+ @Override
public void propertyChange(final PropertyChangeEvent e) {
final String name = e.getPropertyName();
if (FRAME_TYPE.equals(name)) {
@@ -704,14 +737,17 @@
} // end class PaletteListener
static final InternalFrameShadow documentWindowShadow = new InternalFrameShadow() {
+ @Override
Border getForegroundShadowBorder() {
return new AquaUtils.SlicedShadowBorder(new Painter() {
+ @Override
public void paint(final Graphics g, final int x, final int y, final int w, final int h) {
g.setColor(new Color(0, 0, 0, 196));
g.fillRoundRect(x, y, w, h, 16, 16);
g.fillRect(x, y + h - 16, w, 16);
}
}, new Painter() {
+ @Override
public void paint(final Graphics g, int x, int y, int w, int h) {
g.setColor(new Color(0, 0, 0, 64));
g.drawLine(x + 2, y - 8, x + w - 2, y - 8);
@@ -720,14 +756,17 @@
0, 7, 1.1f, 1.0f, 24, 51, 51, 25, 25, 25, 25);
}
+ @Override
Border getBackgroundShadowBorder() {
return new AquaUtils.SlicedShadowBorder(new Painter() {
+ @Override
public void paint(final Graphics g, final int x, final int y, final int w, final int h) {
g.setColor(new Color(0, 0, 0, 128));
g.fillRoundRect(x - 3, y - 8, w + 6, h, 16, 16);
g.fillRect(x - 3, y + h - 20, w + 6, 19);
}
}, new Painter() {
+ @Override
public void paint(final Graphics g, int x, int y, int w, int h) {
g.setColor(new Color(0, 0, 0, 32));
g.drawLine(x, y - 11, x + w - 1, y - 11);
@@ -738,8 +777,10 @@
};
static final InternalFrameShadow paletteWindowShadow = new InternalFrameShadow() {
+ @Override
Border getForegroundShadowBorder() {
return new AquaUtils.SlicedShadowBorder(new Painter() {
+ @Override
public void paint(final Graphics g, final int x, final int y, final int w, final int h) {
g.setColor(new Color(0, 0, 0, 128));
g.fillRect(x, y + 3, w, h - 3);
@@ -748,6 +789,7 @@
0, 3, 1.0f, 1.0f, 10, 25, 25, 12, 12, 12, 12);
}
+ @Override
Border getBackgroundShadowBorder() {
return getForegroundShadowBorder();
}
@@ -762,19 +804,23 @@
abstract Border getForegroundShadowBorder();
abstract Border getBackgroundShadowBorder();
+ @Override
protected Border getInstance() {
final Border fgShadow = getForegroundShadowBorder();
final Border bgShadow = getBackgroundShadowBorder();
return new Border() {
+ @Override
public Insets getBorderInsets(final Component c) {
return fgShadow.getBorderInsets(c);
}
+ @Override
public boolean isBorderOpaque() {
return false;
}
+ @Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h) {
if (((JInternalFrame)c).isSelected()) {
fgShadow.paintBorder(c, g, x, y, w, h);
@@ -790,6 +836,7 @@
@Override
protected Icon getInstance() {
return new AquaIcon.ScalingJRSUIIcon(11, 11) {
+ @Override
public void initIconPainter(final AquaPainter<JRSUIState> iconState) {
iconState.state.set(Widget.GROW_BOX_TEXTURED);
iconState.state.set(WindowType.UTILITY);
@@ -799,12 +846,15 @@
};
@SuppressWarnings("serial") // Superclass is not serializable across versions
- class ResizeBox extends JLabel implements MouseListener, MouseMotionListener, MouseWheelListener, ComponentListener, PropertyChangeListener, UIResource {
- final JLayeredPane layeredPane;
- Dimension originalSize;
- Point originalLocation;
+ private final class ResizeBox extends JLabel
+ implements MouseListener, MouseMotionListener, MouseWheelListener,
+ ComponentListener, PropertyChangeListener, UIResource {
- public ResizeBox(final JLayeredPane layeredPane) {
+ private final JLayeredPane layeredPane;
+ private Dimension originalSize;
+ private Point originalLocation;
+
+ ResizeBox(final JLayeredPane layeredPane) {
super(RESIZE_ICON.get());
setSize(11, 11);
this.layeredPane = layeredPane;
@@ -895,14 +945,18 @@
return c;
}
+ @Override
public void mouseClicked(final MouseEvent e) {
forwardEventToFrame(e);
}
+ @Override
public void mouseEntered(final MouseEvent e) { }
+ @Override
public void mouseExited(final MouseEvent e) { }
+ @Override
public void mousePressed(final MouseEvent e) {
if (frame == null) return;
@@ -916,6 +970,7 @@
forwardEventToFrame(e);
}
+ @Override
public void mouseReleased(final MouseEvent e) {
if (originalLocation != null) {
resizeInternalFrame(e.getPoint());
@@ -927,13 +982,16 @@
forwardEventToFrame(e);
}
+ @Override
public void mouseDragged(final MouseEvent e) {
resizeInternalFrame(e.getPoint());
repositionResizeBox();
}
+ @Override
public void mouseMoved(final MouseEvent e) { }
+ @Override
public void mouseWheelMoved(final MouseWheelEvent e) {
final Point pt = new Point();
final Component c = getComponentToForwardTo(e, pt);
@@ -945,20 +1003,25 @@
e.getPreciseWheelRotation()));
}
+ @Override
public void componentResized(final ComponentEvent e) {
repositionResizeBox();
}
+ @Override
public void componentShown(final ComponentEvent e) {
repositionResizeBox();
}
+ @Override
public void componentMoved(final ComponentEvent e) {
repositionResizeBox();
}
+ @Override
public void componentHidden(final ComponentEvent e) { }
+ @Override
public void propertyChange(final PropertyChangeEvent evt) {
if (!"resizable".equals(evt.getPropertyName())) return;
setVisible(Boolean.TRUE.equals(evt.getNewValue()));
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java Tue Sep 22 11:01:54 2015 -0700
@@ -49,12 +49,14 @@
* so we can't subclass!
*/
public class AquaSpinnerUI extends SpinnerUI {
- private static final RecyclableSingleton<? extends PropertyChangeListener> propertyChangeListener = new RecyclableSingletonFromDefaultConstructor<PropertyChangeHandler>(PropertyChangeHandler.class);
+ private static final RecyclableSingleton<? extends PropertyChangeListener> propertyChangeListener
+ = new RecyclableSingletonFromDefaultConstructor<>(PropertyChangeHandler.class);
static PropertyChangeListener getPropertyChangeListener() {
return propertyChangeListener.get();
}
- private static final RecyclableSingleton<ArrowButtonHandler> nextButtonHandler = new RecyclableSingleton<ArrowButtonHandler>() {
+ private static final RecyclableSingleton<ArrowButtonHandler> nextButtonHandler
+ = new RecyclableSingleton<ArrowButtonHandler>() {
@Override
protected ArrowButtonHandler getInstance() {
return new ArrowButtonHandler("increment", true);
@@ -63,7 +65,8 @@
static ArrowButtonHandler getNextButtonHandler() {
return nextButtonHandler.get();
}
- private static final RecyclableSingleton<ArrowButtonHandler> previousButtonHandler = new RecyclableSingleton<ArrowButtonHandler>() {
+ private static final RecyclableSingleton<ArrowButtonHandler> previousButtonHandler
+ = new RecyclableSingleton<ArrowButtonHandler>() {
@Override
protected ArrowButtonHandler getInstance() {
return new ArrowButtonHandler("decrement", false);
@@ -73,8 +76,10 @@
return previousButtonHandler.get();
}
- JSpinner spinner;
- SpinPainter spinPainter;
+ private JSpinner spinner;
+ private SpinPainter spinPainter;
+ private TransparentButton next;
+ private TransparentButton prev;
public static ComponentUI createUI(final JComponent c) {
return new AquaSpinnerUI();
@@ -87,12 +92,13 @@
}
boolean wasOpaque;
+ @Override
public void installUI(final JComponent c) {
this.spinner = (JSpinner)c;
installDefaults();
installListeners();
- final TransparentButton next = createNextButton();
- final TransparentButton prev = createPreviousButton();
+ next = createNextButton();
+ prev = createPreviousButton();
spinPainter = new SpinPainter(next, prev);
maybeAdd(next, "Next");
@@ -111,11 +117,21 @@
spinner.setOpaque(false);
}
+ @Override
public void uninstallUI(final JComponent c) {
uninstallDefaults();
uninstallListeners();
spinner.setOpaque(wasOpaque);
+ spinPainter = null;
spinner = null;
+ // AquaButtonUI install some listeners to all parents, which means that
+ // we need to uninstall UI here to remove those listeners, because after
+ // we remove them from spinner we lost the latest reference to them,
+ // and our standard uninstallUI machinery will not call them.
+ next.getUI().uninstallUI(next);
+ prev.getUI().uninstallUI(prev);
+ next = null;
+ prev = null;
c.removeAll();
}
@@ -164,6 +180,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getBaseline(JComponent c, int width, int height) {
super.getBaseline(c, width, height);
JComponent editor = spinner.getEditor();
@@ -182,6 +199,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
JComponent c) {
super.getBaselineResizeBehavior(c);
@@ -200,8 +218,10 @@
interceptRepaints = true;
}
+ @Override
public void paint(final Graphics g) {}
+ @Override
public void repaint() {
// only intercept repaints if we are after this has been initialized
// otherwise we can't talk to our containing class
@@ -315,6 +335,7 @@
return (src instanceof JSpinner) ? (JSpinner)src : null;
}
+ @Override
public void actionPerformed(final ActionEvent e) {
if (!(e.getSource() instanceof javax.swing.Timer)) {
// Most likely resulting from being in ActionMap.
@@ -423,6 +444,7 @@
return -1;
}
+ @Override
public void mousePressed(final MouseEvent e) {
if (!SwingUtilities.isLeftMouseButton(e) || !e.getComponent().isEnabled()) return;
spinner = eventToSpinner(e);
@@ -431,13 +453,17 @@
focusSpinnerIfNecessary();
}
+ @Override
public void mouseReleased(final MouseEvent e) {
autoRepeatTimer.stop();
spinner = null;
}
+ @Override
public void mouseClicked(final MouseEvent e) {}
+ @Override
public void mouseEntered(final MouseEvent e) {}
+ @Override
public void mouseExited(final MouseEvent e) {}
/**
@@ -485,6 +511,7 @@
}
}
+ @Override
public void paint(final Graphics g) {
if (spinner.isOpaque()) {
g.setColor(spinner.getBackground());
@@ -511,6 +538,7 @@
painter.paint(g, spinner, 0, 0, bounds.width, bounds.height);
}
+ @Override
public Dimension getPreferredSize() {
final Size size = AquaUtilControlSize.getUserSizeFrom(this);
@@ -533,6 +561,7 @@
private Component editor = null;
private Component painter = null;
+ @Override
public void addLayoutComponent(final String name, final Component c) {
if ("Next".equals(name)) {
nextButton = c;
@@ -545,6 +574,7 @@
}
}
+ @Override
public void removeLayoutComponent(Component c) {
if (c == nextButton) {
c = null;
@@ -561,6 +591,7 @@
return (c == null) ? new Dimension(0, 0) : c.getPreferredSize();
}
+ @Override
public Dimension preferredLayoutSize(final Container parent) {
// Dimension nextD = preferredSize(nextButton);
// Dimension previousD = preferredSize(previousButton);
@@ -579,6 +610,7 @@
return size;
}
+ @Override
public Dimension minimumLayoutSize(final Container parent) {
return preferredLayoutSize(parent);
}
@@ -589,6 +621,7 @@
}
}
+ @Override
public void layoutContainer(final Container parent) {
final Insets insets = parent.getInsets();
final int availWidth = parent.getWidth() - (insets.left + insets.right);
@@ -629,6 +662,7 @@
* property changes are delegated to protected methods.
*/
static class PropertyChangeHandler implements PropertyChangeListener {
+ @Override
public void propertyChange(final PropertyChangeEvent e) {
final String propertyName = e.getPropertyName();
final JSpinner spinner = (JSpinner)(e.getSource());
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -95,6 +95,17 @@
super.assureRectsCreated(tabCount);
}
+ @Override
+ protected void uninstallListeners() {
+ // We're not just a mouseListener, we're a mouseMotionListener
+ if (mouseListener instanceof MouseHandler) {
+ final MouseHandler mh = (MouseHandler) mouseListener;
+ mh.dispose();
+ tabPane.removeMouseMotionListener(mh);
+ }
+ super.uninstallListeners();
+ }
+
protected void uninstallDefaults() {
contentDrawingInsets.set(0, 0, 0, 0);
}
@@ -409,7 +420,15 @@
paintTabNormalFromRect(g, tabPlacement, rects[tabIndex], tabIndex, fIconRect, fTextRect, active, frameActive, isLeftToRight);
}
- protected void paintTabNormalFromRect(final Graphics g, final int tabPlacement, final Rectangle tabRect, final int nonRectIndex, final Rectangle iconRect, final Rectangle textRect, final boolean active, final boolean frameActive, final boolean isLeftToRight) {
+ protected void paintTabNormalFromRect(final Graphics g,
+ final int tabPlacement,
+ final Rectangle tabRect,
+ final int nonRectIndex,
+ final Rectangle iconRect,
+ final Rectangle textRect,
+ final boolean active,
+ final boolean frameActive,
+ final boolean isLeftToRight) {
final int selectedIndex = tabPane.getSelectedIndex();
final boolean isSelected = selectedIndex == nonRectIndex;
@@ -420,7 +439,12 @@
paintContents(g, tabPlacement, nonRectIndex, tabRect, iconRect, textRect, isSelected);
}
- protected void paintCUITab(final Graphics g, final int tabPlacement, final Rectangle tabRect, final boolean isSelected, final boolean frameActive, final boolean isLeftToRight, final int nonRectIndex) {
+ protected void paintCUITab(final Graphics g, final int tabPlacement,
+ final Rectangle tabRect,
+ final boolean isSelected,
+ final boolean frameActive,
+ final boolean isLeftToRight,
+ final int nonRectIndex) {
final int tabCount = tabPane.getTabCount();
final boolean needsLeftScrollTab = visibleTabState.needsLeftScrollTab();
@@ -835,14 +859,20 @@
}
}
- public class MouseHandler extends MouseInputAdapter implements ActionListener {
- protected int trackingTab = -3;
- protected Timer popupTimer = new Timer(500, this);
+ class MouseHandler extends MouseInputAdapter implements ActionListener {
+
+ int trackingTab = -3;
+ private final Timer popupTimer = new Timer(500, this);
- public MouseHandler() {
+ MouseHandler() {
popupTimer.setRepeats(false);
}
+ void dispose (){
+ popupTimer.removeActionListener(this);
+ popupTimer.stop();
+ }
+
public void mousePressed(final MouseEvent e) {
final JTabbedPane pane = (JTabbedPane)e.getSource();
if (!pane.isEnabled()) {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextAreaUI.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextAreaUI.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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,6 +42,7 @@
}
AquaFocusHandler handler;
+ @Override
protected void installListeners() {
super.installListeners();
@@ -53,6 +54,7 @@
AquaUtilControlSize.addSizePropertyListener(c);
}
+ @Override
protected void uninstallListeners() {
final JTextComponent c = getComponent();
@@ -66,6 +68,7 @@
}
boolean oldDragState = false;
+ @Override
protected void installDefaults() {
if (!GraphicsEnvironment.isHeadless()) {
oldDragState = getComponent().getDragEnabled();
@@ -74,6 +77,7 @@
super.installDefaults();
}
+ @Override
protected void uninstallDefaults() {
if (!GraphicsEnvironment.isHeadless()) {
getComponent().setDragEnabled(oldDragState);
@@ -81,7 +85,9 @@
super.uninstallDefaults();
}
- // Install a default keypress action which handles Cmd and Option keys properly
+ // Install a default keypress action which handles Cmd and Option keys
+ // properly
+ @Override
protected void installKeyboardActions() {
super.installKeyboardActions();
AquaKeyBindings bindings = AquaKeyBindings.instance();
@@ -90,13 +96,12 @@
bindings.installAquaUpDownActions(c);
}
+ @Override
protected Caret createCaret() {
- final JTextComponent c = getComponent();
- final Window owningWindow = SwingUtilities.getWindowAncestor(c);
- final AquaCaret returnValue = new AquaCaret(owningWindow, c);
- return returnValue;
+ return new AquaCaret();
}
+ @Override
protected Highlighter createHighlighter() {
return new AquaHighlighter();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextFieldUI.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextFieldUI.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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,6 +42,7 @@
protected JComponentPainter delegate;
protected AquaFocusHandler handler;
+ @Override
protected void installListeners() {
super.installListeners();
@@ -55,6 +56,7 @@
AquaTextFieldSearch.installSearchFieldListener(c);
}
+ @Override
protected void uninstallListeners() {
final JTextComponent c = getComponent();
AquaTextFieldSearch.uninstallSearchFieldListener(c);
@@ -67,6 +69,7 @@
}
boolean oldDragState = false;
+ @Override
protected void installDefaults() {
if (!GraphicsEnvironment.isHeadless()) {
oldDragState = getComponent().getDragEnabled();
@@ -76,6 +79,7 @@
super.installDefaults();
}
+ @Override
protected void uninstallDefaults() {
super.uninstallDefaults();
@@ -84,12 +88,15 @@
}
}
- // Install a default keypress action which handles Cmd and Option keys properly
+ // Install a default keypress action which handles Cmd and Option keys
+ // properly
+ @Override
protected void installKeyboardActions() {
super.installKeyboardActions();
AquaKeyBindings.instance().setDefaultAction(getKeymapName());
}
+ @Override
protected Rectangle getVisibleEditorRect() {
final Rectangle rect = super.getVisibleEditorRect();
if (rect == null) return null;
@@ -102,6 +109,7 @@
return rect;
}
+ @Override
protected void paintSafely(final Graphics g) {
paintBackgroundSafely(g);
super.paintSafely(g);
@@ -149,20 +157,23 @@
// the common case
final int shrinkage = AquaTextFieldBorder.getShrinkageFor(c, height);
- g.fillRect(insets.left - 2, insets.top - shrinkage - 1, width - insets.right - insets.left + 4, height - insets.bottom - insets.top + shrinkage * 2 + 2);
+ g.fillRect(insets.left - 2, insets.top - shrinkage - 1,
+ width - insets.right - insets.left + 4,
+ height - insets.bottom - insets.top + shrinkage * 2 + 2);
}
+ @Override
protected void paintBackground(final Graphics g) {
// we have already ensured that the background is painted to our liking
// by paintBackgroundSafely(), called from paintSafely().
}
+ @Override
protected Caret createCaret() {
- final JTextComponent c = getComponent();
- final Window owningWindow = SwingUtilities.getWindowAncestor(c);
- return new AquaCaret(owningWindow, c);
+ return new AquaCaret();
}
+ @Override
protected Highlighter createHighlighter() {
return new AquaHighlighter();
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextPaneUI.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTextPaneUI.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -43,6 +43,7 @@
}
AquaFocusHandler handler;
+ @Override
protected void installListeners() {
super.installListeners();
final JComponent c = getComponent();
@@ -52,6 +53,7 @@
AquaUtilControlSize.addSizePropertyListener(c);
}
+ @Override
protected void uninstallListeners() {
final JComponent c = getComponent();
AquaUtilControlSize.removeSizePropertyListener(c);
@@ -62,6 +64,7 @@
}
boolean oldDragState = false;
+ @Override
protected void installDefaults() {
final JTextComponent c = getComponent();
if (!GraphicsEnvironment.isHeadless()) {
@@ -71,6 +74,7 @@
super.installDefaults();
}
+ @Override
protected void uninstallDefaults() {
if (!GraphicsEnvironment.isHeadless()) {
getComponent().setDragEnabled(oldDragState);
@@ -78,7 +82,9 @@
super.uninstallDefaults();
}
- // Install a default keypress action which handles Cmd and Option keys properly
+ // Install a default keypress action which handles Cmd and Option keys
+ // properly
+ @Override
protected void installKeyboardActions() {
super.installKeyboardActions();
AquaKeyBindings bindings = AquaKeyBindings.instance();
@@ -88,12 +94,12 @@
bindings.installAquaUpDownActions(c);
}
+ @Override
protected Caret createCaret() {
- final JTextComponent c = getComponent();
- final Window owningWindow = SwingUtilities.getWindowAncestor(c);
- return new AquaCaret(owningWindow, c);
+ return new AquaCaret();
}
+ @Override
protected Highlighter createHighlighter() {
return new AquaHighlighter();
}
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,7 +31,7 @@
import java.util.Arrays;
import java.util.List;
-import sun.awt.image.MultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
import sun.awt.image.MultiResolutionCachedImage;
import sun.awt.image.SunWritableRaster;
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, 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
@@ -25,10 +25,8 @@
package com.sun.media.sound;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URL;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MetaMessage;
@@ -44,28 +42,27 @@
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.UnsupportedAudioFileException;
-import javax.sound.sampled.spi.AudioFileReader;
/**
* MIDI File Audio Renderer/Reader.
*
* @author Karl Helgason
*/
-public final class SoftMidiAudioFileReader extends AudioFileReader {
+public final class SoftMidiAudioFileReader extends SunFileReader {
+
+ private static final Type MIDI = new Type("MIDI", "mid");
- public static final Type MIDI = new Type("MIDI", "mid");
- private static AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
+ private static final AudioFormat format = new AudioFormat(44100, 16, 2,
+ true, false);
- public AudioFileFormat getAudioFileFormat(Sequence seq)
- throws UnsupportedAudioFileException, IOException {
-
+ private static AudioFileFormat getAudioFileFormat(final Sequence seq) {
long totallen = seq.getMicrosecondLength() / 1000000;
long len = (long) (format.getFrameRate() * (totallen + 4));
return new AudioFileFormat(MIDI, format, (int) len);
}
- public AudioInputStream getAudioInputStream(Sequence seq)
- throws UnsupportedAudioFileException, IOException {
+ private AudioInputStream getAudioInputStream(final Sequence seq)
+ throws InvalidMidiDataException {
AudioSynthesizer synth = (AudioSynthesizer) new SoftSynthesizer();
AudioInputStream stream;
Receiver recv;
@@ -73,7 +70,7 @@
stream = synth.openStream(format, null);
recv = synth.getReceiver();
} catch (MidiUnavailableException e) {
- throw new IOException(e.toString());
+ throw new InvalidMidiDataException(e.toString());
}
float divtype = seq.getDivisionType();
Track[] tracks = seq.getTracks();
@@ -111,7 +108,7 @@
if (((MetaMessage) msg).getType() == 0x51) {
byte[] data = ((MetaMessage) msg).getData();
if (data.length < 3) {
- throw new UnsupportedAudioFileException();
+ throw new InvalidMidiDataException();
}
mpq = ((data[0] & 0xff) << 16)
| ((data[1] & 0xff) << 8) | (data[2] & 0xff);
@@ -128,91 +125,25 @@
return stream;
}
- public AudioInputStream getAudioInputStream(InputStream inputstream)
+ @Override
+ public AudioInputStream getAudioInputStream(final InputStream stream)
throws UnsupportedAudioFileException, IOException {
-
- inputstream.mark(200);
- Sequence seq;
+ stream.mark(200);
try {
- seq = MidiSystem.getSequence(inputstream);
- } catch (InvalidMidiDataException e) {
- inputstream.reset();
- throw new UnsupportedAudioFileException();
- } catch (IOException e) {
- inputstream.reset();
+ return getAudioInputStream(MidiSystem.getSequence(stream));
+ } catch (final InvalidMidiDataException ignored) {
+ stream.reset();
throw new UnsupportedAudioFileException();
}
- return getAudioInputStream(seq);
- }
-
- public AudioFileFormat getAudioFileFormat(URL url)
- throws UnsupportedAudioFileException, IOException {
- Sequence seq;
- try {
- seq = MidiSystem.getSequence(url);
- } catch (InvalidMidiDataException e) {
- throw new UnsupportedAudioFileException();
- } catch (IOException e) {
- throw new UnsupportedAudioFileException();
- }
- return getAudioFileFormat(seq);
- }
-
- public AudioFileFormat getAudioFileFormat(File file)
- throws UnsupportedAudioFileException, IOException {
- Sequence seq;
- try {
- seq = MidiSystem.getSequence(file);
- } catch (InvalidMidiDataException e) {
- throw new UnsupportedAudioFileException();
- } catch (IOException e) {
- throw new UnsupportedAudioFileException();
- }
- return getAudioFileFormat(seq);
}
- public AudioInputStream getAudioInputStream(URL url)
+ @Override
+ AudioFileFormat getAudioFileFormatImpl(final InputStream stream)
throws UnsupportedAudioFileException, IOException {
- Sequence seq;
try {
- seq = MidiSystem.getSequence(url);
- } catch (InvalidMidiDataException e) {
- throw new UnsupportedAudioFileException();
- } catch (IOException e) {
+ return getAudioFileFormat(MidiSystem.getSequence(stream));
+ } catch (final InvalidMidiDataException ignored) {
throw new UnsupportedAudioFileException();
}
- return getAudioInputStream(seq);
- }
-
- public AudioInputStream getAudioInputStream(File file)
- throws UnsupportedAudioFileException, IOException {
- if (!file.getName().toLowerCase().endsWith(".mid"))
- throw new UnsupportedAudioFileException();
- Sequence seq;
- try {
- seq = MidiSystem.getSequence(file);
- } catch (InvalidMidiDataException e) {
- throw new UnsupportedAudioFileException();
- } catch (IOException e) {
- throw new UnsupportedAudioFileException();
- }
- return getAudioInputStream(seq);
- }
-
- public AudioFileFormat getAudioFileFormat(InputStream inputstream)
- throws UnsupportedAudioFileException, IOException {
-
- inputstream.mark(200);
- Sequence seq;
- try {
- seq = MidiSystem.getSequence(inputstream);
- } catch (InvalidMidiDataException e) {
- inputstream.reset();
- throw new UnsupportedAudioFileException();
- } catch (IOException e) {
- inputstream.reset();
- throw new UnsupportedAudioFileException();
- }
- return getAudioFileFormat(seq);
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java Tue Sep 22 11:01:54 2015 -0700
@@ -52,10 +52,6 @@
try {
return getAudioFileFormatImpl(stream);
} finally {
- // According to specification the following is not strictly
- // necessary, if we got correct format. But it was implemented like
- // that in 1.3.0 - 1.8. So I leave it as it was, but it seems
- // specification should be updated.
stream.reset();
}
}
--- a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java Tue Sep 22 11:01:54 2015 -0700
@@ -899,11 +899,13 @@
}
}
- // Wake up EDT waiting in getNextEvent(), so it can
- // pick up a new EventQueue. Post the waking event before
- // topQueue.nextQueue is assigned, otherwise the event would
- // go newEventQueue
- topQueue.postEventPrivate(new InvocationEvent(topQueue, dummyRunnable));
+ if (topQueue.dispatchThread != null) {
+ // Wake up EDT waiting in getNextEvent(), so it can
+ // pick up a new EventQueue. Post the waking event before
+ // topQueue.nextQueue is assigned, otherwise the event would
+ // go newEventQueue
+ topQueue.postEventPrivate(new InvocationEvent(topQueue, dummyRunnable));
+ }
newEventQueue.previousQueue = topQueue;
topQueue.nextQueue = newEventQueue;
--- a/jdk/src/java.desktop/share/classes/java/awt/Font.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/Font.java Tue Sep 22 11:01:54 2015 -0700
@@ -128,7 +128,9 @@
* <p>
* For a discussion of the relative advantages and disadvantages of using
* physical or logical fonts, see the
- * <a href="http://www.oracle.com/technetwork/java/javase/tech/faq-jsp-138165.html">Internationalization FAQ</a>
+ * <a href="https://docs.oracle.com/javase/tutorial/2d/text/fonts.html#advantages-and-disadvantages">
+ * Physical and Logical Fonts</a>
+ * in <a href="https://docs.oracle.com/javase/tutorial/index.html">The Java Tutorials</a>
* document.
*
* <h3>Font Faces and Names</h3>
--- a/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java Tue Sep 22 11:01:54 2015 -0700
@@ -955,6 +955,64 @@
SunHints.VALUE_STROKE_PURE;
/**
+ * Image resolution variant hint key.
+ * The {@code RESOLUTION_VARIANT} hint controls which image resolution
+ * variant should be chosen for image drawing.
+ *
+ * <ul>
+ * <li>{@link #VALUE_RESOLUTION_VARIANT_DEFAULT}
+ * <li>{@link #VALUE_RESOLUTION_VARIANT_BASE}
+ * <li>{@link #VALUE_RESOLUTION_VARIANT_SIZE_FIT}
+ * <li>{@link #VALUE_RESOLUTION_VARIANT_DPI_FIT}
+ * </ul>
+ * @since 1.9
+ */
+ public static final Key KEY_RESOLUTION_VARIANT =
+ SunHints.KEY_RESOLUTION_VARIANT;
+
+ /**
+ * Image resolution variant hint value -- an image resolution variant is
+ * chosen based on a default heuristic which may depend on the policies
+ * of the platform
+ *
+ * @see #KEY_RESOLUTION_VARIANT
+ * @since 1.9
+ */
+ public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT =
+ SunHints.VALUE_RESOLUTION_VARIANT_DEFAULT;
+
+ /**
+ * Image resolution variant hint value -- the standard resolution of an image
+ * is always used.
+ *
+ * @see #KEY_RESOLUTION_VARIANT
+ * @since 1.9
+ */
+ public static final Object VALUE_RESOLUTION_VARIANT_BASE =
+ SunHints.VALUE_RESOLUTION_VARIANT_BASE;
+
+ /**
+ * Image resolution variant hint value -- an image resolution variant is
+ * chosen based on the DPI of the screen and the transform in the Graphics2D
+ * context.
+ *
+ * @see #KEY_RESOLUTION_VARIANT
+ * @since 1.9
+ */
+ public static final Object VALUE_RESOLUTION_VARIANT_SIZE_FIT =
+ SunHints.VALUE_RESOLUTION_VARIANT_SIZE_FIT;
+
+ /**
+ * Image resolution variant hint value -- an image resolution variant is
+ * chosen based only on the DPI of the screen.
+ *
+ * @see #KEY_RESOLUTION_VARIANT
+ * @since 1.9
+ */
+ public static final Object VALUE_RESOLUTION_VARIANT_DPI_FIT =
+ SunHints.VALUE_RESOLUTION_VARIANT_DPI_FIT;
+
+ /**
* Constructs a new object with keys and values initialized
* from the specified Map object which may be null.
* @param init a map of key/value pairs to initialize the hints
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 java.awt.image;
+
+import java.awt.Graphics;
+import java.awt.Image;
+
+/**
+ * This class provides default implementations of several {@code Image} methods
+ * for classes that want to implement the {@MultiResolutionImage} interface.
+ *
+ * For example,
+ * <pre> {@code
+ * public class CustomMultiResolutionImage extends AbstractMultiResolutionImage {
+ *
+ * final Image[] resolutionVariants;
+ *
+ * public CustomMultiResolutionImage(Image... resolutionVariants) {
+ * this.resolutionVariants = resolutionVariants;
+ * }
+ *
+ * public Image getResolutionVariant(
+ * double destImageWidth, double destImageHeight) {
+ * // return a resolution variant based on the given destination image size
+ * }
+ *
+ * public List<Image> getResolutionVariants() {
+ * return Collections.unmodifiableList(Arrays.asList(resolutionVariants));
+ * }
+ *
+ * protected Image getBaseImage() {
+ * return resolutionVariants[0];
+ * }
+ * }
+ * } </pre>
+ *
+ * @see java.awt.Image
+ * @see java.awt.image.MultiResolutionImage
+ *
+ * @since 1.9
+ */
+public abstract class AbstractMultiResolutionImage extends java.awt.Image
+ implements MultiResolutionImage {
+
+ @Override
+ public int getWidth(ImageObserver observer) {
+ return getBaseImage().getWidth(observer);
+ }
+
+ @Override
+ public int getHeight(ImageObserver observer) {
+ return getBaseImage().getHeight(observer);
+ }
+
+ @Override
+ public ImageProducer getSource() {
+ return getBaseImage().getSource();
+ }
+
+ @Override
+ public Graphics getGraphics() {
+ throw new UnsupportedOperationException("getGraphics() not supported"
+ + " on Multi-Resolution Images");
+ }
+
+ @Override
+ public Object getProperty(String name, ImageObserver observer) {
+ return getBaseImage().getProperty(name, observer);
+ }
+
+ /**
+ * Return the base image representing the best version of the image for
+ * rendering at the default width and height.
+ *
+ * @return the base image of the set of multi-resolution images
+ *
+ * @since 1.9
+ */
+ protected abstract Image getBaseImage();
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 java.awt.image;
+
+import java.awt.Image;
+import java.util.List;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Objects;
+
+/**
+ * This class is an array-based implementation of
+ * the {@code AbstractMultiResolutionImage} class.
+ *
+ * This class will implement the
+ * {@code getResolutionVariant(double destImageWidth, double destImageHeight)}
+ * method using a simple algorithm which will return the first image variant
+ * in the array that is large enough to satisfy the rendering request. The
+ * last image in the array will be returned if no suitable image is found
+ * that is as large as the rendering request.
+ * <p>
+ * For best effect the array of images should be sorted with each image being
+ * both wider and taller than the previous image. The base image need not be
+ * the first image in the array. No exception will be thrown if the images
+ * are not sorted as suggested.
+ *
+ * @see java.awt.Image
+ * @see java.awt.image.MultiResolutionImage
+ * @see java.awt.image.AbstractMultiResolutionImage
+ *
+ * @since 1.9
+ */
+public class BaseMultiResolutionImage extends AbstractMultiResolutionImage {
+
+ private final int baseImageIndex;
+ private final Image[] resolutionVariants;
+
+ /**
+ * Creates a multi-resolution image with the given resolution variants.
+ * The first resolution variant is used as the base image.
+ *
+ * @param resolutionVariants array of resolution variants sorted by image size
+ * @throws IllegalArgumentException if null or zero-length array is passed
+ * @throws NullPointerException if the specified {@code resolutionVariants}
+ * contains one or more null elements
+ *
+ * @since 1.9
+ */
+ public BaseMultiResolutionImage(Image... resolutionVariants) {
+ this(0, resolutionVariants);
+ }
+
+ /**
+ * Creates a multi-resolution image with the given base image index and
+ * resolution variants.
+ *
+ * @param baseImageIndex the index of base image in the resolution variants
+ * array
+ * @param resolutionVariants array of resolution variants sorted by image size
+ * @throws IllegalArgumentException if null or zero-length array is passed
+ * @throws NullPointerException if the specified {@code resolutionVariants}
+ * contains one or more null elements
+ * @throws IndexOutOfBoundsException if {@code baseImageIndex} is
+ * negative or greater than or equal to {@code resolutionVariants}
+ * length.
+ *
+ * @since 1.9
+ */
+ public BaseMultiResolutionImage(int baseImageIndex,
+ Image... resolutionVariants) {
+
+ if (resolutionVariants == null || resolutionVariants.length == 0) {
+ throw new IllegalArgumentException(
+ "Null or zero-length array is passed");
+ }
+
+ if (baseImageIndex < 0 || baseImageIndex >= resolutionVariants.length) {
+ throw new IndexOutOfBoundsException("Invalid base image index: "
+ + baseImageIndex);
+ }
+
+ this.baseImageIndex = baseImageIndex;
+ this.resolutionVariants = Arrays.copyOf(resolutionVariants,
+ resolutionVariants.length);
+
+ for (Image resolutionVariant : this.resolutionVariants) {
+ Objects.requireNonNull(resolutionVariant,
+ "Resolution variant can't be null");
+ }
+ }
+
+ @Override
+ public Image getResolutionVariant(double destImageWidth,
+ double destImageHeight) {
+
+ checkSize(destImageWidth, destImageHeight);
+
+ for (Image rvImage : resolutionVariants) {
+ if (destImageWidth <= rvImage.getWidth(null)
+ && destImageHeight <= rvImage.getHeight(null)) {
+ return rvImage;
+ }
+ }
+ return resolutionVariants[resolutionVariants.length - 1];
+ }
+
+ private static void checkSize(double width, double height) {
+ if (width <= 0 || height <= 0) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) cannot be <= 0", width, height));
+ }
+
+ if (!Double.isFinite(width) || !Double.isFinite(height)) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) is not finite", width, height));
+ }
+ }
+
+ @Override
+ public List<Image> getResolutionVariants() {
+ return Collections.unmodifiableList(Arrays.asList(resolutionVariants));
+ }
+
+ @Override
+ protected Image getBaseImage() {
+ return resolutionVariants[baseImageIndex];
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 java.awt.image;
+
+import java.awt.Image;
+import java.util.List;
+
+/**
+ * This interface is designed to be an optional additional API supported by
+ * some implementations of {@link java.awt.Image} to allow them to provide
+ * alternate images for various rendering resolutions. The various
+ * {@code Graphics.drawImage(...)} variant methods will consult the methods
+ * of this interface if it is implemented on the argument {@code Image} object
+ * in order to choose the best representation to use for each rendering operation.
+ * <p>
+ * The {@code MultiResolutionImage} interface should be implemented by any
+ * subclass of {@code java.awt.Image} whose instances are intended to provide
+ * image resolution variants according to the given image width and height.
+ * For convenience, toolkit images obtained from
+ * {@code Toolkit.getImage(String name)} and {@code Toolkit.getImage(URL url)}
+ * will implement this interface on platforms that support naming conventions
+ * for resolution variants of stored image media and the
+ * {@code AbstractMultiResolutionImage} and {@code BaseMultiResolutionImage}
+ * classes are provided to facilitate easy construction of custom multi-resolution
+ * images from a list of related images.
+ *
+ * @see java.awt.Image
+ * @see java.awt.image.AbstractMultiResolutionImage
+ * @see java.awt.image.BaseMultiResolutionImage
+ * @see java.awt.Toolkit#getImage(java.lang.String filename)
+ * @see java.awt.Toolkit#getImage(java.net.URL url)
+ *
+ * @since 1.9
+ */
+public interface MultiResolutionImage {
+
+ /**
+ * Gets a specific image that is the best variant to represent
+ * this logical image at the indicated size.
+ *
+ * @param destImageWidth the width of the destination image, in pixels.
+ * @param destImageHeight the height of the destination image, in pixels.
+ * @return image resolution variant.
+ * @throws IllegalArgumentException if {@code destImageWidth} or
+ * {@code destImageHeight} is less than or equal to zero, infinity,
+ * or NaN.
+ *
+ * @since 1.9
+ */
+ Image getResolutionVariant(double destImageWidth, double destImageHeight);
+
+ /**
+ * Gets a readable list of all resolution variants.
+ * The list must be nonempty and contain at least one resolution variant.
+ * <p>
+ * Note that many implementations might return an unmodifiable list.
+ * <p>
+ * @return list of resolution variants.
+ * @since 1.9
+ */
+ public List<Image> getResolutionVariants();
+}
\ No newline at end of file
--- a/jdk/src/java.desktop/share/classes/java/beans/XMLEncoder.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/java/beans/XMLEncoder.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -614,10 +614,12 @@
}
if (isArgument && target instanceof Field && methodName.equals("get")) {
- Field f = (Field)target;
- writeln("<object class=" + quote(f.getDeclaringClass().getName()) +
- " field=" + quote(f.getName()) + "/>");
- return;
+ Field f = (Field) target;
+ if (Modifier.isStatic(f.getModifiers())) {
+ writeln("<object class=" + quote(f.getDeclaringClass().getName()) +
+ " field=" + quote(f.getName()) + "/>");
+ return;
+ }
}
Class<?> primitiveType = primitiveTypeFor(value.getClass());
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -912,9 +912,9 @@
* must point to valid audio file data. The implementation of this method
* may require multiple parsers to examine the stream to determine whether
* they support it. These parsers must be able to mark the stream, read
- * enough data to determine whether they support the stream, and, if not,
- * reset the stream's read pointer to its original position. If the input
- * stream does not support these operations, this method may fail with an
+ * enough data to determine whether they support the stream, and reset the
+ * stream's read pointer to its original position. If the input stream does
+ * not support these operations, this method may fail with an
* {@code IOException}.
*
* @param stream the input stream from which file format information should
@@ -1025,9 +1025,9 @@
* must point to valid audio file data. The implementation of this method
* may require multiple parsers to examine the stream to determine whether
* they support it. These parsers must be able to mark the stream, read
- * enough data to determine whether they support the stream, and, if not,
- * reset the stream's read pointer to its original position. If the input
- * stream does not support these operation, this method may fail with an
+ * enough data to determine whether they support the stream, and reset the
+ * stream's read pointer to its original position. If the input stream does
+ * not support these operation, this method may fail with an
* {@code IOException}.
*
* @param stream the input stream from which the {@code AudioInputStream}
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileReader.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileReader.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -49,9 +49,9 @@
* must point to valid audio file data. In general, audio file readers may
* need to read some data from the stream before determining whether they
* support it. These parsers must be able to mark the stream, read enough
- * data to determine whether they support the stream, and, if not, reset the
- * stream's read pointer to its original position. If the input stream does
- * not support this, this method may fail with an {@code IOException}.
+ * data to determine whether they support the stream, and reset the stream's
+ * read pointer to its original position. If the input stream does not
+ * support this, this method may fail with an {@code IOException}.
*
* @param stream the input stream from which file format information should
* be extracted
@@ -101,9 +101,9 @@
* must point to valid audio file data. In general, audio file readers may
* need to read some data from the stream before determining whether they
* support it. These parsers must be able to mark the stream, read enough
- * data to determine whether they support the stream, and, if not, reset the
- * stream's read pointer to its original position. If the input stream does
- * not support this, this method may fail with an {@code IOException}.
+ * data to determine whether they support the stream, and reset the stream's
+ * read pointer to its original position. If the input stream does not
+ * support this, this method may fail with an {@code IOException}.
*
* @param stream the input stream from which the {@code AudioInputStream}
* should be constructed
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -403,6 +403,7 @@
protected void uninstallListeners() {
header.removeMouseListener(mouseInputListener);
header.removeMouseMotionListener(mouseInputListener);
+ header.removeFocusListener(focusListener);
mouseInputListener = null;
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java Tue Sep 22 11:01:54 2015 -0700
@@ -860,6 +860,7 @@
Highlighter.HighlightPainter p = getSelectionPainter();
try {
selectionTag = h.addHighlight(p0, p1, p);
+ updateOwnsSelection();
} catch (BadLocationException bl) {
selectionTag = null;
}
@@ -870,6 +871,7 @@
Highlighter h = component.getHighlighter();
h.removeHighlight(selectionTag);
selectionTag = null;
+ updateOwnsSelection();
}
}
}
@@ -1110,6 +1112,7 @@
if (selectionTag != null) {
h.removeHighlight(selectionTag);
selectionTag = null;
+ updateOwnsSelection();
}
// otherwise, change or add the highlight
} else {
@@ -1120,6 +1123,7 @@
Highlighter.HighlightPainter p = getSelectionPainter();
selectionTag = h.addHighlight(p0, p1, p);
}
+ updateOwnsSelection();
} catch (BadLocationException e) {
throw new StateInvariantError("Bad caret position");
}
@@ -1170,6 +1174,7 @@
if (this.dot != dot || this.dotBias != dotBias ||
selectionTag != null || forceCaretPositionChange) {
changeCaretPosition(dot, dotBias);
+ updateOwnsSelection();
}
this.markBias = this.dotBias;
this.markLTR = dotLTR;
@@ -1177,6 +1182,7 @@
if ((h != null) && (selectionTag != null)) {
h.removeHighlight(selectionTag);
selectionTag = null;
+ updateOwnsSelection();
}
}
@@ -1925,6 +1931,13 @@
}
}
+ /**
+ * Updates ownsSelection based on text selection in the caret.
+ */
+ private void updateOwnsSelection() {
+ ownsSelection = (selectionTag != null)
+ && SwingUtilities2.canAccessSystemClipboard();
+ }
private class DefaultFilterBypass extends NavigationFilter.FilterBypass {
public Caret getCaret() {
--- a/jdk/src/java.desktop/share/classes/sun/awt/SunHints.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/SunHints.java Tue Sep 22 11:01:54 2015 -0700
@@ -257,8 +257,10 @@
*/
@Native public static final int INTKEY_RESOLUTION_VARIANT = 9;
@Native public static final int INTVAL_RESOLUTION_VARIANT_DEFAULT = 0;
- @Native public static final int INTVAL_RESOLUTION_VARIANT_OFF = 1;
- @Native public static final int INTVAL_RESOLUTION_VARIANT_ON = 2;
+ @Native public static final int INTVAL_RESOLUTION_VARIANT_BASE = 1;
+ @Native public static final int INTVAL_RESOLUTION_VARIANT_SIZE_FIT = 2;
+ @Native public static final int INTVAL_RESOLUTION_VARIANT_DPI_FIT = 3;
+
/**
* LCD text contrast control hint key.
* Value is "100" to make discontiguous with the others which
@@ -466,15 +468,23 @@
public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT =
new SunHints.Value(KEY_RESOLUTION_VARIANT,
SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT,
- "Choose image resolutions based on a default heuristic");
- public static final Object VALUE_RESOLUTION_VARIANT_OFF =
+ "Choose image resolutions based on a default"
+ + "heuristic");
+ public static final Object VALUE_RESOLUTION_VARIANT_BASE =
new SunHints.Value(KEY_RESOLUTION_VARIANT,
- SunHints.INTVAL_RESOLUTION_VARIANT_OFF,
+ SunHints.INTVAL_RESOLUTION_VARIANT_BASE,
"Use only the standard resolution of an image");
- public static final Object VALUE_RESOLUTION_VARIANT_ON =
+ public static final Object VALUE_RESOLUTION_VARIANT_SIZE_FIT =
new SunHints.Value(KEY_RESOLUTION_VARIANT,
- SunHints.INTVAL_RESOLUTION_VARIANT_ON,
- "Always use resolution-specific variants of images");
+ SunHints.INTVAL_RESOLUTION_VARIANT_SIZE_FIT,
+ "Choose image resolutions based on the DPI"
+ + "of the screen and transform"
+ + "in the Graphics2D context");
+ public static final Object VALUE_RESOLUTION_VARIANT_DPI_FIT =
+ new SunHints.Value(KEY_RESOLUTION_VARIANT,
+ SunHints.INTVAL_RESOLUTION_VARIANT_DPI_FIT,
+ "Choose image resolutions based only on the DPI"
+ + " of the screen");
public static class LCDContrastKey extends Key {
--- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java Tue Sep 22 11:01:54 2015 -0700
@@ -60,7 +60,7 @@
import sun.awt.image.ByteArrayImageSource;
import sun.awt.image.FileImageSource;
import sun.awt.image.ImageRepresentation;
-import sun.awt.image.MultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
import sun.awt.image.MultiResolutionToolkitImage;
import sun.awt.image.ToolkitImage;
import sun.awt.image.URLImageSource;
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/AbstractMultiResolutionImage.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2014, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.awt.image;
-
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.image.*;
-
-/**
- * This class provides default implementations for the
- * <code>MultiResolutionImage</code> interface. The developer needs only
- * to subclass this abstract class and define the <code>getResolutionVariant</code>,
- * <code>getResolutionVariants</code>, and <code>getBaseImage</code> methods.
- *
- *
- * For example,
- * {@code
- * public class CustomMultiResolutionImage extends AbstractMultiResolutionImage {
- *
- * int baseImageIndex;
- * Image[] resolutionVariants;
- *
- * public CustomMultiResolutionImage(int baseImageIndex,
- * Image... resolutionVariants) {
- * this.baseImageIndex = baseImageIndex;
- * this.resolutionVariants = resolutionVariants;
- * }
- *
- * @Override
- * public Image getResolutionVariant(float logicalDPIX, float logicalDPIY,
- * float baseImageWidth, float baseImageHeight,
- * float destImageWidth, float destImageHeight) {
- * // return a resolution variant based on the given logical DPI,
- * // base image size, or destination image size
- * }
- *
- * @Override
- * public List<Image> getResolutionVariants() {
- * return Arrays.asList(resolutionVariants);
- * }
- *
- * protected Image getBaseImage() {
- * return resolutionVariants[baseImageIndex];
- * }
- * }
- * }
- *
- * @see java.awt.Image
- * @see java.awt.image.MultiResolutionImage
- *
- * @since 1.9
- */
-public abstract class AbstractMultiResolutionImage extends java.awt.Image
- implements MultiResolutionImage {
-
- /**
- * @inheritDoc
- */
- @Override
- public int getWidth(ImageObserver observer) {
- return getBaseImage().getWidth(null);
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public int getHeight(ImageObserver observer) {
- return getBaseImage().getHeight(null);
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public ImageProducer getSource() {
- return getBaseImage().getSource();
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public Graphics getGraphics() {
- return getBaseImage().getGraphics();
-
- }
-
- /**
- * @inheritDoc
- */
- @Override
- public Object getProperty(String name, ImageObserver observer) {
- return getBaseImage().getProperty(name, observer);
- }
-
- /**
- * @return base image
- */
- protected abstract Image getBaseImage();
-}
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java Tue Sep 22 11:01:54 2015 -0700
@@ -33,6 +33,7 @@
import java.util.function.Function;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
+import java.awt.image.AbstractMultiResolutionImage;
public class MultiResolutionCachedImage extends AbstractMultiResolutionImage {
@@ -58,7 +59,10 @@
}
@Override
- public Image getResolutionVariant(int width, int height) {
+ public Image getResolutionVariant(double destWidth, double destHeight) {
+ checkSize(destWidth, destHeight);
+ int width = (int) Math.ceil(destWidth);
+ int height = (int) Math.ceil(destHeight);
ImageCache cache = ImageCache.getInstance();
ImageCacheKey key = new ImageCacheKey(this, width, height);
Image resolutionVariant = cache.getImage(key);
@@ -70,11 +74,23 @@
return resolutionVariant;
}
+ private static void checkSize(double width, double height) {
+ if (width <= 0 || height <= 0) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) cannot be <= 0", width, height));
+ }
+
+ if (!Double.isFinite(width) || !Double.isFinite(height)) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) is not finite", width, height));
+ }
+ }
+
@Override
public List<Image> getResolutionVariants() {
return Arrays.stream(sizes).map((Function<Dimension2D, Image>) size
- -> getResolutionVariant((int) size.getWidth(),
- (int) size.getHeight())).collect(Collectors.toList());
+ -> getResolutionVariant(size.getWidth(), size.getHeight()))
+ .collect(Collectors.toList());
}
public MultiResolutionCachedImage map(Function<Image, Image> mapper) {
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionImage.java Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2013, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 sun.awt.image;
-
-import java.awt.Image;
-import java.util.List;
-
-/**
- * This interface is designed to provide a set of images at various resolutions.
- *
- * The <code>MultiResolutionImage</code> interface should be implemented by any
- * class whose instances are intended to provide image resolution variants
- * according to the given image width and height.
- *
- * For example,
- * <pre>
- * {@code
- * public class ScaledImage extends BufferedImage
- * implements MultiResolutionImage {
- *
- * @Override
- * public Image getResolutionVariant(int width, int height) {
- * return ((width <= getWidth() && height <= getHeight()))
- * ? this : highResolutionImage;
- * }
- *
- * @Override
- * public List<Image> getResolutionVariants() {
- * return Arrays.asList(this, highResolutionImage);
- * }
- * }
- * }</pre>
- *
- * It is recommended to cache image variants for performance reasons.
- *
- * <b>WARNING</b>: This class is an implementation detail. This API may change
- * between update release, and it may even be removed or be moved in some other
- * package(s)/class(es).
- */
-public interface MultiResolutionImage {
-
- /**
- * Provides an image with necessary resolution which best fits to the given
- * image width and height.
- *
- * @param width the desired image resolution width.
- * @param height the desired image resolution height.
- * @return image resolution variant.
- *
- * @since 1.8
- */
- public Image getResolutionVariant(int width, int height);
-
- /**
- * Gets list of all resolution variants including the base image
- *
- * @return list of resolution variants.
- * @since 1.8
- */
- public List<Image> getResolutionVariants();
-}
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,6 +26,7 @@
import java.awt.Image;
import java.awt.image.ImageObserver;
+import java.awt.image.MultiResolutionImage;
import java.util.Arrays;
import java.util.List;
import sun.misc.SoftCache;
@@ -40,11 +41,24 @@
}
@Override
- public Image getResolutionVariant(int width, int height) {
- return ((width <= getWidth() && height <= getHeight()))
+ public Image getResolutionVariant(double destWidth, double destHeight) {
+ checkSize(destWidth, destHeight);
+ return ((destWidth <= getWidth() && destHeight <= getHeight()))
? this : resolutionVariant;
}
+ private static void checkSize(double width, double height) {
+ if (width <= 0 || height <= 0) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) cannot be <= 0", width, height));
+ }
+
+ if (!Double.isFinite(width) || !Double.isFinite(height)) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) is not finite", width, height));
+ }
+ }
+
public Image getResolutionVariant() {
return resolutionVariant;
}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java Tue Sep 22 11:01:54 2015 -0700
@@ -94,7 +94,7 @@
import sun.misc.PerformanceLogger;
import java.lang.annotation.Native;
-import sun.awt.image.MultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
import static java.awt.geom.AffineTransform.TYPE_FLIP;
import static java.awt.geom.AffineTransform.TYPE_MASK_SCALE;
@@ -3087,9 +3087,8 @@
// end of text rendering methods
private boolean isHiDPIImage(final Image img) {
- return (SurfaceManager.getImageScale(img) != 1) ||
- (resolutionVariantHint != SunHints.INTVAL_RESOLUTION_VARIANT_OFF
- && img instanceof MultiResolutionImage);
+ return (SurfaceManager.getImageScale(img) != 1)
+ || img instanceof MultiResolutionImage;
}
private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
@@ -3175,25 +3174,42 @@
int type = transform.getType();
int dw = dx2 - dx1;
int dh = dy2 - dy1;
- double destRegionWidth;
- double destRegionHeight;
-
- if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP)) == 0) {
- destRegionWidth = dw;
- destRegionHeight = dh;
- } else if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP | TYPE_MASK_SCALE)) == 0) {
- destRegionWidth = dw * transform.getScaleX();
- destRegionHeight = dh * transform.getScaleY();
+
+ double destImageWidth;
+ double destImageHeight;
+
+ if (resolutionVariantHint == SunHints.INTVAL_RESOLUTION_VARIANT_BASE) {
+ destImageWidth = srcWidth;
+ destImageHeight = srcHeight;
+ } else if (resolutionVariantHint == SunHints.INTVAL_RESOLUTION_VARIANT_DPI_FIT) {
+ AffineTransform configTransform = getDefaultTransform();
+ if (configTransform.isIdentity()) {
+ destImageWidth = srcWidth;
+ destImageHeight = srcHeight;
+ } else {
+ destImageWidth = srcWidth * configTransform.getScaleX();
+ destImageHeight = srcHeight * configTransform.getScaleY();
+ }
} else {
- destRegionWidth = dw * Math.hypot(
- transform.getScaleX(), transform.getShearY());
- destRegionHeight = dh * Math.hypot(
- transform.getShearX(), transform.getScaleY());
+ double destRegionWidth;
+ double destRegionHeight;
+
+ if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP)) == 0) {
+ destRegionWidth = dw;
+ destRegionHeight = dh;
+ } else if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP | TYPE_MASK_SCALE)) == 0) {
+ destRegionWidth = dw * transform.getScaleX();
+ destRegionHeight = dh * transform.getScaleY();
+ } else {
+ destRegionWidth = dw * Math.hypot(
+ transform.getScaleX(), transform.getShearY());
+ destRegionHeight = dh * Math.hypot(
+ transform.getShearX(), transform.getScaleY());
+ }
+ destImageWidth = Math.abs(srcWidth * destRegionWidth / sw);
+ destImageHeight = Math.abs(srcHeight * destRegionHeight / sh);
}
- int destImageWidth = (int) Math.abs(srcWidth * destRegionWidth / sw);
- int destImageHeight = (int) Math.abs(srcHeight * destRegionHeight / sh);
-
Image resolutionVariant
= img.getResolutionVariant(destImageWidth, destImageHeight);
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java Tue Sep 22 11:01:54 2015 -0700
@@ -494,16 +494,14 @@
*/
void processConnectionClosure() {
// Notify listeners
- synchronized (unsolicited) {
- if (unsolicited.size() > 0) {
- String msg;
- if (conn != null) {
- msg = conn.host + ":" + conn.port + " connection closed";
- } else {
- msg = "Connection closed";
- }
- notifyUnsolicited(new CommunicationException(msg));
+ if (unsolicited.size() > 0) {
+ String msg;
+ if (conn != null) {
+ msg = conn.host + ":" + conn.port + " connection closed";
+ } else {
+ msg = "Connection closed";
}
+ notifyUnsolicited(new CommunicationException(msg));
}
// Remove from pool
@@ -1499,13 +1497,8 @@
if (debug > 0) {
System.err.println("LdapClient.removeUnsolicited" + ctx);
}
- synchronized (unsolicited) {
- if (unsolicited.size() == 0) {
- return;
- }
unsolicited.removeElement(ctx);
}
- }
// NOTE: Cannot be synchronized because this is called asynchronously
// by the reader thread in Connection. Instead, sync on 'unsolicited' Vector.
@@ -1513,30 +1506,35 @@
if (debug > 0) {
System.err.println("LdapClient.processUnsolicited");
}
- synchronized (unsolicited) {
- try {
- // Parse the response
- LdapResult res = new LdapResult();
+ try {
+ // Parse the response
+ LdapResult res = new LdapResult();
+
+ ber.parseSeq(null); // init seq
+ ber.parseInt(); // msg id; should be 0; ignored
+ if (ber.parseByte() != LDAP_REP_EXTENSION) {
+ throw new IOException(
+ "Unsolicited Notification must be an Extended Response");
+ }
+ ber.parseLength();
+ parseExtResponse(ber, res);
- ber.parseSeq(null); // init seq
- ber.parseInt(); // msg id; should be 0; ignored
- if (ber.parseByte() != LDAP_REP_EXTENSION) {
- throw new IOException(
- "Unsolicited Notification must be an Extended Response");
- }
- ber.parseLength();
- parseExtResponse(ber, res);
+ if (DISCONNECT_OID.equals(res.extensionId)) {
+ // force closing of connection
+ forceClose(pooled);
+ }
- if (DISCONNECT_OID.equals(res.extensionId)) {
- // force closing of connection
- forceClose(pooled);
- }
+ LdapCtx first = null;
+ UnsolicitedNotification notice = null;
+ synchronized (unsolicited) {
if (unsolicited.size() > 0) {
+ first = unsolicited.elementAt(0);
+
// Create an UnsolicitedNotification using the parsed data
// Need a 'ctx' object because we want to use the context's
// list of provider control factories.
- UnsolicitedNotification notice = new UnsolicitedResponseImpl(
+ notice = new UnsolicitedResponseImpl(
res.extensionId,
res.extensionValue,
res.referrals,
@@ -1544,42 +1542,45 @@
res.errorMessage,
res.matchedDN,
(res.resControls != null) ?
- unsolicited.elementAt(0).convertControls(res.resControls) :
+ first.convertControls(res.resControls) :
null);
-
- // Fire UnsolicitedNotification events to listeners
- notifyUnsolicited(notice);
-
- // If "disconnect" notification,
- // notify unsolicited listeners via NamingException
- if (DISCONNECT_OID.equals(res.extensionId)) {
- notifyUnsolicited(
- new CommunicationException("Connection closed"));
- }
}
- } catch (IOException e) {
- if (unsolicited.size() == 0)
- return; // no one registered; ignore
+ }
+
+ if (notice != null) {
+ // Fire UnsolicitedNotification events to listeners
+ notifyUnsolicited(notice);
- NamingException ne = new CommunicationException(
- "Problem parsing unsolicited notification");
- ne.setRootCause(e);
+ // If "disconnect" notification,
+ // notify unsolicited listeners via NamingException
+ if (DISCONNECT_OID.equals(res.extensionId)) {
+ notifyUnsolicited(
+ new CommunicationException("Connection closed"));
+ }
+ }
+ } catch (IOException e) {
+ NamingException ne = new CommunicationException(
+ "Problem parsing unsolicited notification");
+ ne.setRootCause(e);
- notifyUnsolicited(ne);
+ notifyUnsolicited(ne);
- } catch (NamingException e) {
- notifyUnsolicited(e);
- }
+ } catch (NamingException e) {
+ notifyUnsolicited(e);
}
}
private void notifyUnsolicited(Object e) {
- for (int i = 0; i < unsolicited.size(); i++) {
- unsolicited.elementAt(i).fireUnsolicited(e);
+ Vector<LdapCtx> unsolicitedCopy;
+ synchronized (unsolicited) {
+ unsolicitedCopy = new Vector<>(unsolicited);
+ if (e instanceof NamingException) {
+ unsolicited.setSize(0); // no more listeners after exception
+ }
}
- if (e instanceof NamingException) {
- unsolicited.setSize(0); // no more listeners after exception
+ for (int i = 0; i < unsolicitedCopy.size(); i++) {
+ unsolicitedCopy.elementAt(i).fireUnsolicited(e);
}
}
--- a/jdk/test/com/sun/corba/cachedSocket/7056731.sh Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/com/sun/corba/cachedSocket/7056731.sh Tue Sep 22 11:01:54 2015 -0700
@@ -64,12 +64,12 @@
sleep 2 #give orbd time to start
echo "started orb"
echo "starting server"
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp . HelloServer -ORBInitialPort $PORT -ORBInitialHost localhost &
+${JAVA} ${TESTVMOPTS} -cp . HelloServer -ORBInitialPort $PORT -ORBInitialHost localhost &
SERVER_PROC=$!
sleep 2 #give server time to start
echo "started server"
echo "starting client (debug mode)"
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp . -agentlib:jdwp=transport=dt_socket,server=y,address=8000 HelloClient -ORBInitialPort $PORT -ORBInitialHost localhost > client.$$ 2>&1 &
+${JAVA} ${TESTVMOPTS} -cp . -agentlib:jdwp=transport=dt_socket,server=y,address=8000 HelloClient -ORBInitialPort $PORT -ORBInitialHost localhost > client.$$ 2>&1 &
JVM_PROC=$!
sleep 2 #give jvm/debugger/client time to start
@@ -97,7 +97,7 @@
echo "clear com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.unregisterWaiter"
sleep 2;
echo "resume 1";
-)| ${TESTJAVA}${FS}bin${FS}jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000
+)| ${COMPILEJAVA}${FS}bin${FS}jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000
sleep 5 # give time for Client to throw exception
--- a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015 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 6566434
+ @bug 6566434 8039467
@library ../../regtesthelpers
@build Util Sysout AbstractTest
@summary Choice in unfocusable window responds to keyboard
@@ -63,6 +63,18 @@
w.setLayout(new FlowLayout());
w.setSize(200, 200);
+ // Note that Window w is non focusable. Key press events will not be
+ // consumed by w, but by any previously focused window & this can
+ // disturb the environment. So creating tempFrameToHoldFocus frame,
+ // to consume key press events.
+ Frame tempFrameToHoldFocus = new Frame();
+ tempFrameToHoldFocus.setVisible(true);
+ Util.waitForIdle(robot);
+
+ tempFrameToHoldFocus.requestFocus();
+ Util.clickOnComp(tempFrameToHoldFocus, robot);
+ Util.waitForIdle(robot);
+
ch.addKeyListener(new KeyAdapter(){
public void keyTyped(KeyEvent e){
traceEvent("keytyped", e);
@@ -94,6 +106,10 @@
testKeys();
Util.waitForIdle(robot);
+
+ tempFrameToHoldFocus.dispose();
+ w.dispose();
+ f.dispose();
}
private static void testKeys(){
--- a/jdk/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,19 +25,16 @@
import java.awt.Cursor;
import java.awt.Dialog;
import java.awt.Frame;
-import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Label;
import java.awt.Point;
import java.awt.TextArea;
import java.awt.Toolkit;
+import java.awt.image.BaseMultiResolutionImage;
import java.awt.image.BufferedImage;
-import java.util.LinkedList;
-import java.util.List;
import javax.swing.JApplet;
import jdk.testlibrary.OSInfo;
-import sun.awt.image.MultiResolutionImage;
/**
* @test
@@ -52,7 +49,7 @@
public class MultiResolutionCursorTest extends JApplet {
//Declare things used in the test, like buttons and labels here
- static final int sizes[] = {16, 32, 128};
+ static final int sizes[] = {8, 16, 32, 128};
static final Color colors[] = {Color.WHITE, Color.RED, Color.GREEN, Color.BLUE};
public void init() {
@@ -87,7 +84,12 @@
setVisible(true);
validate();
- final Image image = new MultiResolutionCursor();
+ final Image image = new BaseMultiResolutionImage(
+ createResolutionVariant(0),
+ createResolutionVariant(1),
+ createResolutionVariant(2),
+ createResolutionVariant(3)
+ );
int center = sizes[0] / 2;
Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(
@@ -101,53 +103,14 @@
frame.setVisible(true);
}// start()
-
- static class MultiResolutionCursor extends BufferedImage implements MultiResolutionImage {
-
- List<Image> highResolutionImages;
-
- public MultiResolutionCursor() {
- super(sizes[0], sizes[0], BufferedImage.TYPE_INT_RGB);
-
- draw(getGraphics(), 0);
- highResolutionImages = new LinkedList<>();
- highResolutionImages.add(this);
-
- for (int i = 1; i < sizes.length; i++) {
- BufferedImage highResolutionImage =
- new BufferedImage(sizes[i], sizes[i], BufferedImage.TYPE_INT_RGB);
- draw(highResolutionImage.getGraphics(), i);
- highResolutionImages.add(highResolutionImage);
- }
- }
-
- @Override
- public Image getResolutionVariant(int width, int height) {
-
- for (int i = 0; i < sizes.length; i++) {
- Image image = highResolutionImages.get(i);
- int w = image.getWidth(null);
- int h = image.getHeight(null);
-
- if (width <= w && height <= h) {
- return image;
- }
- }
-
- return highResolutionImages.get(highResolutionImages.size() - 1);
- }
-
- void draw(Graphics graphics, int index) {
- Graphics2D g2 = (Graphics2D) graphics;
- Color color = colors[index];
- g2.setColor(color);
- g2.fillRect(0, 0, sizes[index], sizes[index]);
- }
-
- @Override
- public List<Image> getResolutionVariants() {
- return highResolutionImages;
- }
+ static BufferedImage createResolutionVariant(int i) {
+ BufferedImage resolutionVariant = new BufferedImage(sizes[i], sizes[i],
+ BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2 = resolutionVariant.createGraphics();
+ g2.setColor(colors[i]);
+ g2.fillRect(0, 0, sizes[i], sizes[i]);
+ g2.dispose();
+ return resolutionVariant;
}
}// class BlockedWindowTest
--- a/jdk/test/java/awt/Focus/RequestOnCompWithNullParent/RequestOnCompWithNullParent1.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/awt/Focus/RequestOnCompWithNullParent/RequestOnCompWithNullParent1.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2015, 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,19 +24,14 @@
/*
@test
@bug 6418028
- @summary java/awt/Focus/RequestOnCompWithNullParent/RequestOnCompWithNullParent_Barrier.java fails
@author oleg.sukhodolsky: area=awt.focus
@library ../../regtesthelpers
+ @modules java.desktop/java.awt.peer
+ java.desktop/sun.awt
@build Util
@run main RequestOnCompWithNullParent1
*/
-/**
- * RequestOnCompWithNullParent1.java
- *
- * summary: java/awt/Focus/RequestOnCompWithNullParent/RequestOnCompWithNullParent_Barrier.java fails
- */
-
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.ButtonPeer;
@@ -46,26 +41,21 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import test.java.awt.regtesthelpers.Util;
-//*** global search and replace RequestOnCompWithNullParent1 with name of the test ***
+import sun.awt.AWTAccessor;
-public class RequestOnCompWithNullParent1
-{
+public class RequestOnCompWithNullParent1 {
- private static void init() {
- //*** Create instructions for the user here ***
- String[] instructions =
- {
- "This is an AUTOMATIC test, simply wait until it is done.",
- "The result (passed or failed) will be shown in the",
- "message window below."
- };
- Sysout.createDialog( );
- Sysout.printInstructions( instructions );
+ public static void main(final String[] args) throws Exception {
+ Frame frame = new Frame("test for 6418028");
+ try {
+ test(frame);
+ } finally {
+ frame.dispose();
+ }
+ }
-
- Frame frame = new Frame("test for 6418028");
+ private static void test(final Frame frame) throws Exception {
frame.setLayout(new FlowLayout());
Button btn1 = new Button("Button1");
frame.add(btn1);
@@ -80,153 +70,26 @@
});
frame.setVisible(true);
- Util.waitForIdle(null);
+ new Robot().waitForIdle();
btn2.instrumentPeer();
btn2.requestFocusInWindow();
btn2.restorePeer();
- frame.dispose();
- RequestOnCompWithNullParent1.pass();
- }//End init()
-
-
-
- /*****************************************************
- * Standard Test Machinery Section
- * DO NOT modify anything in this section -- it's a
- * standard chunk of code which has all of the
- * synchronisation necessary for the test harness.
- * By keeping it the same in all tests, it is easier
- * to read and understand someone else's test, as
- * well as insuring that all tests behave correctly
- * with the test harness.
- * There is a section following this for test-
- * classes
- ******************************************************/
- private static boolean theTestPassed = false;
- private static boolean testGeneratedInterrupt = false;
- private static String failureMessage = "";
-
- private static Thread mainThread = null;
-
- private static int sleepTime = 300000;
-
- // Not sure about what happens if multiple of this test are
- // instantiated in the same VM. Being static (and using
- // static vars), it aint gonna work. Not worrying about
- // it for now.
- public static void main( String args[] ) throws InterruptedException
- {
- mainThread = Thread.currentThread();
- try
- {
- init();
- }
- catch( TestPassedException e )
- {
- //The test passed, so just return from main and harness will
- // interepret this return as a pass
- return;
- }
- //At this point, neither test pass nor test fail has been
- // called -- either would have thrown an exception and ended the
- // test, so we know we have multiple threads.
-
- //Test involves other threads, so sleep and wait for them to
- // called pass() or fail()
- try
- {
- Thread.sleep( sleepTime );
- //Timed out, so fail the test
- throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
- }
- catch (InterruptedException e)
- {
- //The test harness may have interrupted the test. If so, rethrow the exception
- // so that the harness gets it and deals with it.
- if( ! testGeneratedInterrupt ) throw e;
-
- //reset flag in case hit this code more than once for some reason (just safety)
- testGeneratedInterrupt = false;
-
- if ( theTestPassed == false )
- {
- throw new RuntimeException( failureMessage );
- }
- }
-
- }//main
-
- public static synchronized void setTimeoutTo( int seconds )
- {
- sleepTime = seconds * 1000;
}
-
- public static synchronized void pass()
- {
- Sysout.println( "The test passed." );
- Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
- //first check if this is executing in main thread
- if ( mainThread == Thread.currentThread() )
- {
- //Still in the main thread, so set the flag just for kicks,
- // and throw a test passed exception which will be caught
- // and end the test.
- theTestPassed = true;
- throw new TestPassedException();
- }
- theTestPassed = true;
- testGeneratedInterrupt = true;
- mainThread.interrupt();
- }//pass()
-
- public static synchronized void fail()
- {
- //test writer didn't specify why test failed, so give generic
- fail( "it just plain failed! :-)" );
- }
-
- public static synchronized void fail( String whyFailed )
- {
- Sysout.println( "The test failed: " + whyFailed );
- Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
- //check if this called from main thread
- if ( mainThread == Thread.currentThread() )
- {
- //If main thread, fail now 'cause not sleeping
- throw new RuntimeException( whyFailed );
- }
- theTestPassed = false;
- testGeneratedInterrupt = true;
- failureMessage = whyFailed;
- mainThread.interrupt();
- }//fail()
-
-}// class RequestOnCompWithNullParent1
-
-//This exception is used to exit from any level of call nesting
-// when it's determined that the test has passed, and immediately
-// end the test.
-class TestPassedException extends RuntimeException
-{
}
-//*********** End Standard Test Machinery Section **********
-
-
-//************ Begin classes defined for the test ****************
-
class TestButton extends Button {
ButtonPeer origPeer;
ButtonPeer proxiedPeer;
/** Creates a new instance of TestButton */
- public TestButton(String text) {
+ TestButton(String text) {
super(text);
}
public void instrumentPeer() {
- origPeer = (ButtonPeer) getPeer();
+ origPeer = AWTAccessor.getComponentAccessor().getPeer(this);
+
InvocationHandler handler = new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) {
if (method.getName().equals("requestFocus")) {
@@ -248,7 +111,9 @@
}
};
- proxiedPeer = (ButtonPeer) Proxy.newProxyInstance(ButtonPeer.class.getClassLoader(), new Class[] {ButtonPeer.class}, handler);
+ proxiedPeer = (ButtonPeer) Proxy.newProxyInstance(
+ ButtonPeer.class.getClassLoader(),
+ new Class[] {ButtonPeer.class}, handler);
setPeer(proxiedPeer);
}
@@ -275,145 +140,3 @@
}
}
}
-//************** End classes defined for the test *******************
-
-
-
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
- chunk of code whose purpose is to make user
- interaction uniform, and thereby make it simpler
- to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
- for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
- WithInstructions method. Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
- with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
- as standalone.
- */
-
-class Sysout
-{
- private static TestDialog dialog;
-
- public static void createDialogWithInstructions( String[] instructions )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- dialog.printInstructions( instructions );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
- }
-
- public static void createDialog( )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- String[] defInstr = { "Instructions will appear here. ", "" } ;
- dialog.printInstructions( defInstr );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
- }
-
-
- public static void printInstructions( String[] instructions )
- {
- dialog.printInstructions( instructions );
- }
-
-
- public static void println( String messageIn )
- {
- dialog.displayMessage( messageIn );
- System.out.println(messageIn);
- }
-
-}// Sysout class
-
-/**
- This is part of the standard test machinery. It provides a place for the
- test instructions to be displayed, and a place for interactive messages
- to the user to be displayed.
- To have the test instructions displayed, see Sysout.
- To have a message to the user be displayed, see Sysout.
- Do not call anything in this dialog directly.
- */
-class TestDialog extends Dialog
-{
-
- TextArea instructionsText;
- TextArea messageText;
- int maxStringLength = 80;
-
- //DO NOT call this directly, go through Sysout
- public TestDialog( Frame frame, String name )
- {
- super( frame, name );
- int scrollBoth = TextArea.SCROLLBARS_BOTH;
- instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
- add( "North", instructionsText );
-
- messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
- add("Center", messageText);
-
- pack();
-
- setVisible(true);
- }// TestDialog()
-
- //DO NOT call this directly, go through Sysout
- public void printInstructions( String[] instructions )
- {
- //Clear out any current instructions
- instructionsText.setText( "" );
-
- //Go down array of instruction strings
-
- String printStr, remainingStr;
- for( int i=0; i < instructions.length; i++ )
- {
- //chop up each into pieces maxSringLength long
- remainingStr = instructions[ i ];
- while( remainingStr.length() > 0 )
- {
- //if longer than max then chop off first max chars to print
- if( remainingStr.length() >= maxStringLength )
- {
- //Try to chop on a word boundary
- int posOfSpace = remainingStr.
- lastIndexOf( ' ', maxStringLength - 1 );
-
- if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
- printStr = remainingStr.substring( 0, posOfSpace + 1 );
- remainingStr = remainingStr.substring( posOfSpace + 1 );
- }
- //else just print
- else
- {
- printStr = remainingStr;
- remainingStr = "";
- }
-
- instructionsText.append( printStr + "\n" );
-
- }// while
-
- }// for
-
- }//printInstructions()
-
- //DO NOT call this directly, go through Sysout
- public void displayMessage( String messageIn )
- {
- messageText.append( messageIn + "\n" );
- System.out.println(messageIn);
- }
-
-}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/InvisibleParentTest/InvisibleParentTest.html Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2013, 2015, 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.
+-->
+
+<html>
+<!--
+ @test
+ @bug 6401700 6412803
+ @requires (os.family != "windows")
+ @summary Tests that modal dialog is shown on the screen and
+iconified/restored correctly if its parent window is invisible
+ @author artem.ananiev: area=awt.modal
+ @run applet/manual=yesno InvisibleParentTest.html
+ -->
+<head>
+<title> InvisibleParentTest </title>
+</head>
+<body>
+
+<h1>InvisibleParentTest<br>Bug ID: 6401700, 6412803</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="InvisibleParentTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2013, 2015, 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
+ @bug 6401700 6412803
+ @summary Tests that modal dialog is shown on the screen and
+iconified/restored correctly if some of its blocked windows are invisible
+ @author artem.ananiev: area=awt.modal
+ @run applet/manual=yesno InvisibleParentTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.TextArea;
+import java.awt.Window;
+
+public class InvisibleParentTest extends Applet
+{
+ public void init()
+ {
+ setLayout(new BorderLayout());
+
+ String[] instructions =
+ {
+ "If your system is Windows, press PASS button.",
+ "When the test starts two windows should appear: frame G1 and",
+ " dialog D1. Another one frame F1 should be minimized.",
+ " If the dialog is not shown (minimizied), press FAIL button.",
+ "Then minimize frame G1 and restore F1. If the dialog D1 is not",
+ " restored together with F1, press FAIL, else PASS"
+ };
+ Sysout.createDialogWithInstructions( instructions );
+ }
+
+ public void start ()
+ {
+ Button b;
+
+ setSize (200,200);
+ setVisible(true);
+ validate();
+
+ Component c = this;
+ while ((c != null) && !(c instanceof Window))
+ {
+ c = c.getParent();
+ }
+ if (c != null)
+ {
+ ((Window)c).setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+ }
+
+ Frame f1 = new Frame("F1");
+ f1.setBounds(100, 300, 100, 100);
+ f1.setVisible(true);
+ f1.setExtendedState(Frame.ICONIFIED);
+
+ Frame g1 = new Frame("G1");
+ g1.setBounds(150, 350, 100, 100);
+ g1.setVisible(true);
+
+ final Dialog d1 = new Dialog((Frame)null, "D1", Dialog.ModalityType.APPLICATION_MODAL);
+ d1.setBounds(200, 400, 100, 100);
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ d1.setVisible(true);
+ }
+ }).start();
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- a/jdk/test/java/awt/PrintJob/Text/StringWidth.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/awt/PrintJob/Text/StringWidth.java Tue Sep 22 11:01:54 2015 -0700
@@ -23,7 +23,6 @@
import java.awt.*;
import java.util.Properties;
-import sun.awt.*;
public class StringWidth extends Frame {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2015, 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
+ @bug 8081485
+ @summary tests that a program terminates automatically after EventQueue.push()
+ @author Anton Nashatyrev : area=toolkit
+*/
+
+import java.awt.*;
+
+public class EventQueuePushAutoshutdown implements Runnable {
+ private volatile int status = 2;
+
+ public EventQueuePushAutoshutdown() throws Exception {
+ Runtime.getRuntime().addShutdownHook(new Thread(this));
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ status = 0;
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } finally {
+ status = 1;
+ System.exit(status);
+ }
+ }
+ };
+ thread.setDaemon(true);
+ thread.start();
+
+ System.setProperty("java.awt.headless", "true");
+ final EventQueue systemQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ systemQueue.push(new EventQueue());
+ EventQueue.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ System.out.println("Activated EDT");
+ }
+ });
+ System.out.println("After EDT activation");
+ }
+
+ public static void main(String[] args) throws Exception {
+ new EventQueuePushAutoshutdown();
+ }
+
+ @Override
+ public void run() {
+ Runtime.getRuntime().halt(status);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,159 @@
+#!/bin/ksh -p
+
+#
+# Copyright (c) 20015, 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 EventQueuePushAutoshutdown.sh
+# @bug 8081485
+# @summary tests that a program terminates automatically
+# after EventQueue.push()
+# @author Anton Nashatyrev : area=toolkit
+#
+# @compile EventQueuePushAutoshutdown.java
+# @run shell EventQueuePushAutoshutdown.sh
+
+
+# Beginning of subroutines:
+status=1
+
+#Call this from anywhere to fail the test with an error message
+# usage: fail "reason why the test failed"
+fail()
+ { echo "The test failed :-("
+ echo "$*" 1>&2
+ echo "exit status was $status"
+ exit $status
+ } #end of fail()
+
+#Call this from anywhere to pass the test with a message
+# usage: pass "reason why the test passed if applicable"
+pass()
+ { echo "The test passed!!!"
+ echo "$*" 1>&2
+ exit 0
+ } #end of pass()
+
+# end of subroutines
+
+
+# The beginning of the script proper
+OS=`uname -s`
+case "$OS" in
+ SunOS | Linux | Darwin | CYGWIN* )
+ FILESEP="/"
+ ;;
+
+ Windows_95 | Windows_98 | Windows_NT | Windows_ME )
+ FILESEP="\\"
+ ;;
+
+ # catch all other OSs
+ * )
+ echo "Unrecognized system! $OS"
+ fail "Unrecognized system! $OS"
+ ;;
+esac
+
+
+# Want this test to run standalone as well as in the harness, so do the
+# following to copy the test's directory into the harness's scratch directory
+# and set all appropriate variables:
+
+if [ -z "${TESTJAVA}" ] ; then
+ # TESTJAVA is not set, so the test is running stand-alone.
+ # TESTJAVA holds the path to the root directory of the build of the JDK
+ # to be tested. That is, any java files run explicitly in this shell
+ # should use TESTJAVA in the path to the java interpreter.
+ # So, we'll set this to the JDK spec'd on the command line. If none
+ # is given on the command line, tell the user that and use a cheesy
+ # default.
+ # THIS IS THE JDK BEING TESTED.
+ if [ -n "$1" ] ;
+ then TESTJAVA=$1
+ else fail "no JDK specified on command line!"
+ fi
+ TESTSRC=.
+ TESTCLASSES=.
+ STANDALONE=1;
+fi
+echo "JDK under test is: $TESTJAVA"
+
+#Deal with .class files:
+if [ -n "${STANDALONE}" ] ;
+ then
+ #if standalone, remind user to cd to dir. containing test before running it
+ echo "Just a reminder: cd to the dir containing this test when running it"
+ # then compile all .java files (if there are any) into .class files
+ if [ -a *.java ] ;
+ then echo "Reminder, this test should be in its own directory with all"
+ echo "supporting files it needs in the directory with it."
+ ${TESTJAVA}/bin/javac ./*.java ;
+ fi
+ # else in harness so copy all the class files from where jtreg put them
+ # over to the scratch directory this test is running in.
+ else cp ${TESTCLASSES}/*.class . ;
+fi
+
+#if in test harness, then copy the entire directory that the test is in over
+# to the scratch directory. This catches any support files needed by the test.
+if [ -z "${STANDALONE}" ] ;
+ then cp ${TESTSRC}/* .
+fi
+
+#Just before executing anything, make sure it has executable permission!
+chmod 777 ./*
+
+############### YOUR TEST CODE HERE!!!!!!! #############
+
+#All files required for the test should be in the same directory with
+# this file. If converting a standalone test to run with the harness,
+# as long as all files are in the same directory and it returns 0 for
+# pass, you should be able to cut and paste it into here and it will
+# run with the test harness.
+
+${TESTJAVA}/bin/java EventQueuePushAutoshutdown
+
+############### END YOUR TEST CODE !!!!! ############
+#Be sure the last command executed above this line returns 0 for success,
+# something non-zero for failure.
+status=$?
+
+# pass or fail the test based on status of the command
+case "$status" in
+ 0 )
+ pass ""
+ ;;
+
+ 1 )
+ fail "The program didn't automatically shut down"
+ ;;
+
+ * )
+ fail "The program terminated unexpectedly!"
+ ;;
+esac
+
+#For additional examples of how to write platform independent KSH scripts,
+# see the jtreg file itself. It is a KSH script for both Solaris and Win32
+
--- a/jdk/test/java/awt/image/MultiResolutionImage/NSImageToMultiResolutionImageTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/awt/image/MultiResolutionImage/NSImageToMultiResolutionImageTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -23,15 +23,17 @@
import java.awt.Image;
import java.awt.Toolkit;
-import sun.awt.OSInfo;
-import sun.awt.image.MultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
+import jdk.testlibrary.OSInfo;
+
/*
* @test
* @bug 8033534 8035069
* @summary [macosx] Get MultiResolution image from native system
* @author Alexander Scherbatiy
- * @modules java.desktop/sun.awt
- * java.desktop/sun.awt.image
+ * @modules java.desktop/sun.awt.image
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
* @run main NSImageToMultiResolutionImageTest
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/MultiResolutionImageCommonTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2013, 2015, 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.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import sun.awt.SunHints;
+import java.awt.geom.AffineTransform;
+import java.util.Arrays;
+import java.util.List;
+import java.awt.image.MultiResolutionImage;
+
+/**
+ * @test @bug 8011059
+ * @author Alexander Scherbatiy
+ * @summary Test MultiResolution image loading and painting with various scaling
+ * combinations
+ * @modules java.desktop/sun.awt
+ * java.desktop/sun.awt.image
+ */
+public class MultiResolutionImageCommonTest {
+
+ private static final int IMAGE_WIDTH = 300;
+ private static final int IMAGE_HEIGHT = 200;
+ private static final Color COLOR_1X = Color.GREEN;
+ private static final Color COLOR_2X = Color.BLUE;
+
+ public static void main(String[] args) throws Exception {
+ testCustomMultiResolutionImage();
+ System.out.println("Test passed.");
+ }
+
+ public static void testCustomMultiResolutionImage() {
+ testCustomMultiResolutionImage(false);
+ testCustomMultiResolutionImage(true);
+ }
+
+ public static void testCustomMultiResolutionImage(
+ boolean enableImageScaling) {
+
+ Image image = new MultiResolutionBufferedImage();
+
+ // Same image size
+ BufferedImage bufferedImage = new BufferedImage(
+ IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2d = (Graphics2D) bufferedImage.getGraphics();
+ setImageScalingHint(g2d, enableImageScaling);
+ g2d.drawImage(image, 0, 0, null);
+ checkColor(bufferedImage.getRGB(
+ 3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+ // Twice image size
+ bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT,
+ BufferedImage.TYPE_INT_RGB);
+ g2d = (Graphics2D) bufferedImage.getGraphics();
+ setImageScalingHint(g2d, enableImageScaling);
+ g2d.drawImage(image, 0, 0, 2 * IMAGE_WIDTH,
+ 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+ checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2,
+ 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+ // Scale 2x
+ bufferedImage = new BufferedImage(
+ 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ g2d = (Graphics2D) bufferedImage.getGraphics();
+ setImageScalingHint(g2d, enableImageScaling);
+ g2d.scale(2, 2);
+ g2d.drawImage(image, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+ checkColor(bufferedImage.getRGB(
+ 3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+ // Rotate
+ bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
+ BufferedImage.TYPE_INT_RGB);
+ g2d = (Graphics2D) bufferedImage.getGraphics();
+ setImageScalingHint(g2d, enableImageScaling);
+ g2d.drawImage(image, 0, 0, null);
+ g2d.rotate(Math.PI / 4);
+ checkColor(bufferedImage.getRGB(
+ 3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+ // Scale 2x and Rotate
+ bufferedImage = new BufferedImage(
+ 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ g2d = (Graphics2D) bufferedImage.getGraphics();
+ setImageScalingHint(g2d, enableImageScaling);
+ g2d.scale(-2, 2);
+ g2d.rotate(-Math.PI / 10);
+ g2d.drawImage(image, -IMAGE_WIDTH, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+ checkColor(bufferedImage.getRGB(
+ 3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+ // General Transform
+ bufferedImage = new BufferedImage(
+ 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ g2d = (Graphics2D) bufferedImage.getGraphics();
+ setImageScalingHint(g2d, enableImageScaling);
+ float delta = 0.05f;
+ float cos = 1 - delta * delta / 2;
+ float sin = 1 + delta;
+ AffineTransform transform
+ = new AffineTransform(2 * cos, 0.1, 0.3, -2 * sin, 10, -5);
+ g2d.setTransform(transform);
+ g2d.drawImage(image, 0, -IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+ checkColor(bufferedImage.getRGB(
+ 3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+ int D = 10;
+ // From Source to small Destination region
+ bufferedImage = new BufferedImage(
+ IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ g2d = (Graphics2D) bufferedImage.getGraphics();
+ setImageScalingHint(g2d, enableImageScaling);
+ g2d.drawImage(image, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2,
+ IMAGE_WIDTH - D, IMAGE_HEIGHT - D,
+ D, D, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null);
+ checkColor(bufferedImage.getRGB(
+ 3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+ // From Source to large Destination region
+ bufferedImage = new BufferedImage(
+ 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ g2d = (Graphics2D) bufferedImage.getGraphics();
+ setImageScalingHint(g2d, enableImageScaling);
+ g2d.drawImage(image, D, D, 2 * IMAGE_WIDTH - D, 2 * IMAGE_HEIGHT - D,
+ IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2,
+ IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null);
+ checkColor(bufferedImage.getRGB(
+ 3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+ }
+
+ static class MultiResolutionBufferedImage extends BufferedImage
+ implements MultiResolutionImage {
+
+ Image highResolutionImage;
+
+ public MultiResolutionBufferedImage() {
+ super(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ highResolutionImage = new BufferedImage(
+ 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT,
+ BufferedImage.TYPE_INT_RGB);
+ draw(getGraphics(), 1);
+ draw(highResolutionImage.getGraphics(), 2);
+ }
+
+ final void draw(Graphics graphics, float resolution) {
+ Graphics2D g2 = (Graphics2D) graphics;
+ g2.scale(resolution, resolution);
+ g2.setColor((resolution == 1) ? COLOR_1X : COLOR_2X);
+ g2.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
+ }
+
+ @Override
+ public Image getResolutionVariant(
+ double destImageWidth, double destImageHeight) {
+ return ((destImageWidth <= getWidth() && destImageHeight <= getHeight()))
+ ? this : highResolutionImage;
+ }
+
+ @Override
+ public List<Image> getResolutionVariants() {
+ return Arrays.asList(this, highResolutionImage);
+ }
+ }
+
+ static void setImageScalingHint(
+ Graphics2D g2d, boolean enableImageScaling) {
+ g2d.setRenderingHint(SunHints.KEY_RESOLUTION_VARIANT, enableImageScaling
+ ? RenderingHints.VALUE_RESOLUTION_VARIANT_DEFAULT
+ : RenderingHints.VALUE_RESOLUTION_VARIANT_BASE);
+ }
+
+ static void checkColor(int rgb, boolean isImageScaled) {
+
+ if (!isImageScaled && COLOR_1X.getRGB() != rgb) {
+ throw new RuntimeException("Wrong 1x color: " + new Color(rgb));
+ }
+
+ if (isImageScaled && COLOR_2X.getRGB() != rgb) {
+ throw new RuntimeException("Wrong 2x color" + new Color(rgb));
+ }
+ }
+
+}
--- a/jdk/test/java/awt/image/MultiResolutionImageTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/awt/image/MultiResolutionImageTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,25 +31,24 @@
import java.lang.reflect.Method;
import java.net.URL;
import javax.imageio.ImageIO;
-import sun.awt.OSInfo;
import sun.awt.SunHints;
import java.awt.MediaTracker;
-import java.awt.geom.AffineTransform;
+import java.awt.RenderingHints;
import java.awt.image.ImageObserver;
-import java.util.Arrays;
-import java.util.List;
import javax.swing.JPanel;
-import sun.awt.SunToolkit;
-import sun.awt.image.MultiResolutionImage;
+import jdk.testlibrary.Platform;
+import java.awt.image.MultiResolutionImage;
/**
- * @test
- * @bug 8011059
+ * @test @bug 8011059
* @author Alexander Scherbatiy
* @summary [macosx] Make JDK demos look perfect on retina displays
+ * @library /lib/testlibrary/
+ * @build jdk.testlibrary.Platform
+ * @requires (os.family == "mac")
* @modules java.desktop/sun.awt
* java.desktop/sun.awt.image
- * @run main MultiResolutionImageTest CUSTOM
+ * java.desktop/sun.lwawt.macosx
* @run main MultiResolutionImageTest TOOLKIT_PREPARE
* @run main MultiResolutionImageTest TOOLKIT_LOAD
* @run main MultiResolutionImageTest TOOLKIT
@@ -70,149 +69,29 @@
if (args.length == 0) {
throw new RuntimeException("Not found a test");
}
-
String test = args[0];
-
System.out.println("TEST: " + test);
- System.out.println("CHECK OS: " + checkOS());
-
- if ("CUSTOM".equals(test)) {
- testCustomMultiResolutionImage();
- } else if (checkOS()) {
- switch (test) {
- case "CUSTOM":
- break;
- case "TOOLKIT_PREPARE":
- testToolkitMultiResolutionImagePrepare();
- break;
- case "TOOLKIT_LOAD":
- testToolkitMultiResolutionImageLoad();
- break;
- case "TOOLKIT":
- testToolkitMultiResolutionImage();
- testImageNameTo2xParsing();
- break;
- default:
- throw new RuntimeException("Unknown test: " + test);
- }
- }
- }
-
- static boolean checkOS() {
- return OSInfo.getOSType() == OSInfo.OSType.MACOSX;
- }
-
- public static void testCustomMultiResolutionImage() {
- testCustomMultiResolutionImage(false);
- testCustomMultiResolutionImage(true);
- }
-
- public static void testCustomMultiResolutionImage(boolean enableImageScaling) {
-
- Image image = new MultiResolutionBufferedImage();
-
- // Same image size
- BufferedImage bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
- BufferedImage.TYPE_INT_RGB);
- Graphics2D g2d = (Graphics2D) bufferedImage.getGraphics();
- setImageScalingHint(g2d, enableImageScaling);
- g2d.drawImage(image, 0, 0, null);
- checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
-
- // Twice image size
- bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT,
- BufferedImage.TYPE_INT_RGB);
- g2d = (Graphics2D) bufferedImage.getGraphics();
- setImageScalingHint(g2d, enableImageScaling);
- g2d.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
- checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
-
- // Scale 2x
- bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
- g2d = (Graphics2D) bufferedImage.getGraphics();
- setImageScalingHint(g2d, enableImageScaling);
- g2d.scale(2, 2);
- g2d.drawImage(image, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
- checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
- // Rotate
- bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
- BufferedImage.TYPE_INT_RGB);
- g2d = (Graphics2D) bufferedImage.getGraphics();
- setImageScalingHint(g2d, enableImageScaling);
- g2d.drawImage(image, 0, 0, null);
- g2d.rotate(Math.PI / 4);
- checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
-
- // Scale 2x and Rotate
- bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
- g2d = (Graphics2D) bufferedImage.getGraphics();
- setImageScalingHint(g2d, enableImageScaling);
- g2d.scale(-2, 2);
- g2d.rotate(-Math.PI / 10);
- g2d.drawImage(image, -IMAGE_WIDTH, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
- checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
-
- // General Transform
- bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
- g2d = (Graphics2D) bufferedImage.getGraphics();
- setImageScalingHint(g2d, enableImageScaling);
- float delta = 0.05f;
- float cos = 1 - delta * delta / 2;
- float sin = 1 + delta;
- AffineTransform transform = new AffineTransform(2 * cos, 0.1, 0.3, -2 * sin, 10, -5);
- g2d.setTransform(transform);
- g2d.drawImage(image, 0, -IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT, null);
- checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
-
- int D = 10;
- // From Source to small Destination region
- bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
- g2d = (Graphics2D) bufferedImage.getGraphics();
- setImageScalingHint(g2d, enableImageScaling);
- g2d.drawImage(image, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, IMAGE_WIDTH - D, IMAGE_HEIGHT - D,
- D, D, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null);
- checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
-
- // From Source to large Destination region
- bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
- g2d = (Graphics2D) bufferedImage.getGraphics();
- setImageScalingHint(g2d, enableImageScaling);
- g2d.drawImage(image, D, D, 2 * IMAGE_WIDTH - D, 2 * IMAGE_HEIGHT - D,
- IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null);
- checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
- }
-
- static class MultiResolutionBufferedImage extends BufferedImage
- implements MultiResolutionImage {
-
- Image highResolutionImage;
-
- public MultiResolutionBufferedImage() {
- super(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
- highResolutionImage = new BufferedImage(
- 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
- draw(getGraphics(), 1);
- draw(highResolutionImage.getGraphics(), 2);
+ // To automatically pass the test if the test is not run using JTReg.
+ if (!Platform.isOSX()) {
+ System.out.println("Non-Mac platform detected. Passing the test");
+ return;
}
-
- void draw(Graphics graphics, float resolution) {
- Graphics2D g2 = (Graphics2D) graphics;
- g2.scale(resolution, resolution);
- g2.setColor((resolution == 1) ? COLOR_1X : COLOR_2X);
- g2.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
+ switch (test) {
+ case "TOOLKIT_PREPARE":
+ testToolkitMultiResolutionImagePrepare();
+ break;
+ case "TOOLKIT_LOAD":
+ testToolkitMultiResolutionImageLoad();
+ break;
+ case "TOOLKIT":
+ testToolkitMultiResolutionImage();
+ testImageNameTo2xParsing();
+ break;
+ default:
+ throw new RuntimeException("Unknown test: " + test);
}
-
- @Override
- public Image getResolutionVariant(int width, int height) {
- return ((width <= getWidth() && height <= getHeight()))
- ? this : highResolutionImage;
- }
-
- @Override
- public List<Image> getResolutionVariants() {
- return Arrays.asList(this, highResolutionImage);
- }
+ System.out.println("Test passed.");
}
static void testToolkitMultiResolutionImagePrepare() throws Exception {
@@ -224,8 +103,9 @@
Image image = Toolkit.getDefaultToolkit().getImage(fileName);
- SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
- toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT,
+ new LoadImageObserver(image));
testToolkitMultiResolutionImageLoad(image);
}
@@ -240,7 +120,8 @@
testToolkitMultiResolutionImageLoad(image);
}
- static void testToolkitMultiResolutionImageLoad(Image image) throws Exception {
+ static void testToolkitMultiResolutionImageLoad(Image image)
+ throws Exception {
MediaTracker tracker = new MediaTracker(new JPanel());
tracker.addImage(image, 0);
@@ -256,7 +137,7 @@
int h = image.getHeight(null);
Image resolutionVariant = ((MultiResolutionImage) image)
- .getResolutionVariant(2 * w, 2 * h);
+ .getResolutionVariant(2 * w, 2 * h);
if (image == resolutionVariant) {
throw new RuntimeException("Resolution variant is not loaded");
@@ -267,9 +148,10 @@
static void testImageLoaded(Image image) {
- SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
- int flags = toolkit.checkImage(image, IMAGE_WIDTH, IMAGE_WIDTH, new SilentImageObserver());
+ int flags = toolkit.checkImage(image, IMAGE_WIDTH, IMAGE_WIDTH,
+ new SilentImageObserver());
if ((flags & (ImageObserver.FRAMEBITS | ImageObserver.ALLBITS)) == 0) {
throw new RuntimeException("Image is not loaded!");
}
@@ -278,7 +160,8 @@
static class SilentImageObserver implements ImageObserver {
@Override
- public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+ public boolean imageUpdate(Image img, int infoflags, int x, int y,
+ int width, int height) {
throw new RuntimeException("Observer should not be called!");
}
}
@@ -292,21 +175,25 @@
}
@Override
- public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+ public boolean imageUpdate(Image img, int infoflags, int x, int y,
+ int width, int height) {
if (image != img) {
- throw new RuntimeException("Original image is not passed to the observer");
+ throw new RuntimeException("Original image is not passed "
+ + "to the observer");
}
if ((infoflags & ImageObserver.WIDTH) != 0) {
if (width != IMAGE_WIDTH) {
- throw new RuntimeException("Original width is not passed to the observer");
+ throw new RuntimeException("Original width is not passed "
+ + "to the observer");
}
}
if ((infoflags & ImageObserver.HEIGHT) != 0) {
if (height != IMAGE_HEIGHT) {
- throw new RuntimeException("Original height is not passed to the observer");
+ throw new RuntimeException("Original height is not passed "
+ + "to the observer");
}
}
@@ -335,7 +222,8 @@
testToolkitMultiResolutionImage(image, true);
}
- static void testToolkitMultiResolutionImageChache(String fileName, URL url) {
+ static void testToolkitMultiResolutionImageChache(String fileName,
+ URL url) {
Image img1 = Toolkit.getDefaultToolkit().getImage(fileName);
if (!(img1 instanceof MultiResolutionImage)) {
@@ -358,8 +246,8 @@
}
}
- static void testToolkitMultiResolutionImage(Image image, boolean enableImageScaling)
- throws Exception {
+ static void testToolkitMultiResolutionImage(Image image,
+ boolean enableImageScaling) throws Exception {
MediaTracker tracker = new MediaTracker(new JPanel());
tracker.addImage(image, 0);
@@ -368,15 +256,16 @@
throw new RuntimeException("Error during image loading");
}
- final BufferedImage bufferedImage1x = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
- BufferedImage.TYPE_INT_RGB);
+ final BufferedImage bufferedImage1x = new BufferedImage(IMAGE_WIDTH,
+ IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
Graphics2D g1x = (Graphics2D) bufferedImage1x.getGraphics();
setImageScalingHint(g1x, false);
g1x.drawImage(image, 0, 0, null);
- checkColor(bufferedImage1x.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+ checkColor(bufferedImage1x.getRGB(3 * IMAGE_WIDTH / 4,
+ 3 * IMAGE_HEIGHT / 4), false);
Image resolutionVariant = ((MultiResolutionImage) image).
- getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT);
+ getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT);
if (resolutionVariant == null) {
throw new RuntimeException("Resolution variant is null");
@@ -390,23 +279,28 @@
}
final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
- 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
setImageScalingHint(g2x, enableImageScaling);
- g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
- checkColor(bufferedImage2x.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+ g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH,
+ 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+ checkColor(bufferedImage2x.getRGB(3 * IMAGE_WIDTH / 2,
+ 3 * IMAGE_HEIGHT / 2), enableImageScaling);
if (!(image instanceof MultiResolutionImage)) {
throw new RuntimeException("Not a MultiResolutionImage");
}
- MultiResolutionImage multiResolutionImage = (MultiResolutionImage) image;
+ MultiResolutionImage multiResolutionImage
+ = (MultiResolutionImage) image;
- Image image1x = multiResolutionImage.getResolutionVariant(IMAGE_WIDTH, IMAGE_HEIGHT);
- Image image2x = multiResolutionImage.getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT);
+ Image image1x = multiResolutionImage.getResolutionVariant(
+ IMAGE_WIDTH, IMAGE_HEIGHT);
+ Image image2x = multiResolutionImage.getResolutionVariant(
+ 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT);
if (image1x.getWidth(null) * 2 != image2x.getWidth(null)
- || image1x.getHeight(null) * 2 != image2x.getHeight(null)) {
+ || image1x.getHeight(null) * 2 != image2x.getHeight(null)) {
throw new RuntimeException("Wrong resolution variant size");
}
}
@@ -416,13 +310,15 @@
ImageObserver observer = new ImageObserver() {
@Override
- public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+ public boolean imageUpdate(Image img, int infoflags, int x, int y,
+ int width, int height) {
if (img != image) {
throw new RuntimeException("Wrong image in observer");
}
- if ((infoflags & (ImageObserver.ERROR | ImageObserver.ABORT)) != 0) {
+ if ((infoflags & (ImageObserver.ERROR | ImageObserver.ABORT))
+ != 0) {
throw new RuntimeException("Error during image loading");
}
@@ -432,18 +328,20 @@
};
final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
- 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
setImageScalingHint(g2x, true);
- g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, observer);
+ g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0,
+ IMAGE_WIDTH, IMAGE_HEIGHT, observer);
}
- static void setImageScalingHint(Graphics2D g2d, boolean enableImageScaling) {
+ static void setImageScalingHint(Graphics2D g2d,
+ boolean enableImageScaling) {
g2d.setRenderingHint(SunHints.KEY_RESOLUTION_VARIANT, enableImageScaling
- ? SunHints.VALUE_RESOLUTION_VARIANT_ON
- : SunHints.VALUE_RESOLUTION_VARIANT_OFF);
+ ? RenderingHints.VALUE_RESOLUTION_VARIANT_DEFAULT
+ : RenderingHints.VALUE_RESOLUTION_VARIANT_BASE);
}
static void checkColor(int rgb, boolean isImageScaled) {
@@ -468,8 +366,9 @@
}
static void generateImage(int scale) throws Exception {
- BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
- BufferedImage.TYPE_INT_RGB);
+ BufferedImage image = new BufferedImage(
+ scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
+ BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(scale == 1 ? COLOR_1X : COLOR_2X);
g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
@@ -493,7 +392,7 @@
}
throw new RuntimeException("Test name " + testName
- + ", result name: " + resultName);
+ + ", result name: " + resultName);
}
for (URL[] testURLs : TEST_URLS) {
@@ -510,7 +409,7 @@
}
throw new RuntimeException("Test url: " + testURL
- + ", result url: " + resultURL);
+ + ", result url: " + resultURL);
}
}
@@ -521,19 +420,22 @@
}
static String getTestScaledImageName(String name) throws Exception {
- Method method = getScalableImageMethod("getScaledImageName", String.class);
+ Method method = getScalableImageMethod(
+ "getScaledImageName", String.class);
return (String) method.invoke(null, name);
}
private static boolean isValidPath(String path) {
return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".")
- && !path.contains("@2x");
+ && !path.contains("@2x");
}
private static Method getScalableImageMethod(String name,
- Class... parameterTypes) throws Exception {
+ Class... parameterTypes) throws Exception {
Toolkit toolkit = Toolkit.getDefaultToolkit();
- Method method = toolkit.getClass().getDeclaredMethod(name, parameterTypes);
+ Method method = toolkit.getClass()
+ .
+ getDeclaredMethod(name, parameterTypes);
method.setAccessible(true);
return method;
}
@@ -604,9 +506,11 @@
{new URL("jar:file:/dir/Java2D.jar!/images/image.ext"),
new URL("jar:file:/dir/Java2D.jar!/images/image@2x.ext")},
{new URL("jar:file:/aaa.bbb/Java2D.jar!/images/image.ext"),
- new URL("jar:file:/aaa.bbb/Java2D.jar!/images/image@2x.ext")},
+ new URL("jar:file:/aaa.bbb/Java2D.jar!/"
+ + "images/image@2x.ext")},
{new URL("jar:file:/dir/Java2D.jar!/aaa.bbb/image.ext"),
- new URL("jar:file:/dir/Java2D.jar!/aaa.bbb/image@2x.ext")},};
+ new URL("jar:file:/dir/Java2D.jar!/"
+ + "aaa.bbb/image@2x.ext")},};
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -615,7 +519,8 @@
static class PreloadedImageObserver implements ImageObserver {
@Override
- public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+ public boolean imageUpdate(Image img, int infoflags, int x, int y,
+ int width, int height) {
throw new RuntimeException("Image should be already preloaded");
}
}
--- a/jdk/test/java/awt/image/RescaleOp/RescaleAlphaTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/awt/image/RescaleOp/RescaleAlphaTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -22,8 +22,8 @@
*/
/**
* @test
- * @bug 8080287
- * @run RescaleAlphaTest
+ * @bug 8080287 8136354
+ * @run main RescaleAlphaTest
* @summary RescaleOp with scaleFactor/alpha should copy alpha to destination
* channel
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/BaseMultiResolutionImageTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+import java.awt.Dimension;
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.awt.image.BaseMultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
+import java.util.List;
+
+/**
+ * @test
+ * @bug 8029339
+ * @author Alexander Scherbatiy
+ * @summary Custom MultiResolution image support on HiDPI displays
+ * @run main BaseMultiResolutionImageTest
+ */
+public class BaseMultiResolutionImageTest {
+
+ public static void main(String[] args) {
+ testZeroRVIMages();
+ testNullRVIMages();
+ testNullRVIMage();
+ testIOOBException();
+ testRVSizes();
+ testBaseMRImage();
+ }
+
+ static void testZeroRVIMages() {
+ try {
+ new BaseMultiResolutionImage();
+ } catch (IllegalArgumentException ignored) {
+ return;
+ }
+ throw new RuntimeException("IllegalArgumentException is not thrown!");
+ }
+
+ static void testNullRVIMages() {
+ try {
+ new BaseMultiResolutionImage(null);
+ } catch (IllegalArgumentException ignored) {
+ return;
+ }
+ throw new RuntimeException("IllegalArgumentException is not thrown!");
+ }
+
+ static void testNullRVIMage() {
+
+ Image baseImage = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+
+ try {
+ new BaseMultiResolutionImage(baseImage, null);
+ } catch (NullPointerException ignored) {
+ return;
+ }
+ throw new RuntimeException("NullPointerException is not thrown!");
+ }
+
+ static void testIOOBException() {
+
+ for (int baseImageIndex : new int[]{-3, 2, 4}) {
+ try {
+ new BaseMultiResolutionImage(baseImageIndex,
+ createRVImage(0), createRVImage(1));
+ } catch (IndexOutOfBoundsException ignored) {
+ continue;
+ }
+
+ throw new RuntimeException("IndexOutOfBoundsException is not thrown!");
+ }
+ }
+
+ static void testRVSizes() {
+
+ int imageSize = getSize(1);
+
+ double[][] sizeArray = {
+ {-imageSize, imageSize},
+ {2 * imageSize, -2 * imageSize},
+ {Double.POSITIVE_INFINITY, imageSize},
+ {Double.POSITIVE_INFINITY, -imageSize},
+ {imageSize, Double.NEGATIVE_INFINITY},
+ {-imageSize, Double.NEGATIVE_INFINITY},
+ {Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY},
+ {Double.NaN, imageSize},
+ {imageSize, Double.NaN},
+ {Double.NaN, Double.NaN},
+ {Double.POSITIVE_INFINITY, Double.NaN}
+ };
+
+ for (double[] sizes : sizeArray) {
+ try {
+ MultiResolutionImage mrImage = new BaseMultiResolutionImage(
+ 0, createRVImage(0), createRVImage(1));
+ mrImage.getResolutionVariant(sizes[0], sizes[1]);
+ } catch (IllegalArgumentException ignored) {
+ continue;
+ }
+
+ throw new RuntimeException("IllegalArgumentException is not thrown!");
+ }
+ }
+
+ static void testBaseMRImage() {
+ int baseIndex = 1;
+ int length = 3;
+ BufferedImage[] resolutionVariants = new BufferedImage[length];
+ for (int i = 0; i < length; i++) {
+ resolutionVariants[i] = createRVImage(i);
+ }
+
+ BaseMultiResolutionImage mrImage = new BaseMultiResolutionImage(baseIndex,
+ resolutionVariants);
+
+ List<Image> rvImageList = mrImage.getResolutionVariants();
+ if (rvImageList.size() != length) {
+ throw new RuntimeException("Wrong size of resolution variants list!");
+ }
+
+ for (int i = 0; i < length; i++) {
+ int imageSize = getSize(i);
+ Image testRVImage = mrImage.getResolutionVariant(imageSize, imageSize);
+
+ if (testRVImage != resolutionVariants[i]) {
+ throw new RuntimeException("Wrong resolution variant!");
+ }
+
+ if (rvImageList.get(i) != resolutionVariants[i]) {
+ throw new RuntimeException("Wrong resolution variant!");
+ }
+ }
+
+ BufferedImage baseImage = resolutionVariants[baseIndex];
+
+ if (baseImage.getWidth() != mrImage.getWidth(null)
+ || baseImage.getHeight() != mrImage.getHeight(null)) {
+ throw new RuntimeException("Base image is wrong!");
+ }
+
+ boolean passed = false;
+
+ try {
+ rvImageList.set(0, createRVImage(10));
+ } catch (Exception e) {
+ passed = true;
+ }
+
+ if (!passed) {
+ throw new RuntimeException("Resolution variants list is modifiable!");
+ }
+
+ passed = false;
+
+ try {
+ rvImageList.remove(0);
+ } catch (Exception e) {
+ passed = true;
+ }
+
+ if (!passed) {
+ throw new RuntimeException("Resolution variants list is modifiable!");
+ }
+
+ passed = false;
+
+ try {
+ rvImageList.add(0, createRVImage(10));
+ } catch (Exception e) {
+ passed = true;
+ }
+
+ if (!passed) {
+ throw new RuntimeException("Resolution variants list is modifiable!");
+ }
+ }
+
+ private static int getSize(int i) {
+ return 8 * (i + 1);
+ }
+
+ private static BufferedImage createRVImage(int i) {
+ return new BufferedImage(getSize(i), getSize(i),
+ BufferedImage.TYPE_INT_RGB);
+ }
+}
--- a/jdk/test/java/awt/image/multiresolution/MultiResolutionCachedImageTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionCachedImageTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -98,7 +98,7 @@
}
@Override
- public Image getResolutionVariant(int width, int height) {
+ public Image getResolutionVariant(double width, double height) {
if (width == size || height == size) {
throw new RuntimeException("Base image is requested!");
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionRenderingHintsTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
+import java.awt.image.BaseMultiResolutionImage;
+import static java.awt.RenderingHints.KEY_RESOLUTION_VARIANT;
+import static java.awt.RenderingHints.VALUE_RESOLUTION_VARIANT_BASE;
+import static java.awt.RenderingHints.VALUE_RESOLUTION_VARIANT_DPI_FIT;
+import static java.awt.RenderingHints.VALUE_RESOLUTION_VARIANT_SIZE_FIT;
+import static java.awt.RenderingHints.VALUE_RESOLUTION_VARIANT_DEFAULT;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ColorModel;
+import java.awt.image.Raster;
+import sun.java2d.StateTrackable;
+import sun.java2d.SunGraphics2D;
+import sun.java2d.SurfaceData;
+import sun.java2d.loops.SurfaceType;
+
+/**
+ * @test
+ * @bug 8029339
+ * @author Alexander Scherbatiy
+ * @summary Custom MultiResolution image support on HiDPI displays
+ * @modules java.desktop/sun.java2d
+ * @run main MultiResolutionRenderingHintsTest
+ */
+public class MultiResolutionRenderingHintsTest {
+
+ private static final int BASE_SIZE = 200;
+ private static final Color[] COLORS = {
+ Color.CYAN, Color.GREEN, Color.BLUE, Color.ORANGE, Color.RED, Color.PINK
+ };
+
+ public static void main(String[] args) throws Exception {
+
+ int length = COLORS.length;
+ BufferedImage[] resolutionVariants = new BufferedImage[length];
+ for (int i = 0; i < length; i++) {
+ resolutionVariants[i] = createRVImage(getSize(i), COLORS[i]);
+ }
+
+ BaseMultiResolutionImage mrImage = new BaseMultiResolutionImage(
+ resolutionVariants);
+
+ // base
+ Color color = getImageColor(VALUE_RESOLUTION_VARIANT_BASE, mrImage, 2, 3);
+ if (!getColorForScale(1).equals(color)) {
+ throw new RuntimeException("Wrong base resolution variant!");
+ }
+
+ // dpi fit
+ color = getImageColor(VALUE_RESOLUTION_VARIANT_DPI_FIT, mrImage, 2, 3);
+ if (!getColorForScale(2).equals(color)) {
+ throw new RuntimeException("Resolution variant is not based on dpi!");
+ }
+
+ // size fit
+ color = getImageColor(VALUE_RESOLUTION_VARIANT_SIZE_FIT, mrImage, 2, 3);
+ if (!getColorForScale(6).equals(color)) {
+ throw new RuntimeException("Resolution variant is not based on"
+ + " rendered size!");
+ }
+
+ // default
+ // depends on the policies of the platform
+ // just check that exception is not thrown
+ getImageColor(VALUE_RESOLUTION_VARIANT_DEFAULT, mrImage, 2, 3);
+ }
+
+ private static Color getColorForScale(int scale) {
+ return COLORS[scale - 1];
+ }
+
+ private static Color getImageColor(final Object renderingHint, Image image,
+ double configScale, double graphicsScale) {
+
+ int width = image.getWidth(null);
+ int height = image.getHeight(null);
+
+ TestSurfaceData surface = new TestSurfaceData(width, height, configScale);
+ SunGraphics2D g2d = new SunGraphics2D(surface,
+ Color.BLACK, Color.BLACK, null);
+ g2d.setRenderingHint(KEY_RESOLUTION_VARIANT, renderingHint);
+ g2d.scale(graphicsScale, graphicsScale);
+ g2d.drawImage(image, 0, 0, null);
+ g2d.dispose();
+ return surface.getColor(width / 2, height / 2);
+ }
+
+ private static int getSize(int i) {
+ return (i + 1) * BASE_SIZE;
+ }
+
+ private static BufferedImage createRVImage(int size, Color color) {
+ BufferedImage image = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);
+ Graphics g = image.createGraphics();
+ g.setColor(Color.BLACK);
+ g.fillRect(0, 0, size, size);
+ g.setColor(color);
+ g.fillOval(0, 0, size, size);
+ g.dispose();
+ return image;
+ }
+
+ static class TestGraphicsConfig extends GraphicsConfiguration {
+
+ private final double scale;
+
+ TestGraphicsConfig(double scale) {
+ this.scale = scale;
+ }
+
+ @Override
+ public GraphicsDevice getDevice() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ColorModel getColorModel() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ColorModel getColorModel(int transparency) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public AffineTransform getDefaultTransform() {
+ return AffineTransform.getScaleInstance(scale, scale);
+ }
+
+ @Override
+ public AffineTransform getNormalizingTransform() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Rectangle getBounds() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ }
+
+ static class TestSurfaceData extends SurfaceData {
+
+ private final int width;
+ private final int height;
+ private final GraphicsConfiguration gc;
+ private final BufferedImage buffImage;
+ private final double scale;
+
+ public TestSurfaceData(int width, int height, double scale) {
+ super(StateTrackable.State.DYNAMIC, SurfaceType.Custom, ColorModel.getRGBdefault());
+ this.scale = scale;
+ gc = new TestGraphicsConfig(scale);
+ this.width = (int) Math.ceil(scale * width);
+ this.height = (int) Math.ceil(scale * height);
+ buffImage = new BufferedImage(this.width, this.height,
+ BufferedImage.TYPE_INT_RGB);
+ }
+
+ Color getColor(int x, int y) {
+ int sx = (int) Math.ceil(x * scale);
+ int sy = (int) Math.ceil(y * scale);
+ return new Color(buffImage.getRGB(sx, sy));
+ }
+
+ @Override
+ public SurfaceData getReplacement() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public GraphicsConfiguration getDeviceConfiguration() {
+ return gc;
+ }
+
+ @Override
+ public Raster getRaster(int x, int y, int w, int h) {
+ return buffImage.getRaster();
+ }
+
+ @Override
+ public Rectangle getBounds() {
+ return new Rectangle(0, 0, width, height);
+ }
+
+ @Override
+ public Object getDestination() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/XMLEncoder/ReferenceToNonStaticField.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.awt.font.TextAttribute;
+
+/**
+ * @test
+ * @bug 8060027
+ */
+public final class ReferenceToNonStaticField
+ extends AbstractTest<ReferenceToNonStaticField.TestValue> {
+
+ public static final class TestValue {
+
+ // reference to static field
+ public TextAttribute font_default = TextAttribute.FONT;
+ public TextAttribute family_default = TextAttribute.FAMILY;
+ public TextAttribute family_set1; // will be set to the same as default
+ public TextAttribute family_set2; // will be set to the same as default
+ public TextAttribute family_set3; // will be set to the same as default
+
+ // primitive small
+ public int int_1_default = 1;
+ public int int_10_default = 10;
+ public int int_10_set1; // will be set to the same as default
+ public int int_10_set2; // will be set to the same as default
+ public int int_10_set3; // will be set to the same as default
+
+ // primitive big
+ public int int_1000_default = 1000;
+ public int int_2000_default = 2000;
+ public int int_2000_set1; // will be set to the same as default
+ public int int_2000_set2; // will be set to the same as default
+ public int int_2000_set3; // will be set to the same as default
+
+ // wrappers
+ public Integer integer_1_default = new Integer(1);
+ public Integer integer_10_default = new Integer(10);
+ public Integer integer_10_set1; // will be set to the same as default
+ public Integer integer_10_set2; // will be set to the same as default
+ public Integer integer_10_set3; // will be set to the same as default
+
+ public TestValue() {
+ }
+
+ public TestValue(final Object ignored) {
+ // set some fields to non-default values, so they will be saved
+ family_set1 = family_default;
+ family_set3 = family_default;
+ family_set2 = family_default;
+ int_10_set1 = int_10_default;
+ int_10_set2 = int_10_default;
+ int_10_set3 = int_10_default;
+ int_2000_set1 = int_2000_default;
+ int_2000_set2 = int_2000_default;
+ int_2000_set3 = int_2000_default;
+ integer_10_set1 = integer_10_default;
+ integer_10_set2 = integer_10_default;
+ integer_10_set3 = integer_10_default;
+ }
+ }
+
+ public static void main(final String[] args) {
+ new ReferenceToNonStaticField().test(true);
+ }
+
+ protected TestValue getObject() {
+ return new TestValue(new Object());
+ }
+
+ @Override
+ protected void validate(final TestValue before,final TestValue after) {
+ super.validate(before, after);
+ validate(before);
+ validate(after);
+ }
+
+ private static void validate(final TestValue object) {
+ // reference to static field
+ if (object.font_default != TextAttribute.FONT) {
+ throw new Error("Wrong font_default: " + object.font_default);
+ }
+ if (object.family_default != TextAttribute.FAMILY) {
+ throw new Error("Wrong family_default: " + object.family_default);
+ }
+ if (object.family_set1 != object.family_default) {
+ throw new Error("Wrong family_set1: " + object.family_set1);
+ }
+ if (object.family_set2 != object.family_default) {
+ throw new Error("Wrong family_set2: " + object.family_set2);
+ }
+ if (object.family_set3 != object.family_default) {
+ throw new Error("Wrong family_set3: " + object.family_set3);
+ }
+ // primitive small
+ if (object.int_1_default != 1) {
+ throw new Error("Wrong int_1_default: " + object.int_1_default);
+ }
+ if (object.int_10_default != 10) {
+ throw new Error("Wrong int_10_default: " + object.int_10_default);
+ }
+ if (object.int_10_set1 != object.int_10_default) {
+ throw new Error("Wrong int_10_set1: " + object.int_10_set1);
+ }
+ if (object.int_10_set2 != object.int_10_default) {
+ throw new Error("Wrong int_10_set2: " + object.int_10_set2);
+ }
+ if (object.int_10_set3 != object.int_10_default) {
+ throw new Error("Wrong int_10_set3: " + object.int_10_set3);
+ }
+ // primitive big
+ if (object.int_1000_default != 1000) {
+ throw new Error("Wrong int_1000_default: " + object.int_1000_default);
+ }
+ if (object.int_2000_default != 2000) {
+ throw new Error("Wrong int_2000_default: " + object.int_2000_default);
+ }
+ if (object.int_2000_set1 != object.int_2000_default) {
+ throw new Error("Wrong int_2000_set1: " + object.int_2000_set1);
+ }
+ if (object.int_2000_set2 != object.int_2000_default) {
+ throw new Error("Wrong int_2000_set2: " + object.int_2000_set2);
+ }
+ if (object.int_2000_set3 != object.int_2000_default) {
+ throw new Error("Wrong int_2000_set3: " + object.int_2000_set3);
+ }
+ // wrappers
+ if (!object.integer_1_default.equals(new Integer(1))) {
+ throw new Error("Wrong integer_1_default: " + object.integer_1_default);
+ }
+ if (!object.integer_10_default.equals(new Integer(10))) {
+ throw new Error("Wrong integer_10_default: " + object.integer_10_default);
+ }
+ if (object.integer_10_set1 != object.integer_10_default) {
+ throw new Error("Wrong integer_10_set1: " + object.integer_10_set1);
+ }
+ if (object.integer_10_set2 != object.integer_10_default) {
+ throw new Error("Wrong integer_10_set2: " + object.integer_10_set2);
+ }
+ if (object.integer_10_set3 != object.integer_10_default) {
+ throw new Error("Wrong integer_10_set3: " + object.integer_10_set3);
+ }
+ }
+}
--- a/jdk/test/java/lang/Math/PowTests.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/lang/Math/PowTests.java Tue Sep 22 11:01:54 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, 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 4984407 5033578
+ * @bug 4984407 5033578 8134795
* @summary Tests for {Math, StrictMath}.pow
* @author Joseph D. Darcy
*/
@@ -88,12 +88,19 @@
/* > -oo */ -Double.MAX_VALUE,
/**/ (double)Long.MIN_VALUE,
/**/ (double) -((1L<<53)+2L),
+ -0x1.0p65,
+ -0x1.0000000000001p64,
+ -0x1.0p64,
/**/ (double) -((1L<<53)),
/**/ (double) -((1L<<53)-1L),
/**/ -((double)Integer.MAX_VALUE + 4.0),
/**/ (double)Integer.MIN_VALUE - 1.0,
/**/ (double)Integer.MIN_VALUE,
/**/ (double)Integer.MIN_VALUE + 1.0,
+ -0x1.0p31 + 2.0,
+ -0x1.0p31 + 1.0,
+ -0x1.0000000000001p31,
+ -0x1.0p31,
/**/ -Math.PI,
/**/ -3.0,
/**/ -Math.E,
@@ -103,6 +110,8 @@
-1.0,
/* > -1.0 */ -0.9999999999999999, // nextAfter(-1.0, +oo)
/* > -1.0 */ -0.9999999999999998,
+ -0x1.fffffp-1,
+ -0x1.ffffeffffffffp-1,
/**/ -0.5,
/**/ -1.0/3.0,
/* < 0.0 */ -Double.MIN_VALUE,
@@ -111,6 +120,8 @@
/* > 0.0 */ +Double.MIN_VALUE,
/**/ +1.0/3.0,
/**/ +0.5,
+ +0x1.ffffeffffffffp-1,
+ +0x1.fffffp-1,
/**/ +0.9999999999999998,
/* < +1.0 */ +0.9999999999999999, // nextAfter(-1.0, +oo)
+1.0,
@@ -120,6 +131,10 @@
/**/ +Math.E,
/**/ +3.0,
/**/ +Math.PI,
+ 0x1.0p31,
+ 0x1.0000000000001p31,
+ 0x1.0p31 + 1.0,
+ 0x1.0p31 + 2.0,
/**/ -(double)Integer.MIN_VALUE - 1.0,
/**/ -(double)Integer.MIN_VALUE,
/**/ -(double)Integer.MIN_VALUE + 1.0,
@@ -127,6 +142,9 @@
/**/ (double) ((1L<<53)-1L),
/**/ (double) ((1L<<53)),
/**/ (double) ((1L<<53)+2L),
+ 0x1.0p64,
+ 0x1.0000000000001p64,
+ 0x1.0p65,
/**/ -(double)Long.MIN_VALUE,
/* < oo */ Double.MAX_VALUE,
Double.POSITIVE_INFINITY,
@@ -257,7 +275,7 @@
}
static boolean isFinite(double a) {
- return (0.0*a == 0);
+ return (0.0 * a == 0);
}
/**
--- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -96,8 +96,6 @@
ConcurrentHashMap<ProcessHandle, ProcessHandle> processes = new ConcurrentHashMap<>();
List<ProcessHandle> children = getChildren(ProcessHandle.current());
children.forEach(ProcessUtil::printProcess);
- Assert.assertEquals(children.size(), 0,
- "Expected to start with zero children; " + children);
JavaChild proc = JavaChild.spawnJavaChild("stdin");
procHandle = proc.toHandle();
@@ -186,10 +184,6 @@
children.forEach(p -> printProcess(p, "after onExit:"));
Assert.assertEquals(proc.isAlive(), false, "destroyed process is alive:: %s%n" + proc);
-
- List<ProcessHandle> children2 = getAllChildren(procHandle);
- printf(" children2: %s%n", children2.toString());
- Assert.assertEquals(children2.size(), 0, "After onExit, expected no children");
} catch (IOException | InterruptedException ex) {
Assert.fail(ex.getMessage());
} finally {
--- a/jdk/test/java/lang/ProcessHandle/TreeTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/lang/ProcessHandle/TreeTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -29,6 +29,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -67,8 +68,6 @@
printf("self pid: %d%n", self.getPid());
printDeep(self, "");
- long count = getChildren(self).size();
- Assert.assertEquals(count, 0, "Start with zero children");
for (int i = 0; i < MAXCHILDREN; i++) {
// spawn and wait for instructions
@@ -124,8 +123,10 @@
spawned.stream()
.map(Process::toHandle)
.filter(ProcessHandle::isAlive)
- .forEach(ph -> printDeep(ph, "test1 cleanup: "));
- destroyProcessTree(ProcessHandle.current());
+ .forEach(ph -> {
+ printDeep(ph, "test1 cleanup: ");
+ ph.destroyForcibly();
+ });
}
}
@@ -135,18 +136,29 @@
@Test
public static void test2() {
try {
+ ConcurrentHashMap<ProcessHandle, ProcessHandle> processes = new ConcurrentHashMap<>();
+
ProcessHandle self = ProcessHandle.current();
List<ProcessHandle> initialChildren = getChildren(self);
long count = initialChildren.size();
if (count > 0) {
initialChildren.forEach(p -> printDeep(p, "test2 initial unexpected: "));
- Assert.assertEquals(count, 0, "Start with zero children (except Windows conhost.exe)");
}
JavaChild p1 = JavaChild.spawnJavaChild("stdin");
ProcessHandle p1Handle = p1.toHandle();
printf(" p1 pid: %d%n", p1.getPid());
+ // Gather the PIDs from the output of the spawing process
+ p1.forEachOutputLine((s) -> {
+ String[] split = s.trim().split(" ");
+ if (split.length == 3 && split[1].equals("spawn")) {
+ Long child = Long.valueOf(split[2]);
+ Long parent = Long.valueOf(split[0].split(":")[0]);
+ processes.put(ProcessHandle.of(child).get(), ProcessHandle.of(parent).get());
+ }
+ });
+
int spawnNew = 3;
p1.sendAction("spawn", spawnNew, "stdin");
@@ -160,18 +172,33 @@
int spawnNewSub = 2;
p1.sendAction("child", "spawn", spawnNewSub, "stdin");
- // For each spawned child, wait for its children
- for (ProcessHandle p : subprocesses) {
- List<ProcessHandle> grandChildren = waitForChildren(p, spawnNewSub);
+ // Poll until all 9 child processes exist or the timeout is reached
+ int expected = 9;
+ long timeout = jdk.testlibrary.Utils.adjustTimeout(10L);
+ Instant endTimeout = Instant.now().plusSeconds(timeout);
+ do {
+ Thread.sleep(200L);
+ printf(" subprocess count: %d, waiting for %d%n", processes.size(), expected);
+ } while (processes.size() < expected &&
+ Instant.now().isBefore(endTimeout));
+
+ if (processes.size() < expected) {
+ printf("WARNING: not all children have been started. Can't complete test.%n");
+ printf(" You can try to increase the timeout or%n");
+ printf(" you can try to use a faster VM (i.e. not a debug version).%n");
}
+ // show the complete list of children (for debug)
List<ProcessHandle> allChildren = getAllChildren(p1Handle);
printf(" allChildren: %s%n",
allChildren.stream().map(p -> p.getPid())
.collect(Collectors.toList()));
- for (ProcessHandle ph : allChildren) {
- Assert.assertEquals(ph.isAlive(), true, "Child should be alive: " + ph);
- }
+
+ // Verify that all spawned children show up in the allChildrenList
+ processes.forEach((p, parent) -> {
+ Assert.assertEquals(p.isAlive(), true, "Child should be alive: " + p);
+ Assert.assertTrue(allChildren.contains(p), "Spawned child should be listed in allChildren: " + p);
+ });
// Closing JavaChild's InputStream will cause all children to exit
p1.getOutputStream().close();
@@ -185,15 +212,12 @@
}
p1.waitFor(); // wait for spawned process to exit
- List<ProcessHandle> remaining = getChildren(self);
- remaining.forEach(ph -> Assert.assertFalse(ph.isAlive(),
+ // Verify spawned processes are no longer alive
+ processes.forEach((ph, parent) -> Assert.assertFalse(ph.isAlive(),
"process should not be alive: " + ph));
} catch (IOException | InterruptedException t) {
t.printStackTrace();
throw new RuntimeException(t);
- } finally {
- // Cleanup any left over processes
- destroyProcessTree(ProcessHandle.current());
}
}
@@ -202,6 +226,8 @@
*/
@Test
public static void test3() {
+ ConcurrentHashMap<ProcessHandle, ProcessHandle> processes = new ConcurrentHashMap<>();
+
try {
ProcessHandle self = ProcessHandle.current();
@@ -209,44 +235,53 @@
ProcessHandle p1Handle = p1.toHandle();
printf(" p1: %s%n", p1.getPid());
- List<ProcessHandle> subprocesses = getChildren(self);
- long count = subprocesses.size();
- Assert.assertEquals(count, 1, "Wrong number of spawned children");
-
int newChildren = 3;
// Spawn children and have them wait
p1.sendAction("spawn", newChildren, "stdin");
+ // Gather the PIDs from the output of the spawing process
+ p1.forEachOutputLine((s) -> {
+ String[] split = s.trim().split(" ");
+ if (split.length == 3 && split[1].equals("spawn")) {
+ Long child = Long.valueOf(split[2]);
+ Long parent = Long.valueOf(split[0].split(":")[0]);
+ processes.put(ProcessHandle.of(child).get(), ProcessHandle.of(parent).get());
+ }
+ });
+
// Wait for the new processes and save the list
- subprocesses = waitForAllChildren(p1Handle, newChildren);
- Assert.assertEquals(subprocesses.size(), newChildren, "Wrong number of children");
-
- p1.children().filter(TreeTest::isNotWindowsConsole)
- .forEach(ProcessHandle::destroyForcibly);
+ List<ProcessHandle> allChildren = waitForAllChildren(p1Handle, newChildren);
- self.children().filter(TreeTest::isNotWindowsConsole)
- .forEach(ProcessHandle::destroyForcibly);
+ // Verify that all spawned children are alive, show up in the allChildren list
+ // then destroy them
+ processes.forEach((p, parent) -> {
+ Assert.assertEquals(p.isAlive(), true, "Child should be alive: " + p);
+ Assert.assertTrue(allChildren.contains(p), "Spawned child should be listed in allChildren: " + p);
+ p.destroyForcibly();
+ });
- for (ProcessHandle p : subprocesses) {
+ processes.forEach((p, parent) -> {
while (p.isAlive()) {
- Thread.sleep(100L); // It will happen but don't burn the cpu
+ try {
+ Thread.sleep(100L); // It will happen but don't burn the cpu
+ } catch (InterruptedException ie) {
+ // try again
+ }
}
- }
+ });
+ p1.destroyForcibly();
+ p1.waitFor();
List<ProcessHandle> remaining = getAllChildren(self);
- remaining.retainAll(subprocesses);
- if (remaining.size() > 0) {
- remaining.forEach(p -> printProcess(p, " remaining: "));
- Assert.fail("Subprocess(es) should have exited");
- }
+ remaining = remaining.stream().filter(processes::contains).collect(Collectors.toList());
+ Assert.assertEquals(remaining.size(), 0, "Subprocess(es) should have exited: " + remaining);
} catch (IOException ioe) {
Assert.fail("Spawn of subprocess failed", ioe);
} catch (InterruptedException inte) {
Assert.fail("InterruptedException", inte);
} finally {
- // Cleanup any left over processes
- destroyProcessTree(ProcessHandle.current());
+ processes.forEach((p, parent) -> p.destroyForcibly());
}
}
@@ -302,9 +337,10 @@
@Test
public static void test5() {
int factor = 2;
+ JavaChild p1 = null;
Instant start = Instant.now();
try {
- JavaChild p1 = JavaChild.spawnJavaChild("stdin");
+ p1 = JavaChild.spawnJavaChild("stdin");
ProcessHandle p1Handle = p1.toHandle();
printf("Spawning %d x %d x %d processes, pid: %d%n",
@@ -340,7 +376,9 @@
Assert.fail("Unexpected Exception", ex);
} finally {
printf("Duration: %s%n", Duration.between(start, Instant.now()));
- destroyProcessTree(ProcessHandle.current());
+ if (p1 != null) {
+ p1.destroyForcibly();
+ }
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/KeyStore/CheckInputStream.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, 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
+ * @bug 8136534
+ * @summary The input stream supplied to KeyStore.load should remain open.
+ */
+
+import java.io.*;
+import java.security.*;
+
+public class CheckInputStream {
+ private final static String DIR = System.getProperty("test.src", ".");
+ private static final char[] PASSWORD = "passphrase".toCharArray();
+ private static final String KEYSTORE = DIR + "/keystore.jks";
+
+ public static final void main(String[] args) throws Exception {
+
+ KeyStore keystore = KeyStore.getInstance("JKS");
+ try (FileInputStream inStream = new FileInputStream(KEYSTORE)) {
+ System.out.println("Loading JKS keystore: " + KEYSTORE);
+ keystore.load(inStream, PASSWORD);
+ // check that the stream is still open
+ inStream.available();
+ System.out.println("OK");
+ }
+ }
+}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/CountTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/CountTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -31,6 +31,7 @@
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
import java.util.stream.DoubleStream;
import java.util.stream.DoubleStreamTestDataProvider;
import java.util.stream.IntStream;
@@ -61,6 +62,12 @@
expectedResult(expectedCount).
exercise();
+ // Test counting collector
+ withData(data).
+ terminal(s -> s, s -> s.collect(Collectors.counting())).
+ expectedResult(expectedCount).
+ exercise();
+
// Test with stateful distinct op that is a barrier or lazy
// depending if source is not already distinct and encounter order is
// preserved or not
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASConfigSyntaxTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,57 @@
+
+/**
+ * Copyright (c) 2007, 2015, 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.
+ */
+
+import javax.security.auth.login.LoginContext;
+
+/**
+ * @test
+ * @bug 8050461
+ * @summary Test should throw Configuration error if configuration file contains
+ * syntax error
+ * @build SampleLoginModule JAASConfigSyntaxTest
+ * @run main/othervm -Djava.security.auth.login.config=file:${test.src}/JAASSynWithOutApplication.config JAASConfigSyntaxTest
+ * @run main/othervm -Djava.security.auth.login.config=file:${test.src}/JAASSynWithOutBraces.config JAASConfigSyntaxTest
+ * @run main/othervm -Djava.security.auth.login.config=file:${test.src}/JAASSynWithOutFlag.config JAASConfigSyntaxTest
+ * @run main/othervm -Djava.security.auth.login.config=file:${test.src}/JAASSynWithOutLoginModule.config JAASConfigSyntaxTest
+ * @run main/othervm -Djava.security.auth.login.config=file:${test.src}/JAASSynWithOutSemiColen.config JAASConfigSyntaxTest
+ */
+public class JAASConfigSyntaxTest {
+
+ private static final String TEST_NAME = "JAASConfigSyntaxTest";
+
+ public static void main(String[] args) throws Exception {
+ try {
+ LoginContext lc = new LoginContext(TEST_NAME);
+ lc.login();
+ throw new RuntimeException("Test Case Failed, did not get "
+ + "expected exception");
+ } catch (Exception ex) {
+ if (ex.getMessage().contains("java.io.IOException: "
+ + "Configuration Error:")) {
+ System.out.println("Test case passed");
+ } else {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASSynWithOutApplication.config Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,5 @@
+{
+SampleLoginModule Required;
+SampleLoginModule Required;
+SampleLoginModule Required;
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASSynWithOutBraces.config Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,5 @@
+JAASConfigSyntaxTest
+SampleLoginModule Required;
+SampleLoginModule Required;
+SampleLoginModule Required;
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASSynWithOutFlag.config Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,5 @@
+JAASConfigSyntaxTest{
+SampleLoginModule ;
+SampleLoginModule ;
+SampleLoginModule ;
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASSynWithOutLoginModule.config Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,5 @@
+JAASConfigSyntaxTest{
+;
+;
+;
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/JAASSynWithOutSemiColen.config Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,5 @@
+JAASConfigSyntaxTest{
+SampleLoginModule Required;
+SampleLoginModule Required
+SampleLoginModule Required;
+};
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/SampleLoginModule.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2007, 2015, 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.
+ */
+
+import static java.lang.System.out;
+import java.util.Map;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+/**
+ * Login module which passes all the time
+ */
+
+public class SampleLoginModule implements LoginModule {
+
+ private final String name;
+
+ public SampleLoginModule() {
+ name = this.getClass().getName();
+ }
+
+ @Override
+ public void initialize(Subject subject, CallbackHandler callbackHandler,
+ Map<String, ?> sharedState, Map<String, ?> options) {
+ }
+
+ @Override
+ public boolean login() throws LoginException {
+ out.println(name + " Login method of AbstractLoginModule is called ");
+ out.println(name + ":login:PASS");
+ return true;
+ }
+
+ @Override
+ public boolean commit() throws LoginException {
+ out.println("Commit of AbstractLoginModule is called");
+ out.println(name + ":commit:PASS");
+ return true;
+
+ }
+
+ @Override
+ public boolean abort() throws LoginException {
+ out.println("Abourt is called in AbstractLoginModule");
+ out.println(name + ":abort:PASS");
+ return true;
+ }
+
+ @Override
+ public boolean logout() throws LoginException {
+ out.println("logout is called in AbstractLoginModule");
+ out.println(name + ":logout:PASS");
+ return true;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/sampled/FileReader/RepeatedFormatReader.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.UnsupportedAudioFileException;
+
+/**
+ * @test
+ * @bug 8133677
+ * @summary Subsequent read from the same stream should work
+ */
+public final class RepeatedFormatReader {
+
+ // Stubs
+
+ private static byte[] headerMIDI = {0x4d, 0x54, 0x68, 0x64, // MThd
+ 0, 0, 0, 6, // read header length
+ 0, 0, // type
+ 0, 0, // numtracks
+ 0, 1, // timing
+ };
+
+ private static byte[] headerAU = {0x2e, 0x73, 0x6e, 0x64, // AU_SUN_MAGIC
+ 0, 0, 0, 0, // headerSize
+ 0, 0, 0, 0, // dataSize
+ 0, 0, 0, 1, // encoding
+ 0, 0, 0, 0, // sampleRate
+ 0, 0, 0, 1 // channels
+ };
+
+ private static byte[] headerWAV = {0x52, 0x49, 0x46, 0x46, // RIFF_MAGIC
+ 1, 1, 1, 1, // fileLength
+ 0x57, 0x41, 0x56, 0x45, // waveMagic
+ 0x66, 0x6d, 0x74, 0x20, // FMT_MAGIC
+ 3, 0, 0, 0, // length
+ 1, 0, // wav_type WAVE_FORMAT_PCM
+ 0, 1, // channels
+ 0, 0, 0, 0, // sampleRate
+ 0, 0, 0, 0, // avgBytesPerSec
+ 0, 0, // blockAlign
+ 1, 0, // sampleSizeInBits
+ 0x64, 0x61, 0x74, 0x61, // DATA_MAGIC
+ 0, 0, 0, 0, // dataLength
+ };
+
+ private static final byte[][] data = {headerMIDI, headerAU, headerWAV};
+
+ public static void main(final String[] args)
+ throws IOException, UnsupportedAudioFileException {
+ for (final byte[] bytes : data) {
+ test(bytes);
+ }
+ }
+
+ private static void test(final byte[] buffer)
+ throws IOException, UnsupportedAudioFileException {
+ final InputStream is = new ByteArrayInputStream(buffer);
+ for (int i = 0; i < 10; ++i) {
+ AudioSystem.getAudioFileFormat(is);
+ }
+ }
+}
--- a/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java Tue Sep 22 11:01:54 2015 -0700
@@ -35,7 +35,7 @@
/**
* @test
- * @bug 8020708
+ * @bug 8020708 8032568
* @author Alexander Scherbatiy
* @summary NLS: mnemonics missing in SwingSet2/JInternalFrame demo
* @library ../../regtesthelpers
@@ -111,8 +111,14 @@
Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_SPACE);
robot.waitForIdle();
-
- Util.hitKeys(robot, KeyEvent.VK_C);
+ int keyCode = KeyEvent.VK_C;
+ String mnemonic = UIManager
+ .getString("InternalFrameTitlePane.closeButton.mnemonic");
+ try {
+ keyCode = Integer.parseInt(mnemonic);
+ } catch (NumberFormatException e) {
+ }
+ Util.hitKeys(robot, keyCode);
robot.waitForIdle();
robot.delay(500);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTableHeader/6442918/bug6442918a.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2015, 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
+ @bug 6442918 8005914
+ @summary Ensures that empty table headers do not show "..."
+ @author Shannon Hickey
+ @library ../../regtesthelpers
+ @build Util
+ @run main/manual bug6442918a
+ @requires os.family == "windows"
+*/
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.table.DefaultTableCellRenderer;
+
+
+public class bug6442918a {
+
+ public static void main(String[] args) throws Throwable, Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf"
+ + ".windows.WindowsLookAndFeel");
+ } catch (Exception e) {
+ // test is for Windows look and feel
+ throw new RuntimeException("Test is only for WLaF."
+ + e.getMessage());
+ }
+ runTest();
+ }
+ });
+ }
+
+ private static void runTest() {
+ JDialog dialog = Util
+ .createModalDialogWithPassFailButtons("Empty header showing \"...\"");
+ String[] columnNames = {"", "", "", "", "Testing"};
+ String[][] data = {{"1", "2", "3", "4", "5"}};
+ JTable table = new JTable(data, columnNames);
+ DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
+ int tableCellWidth = renderer.getFontMetrics(renderer.getFont())
+ .stringWidth("test");
+ table.setPreferredScrollableViewportSize(new Dimension(
+ 5 * tableCellWidth, 50));
+ JPanel p = new JPanel();
+ p.add(new JScrollPane(table));
+ dialog.add(p, BorderLayout.NORTH);
+ JTextArea area = new JTextArea();
+ String txt = "\nInstructions:\n\n";
+ txt += "Only the last column header should show \"...\".";
+ area.setText(txt);
+ dialog.add(new JScrollPane(area), BorderLayout.CENTER);
+ dialog.pack();
+ dialog.setVisible(true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTextPane/bug8025082.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2015, 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
+ * @bug 8025082
+ * @summary The behaviour of the highlight will be lost after clicking the set
+ * button.
+ * @run main bug8025082
+ */
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import javax.swing.*;
+
+public class bug8025082 {
+
+ private static JButton button;
+ private static JFrame frame;
+
+ public static void main(String[] args) throws Exception {
+ Robot robo = new Robot();
+ robo.delay(500);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ createUI();
+ }
+ });
+
+ robo.waitForIdle();
+ Point point = getButtonLocationOnScreen();
+ robo.mouseMove(point.x, point.y);
+ robo.mousePress(InputEvent.BUTTON1_MASK);
+ robo.mouseRelease(InputEvent.BUTTON1_MASK);
+ robo.waitForIdle();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ }
+ });
+ }
+
+ private static void createUI() {
+ frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setSize(500, 500);
+ JTextPane textpane = new JTextPane();
+ textpane.setText("Select Me");
+ textpane.selectAll();
+
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.add(textpane, BorderLayout.CENTER);
+ button = new JButton("Press Me");
+ panel.add(button, BorderLayout.SOUTH);
+
+ button.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (!textpane.getCaret().isSelectionVisible()) {
+ throw new RuntimeException("Highlight removed after "
+ + "button click");
+ }
+ }
+ });
+
+ frame.getContentPane().add(panel);
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ }
+
+ private static Point getButtonLocationOnScreen() throws Exception {
+ final Point[] result = new Point[1];
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ Point point = button.getLocationOnScreen();
+ point.x += button.getWidth() / 2;
+ point.y += button.getHeight() / 2;
+ result[0] = point;
+ }
+ });
+ return result[0];
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/UI/UnninstallUIMemoryLeaks/UnninstallUIMemoryLeaks.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.awt.EventQueue;
+import java.awt.FlowLayout;
+
+import javax.swing.*;
+import javax.swing.UIManager.LookAndFeelInfo;
+
+import static javax.swing.UIManager.getInstalledLookAndFeels;
+
+/**
+ * @test
+ * @bug 8134947
+ * @author Sergey Bylokhov
+ * @run main/timeout=300/othervm -Xmx12m -XX:+HeapDumpOnOutOfMemoryError UnninstallUIMemoryLeaks
+ */
+public final class UnninstallUIMemoryLeaks {
+
+ private static JFrame frame;
+
+ public static void main(final String[] args) throws Exception {
+ try {
+ createGUI();
+ for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
+ final String name = laf.getName();
+ if (name.contains("OS X") || name.contains("Metal")) {
+ SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
+ SwingUtilities.invokeAndWait(() -> {
+ for (int i = 0; i < 4000; ++i) {
+ SwingUtilities.updateComponentTreeUI(frame);
+ }
+ });
+ }
+ }
+ } finally {
+ EventQueue.invokeAndWait(() -> frame.dispose());
+ }
+ }
+
+ private static void createGUI() throws Exception {
+ EventQueue.invokeAndWait(() -> {
+ frame = new JFrame();
+ frame.setLayout(new FlowLayout());
+
+ frame.add(new JButton("JButton"));
+ frame.add(new JCheckBox("JCheckBox"));
+ frame.add(new JComboBox<>());
+ frame.add(new JEditorPane());
+ frame.add(new JFormattedTextField("JFormattedTextField"));
+ frame.add(new JLabel("label"));
+ frame.add(new JPanel());
+ frame.add(new JPasswordField("JPasswordField"));
+ frame.add(new JProgressBar());
+ frame.add(new JRadioButton("JRadioButton"));
+ frame.add(new JScrollBar());
+ frame.add(new JScrollPane());
+ frame.add(new JSeparator());
+ frame.add(new JSlider());
+ frame.add(new JSpinner());
+ frame.add(new JSplitPane());
+ frame.add(new JTabbedPane());
+ frame.add(new JTable());
+ frame.add(new JTextArea("JTextArea"));
+ frame.add(new JTextField("JTextField"));
+ frame.add(new JTextPane());
+ frame.add(new JToggleButton());
+ frame.add(new JToolBar());
+ frame.add(new JToolTip());
+ frame.add(new JTree());
+ frame.add(new JViewport());
+
+ final JMenuBar bar = new JMenuBar();
+ final JMenu menu1 = new JMenu("menu1");
+ final JMenu menu2 = new JMenu("menu2");
+ menu1.add(new JMenuItem("menuitem"));
+ menu2.add(new JCheckBoxMenuItem("JCheckBoxMenuItem"));
+ menu2.add(new JRadioButtonMenuItem("JRadioButtonMenuItem"));
+ bar.add(menu1);
+ bar.add(menu2);
+ frame.setJMenuBar(bar);
+
+ final String[] data = {"one", "two", "three", "four"};
+ final JList<String> list = new JList<>(data);
+ frame.add(list);
+
+ final JDesktopPane pane = new JDesktopPane();
+ final JInternalFrame internalFrame = new JInternalFrame();
+ internalFrame.setBounds(10, 10, 130, 130);
+ internalFrame.setVisible(true);
+ pane.add(internalFrame);
+ pane.setSize(150, 150);
+
+ frame.add(pane);
+ frame.pack();
+ frame.setSize(600, 600);
+ frame.setLocationRelativeTo(null);
+ // Commented to prevent a reference from RepaintManager
+ // frame.setVisible(true);
+ });
+ }
+
+ private static void setLookAndFeel(final LookAndFeelInfo laf) {
+ try {
+ UIManager.setLookAndFeel(laf.getClassName());
+ System.out.println("LookAndFeel: " + laf.getClassName());
+ } catch (ClassNotFoundException | InstantiationException |
+ UnsupportedLookAndFeelException | IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicHTML/4960629/bug4960629.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015, 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
+ @bug 4960629 7124238
+ @summary Tests if font for html text on widgets in correct.
+ @author Denis Sharypov
+ @run main bug4960629
+*/
+
+import java.awt.Font;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicHTML;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.View;
+import javax.swing.text.html.StyleSheet;
+import javax.swing.text.html.HTMLDocument;
+
+public class bug4960629 {
+ private boolean passed = false;
+ private JLabel label = null;
+ private JFrame f = null;
+
+ public void createAndShowGUI() throws Exception {
+ try {
+ UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
+ label = new JLabel("<html><P>This is a test of the</P></html>");
+ System.out.println("UIManager.getLookAndFeel()"
+ + UIManager.getLookAndFeel().getClass());
+ f = new JFrame();
+ f.getContentPane().add(label);
+ f.pack();
+ f.setVisible(true);
+ test();
+ } finally {
+ f.dispose();
+ }
+ }
+
+ bug4960629() throws InvocationTargetException, InterruptedException {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ createAndShowGUI();
+ } catch (Exception e) {
+ throw new RuntimeException("Exception "
+ + e.getMessage());
+ }
+ }
+ });
+ }
+
+ private void test() {
+ View root = ((View)label.getClientProperty(BasicHTML.propertyKey))
+ .getView(0);
+ int n = root.getViewCount();
+ View v = root.getView(n - 1);
+ AttributeSet attrs = v.getAttributes();
+ StyleSheet ss = ((HTMLDocument) v.getDocument()).getStyleSheet();
+ Font font = ss.getFont(attrs);
+ System.out.println(font.getSize());
+ passed = (font.getSize() == 12);
+ if(!passed) {
+ throw new RuntimeException("Test failed.");
+ }
+ }
+
+ public static void main(String args[]) throws Throwable {
+ new bug4960629();
+ }
+}
--- a/jdk/test/javax/swing/regtesthelpers/Util.java Thu Sep 17 09:19:40 2015 -0700
+++ b/jdk/test/javax/swing/regtesthelpers/Util.java Tue Sep 22 11:01:54 2015 -0700
@@ -41,6 +41,7 @@
*/
public class Util {
+
/**
* Convert a rectangle from coordinate system of Component c to
* screen coordinate system.
@@ -266,4 +267,42 @@
result.add(KeyEvent.VK_ALT);
return result;
}
+
+ /**
+ * Creates and returns a JDialog with two button, one that says pass,
+ * another that says fail. The fail button is wired to call
+ * <code>uiTestFailed</code> with <code>failString</code> and the pass
+ * button is wired to invoked <code>uiTestPassed</code>.
+ * <p>The content pane of the JDialog uses a BorderLayout with the
+ * buttons inside a horizontal box with filler between them and the
+ * pass button on the left.
+ * <p>The returned Dialog has not been packed, or made visible, it is
+ * up to the caller to do that (after putting in some useful components).
+ */
+ public static JDialog createModalDialogWithPassFailButtons(final String failString) {
+ JDialog retDialog = new JDialog();
+ Box buttonBox = Box.createHorizontalBox();
+ JButton passButton = new JButton("Pass");
+ JButton failButton = new JButton("Fail");
+
+ passButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ retDialog.dispose();
+ }
+ });
+ failButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ retDialog.dispose();
+ throw new RuntimeException("Test failed. " + failString);
+ }
+ });
+ retDialog.setTitle("Test");
+ retDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
+ buttonBox.add(passButton);
+ buttonBox.add(Box.createGlue());
+ buttonBox.add(failButton);
+ retDialog.getContentPane().add(buttonBox, BorderLayout.SOUTH);
+ retDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ return retDialog;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/OpenGL/CopyAreaOOB.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2015, 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
+ * @bug 6430601
+ * @summary Verifies that copyArea() works properly when the
+ * destination parameters are outside the destination bounds.
+ * @run main/othervm CopyAreaOOB
+ * @run main/othervm -Dsun.java2d.opengl=True CopyAreaOOB
+ * @author campbelc
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class CopyAreaOOB extends Canvas {
+
+ private static boolean done;
+
+ public void paint(Graphics g) {
+ synchronized (this) {
+ if (done) {
+ return;
+ }
+ }
+
+ int w = getWidth();
+ int h = getHeight();
+
+ Graphics2D g2d = (Graphics2D)g;
+ g2d.setColor(Color.black);
+ g2d.fillRect(0, 0, w, h);
+
+ g2d.setColor(Color.green);
+ g2d.fillRect(0, 0, w, 10);
+
+ g2d.setColor(Color.red);
+ g2d.fillRect(0, 10, 50, h-10);
+
+ // copy the region such that part of it goes below the bottom of the
+ // destination surface
+ g2d.copyArea(0, 10, 50, h-10, 60, 10);
+
+ Toolkit.getDefaultToolkit().sync();
+
+ synchronized (this) {
+ done = true;
+ notifyAll();
+ }
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(400, 400);
+ }
+
+ private static void testRegion(BufferedImage bi, String name,
+ int x1, int y1, int x2, int y2,
+ int expected)
+ {
+ for (int y = y1; y < y2; y++) {
+ for (int x = x1; x < x2; x++) {
+ int actual = bi.getRGB(x, y);
+ if (actual != expected) {
+ throw new RuntimeException("Test failed for " + name +
+ " region at x="+x+" y="+y+
+ " (expected="+
+ Integer.toHexString(expected) +
+ " actual="+
+ Integer.toHexString(actual) +
+ ")");
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ boolean show = (args.length == 1) && ("-show".equals(args[0]));
+
+ CopyAreaOOB test = new CopyAreaOOB();
+ Frame frame = new Frame();
+ frame.setUndecorated(true);
+ frame.add(test);
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+
+ // Wait until the component's been painted
+ synchronized (test) {
+ while (!done) {
+ try {
+ test.wait();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Failed: Interrupted");
+ }
+ }
+ }
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {}
+
+ // Grab the screen region
+ BufferedImage capture = null;
+ try {
+ Robot robot = new Robot();
+ Point pt1 = test.getLocationOnScreen();
+ Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400);
+ capture = robot.createScreenCapture(rect);
+ } catch (Exception e) {
+ throw new RuntimeException("Problems creating Robot");
+ } finally {
+ if (!show) {
+ frame.dispose();
+ }
+ }
+
+ // Test pixels
+ testRegion(capture, "green", 0, 0, 400, 10, 0xff00ff00);
+ testRegion(capture, "original red", 0, 10, 50, 400, 0xffff0000);
+ testRegion(capture, "background", 50, 10, 60, 400, 0xff000000);
+ testRegion(capture, "in-between", 60, 10, 110, 20, 0xff000000);
+ testRegion(capture, "copied red", 60, 20, 110, 400, 0xffff0000);
+ testRegion(capture, "background", 110, 10, 400, 400, 0xff000000);
+ }
+}
--- a/langtools/.hgtags Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/.hgtags Tue Sep 22 11:01:54 2015 -0700
@@ -324,3 +324,4 @@
eaab8a16dcfb807acacdb6d133f3ecd502667a8c jdk9-b79
c5671e662392df372b2005b75afa6cfdc0eebce7 jdk9-b80
ead8b7192f00417185f0e64d0cb332f0f8ad4ae1 jdk9-b81
+d68904d5a00e7e6c714e11f7ec9d0689af959d79 jdk9-b82
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Tue Sep 22 11:01:54 2015 -0700
@@ -3152,10 +3152,20 @@
throw new IllegalArgumentException("Not a method type: " + t);
}
public Type visitMethodType(MethodType t, Type newReturn) {
- return new MethodType(t.argtypes, newReturn, t.thrown, t.tsym);
+ return new MethodType(t.argtypes, newReturn, t.thrown, t.tsym) {
+ @Override
+ public Type baseType() {
+ return t;
+ }
+ };
}
public Type visitForAll(ForAll t, Type newReturn) {
- return new ForAll(t.tvars, t.qtype.accept(this, newReturn));
+ return new ForAll(t.tvars, t.qtype.accept(this, newReturn)) {
+ @Override
+ public Type baseType() {
+ return t;
+ }
+ };
}
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,679 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 com.sun.tools.javac.comp;
+
+import com.sun.source.tree.LambdaExpressionTree.BodyKind;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Types.FunctionDescriptorLookupError;
+import com.sun.tools.javac.comp.Attr.ResultInfo;
+import com.sun.tools.javac.comp.Attr.TargetInfo;
+import com.sun.tools.javac.comp.Check.CheckContext;
+import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
+import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
+import com.sun.tools.javac.comp.DeferredAttr.DeferredType;
+import com.sun.tools.javac.comp.DeferredAttr.DeferredTypeCompleter;
+import com.sun.tools.javac.comp.DeferredAttr.LambdaReturnScanner;
+import com.sun.tools.javac.comp.Infer.PartiallyInferredMethodType;
+import com.sun.tools.javac.comp.Resolve.MethodResolutionPhase;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCConditional;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.JCTree.JCLambda;
+import com.sun.tools.javac.tree.JCTree.JCLambda.ParameterKind;
+import com.sun.tools.javac.tree.JCTree.JCMemberReference;
+import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
+import com.sun.tools.javac.tree.JCTree.JCNewClass;
+import com.sun.tools.javac.tree.JCTree.JCParens;
+import com.sun.tools.javac.tree.JCTree.JCReturn;
+import com.sun.tools.javac.tree.TreeCopier;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DiagnosticSource;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Log;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+import static com.sun.tools.javac.code.TypeTag.DEFERRED;
+import static com.sun.tools.javac.code.TypeTag.FORALL;
+import static com.sun.tools.javac.code.TypeTag.METHOD;
+import static com.sun.tools.javac.code.TypeTag.VOID;
+
+/**
+ * This class performs attribution of method/constructor arguments when target-typing is enabled
+ * (source >= 8); for each argument that is potentially a poly expression, this class builds
+ * a rich representation (see {@link ArgumentType} which can then be used for performing fast overload
+ * checks without requiring multiple attribution passes over the same code.
+ *
+ * The attribution strategy for a given method/constructor argument A is as follows:
+ *
+ * - if A is potentially a poly expression (i.e. diamond instance creation expression), a speculative
+ * pass over A is performed; the results of such speculative attribution are then saved in a special
+ * type, so that enclosing overload resolution can be carried by simply checking compatibility against the
+ * type determined during this speculative pass.
+ *
+ * - if A is a standalone expression, regular atributtion takes place.
+ *
+ * To minimize the speculative work, a cache is used, so that already computed argument types
+ * associated with a given unique source location are never recomputed multiple times.
+ */
+public class ArgumentAttr extends JCTree.Visitor {
+
+ protected static final Context.Key<ArgumentAttr> methodAttrKey = new Context.Key<>();
+
+ private final DeferredAttr deferredAttr;
+ private final Attr attr;
+ private final Symtab syms;
+ private final Log log;
+
+ /** Attribution environment to be used. */
+ private Env<AttrContext> env;
+
+ /** Result of method attribution. */
+ private Type result;
+
+ /** Cache for argument types; behavior is influences by the currrently selected cache policy. */
+ Map<UniquePos, ArgumentType<?>> argumentTypeCache = new LinkedHashMap<>();
+
+ /** Cache policy: should argument types be cached? */
+ private CachePolicy cachePolicy = CachePolicy.CACHE;
+
+ public static ArgumentAttr instance(Context context) {
+ ArgumentAttr instance = context.get(methodAttrKey);
+ if (instance == null)
+ instance = new ArgumentAttr(context);
+ return instance;
+ }
+
+ protected ArgumentAttr(Context context) {
+ context.put(methodAttrKey, this);
+ deferredAttr = DeferredAttr.instance(context);
+ attr = Attr.instance(context);
+ syms = Symtab.instance(context);
+ log = Log.instance(context);
+ }
+
+ /**
+ * Set the results of method attribution.
+ */
+ void setResult(JCExpression tree, Type type) {
+ result = type;
+ if (env.info.isSpeculative) {
+ //if we are in a speculative branch we can save the type in the tree itself
+ //as there's no risk of polluting the original tree.
+ tree.type = result;
+ }
+ }
+
+ /**
+ * Checks a type in the speculative tree against a given result; the type can be either a plain
+ * type or an argument type,in which case a more complex check is required.
+ */
+ Type checkSpeculative(JCExpression expr, ResultInfo resultInfo) {
+ return checkSpeculative(expr, expr.type, resultInfo);
+ }
+
+ /**
+ * Checks a type in the speculative tree against a given result; the type can be either a plain
+ * type or an argument type,in which case a more complex check is required.
+ */
+ Type checkSpeculative(DiagnosticPosition pos, Type t, ResultInfo resultInfo) {
+ if (t.hasTag(DEFERRED)) {
+ return ((DeferredType)t).check(resultInfo);
+ } else {
+ return resultInfo.check(pos, t);
+ }
+ }
+
+ /**
+ * Sets given ache policy and returns current policy.
+ */
+ CachePolicy withCachePolicy(CachePolicy newPolicy) {
+ CachePolicy oldPolicy = this.cachePolicy;
+ this.cachePolicy = newPolicy;
+ return oldPolicy;
+ }
+
+ /**
+ * Main entry point for attributing an argument with given tree and attribution environment.
+ */
+ Type attribArg(JCTree tree, Env<AttrContext> env) {
+ Env<AttrContext> prevEnv = this.env;
+ try {
+ this.env = env;
+ tree.accept(this);
+ return result;
+ } finally {
+ this.env = prevEnv;
+ }
+ }
+
+ @Override
+ public void visitTree(JCTree that) {
+ //delegates to Attr
+ that.accept(attr);
+ result = attr.result;
+ }
+
+ /**
+ * Process a method argument; this method takes care of performing a speculative pass over the
+ * argument tree and calling a well-defined entry point to build the argument type associated
+ * with such tree.
+ */
+ @SuppressWarnings("unchecked")
+ <T extends JCExpression, Z extends ArgumentType<T>> void processArg(T that, Function<T, Z> argumentTypeFactory) {
+ UniquePos pos = new UniquePos(that);
+ processArg(that, () -> {
+ T speculativeTree = (T)deferredAttr.attribSpeculative(that, env, attr.new MethodAttrInfo() {
+ @Override
+ protected void attr(JCTree tree, Env<AttrContext> env) {
+ //avoid speculative attribution loops
+ if (!new UniquePos(tree).equals(pos)) {
+ super.attr(tree, env);
+ } else {
+ visitTree(tree);
+ }
+ }
+ });
+ return argumentTypeFactory.apply(speculativeTree);
+ });
+ }
+
+ /**
+ * Process a method argument; this method allows the caller to specify a custom speculative attribution
+ * logic (this is used e.g. for lambdas).
+ */
+ @SuppressWarnings("unchecked")
+ <T extends JCExpression, Z extends ArgumentType<T>> void processArg(T that, Supplier<Z> argumentTypeFactory) {
+ UniquePos pos = new UniquePos(that);
+ Z cached = (Z)argumentTypeCache.get(pos);
+ if (cached != null) {
+ //dup existing speculative type
+ setResult(that, cached.dup(that, env));
+ } else {
+ Z res = argumentTypeFactory.get();
+ if (cachePolicy == CachePolicy.CACHE) {
+ argumentTypeCache.put(pos, res);
+ }
+ setResult(that, res);
+ }
+ }
+
+ @Override
+ public void visitParens(JCParens that) {
+ processArg(that, speculativeTree -> new ParensType(that, env, speculativeTree));
+ }
+
+ @Override
+ public void visitConditional(JCConditional that) {
+ processArg(that, speculativeTree -> new ConditionalType(that, env, speculativeTree));
+ }
+
+ @Override
+ public void visitReference(JCMemberReference tree) {
+ //perform arity-based check
+ Env<AttrContext> localEnv = env.dup(tree);
+ JCExpression exprTree = (JCExpression)deferredAttr.attribSpeculative(tree.getQualifierExpression(), localEnv,
+ attr.memberReferenceQualifierResult(tree));
+ JCMemberReference mref2 = new TreeCopier<Void>(attr.make).copy(tree);
+ mref2.expr = exprTree;
+ Symbol res =
+ attr.rs.getMemberReference(tree, localEnv, mref2,
+ exprTree.type, tree.name);
+ if (!res.kind.isResolutionError()) {
+ tree.sym = res;
+ }
+ if (res.kind.isResolutionTargetError() ||
+ res.type != null && res.type.hasTag(FORALL) ||
+ (res.flags() & Flags.VARARGS) != 0 ||
+ (TreeInfo.isStaticSelector(exprTree, tree.name.table.names) &&
+ exprTree.type.isRaw())) {
+ tree.overloadKind = JCMemberReference.OverloadKind.OVERLOADED;
+ } else {
+ tree.overloadKind = JCMemberReference.OverloadKind.UNOVERLOADED;
+ }
+ //return a plain old deferred type for this
+ setResult(tree, deferredAttr.new DeferredType(tree, env));
+ }
+
+ @Override
+ public void visitLambda(JCLambda that) {
+ if (that.paramKind == ParameterKind.EXPLICIT) {
+ //if lambda is explicit, we can save info in the corresponding argument type
+ processArg(that, () -> {
+ JCLambda speculativeLambda =
+ deferredAttr.attribSpeculativeLambda(that, env, attr.methodAttrInfo);
+ return new ExplicitLambdaType(that, env, speculativeLambda);
+ });
+ } else {
+ //otherwise just use a deferred type
+ setResult(that, deferredAttr.new DeferredType(that, env));
+ }
+ }
+
+ @Override
+ public void visitApply(JCMethodInvocation that) {
+ if (that.getTypeArguments().isEmpty()) {
+ processArg(that, speculativeTree -> new ResolvedMethodType(that, env, speculativeTree));
+ } else {
+ //not a poly expression, just call Attr
+ setResult(that, attr.attribTree(that, env, attr.unknownExprInfo));
+ }
+ }
+
+ @Override
+ public void visitNewClass(JCNewClass that) {
+ if (TreeInfo.isDiamond(that)) {
+ processArg(that, speculativeTree -> new ResolvedConstructorType(that, env, speculativeTree));
+ } else {
+ //not a poly expression, just call Attr
+ setResult(that, attr.attribTree(that, env, attr.unknownExprInfo));
+ }
+ }
+
+ /**
+ * An argument type is similar to a plain deferred type; the most important difference is that
+ * the completion logic associated with argument types allows speculative attribution to be skipped
+ * during overload resolution - that is, an argument type always has enough information to
+ * perform an overload check without the need of calling back to Attr. This extra information
+ * is typically stored in the form of a speculative tree.
+ */
+ abstract class ArgumentType<T extends JCExpression> extends DeferredType implements DeferredTypeCompleter {
+
+ /** The speculative tree carrying type information. */
+ T speculativeTree;
+
+ /** Types associated with this argument (one type per possible target result). */
+ Map<ResultInfo, Type> speculativeTypes;
+
+ public ArgumentType(JCExpression tree, Env<AttrContext> env, T speculativeTree, Map<ResultInfo, Type> speculativeTypes) {
+ deferredAttr.super(tree, env);
+ this.speculativeTree = speculativeTree;
+ this.speculativeTypes = speculativeTypes;
+ }
+
+ @Override
+ final DeferredTypeCompleter completer() {
+ return this;
+ }
+
+ @Override
+ final public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+ Assert.check(dt == this);
+ if (deferredAttrContext.mode == AttrMode.SPECULATIVE) {
+ Type t = (resultInfo.pt == Type.recoveryType) ?
+ deferredAttr.basicCompleter.complete(dt, resultInfo, deferredAttrContext) :
+ overloadCheck(resultInfo, deferredAttrContext);
+ speculativeTypes.put(resultInfo, t);
+ return t;
+ } else {
+ if (!env.info.isSpeculative && cachePolicy == CachePolicy.CACHE) {
+ argumentTypeCache.remove(new UniquePos(dt.tree));
+ }
+ return deferredAttr.basicCompleter.complete(dt, resultInfo, deferredAttrContext);
+ }
+ }
+
+ @Override
+ Type speculativeType(Symbol msym, MethodResolutionPhase phase) {
+ for (Map.Entry<ResultInfo, Type> _entry : speculativeTypes.entrySet()) {
+ DeferredAttrContext deferredAttrContext = _entry.getKey().checkContext.deferredAttrContext();
+ if (deferredAttrContext.phase == phase && deferredAttrContext.msym == msym) {
+ return _entry.getValue();
+ }
+ }
+ return Type.noType;
+ }
+
+ @Override
+ JCTree speculativeTree(DeferredAttrContext deferredAttrContext) {
+ return speculativeTree;
+ }
+
+ /**
+ * Performs an overload check against a given target result.
+ */
+ abstract Type overloadCheck(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext);
+
+ /**
+ * Creates a copy of this argument type with given tree and environment.
+ */
+ abstract ArgumentType<T> dup(T tree, Env<AttrContext> env);
+ }
+
+ /**
+ * Argument type for parenthesized expression.
+ */
+ class ParensType extends ArgumentType<JCParens> {
+ ParensType(JCExpression tree, Env<AttrContext> env, JCParens speculativeParens) {
+ this(tree, env, speculativeParens, new HashMap<>());
+ }
+
+ ParensType(JCExpression tree, Env<AttrContext> env, JCParens speculativeParens, Map<ResultInfo, Type> speculativeTypes) {
+ super(tree, env, speculativeParens, speculativeTypes);
+ }
+
+ @Override
+ Type overloadCheck(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+ return checkSpeculative(speculativeTree.expr, resultInfo);
+ }
+
+ @Override
+ ArgumentType<JCParens> dup(JCParens tree, Env<AttrContext> env) {
+ return new ParensType(tree, env, speculativeTree, speculativeTypes);
+ }
+ }
+
+ /**
+ * Argument type for conditionals.
+ */
+ class ConditionalType extends ArgumentType<JCConditional> {
+ ConditionalType(JCExpression tree, Env<AttrContext> env, JCConditional speculativeCond) {
+ this(tree, env, speculativeCond, new HashMap<>());
+ }
+
+ ConditionalType(JCExpression tree, Env<AttrContext> env, JCConditional speculativeCond, Map<ResultInfo, Type> speculativeTypes) {
+ super(tree, env, speculativeCond, speculativeTypes);
+ }
+
+ @Override
+ Type overloadCheck(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+ ResultInfo localInfo = resultInfo.dup(attr.conditionalContext(resultInfo.checkContext));
+ if (speculativeTree.isStandalone()) {
+ return localInfo.check(speculativeTree, speculativeTree.type);
+ } else if (resultInfo.pt.hasTag(VOID)) {
+ //this means we are returning a poly conditional from void-compatible lambda expression
+ resultInfo.checkContext.report(tree, attr.diags.fragment("conditional.target.cant.be.void"));
+ return attr.types.createErrorType(resultInfo.pt);
+ } else {
+ //poly
+ checkSpeculative(speculativeTree.truepart, localInfo);
+ checkSpeculative(speculativeTree.falsepart, localInfo);
+ return localInfo.pt;
+ }
+ }
+
+ @Override
+ ArgumentType<JCConditional> dup(JCConditional tree, Env<AttrContext> env) {
+ return new ConditionalType(tree, env, speculativeTree, speculativeTypes);
+ }
+ }
+
+ /**
+ * Argument type for explicit lambdas.
+ */
+ class ExplicitLambdaType extends ArgumentType<JCLambda> {
+
+ /** List of argument types (lazily populated). */
+ Optional<List<Type>> argtypes = Optional.empty();
+
+ /** List of return expressions (lazily populated). */
+ Optional<List<JCReturn>> returnExpressions = Optional.empty();
+
+ ExplicitLambdaType(JCLambda originalLambda, Env<AttrContext> env, JCLambda speculativeLambda) {
+ this(originalLambda, env, speculativeLambda, new HashMap<>());
+ }
+
+ ExplicitLambdaType(JCLambda originalLambda, Env<AttrContext> env, JCLambda speculativeLambda, Map<ResultInfo, Type> speculativeTypes) {
+ super(originalLambda, env, speculativeLambda, speculativeTypes);
+ }
+
+ /** Compute argument types (if needed). */
+ List<Type> argtypes() {
+ return argtypes.orElseGet(() -> {
+ List<Type> res = TreeInfo.types(speculativeTree.params);
+ argtypes = Optional.of(res);
+ return res;
+ });
+ }
+
+ /** Compute return expressions (if needed). */
+ List<JCReturn> returnExpressions() {
+ return returnExpressions.orElseGet(() -> {
+ final List<JCReturn> res;
+ if (speculativeTree.getBodyKind() == BodyKind.EXPRESSION) {
+ res = List.of(attr.make.Return((JCExpression)speculativeTree.body));
+ } else {
+ ListBuffer<JCReturn> returnExpressions = new ListBuffer<>();
+ new LambdaReturnScanner() {
+ @Override
+ public void visitReturn(JCReturn tree) {
+ returnExpressions.add(tree);
+ }
+ }.scan(speculativeTree.body);
+ res = returnExpressions.toList();
+ }
+ returnExpressions = Optional.of(res);
+ return res;
+ });
+ }
+
+ @Override
+ Type overloadCheck(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+ try {
+ //compute target-type; this logic could be shared with Attr
+ TargetInfo targetInfo = attr.getTargetInfo(speculativeTree, resultInfo, argtypes());
+ Type lambdaType = targetInfo.descriptor;
+ Type currentTarget = targetInfo.target;
+ //check compatibility
+ checkLambdaCompatible(lambdaType, resultInfo);
+ return currentTarget;
+ } catch (FunctionDescriptorLookupError ex) {
+ resultInfo.checkContext.report(null, ex.getDiagnostic());
+ return null; //cannot get here
+ }
+ }
+
+ /** Check lambda against given target result */
+ private void checkLambdaCompatible(Type descriptor, ResultInfo resultInfo) {
+ CheckContext checkContext = resultInfo.checkContext;
+ ResultInfo bodyResultInfo = attr.lambdaBodyResult(speculativeTree, descriptor, resultInfo);
+ for (JCReturn ret : returnExpressions()) {
+ Type t = getReturnType(ret);
+ if (speculativeTree.getBodyKind() == BodyKind.EXPRESSION || !t.hasTag(VOID)) {
+ checkSpeculative(ret.expr, t, bodyResultInfo);
+ }
+ }
+
+ attr.checkLambdaCompatible(speculativeTree, descriptor, checkContext);
+ }
+
+ /** Get the type associated with given return expression. */
+ Type getReturnType(JCReturn ret) {
+ if (ret.expr == null) {
+ return syms.voidType;
+ } else {
+ return ret.expr.type;
+ }
+ }
+
+ @Override
+ ArgumentType<JCLambda> dup(JCLambda tree, Env<AttrContext> env) {
+ return new ExplicitLambdaType(tree, env, speculativeTree, speculativeTypes);
+ }
+ }
+
+ /**
+ * Argument type for methods/constructors.
+ */
+ abstract class ResolvedMemberType<E extends JCExpression> extends ArgumentType<E> {
+
+ public ResolvedMemberType(JCExpression tree, Env<AttrContext> env, E speculativeMethod, Map<ResultInfo, Type> speculativeTypes) {
+ super(tree, env, speculativeMethod, speculativeTypes);
+ }
+
+ @Override
+ Type overloadCheck(ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+ Type mtype = methodType();
+ ResultInfo localInfo = resultInfo(resultInfo);
+ if (mtype != null && mtype.hasTag(METHOD) && mtype.isPartial()) {
+ Type t = ((PartiallyInferredMethodType)mtype).check(localInfo);
+ if (!deferredAttrContext.inferenceContext.free(localInfo.pt)) {
+ speculativeTypes.put(localInfo, t);
+ return localInfo.check(tree.pos(), t);
+ } else {
+ return t;
+ }
+ } else {
+ Type t = localInfo.check(tree.pos(), speculativeTree.type);
+ speculativeTypes.put(localInfo, t);
+ return t;
+ }
+ }
+
+ /**
+ * Get the result info to be used for performing an overload check.
+ */
+ abstract ResultInfo resultInfo(ResultInfo resultInfo);
+
+ /**
+ * Get the method type to be used for performing an overload check.
+ */
+ abstract Type methodType();
+ }
+
+ /**
+ * Argument type for methods.
+ */
+ class ResolvedMethodType extends ResolvedMemberType<JCMethodInvocation> {
+
+ public ResolvedMethodType(JCExpression tree, Env<AttrContext> env, JCMethodInvocation speculativeTree) {
+ this(tree, env, speculativeTree, new HashMap<>());
+ }
+
+ public ResolvedMethodType(JCExpression tree, Env<AttrContext> env, JCMethodInvocation speculativeTree, Map<ResultInfo, Type> speculativeTypes) {
+ super(tree, env, speculativeTree, speculativeTypes);
+ }
+
+ @Override
+ ResultInfo resultInfo(ResultInfo resultInfo) {
+ return resultInfo;
+ }
+
+ @Override
+ Type methodType() {
+ return speculativeTree.meth.type;
+ }
+
+ @Override
+ ArgumentType<JCMethodInvocation> dup(JCMethodInvocation tree, Env<AttrContext> env) {
+ return new ResolvedMethodType(tree, env, speculativeTree, speculativeTypes);
+ }
+ }
+
+ /**
+ * Argument type for constructors.
+ */
+ class ResolvedConstructorType extends ResolvedMemberType<JCNewClass> {
+
+ public ResolvedConstructorType(JCExpression tree, Env<AttrContext> env, JCNewClass speculativeTree) {
+ this(tree, env, speculativeTree, new HashMap<>());
+ }
+
+ public ResolvedConstructorType(JCExpression tree, Env<AttrContext> env, JCNewClass speculativeTree, Map<ResultInfo, Type> speculativeTypes) {
+ super(tree, env, speculativeTree, speculativeTypes);
+ }
+
+ @Override
+ ResultInfo resultInfo(ResultInfo resultInfo) {
+ return resultInfo.dup(attr.diamondContext(speculativeTree, speculativeTree.clazz.type.tsym, resultInfo.checkContext));
+ }
+
+ @Override
+ Type methodType() {
+ return (speculativeTree.constructorType != null) ?
+ speculativeTree.constructorType.baseType() : syms.errType;
+ }
+
+ @Override
+ ArgumentType<JCNewClass> dup(JCNewClass tree, Env<AttrContext> env) {
+ return new ResolvedConstructorType(tree, env, speculativeTree, speculativeTypes);
+ }
+ }
+
+ /**
+ * An instance of this class represents a unique position in a compilation unit. A unique
+ * position is made up of (i) a unique position in a source file (char offset) and (ii)
+ * a source file info.
+ */
+ class UniquePos {
+
+ /** Char offset. */
+ int pos;
+
+ /** Source info. */
+ DiagnosticSource source;
+
+ UniquePos(JCTree tree) {
+ this.pos = tree.pos;
+ this.source = log.currentSource();
+ }
+
+ @Override
+ public int hashCode() {
+ return pos << 16 + source.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof UniquePos) {
+ UniquePos that = (UniquePos)obj;
+ return pos == that.pos && source == that.source;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return source.getFile().getName() + " @ " + source.getLineNumber(pos);
+ }
+ }
+
+ /**
+ * Argument type caching policy.
+ */
+ enum CachePolicy {
+ /** Cache argument types. */
+ CACHE,
+ /**
+ * Don't cache argument types. This is useful when performing speculative attribution on
+ * a tree that is known to contain erroneous info.
+ */
+ NO_CACHE;
+ }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Tue Sep 22 11:01:54 2015 -0700
@@ -108,6 +108,7 @@
final TypeEnvs typeEnvs;
final Dependencies dependencies;
final Annotate annotate;
+ final ArgumentAttr argumentAttr;
public static Attr instance(Context context) {
Attr instance = context.get(attrKey);
@@ -142,6 +143,7 @@
deferredLintHandler = DeferredLintHandler.instance(context);
typeEnvs = TypeEnvs.instance(context);
dependencies = Dependencies.instance(context);
+ argumentAttr = ArgumentAttr.instance(context);
Options options = Options.instance(context);
@@ -160,7 +162,7 @@
statInfo = new ResultInfo(KindSelector.NIL, Type.noType);
varAssignmentInfo = new ResultInfo(KindSelector.ASG, Type.noType);
unknownExprInfo = new ResultInfo(KindSelector.VAL, Type.noType);
- unknownAnyPolyInfo = new ResultInfo(KindSelector.VAL, Infer.anyPoly);
+ methodAttrInfo = new MethodAttrInfo();
unknownTypeInfo = new ResultInfo(KindSelector.TYP, Type.noType);
unknownTypeExprInfo = new ResultInfo(KindSelector.VAL_TYP, Type.noType);
recoveryInfo = new RecoveryInfo(deferredAttr.emptyDeferredAttrContext);
@@ -488,6 +490,10 @@
this.checkMode = checkMode;
}
+ protected void attr(JCTree tree, Env<AttrContext> env) {
+ tree.accept(Attr.this);
+ }
+
protected Type check(final DiagnosticPosition pos, final Type found) {
return chk.checkType(pos, found, pt, checkContext);
}
@@ -522,6 +528,41 @@
}
}
+ class MethodAttrInfo extends ResultInfo {
+ public MethodAttrInfo() {
+ this(chk.basicHandler);
+ }
+
+ public MethodAttrInfo(CheckContext checkContext) {
+ super(KindSelector.VAL, Infer.anyPoly, checkContext);
+ }
+
+ @Override
+ protected void attr(JCTree tree, Env<AttrContext> env) {
+ result = argumentAttr.attribArg(tree, env);
+ }
+
+ protected ResultInfo dup(Type newPt) {
+ throw new IllegalStateException();
+ }
+
+ protected ResultInfo dup(CheckContext newContext) {
+ return new MethodAttrInfo(newContext);
+ }
+
+ protected ResultInfo dup(Type newPt, CheckContext newContext) {
+ throw new IllegalStateException();
+ }
+
+ protected ResultInfo dup(Type newPt, CheckContext newContext, CheckMode newMode) {
+ throw new IllegalStateException();
+ }
+
+ protected ResultInfo dup(CheckMode newMode) {
+ throw new IllegalStateException();
+ }
+ }
+
class RecoveryInfo extends ResultInfo {
public RecoveryInfo(final DeferredAttr.DeferredAttrContext deferredAttrContext) {
@@ -545,7 +586,7 @@
final ResultInfo statInfo;
final ResultInfo varAssignmentInfo;
- final ResultInfo unknownAnyPolyInfo;
+ final ResultInfo methodAttrInfo;
final ResultInfo unknownExprInfo;
final ResultInfo unknownTypeInfo;
final ResultInfo unknownTypeExprInfo;
@@ -588,7 +629,7 @@
try {
this.env = env;
this.resultInfo = resultInfo;
- tree.accept(this);
+ resultInfo.attr(tree, env);
if (tree == breakTree &&
resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
throw new BreakAttr(copyEnv(env));
@@ -684,12 +725,9 @@
KindSelector attribArgs(KindSelector initialKind, List<JCExpression> trees, Env<AttrContext> env, ListBuffer<Type> argtypes) {
KindSelector kind = initialKind;
for (JCExpression arg : trees) {
- Type argtype;
- if (allowPoly && deferredAttr.isDeferred(env, arg)) {
- argtype = deferredAttr.new DeferredType(arg, env);
+ Type argtype = chk.checkNonVoid(arg, attribTree(arg, env, allowPoly ? methodAttrInfo : unknownExprInfo));
+ if (argtype.hasTag(DEFERRED)) {
kind = KindSelector.of(KindSelector.POLY, kind);
- } else {
- argtype = chk.checkNonVoid(arg, attribTree(arg, env, unknownAnyPolyInfo));
}
argtypes.append(argtype);
}
@@ -1426,12 +1464,12 @@
Type condtype = attribExpr(tree.cond, env, syms.booleanType);
tree.polyKind = (!allowPoly ||
- pt().hasTag(NONE) && pt() != Type.recoveryType ||
+ pt().hasTag(NONE) && pt() != Type.recoveryType && pt() != Infer.anyPoly ||
isBooleanOrNumeric(env, tree)) ?
PolyKind.STANDALONE : PolyKind.POLY;
if (tree.polyKind == PolyKind.POLY && resultInfo.pt.hasTag(VOID)) {
- //cannot get here (i.e. it means we are returning from void method - which is already an error)
+ //this means we are returning a poly conditional from void-compatible lambda expression
resultInfo.checkContext.report(tree, diags.fragment("conditional.target.cant.be.void"));
result = tree.type = types.createErrorType(resultInfo.pt);
return;
@@ -1439,15 +1477,7 @@
ResultInfo condInfo = tree.polyKind == PolyKind.STANDALONE ?
unknownExprInfo :
- resultInfo.dup(new Check.NestedCheckContext(resultInfo.checkContext) {
- //this will use enclosing check context to check compatibility of
- //subexpression against target type; if we are in a method check context,
- //depending on whether boxing is allowed, we could have incompatibilities
- @Override
- public void report(DiagnosticPosition pos, JCDiagnostic details) {
- enclosingContext.report(pos, diags.fragment("incompatible.type.in.conditional", details));
- }
- });
+ resultInfo.dup(conditionalContext(resultInfo.checkContext));
Type truetype = attribTree(tree.truepart, env, condInfo);
Type falsetype = attribTree(tree.falsepart, env, condInfo);
@@ -1506,6 +1536,18 @@
}
};
+ CheckContext conditionalContext(CheckContext checkContext) {
+ return new Check.NestedCheckContext(checkContext) {
+ //this will use enclosing check context to check compatibility of
+ //subexpression against target type; if we are in a method check context,
+ //depending on whether boxing is allowed, we could have incompatibilities
+ @Override
+ public void report(DiagnosticPosition pos, JCDiagnostic details) {
+ enclosingContext.report(pos, diags.fragment("incompatible.type.in.conditional", details));
+ }
+ };
+ }
+
/** Compute the type of a conditional expression, after
* checking that it exists. See JLS 15.25. Does not take into
* account the special case where condition and both arms
@@ -2070,13 +2112,8 @@
tree.constructor = constructor.baseSymbol();
final TypeSymbol csym = clazztype.tsym;
- ResultInfo diamondResult = new ResultInfo(pkind, newMethodTemplate(resultInfo.pt, argtypes, typeargtypes), new Check.NestedCheckContext(resultInfo.checkContext) {
- @Override
- public void report(DiagnosticPosition _unused, JCDiagnostic details) {
- enclosingContext.report(tree.clazz,
- diags.fragment("cant.apply.diamond.1", diags.fragment("diamond", csym), details));
- }
- }, CheckMode.NO_TREE_UPDATE);
+ ResultInfo diamondResult = new ResultInfo(pkind, newMethodTemplate(resultInfo.pt, argtypes, typeargtypes),
+ diamondContext(tree, csym, resultInfo.checkContext), CheckMode.NO_TREE_UPDATE);
Type constructorType = tree.constructorType = types.createErrorType(clazztype);
constructorType = checkId(tree, site,
constructor,
@@ -2261,6 +2298,16 @@
chk.validate(tree.typeargs, localEnv);
}
+ CheckContext diamondContext(JCNewClass clazz, TypeSymbol tsym, CheckContext checkContext) {
+ return new Check.NestedCheckContext(checkContext) {
+ @Override
+ public void report(DiagnosticPosition _unused, JCDiagnostic details) {
+ enclosingContext.report(clazz.clazz,
+ diags.fragment("cant.apply.diamond.1", diags.fragment("diamond", tsym), details));
+ }
+ };
+ }
+
/** Make an attributed null check tree.
*/
public JCExpression makeNullCheck(JCExpression arg) {
@@ -2330,8 +2377,7 @@
boolean needsRecovery =
resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK;
try {
- Type currentTarget = pt();
- if (needsRecovery && isSerializable(currentTarget)) {
+ if (needsRecovery && isSerializable(pt())) {
localEnv.info.isSerializable = true;
}
List<Type> explicitParamTypes = null;
@@ -2341,22 +2387,13 @@
explicitParamTypes = TreeInfo.types(that.params);
}
- Type lambdaType;
- if (pt() != Type.recoveryType) {
- /* We need to adjust the target. If the target is an
- * intersection type, for example: SAM & I1 & I2 ...
- * the target will be updated to SAM
- */
- currentTarget = targetChecker.visit(currentTarget, that);
- if (explicitParamTypes != null) {
- currentTarget = infer.instantiateFunctionalInterface(that,
- currentTarget, explicitParamTypes, resultInfo.checkContext);
- }
- currentTarget = types.removeWildcards(currentTarget);
- lambdaType = types.findDescriptorType(currentTarget);
- } else {
- currentTarget = Type.recoveryType;
- lambdaType = fallbackDescriptorType(that);
+ TargetInfo targetInfo = getTargetInfo(that, resultInfo, explicitParamTypes);
+ Type currentTarget = targetInfo.target;
+ Type lambdaType = targetInfo.descriptor;
+
+ if (currentTarget.isErroneous()) {
+ result = that.type = currentTarget;
+ return;
}
setFunctionalInfo(localEnv, that, pt(), lambdaType, currentTarget, resultInfo.checkContext);
@@ -2409,15 +2446,8 @@
//with the target-type, it will be recovered anyway in Attr.checkId
needsRecovery = false;
- FunctionalReturnContext funcContext = that.getBodyKind() == JCLambda.BodyKind.EXPRESSION ?
- new ExpressionLambdaReturnContext((JCExpression)that.getBody(), resultInfo.checkContext) :
- new FunctionalReturnContext(resultInfo.checkContext);
-
- ResultInfo bodyResultInfo = lambdaType.getReturnType() == Type.recoveryType ?
- recoveryInfo :
- new ResultInfo(KindSelector.VAL,
- lambdaType.getReturnType(), funcContext);
- localEnv.info.returnResult = bodyResultInfo;
+ ResultInfo bodyResultInfo = localEnv.info.returnResult =
+ lambdaBodyResult(that, lambdaType, resultInfo);
if (that.getBodyKind() == JCLambda.BodyKind.EXPRESSION) {
attribTree(that.getBody(), localEnv, bodyResultInfo);
@@ -2467,6 +2497,44 @@
}
}
//where
+ class TargetInfo {
+ Type target;
+ Type descriptor;
+
+ public TargetInfo(Type target, Type descriptor) {
+ this.target = target;
+ this.descriptor = descriptor;
+ }
+ }
+
+ TargetInfo getTargetInfo(JCPolyExpression that, ResultInfo resultInfo, List<Type> explicitParamTypes) {
+ Type lambdaType;
+ Type currentTarget = resultInfo.pt;
+ if (resultInfo.pt != Type.recoveryType) {
+ /* We need to adjust the target. If the target is an
+ * intersection type, for example: SAM & I1 & I2 ...
+ * the target will be updated to SAM
+ */
+ currentTarget = targetChecker.visit(currentTarget, that);
+ if (explicitParamTypes != null) {
+ currentTarget = infer.instantiateFunctionalInterface(that,
+ currentTarget, explicitParamTypes, resultInfo.checkContext);
+ }
+ currentTarget = types.removeWildcards(currentTarget);
+ lambdaType = types.findDescriptorType(currentTarget);
+ } else {
+ currentTarget = Type.recoveryType;
+ lambdaType = fallbackDescriptorType(that);
+ }
+ if (that.hasTag(LAMBDA) && lambdaType.hasTag(FORALL)) {
+ //lambda expression target desc cannot be a generic method
+ resultInfo.checkContext.report(that, diags.fragment("invalid.generic.lambda.target",
+ lambdaType, kindName(currentTarget.tsym), currentTarget.tsym));
+ currentTarget = types.createErrorType(pt());
+ }
+ return new TargetInfo(currentTarget, lambdaType);
+ }
+
void preFlow(JCLambda tree) {
new PostAttrAnalyzer() {
@Override
@@ -2612,13 +2680,24 @@
}
}
+ ResultInfo lambdaBodyResult(JCLambda that, Type descriptor, ResultInfo resultInfo) {
+ FunctionalReturnContext funcContext = that.getBodyKind() == JCLambda.BodyKind.EXPRESSION ?
+ new ExpressionLambdaReturnContext((JCExpression)that.getBody(), resultInfo.checkContext) :
+ new FunctionalReturnContext(resultInfo.checkContext);
+
+ return descriptor.getReturnType() == Type.recoveryType ?
+ recoveryInfo :
+ new ResultInfo(KindSelector.VAL,
+ descriptor.getReturnType(), funcContext);
+ }
+
/**
* Lambda compatibility. Check that given return types, thrown types, parameter types
* are compatible with the expected functional interface descriptor. This means that:
* (i) parameter types must be identical to those of the target descriptor; (ii) return
* types must be compatible with the return type of the expected descriptor.
*/
- private void checkLambdaCompatible(JCLambda tree, Type descriptor, CheckContext checkContext) {
+ void checkLambdaCompatible(JCLambda tree, Type descriptor, CheckContext checkContext) {
Type returnType = checkContext.inferenceContext().asUndetVar(descriptor.getReturnType());
//return values have already been checked - but if lambda has no return
@@ -2746,18 +2825,12 @@
typeargtypes = attribTypes(that.typeargs, localEnv);
}
- Type desc;
- Type currentTarget = pt();
boolean isTargetSerializable =
resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK &&
- isSerializable(currentTarget);
- if (currentTarget != Type.recoveryType) {
- currentTarget = types.removeWildcards(targetChecker.visit(currentTarget, that));
- desc = types.findDescriptorType(currentTarget);
- } else {
- currentTarget = Type.recoveryType;
- desc = fallbackDescriptorType(that);
- }
+ isSerializable(pt());
+ TargetInfo targetInfo = getTargetInfo(that, resultInfo, null);
+ Type currentTarget = targetInfo.target;
+ Type desc = targetInfo.descriptor;
setFunctionalInfo(localEnv, that, pt(), desc, currentTarget, resultInfo.checkContext);
List<Type> argtypes = desc.getParameterTypes();
@@ -3279,7 +3352,7 @@
}
// Attribute the qualifier expression, and determine its symbol (if any).
- Type site = attribTree(tree.selected, env, new ResultInfo(skind, Infer.anyPoly));
+ Type site = attribTree(tree.selected, env, new ResultInfo(skind, Type.noType));
if (!pkind().contains(KindSelector.TYP_PCK))
site = capture(site); // Capture field access
@@ -3884,8 +3957,15 @@
syms.methodClass);
}
- return chk.checkMethod(owntype, sym, env, argtrees, argtypes, env.info.lastResolveVarargs(),
- resultInfo.checkContext.inferenceContext());
+ PolyKind pkind = (sym.type.hasTag(FORALL) &&
+ sym.type.getReturnType().containsAny(((ForAll)sym.type).tvars)) ?
+ PolyKind.POLY : PolyKind.STANDALONE;
+ TreeInfo.setPolyKind(env.tree, pkind);
+
+ return (resultInfo.pt == Infer.anyPoly) ?
+ owntype :
+ chk.checkMethod(owntype, sym, env, argtrees, argtypes, env.info.lastResolveVarargs(),
+ resultInfo.checkContext.inferenceContext());
} catch (Infer.InferenceException ex) {
//invalid target type - propagate exception outwards or report error
//depending on the current check context
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Tue Sep 22 11:01:54 2015 -0700
@@ -49,7 +49,6 @@
import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
import com.sun.tools.javac.comp.Infer.FreeTypeListener;
import com.sun.tools.javac.tree.JCTree.*;
-import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
import static com.sun.tools.javac.code.Flags.*;
import static com.sun.tools.javac.code.Flags.ANNOTATION;
@@ -976,10 +975,6 @@
TreeInfo.setVarargsElement(env.tree, types.elemtype(argtype));
}
}
- PolyKind pkind = (sym.type.hasTag(FORALL) &&
- sym.type.getReturnType().containsAny(((ForAll)sym.type).tvars)) ?
- PolyKind.POLY : PolyKind.STANDALONE;
- TreeInfo.setPolyKind(env.tree, pkind);
return owntype;
}
//where
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Tue Sep 22 11:01:54 2015 -0700
@@ -29,6 +29,7 @@
import com.sun.source.tree.NewClassTree;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.code.Type.TypeMapping;
+import com.sun.tools.javac.comp.ArgumentAttr.CachePolicy;
import com.sun.tools.javac.comp.Resolve.ResolveError;
import com.sun.tools.javac.resources.CompilerProperties.Fragments;
import com.sun.tools.javac.tree.*;
@@ -36,7 +37,6 @@
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.comp.Attr.ResultInfo;
import com.sun.tools.javac.comp.Resolve.MethodResolutionPhase;
import com.sun.tools.javac.tree.JCTree.*;
@@ -55,8 +55,6 @@
import static com.sun.tools.javac.code.TypeTag.*;
import static com.sun.tools.javac.tree.JCTree.Tag.*;
-import static com.sun.tools.javac.code.Kinds.*;
-import static com.sun.tools.javac.code.Kinds.Kind.*;
/**
* This is an helper class that is used to perform deferred type-analysis.
@@ -73,6 +71,7 @@
protected static final Context.Key<DeferredAttr> deferredAttrKey = new Context.Key<>();
final Attr attr;
+ final ArgumentAttr argumentAttr;
final Check chk;
final JCDiagnostic.Factory diags;
final Enter enter;
@@ -98,6 +97,7 @@
protected DeferredAttr(Context context) {
context.put(deferredAttrKey, this);
attr = Attr.instance(context);
+ argumentAttr = ArgumentAttr.instance(context);
chk = Check.instance(context);
diags = JCDiagnostic.Factory.instance(context);
enter = Enter.instance(context);
@@ -255,6 +255,15 @@
return e != null ? e.speculativeTree.type : Type.noType;
}
+ JCTree speculativeTree(DeferredAttrContext deferredAttrContext) {
+ DeferredType.SpeculativeCache.Entry e = speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
+ return e != null ? e.speculativeTree : stuckTree;
+ }
+
+ DeferredTypeCompleter completer() {
+ return basicCompleter;
+ }
+
/**
* Check a deferred type against a potential target-type. Depending on
* the current attribution mode, a normal vs. speculative attribution
@@ -272,7 +281,7 @@
} else {
deferredStuckPolicy = new CheckStuckPolicy(resultInfo, this);
}
- return check(resultInfo, deferredStuckPolicy, basicCompleter);
+ return check(resultInfo, deferredStuckPolicy, completer());
}
private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy,
@@ -389,6 +398,42 @@
}
/**
+ * Performs speculative attribution of a lambda body and returns the speculative lambda tree,
+ * in the absence of a target-type. Since {@link Attr#visitLambda(JCLambda)} cannot type-check
+ * lambda bodies w/o a suitable target-type, this routine 'unrolls' the lambda by turning it
+ * into a regular block, speculatively type-checks the block and then puts back the pieces.
+ */
+ JCLambda attribSpeculativeLambda(JCLambda that, Env<AttrContext> env, ResultInfo resultInfo) {
+ ListBuffer<JCStatement> stats = new ListBuffer<>();
+ stats.addAll(that.params);
+ if (that.getBodyKind() == JCLambda.BodyKind.EXPRESSION) {
+ stats.add(make.Return((JCExpression)that.body));
+ } else {
+ stats.add((JCBlock)that.body);
+ }
+ JCBlock lambdaBlock = make.Block(0, stats.toList());
+ Env<AttrContext> localEnv = attr.lambdaEnv(that, env);
+ try {
+ localEnv.info.returnResult = resultInfo;
+ JCBlock speculativeTree = (JCBlock)attribSpeculative(lambdaBlock, localEnv, resultInfo);
+ List<JCVariableDecl> args = speculativeTree.getStatements().stream()
+ .filter(s -> s.hasTag(Tag.VARDEF))
+ .map(t -> (JCVariableDecl)t)
+ .collect(List.collector());
+ JCTree lambdaBody = speculativeTree.getStatements().last();
+ if (lambdaBody.hasTag(Tag.RETURN)) {
+ lambdaBody = ((JCReturn)lambdaBody).expr;
+ }
+ JCLambda speculativeLambda = make.Lambda(args, lambdaBody);
+ attr.preFlow(speculativeLambda);
+ flow.analyzeLambda(env, speculativeLambda, make, false);
+ return speculativeLambda;
+ } finally {
+ localEnv.info.scope.leave();
+ }
+ }
+
+ /**
* Routine that performs speculative type-checking; the input AST node is
* cloned (to avoid side-effects cause by Attr) and compiler state is
* restored after type-checking. All diagnostics (but critical ones) are
@@ -572,7 +617,7 @@
}
}
- private boolean insideOverloadPhase() {
+ public boolean insideOverloadPhase() {
DeferredAttrContext dac = this;
if (dac == emptyDeferredAttrContext) {
return false;
@@ -731,56 +776,16 @@
}
boolean canLambdaBodyCompleteNormally(JCLambda tree) {
- JCLambda newTree = new TreeCopier<>(make).copy(tree);
- /* attr.lambdaEnv will create a meaningful env for the
- * lambda expression. This is specially useful when the
- * lambda is used as the init of a field. But we need to
- * remove any added symbol.
- */
- Env<AttrContext> localEnv = attr.lambdaEnv(newTree, env);
+ List<JCVariableDecl> oldParams = tree.params;
+ CachePolicy prevPolicy = argumentAttr.withCachePolicy(CachePolicy.NO_CACHE);
try {
- List<JCVariableDecl> tmpParams = newTree.params;
- while (tmpParams.nonEmpty()) {
- tmpParams.head.vartype = make.at(tmpParams.head).Type(syms.errType);
- tmpParams = tmpParams.tail;
- }
-
- attr.attribStats(newTree.params, localEnv);
-
- /* set pt to Type.noType to avoid generating any bound
- * which may happen if lambda's return type is an
- * inference variable
- */
- Attr.ResultInfo bodyResultInfo = attr.new ResultInfo(KindSelector.VAL, Type.noType);
- localEnv.info.returnResult = bodyResultInfo;
-
- // discard any log output
- Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log);
- try {
- JCBlock body = (JCBlock)newTree.body;
- /* we need to attribute the lambda body before
- * doing the aliveness analysis. This is because
- * constant folding occurs during attribution
- * and the reachability of some statements depends
- * on constant values, for example:
- *
- * while (true) {...}
- */
- attr.attribStats(body.stats, localEnv);
-
- attr.preFlow(newTree);
- /* make an aliveness / reachability analysis of the lambda
- * to determine if it can complete normally
- */
- flow.analyzeLambda(localEnv, newTree, make, true);
- } finally {
- log.popDiagnosticHandler(diagHandler);
- }
- return newTree.canCompleteNormally;
+ tree.params = tree.params.stream()
+ .map(vd -> make.VarDef(vd.mods, vd.name, make.Erroneous(), null))
+ .collect(List.collector());
+ return attribSpeculativeLambda(tree, env, attr.unknownExprInfo).canCompleteNormally;
} finally {
- JCBlock body = (JCBlock)newTree.body;
- unenterScanner.scan(body.stats);
- localEnv.info.scope.leave();
+ argumentAttr.withCachePolicy(prevPolicy);
+ tree.params = oldParams;
}
}
@@ -951,7 +956,7 @@
* A special tree scanner that would only visit portions of a given tree.
* The set of nodes visited by the scanner can be customized at construction-time.
*/
- abstract static class FilterScanner extends TreeScanner {
+ abstract static class FilterScanner extends com.sun.tools.javac.tree.TreeScanner {
final Filter<JCTree> treeFilter;
@@ -1148,330 +1153,4 @@
}
}
}
-
- /**
- * Does the argument expression {@code expr} need speculative type-checking?
- */
- boolean isDeferred(Env<AttrContext> env, JCExpression expr) {
- DeferredChecker dc = new DeferredChecker(env);
- dc.scan(expr);
- return dc.result.isPoly();
- }
-
- /**
- * The kind of an argument expression. This is used by the analysis that
- * determines as to whether speculative attribution is necessary.
- */
- enum ArgumentExpressionKind {
-
- /** kind that denotes poly argument expression */
- POLY,
- /** kind that denotes a standalone expression */
- NO_POLY,
- /** kind that denotes a primitive/boxed standalone expression */
- PRIMITIVE;
-
- /**
- * Does this kind denote a poly argument expression
- */
- public final boolean isPoly() {
- return this == POLY;
- }
-
- /**
- * Does this kind denote a primitive standalone expression
- */
- public final boolean isPrimitive() {
- return this == PRIMITIVE;
- }
-
- /**
- * Compute the kind of a standalone expression of a given type
- */
- static ArgumentExpressionKind standaloneKind(Type type, Types types) {
- return types.unboxedTypeOrType(type).isPrimitive() ?
- ArgumentExpressionKind.PRIMITIVE :
- ArgumentExpressionKind.NO_POLY;
- }
-
- /**
- * Compute the kind of a method argument expression given its symbol
- */
- static ArgumentExpressionKind methodKind(Symbol sym, Types types) {
- Type restype = sym.type.getReturnType();
- if (sym.type.hasTag(FORALL) &&
- restype.containsAny(((ForAll)sym.type).tvars)) {
- return ArgumentExpressionKind.POLY;
- } else {
- return ArgumentExpressionKind.standaloneKind(restype, types);
- }
- }
- }
-
- /**
- * Tree scanner used for checking as to whether an argument expression
- * requires speculative attribution
- */
- final class DeferredChecker extends FilterScanner {
-
- Env<AttrContext> env;
- ArgumentExpressionKind result;
-
- public DeferredChecker(Env<AttrContext> env) {
- super(deferredCheckerTags);
- this.env = env;
- }
-
- @Override
- public void visitLambda(JCLambda tree) {
- //a lambda is always a poly expression
- result = ArgumentExpressionKind.POLY;
- }
-
- @Override
- public void visitReference(JCMemberReference tree) {
- //perform arity-based check
- Env<AttrContext> localEnv = env.dup(tree);
- JCExpression exprTree = (JCExpression)attribSpeculative(tree.getQualifierExpression(), localEnv,
- attr.memberReferenceQualifierResult(tree));
- JCMemberReference mref2 = new TreeCopier<Void>(make).copy(tree);
- mref2.expr = exprTree;
- Symbol res =
- rs.getMemberReference(tree, localEnv, mref2,
- exprTree.type, tree.name);
- tree.sym = res;
- if (res.kind.isResolutionTargetError() ||
- res.type != null && res.type.hasTag(FORALL) ||
- (res.flags() & Flags.VARARGS) != 0 ||
- (TreeInfo.isStaticSelector(exprTree, tree.name.table.names) &&
- exprTree.type.isRaw())) {
- tree.overloadKind = JCMemberReference.OverloadKind.OVERLOADED;
- } else {
- tree.overloadKind = JCMemberReference.OverloadKind.UNOVERLOADED;
- }
- //a method reference is always a poly expression
- result = ArgumentExpressionKind.POLY;
- }
-
- @Override
- public void visitTypeCast(JCTypeCast tree) {
- //a cast is always a standalone expression
- result = ArgumentExpressionKind.NO_POLY;
- }
-
- @Override
- public void visitConditional(JCConditional tree) {
- scan(tree.truepart);
- if (!result.isPrimitive()) {
- result = ArgumentExpressionKind.POLY;
- return;
- }
- scan(tree.falsepart);
- result = reduce(ArgumentExpressionKind.PRIMITIVE).isPrimitive() ?
- ArgumentExpressionKind.PRIMITIVE :
- ArgumentExpressionKind.POLY;
-
- }
-
- @Override
- public void visitNewClass(JCNewClass tree) {
- result = TreeInfo.isDiamond(tree) ?
- ArgumentExpressionKind.POLY : ArgumentExpressionKind.NO_POLY;
- }
-
- @Override
- public void visitApply(JCMethodInvocation tree) {
- Name name = TreeInfo.name(tree.meth);
-
- //fast path
- if (tree.typeargs.nonEmpty() ||
- name == name.table.names._this ||
- name == name.table.names._super) {
- result = ArgumentExpressionKind.NO_POLY;
- return;
- }
-
- //slow path
- Symbol sym = quicklyResolveMethod(env, tree);
-
- if (sym == null) {
- result = ArgumentExpressionKind.POLY;
- return;
- }
-
- result = analyzeCandidateMethods(sym, ArgumentExpressionKind.PRIMITIVE,
- argumentKindAnalyzer);
- }
- //where
- private boolean isSimpleReceiver(JCTree rec) {
- switch (rec.getTag()) {
- case IDENT:
- return true;
- case SELECT:
- return isSimpleReceiver(((JCFieldAccess)rec).selected);
- case TYPEAPPLY:
- case TYPEARRAY:
- return true;
- case ANNOTATED_TYPE:
- return isSimpleReceiver(((JCAnnotatedType)rec).underlyingType);
- case APPLY:
- return true;
- case NEWCLASS:
- JCNewClass nc = (JCNewClass) rec;
- return nc.encl == null && nc.def == null && !TreeInfo.isDiamond(nc);
- default:
- return false;
- }
- }
- private ArgumentExpressionKind reduce(ArgumentExpressionKind kind) {
- return argumentKindAnalyzer.reduce(result, kind);
- }
- MethodAnalyzer<ArgumentExpressionKind> argumentKindAnalyzer =
- new MethodAnalyzer<ArgumentExpressionKind>() {
- @Override
- public ArgumentExpressionKind process(MethodSymbol ms) {
- return ArgumentExpressionKind.methodKind(ms, types);
- }
- @Override
- public ArgumentExpressionKind reduce(ArgumentExpressionKind kind1,
- ArgumentExpressionKind kind2) {
- switch (kind1) {
- case PRIMITIVE: return kind2;
- case NO_POLY: return kind2.isPoly() ? kind2 : kind1;
- case POLY: return kind1;
- default:
- Assert.error();
- return null;
- }
- }
- @Override
- public boolean shouldStop(ArgumentExpressionKind result) {
- return result.isPoly();
- }
- };
-
- @Override
- public void visitLiteral(JCLiteral tree) {
- Type litType = attr.litType(tree.typetag);
- result = ArgumentExpressionKind.standaloneKind(litType, types);
- }
-
- @Override
- void skip(JCTree tree) {
- result = ArgumentExpressionKind.NO_POLY;
- }
-
- private Symbol quicklyResolveMethod(Env<AttrContext> env, final JCMethodInvocation tree) {
- final JCExpression rec = tree.meth.hasTag(SELECT) ?
- ((JCFieldAccess)tree.meth).selected :
- null;
-
- if (rec != null && !isSimpleReceiver(rec)) {
- return null;
- }
-
- Type site;
-
- if (rec != null) {
- switch (rec.getTag()) {
- case APPLY:
- Symbol recSym = quicklyResolveMethod(env, (JCMethodInvocation) rec);
- if (recSym == null)
- return null;
- Symbol resolvedReturnType =
- analyzeCandidateMethods(recSym, syms.errSymbol, returnSymbolAnalyzer);
- if (resolvedReturnType == null)
- return null;
- site = resolvedReturnType.type;
- break;
- case NEWCLASS:
- JCNewClass nc = (JCNewClass) rec;
- site = attribSpeculative(nc.clazz, env, attr.unknownTypeExprInfo).type;
- break;
- default:
- site = attribSpeculative(rec, env, attr.unknownTypeExprInfo).type;
- break;
- }
- } else {
- site = env.enclClass.sym.type;
- }
-
- site = types.skipTypeVars(site, true);
-
- List<Type> args = rs.dummyArgs(tree.args.length());
- Name name = TreeInfo.name(tree.meth);
-
- Resolve.LookupHelper lh = rs.new LookupHelper(name, site, args, List.<Type>nil(), MethodResolutionPhase.VARARITY) {
- @Override
- Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
- return rec == null ?
- rs.findFun(env, name, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()) :
- rs.findMethod(env, site, name, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired());
- }
- @Override
- Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
- return sym;
- }
- };
-
- return rs.lookupMethod(env, tree, site.tsym, rs.arityMethodCheck, lh);
- }
- //where:
- MethodAnalyzer<Symbol> returnSymbolAnalyzer = new MethodAnalyzer<Symbol>() {
- @Override
- public Symbol process(MethodSymbol ms) {
- ArgumentExpressionKind kind = ArgumentExpressionKind.methodKind(ms, types);
- if (kind == ArgumentExpressionKind.POLY || ms.getReturnType().hasTag(TYPEVAR))
- return null;
- return ms.getReturnType().tsym;
- }
- @Override
- public Symbol reduce(Symbol s1, Symbol s2) {
- return s1 == syms.errSymbol ? s2 : s1 == s2 ? s1 : null;
- }
- @Override
- public boolean shouldStop(Symbol result) {
- return result == null;
- }
- };
-
- /**
- * Process the result of Resolve.lookupMethod. If sym is a method symbol, the result of
- * MethodAnalyzer.process is returned. If sym is an ambiguous symbol, all the candidate
- * methods are inspected one by one, using MethodAnalyzer.process. The outcomes are
- * reduced using MethodAnalyzer.reduce (using defaultValue as the first value over which
- * the reduction runs). MethodAnalyzer.shouldStop can be used to stop the inspection early.
- */
- <E> E analyzeCandidateMethods(Symbol sym, E defaultValue, MethodAnalyzer<E> analyzer) {
- switch (sym.kind) {
- case MTH:
- return analyzer.process((MethodSymbol) sym);
- case AMBIGUOUS:
- Resolve.AmbiguityError err = (Resolve.AmbiguityError)sym.baseSymbol();
- E res = defaultValue;
- for (Symbol s : err.ambiguousSyms) {
- if (s.kind == MTH) {
- res = analyzer.reduce(res, analyzer.process((MethodSymbol) s));
- if (analyzer.shouldStop(res))
- return res;
- }
- }
- return res;
- default:
- return defaultValue;
- }
- }
- }
-
- /** Analyzer for methods - used by analyzeCandidateMethods. */
- interface MethodAnalyzer<E> {
- E process(MethodSymbol ms);
- E reduce(E e1, E e2);
- boolean shouldStop(E result);
- }
-
- //where
- private EnumSet<JCTree.Tag> deferredCheckerTags =
- EnumSet.of(LAMBDA, REFERENCE, PARENS, TYPECAST,
- CONDEXPR, NEWCLASS, APPLY, LITERAL);
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Tue Sep 22 11:01:54 2015 -0700
@@ -37,6 +37,7 @@
import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
+import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph;
import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph.Node;
import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
@@ -179,7 +180,11 @@
resolveContext.methodCheck.argumentsAcceptable(env, deferredAttrContext, //B2
argtypes, mt.getParameterTypes(), warn);
- if (allowGraphInference &&
+
+ if (allowGraphInference && resultInfo != null && resultInfo.pt == anyPoly) {
+ //we are inside method attribution - just return a partially inferred type
+ return new PartiallyInferredMethodType(mt, inferenceContext, env, warn);
+ } else if (allowGraphInference &&
resultInfo != null &&
!warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
//inject return constraints earlier
@@ -238,6 +243,73 @@
}
}
+ /**
+ * A partially infered method/constructor type; such a type can be checked multiple times
+ * against different targets.
+ */
+ public class PartiallyInferredMethodType extends MethodType {
+ public PartiallyInferredMethodType(MethodType mtype, InferenceContext inferenceContext, Env<AttrContext> env, Warner warn) {
+ super(mtype.getParameterTypes(), mtype.getReturnType(), mtype.getThrownTypes(), mtype.tsym);
+ this.inferenceContext = inferenceContext;
+ this.env = env;
+ this.warn = warn;
+ }
+
+ /** The inference context. */
+ final InferenceContext inferenceContext;
+
+ /** The attribution environment. */
+ Env<AttrContext> env;
+
+ /** The warner. */
+ final Warner warn;
+
+ @Override
+ public boolean isPartial() {
+ return true;
+ }
+
+ /**
+ * Checks this type against a target; this means generating return type constraints, solve
+ * and then roll back the results (to avoid poolluting the context).
+ */
+ Type check(Attr.ResultInfo resultInfo) {
+ Warner noWarnings = new Warner(null);
+ inferenceException.clear();
+ List<Type> saved_undet = null;
+ try {
+ /** we need to save the inference context before generating target type constraints.
+ * This constraints may pollute the inference context and make it useless in case we
+ * need to use it several times: with several targets.
+ */
+ saved_undet = inferenceContext.save();
+ if (allowGraphInference && !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
+ //inject return constraints earlier
+ checkWithinBounds(inferenceContext, noWarnings); //propagation
+ Type res = generateReturnConstraints(env.tree, resultInfo, //B3
+ this, inferenceContext);
+
+ if (resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
+ //propagate inference context outwards and exit
+ inferenceContext.dupTo(resultInfo.checkContext.inferenceContext(),
+ resultInfo.checkContext.deferredAttrContext().insideOverloadPhase());
+ return res;
+ }
+ }
+ inferenceContext.solve(noWarnings);
+ return inferenceContext.asInstType(this).getReturnType();
+ } catch (InferenceException ex) {
+ resultInfo.checkContext.report(null, ex.getDiagnostic());
+ Assert.error(); //cannot get here (the above should throw)
+ return null;
+ } finally {
+ if (saved_undet != null) {
+ inferenceContext.rollback(saved_undet);
+ }
+ }
+ }
+ }
+
private void dumpGraphsIfNeeded(DiagnosticPosition pos, Symbol msym, Resolve.MethodResolutionContext rsContext) {
int round = 0;
try {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java Tue Sep 22 11:01:54 2015 -0700
@@ -315,31 +315,46 @@
return buf.toList();
}
- /**
- * Restore the state of this inference context to the previous known checkpoint
- */
+ /** Restore the state of this inference context to the previous known checkpoint.
+ * Consider that the number of saved undetermined variables can be different to the current
+ * amount. This is because new captured variables could have been added.
+ */
void rollback(List<Type> saved_undet) {
- Assert.check(saved_undet != null && saved_undet.length() == undetvars.length());
+ Assert.check(saved_undet != null);
//restore bounds (note: we need to preserve the old instances)
- for (Type t : undetvars) {
- UndetVar uv = (UndetVar)t;
+ ListBuffer<Type> newUndetVars = new ListBuffer<>();
+ ListBuffer<Type> newInferenceVars = new ListBuffer<>();
+ while (saved_undet.nonEmpty() && undetvars.nonEmpty()) {
+ UndetVar uv = (UndetVar)undetvars.head;
UndetVar uv_saved = (UndetVar)saved_undet.head;
- for (InferenceBound ib : InferenceBound.values()) {
- uv.setBounds(ib, uv_saved.getBounds(ib));
+ if (uv.qtype == uv_saved.qtype) {
+ for (InferenceBound ib : InferenceBound.values()) {
+ uv.setBounds(ib, uv_saved.getBounds(ib));
+ }
+ uv.inst = uv_saved.inst;
+ undetvars = undetvars.tail;
+ saved_undet = saved_undet.tail;
+ newUndetVars.add(uv);
+ newInferenceVars.add(uv.qtype);
+ } else {
+ undetvars = undetvars.tail;
}
- uv.inst = uv_saved.inst;
- saved_undet = saved_undet.tail;
}
+ undetvars = newUndetVars.toList();
+ inferencevars = newInferenceVars.toList();
}
/**
* Copy variable in this inference context to the given context
*/
void dupTo(final InferenceContext that) {
- that.inferencevars = that.inferencevars.appendList(
- inferencevars.diff(that.inferencevars));
- that.undetvars = that.undetvars.appendList(
- undetvars.diff(that.undetvars));
+ dupTo(that, false);
+ }
+
+ void dupTo(final InferenceContext that, boolean clone) {
+ that.inferencevars = that.inferencevars.appendList(inferencevars.diff(that.inferencevars));
+ List<Type> undetsToPropagate = clone ? save() : undetvars;
+ that.undetvars = that.undetvars.appendList(undetsToPropagate.diff(that.undetvars)); //propagate cloned undet!!
//set up listeners to notify original inference contexts as
//propagated vars are inferred in new context
for (Type t : inferencevars) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Sep 22 11:01:54 2015 -0700
@@ -588,7 +588,8 @@
MethodResolutionContext prevContext = currentResolutionContext;
try {
currentResolutionContext = new MethodResolutionContext();
- currentResolutionContext.attrMode = DeferredAttr.AttrMode.CHECK;
+ currentResolutionContext.attrMode = (resultInfo.pt == Infer.anyPoly) ?
+ AttrMode.SPECULATIVE : DeferredAttr.AttrMode.CHECK;
if (env.tree.hasTag(JCTree.Tag.REFERENCE)) {
//method/constructor references need special check class
//to handle inference variables in 'argtypes' (might happen
@@ -1032,6 +1033,11 @@
protected ResultInfo dup(CheckContext newContext) {
return new MethodResultInfo(pt, newContext);
}
+
+ @Override
+ protected ResultInfo dup(Type newPt, CheckContext newContext) {
+ return new MethodResultInfo(newPt, newContext);
+ }
}
/**
@@ -1092,10 +1098,9 @@
unrelatedFunctionalInterfaces(found, req) &&
(actual != null && actual.getTag() == DEFERRED)) {
DeferredType dt = (DeferredType) actual;
- DeferredType.SpeculativeCache.Entry e =
- dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
- if (e != null && e.speculativeTree != deferredAttr.stuckTree) {
- return functionalInterfaceMostSpecific(found, req, e.speculativeTree);
+ JCTree speculativeTree = dt.speculativeTree(deferredAttrContext);
+ if (speculativeTree != deferredAttr.stuckTree) {
+ return functionalInterfaceMostSpecific(found, req, speculativeTree);
}
}
return compatibleBySubtyping(found, req);
@@ -1147,8 +1152,8 @@
@Override
public void visitConditional(JCConditional tree) {
- scan(tree.truepart);
- scan(tree.falsepart);
+ scan(asExpr(tree.truepart));
+ scan(asExpr(tree.falsepart));
}
@Override
@@ -1180,6 +1185,11 @@
}
@Override
+ public void visitParens(JCParens tree) {
+ scan(asExpr(tree.expr));
+ }
+
+ @Override
public void visitLambda(JCLambda tree) {
Type desc_t = types.findDescriptorType(t);
Type desc_s = types.findDescriptorType(s);
@@ -1214,7 +1224,7 @@
private List<JCExpression> lambdaResults(JCLambda lambda) {
if (lambda.getBodyKind() == JCTree.JCLambda.BodyKind.EXPRESSION) {
- return List.of((JCExpression) lambda.body);
+ return List.of(asExpr((JCExpression) lambda.body));
} else {
final ListBuffer<JCExpression> buffer = new ListBuffer<>();
DeferredAttr.LambdaReturnScanner lambdaScanner =
@@ -1222,7 +1232,7 @@
@Override
public void visitReturn(JCReturn tree) {
if (tree.expr != null) {
- buffer.append(tree.expr);
+ buffer.append(asExpr(tree.expr));
}
}
};
@@ -1230,6 +1240,16 @@
return buffer.toList();
}
}
+
+ private JCExpression asExpr(JCExpression expr) {
+ if (expr.type.hasTag(DEFERRED)) {
+ JCTree speculativeTree = ((DeferredType)expr.type).speculativeTree(deferredAttrContext);
+ if (speculativeTree != deferredAttr.stuckTree) {
+ expr = (JCExpression)speculativeTree;
+ }
+ }
+ return expr;
+ }
}
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java Tue Sep 22 11:01:54 2015 -0700
@@ -419,13 +419,14 @@
@SuppressWarnings("unchecked")
public <Z> List<Z> map(Function<A, Z> mapper) {
- if (nonEmpty()) {
- List<Z> tail1 = tail.map(mapper);
- Z head1 = mapper.apply(head);
- if (tail1 != tail || head1 != head)
- return tail1.prepend(head1);
+ boolean changed = false;
+ ListBuffer<Z> buf = new ListBuffer<>();
+ for (A a : this) {
+ Z z = mapper.apply(a);
+ buf.append(z);
+ changed |= (z != a);
}
- return (List<Z>)this;
+ return changed ? buf.toList() : (List<Z>)this;
}
@SuppressWarnings("unchecked")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8077306/T8077306.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8077306
+ * @summary Recursive implementation of List.map leads to stack overflow
+ * @compile T8077306.java
+ */
+
+import java.util.Arrays;
+import java.util.List;
+
+class T8077306 {
+ List<Integer> list = Arrays.asList(
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+
+ );
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/generics/wildcards/neg/Readonly.out Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/test/tools/javac/generics/wildcards/neg/Readonly.out Tue Sep 22 11:01:54 2015 -0700
@@ -1,2 +1,2 @@
-Readonly.java:15:10: compiler.err.cant.apply.symbol: kindname.method, put, Err<compiler.misc.type.captureof: 1, ? extends java.lang.String>, Err<compiler.misc.type.captureof: 2, ? extends java.lang.String>, kindname.class, Err<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: Err<compiler.misc.type.captureof: 2, ? extends java.lang.String>, Err<compiler.misc.type.captureof: 1, ? extends java.lang.String>))
+Readonly.java:15:10: compiler.err.cant.apply.symbol: kindname.method, put, Err<compiler.misc.type.captureof: 1, ? extends java.lang.String>, Err<compiler.misc.type.captureof: 2, ? extends java.lang.String>, kindname.class, Err<T>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: Err<compiler.misc.type.captureof: 3, ? extends java.lang.String>, Err<compiler.misc.type.captureof: 1, ? extends java.lang.String>))
1 error
--- a/langtools/test/tools/javac/lambda/8019480/T8019480.out Thu Sep 17 09:19:40 2015 -0700
+++ b/langtools/test/tools/javac/lambda/8019480/T8019480.out Tue Sep 22 11:01:54 2015 -0700
@@ -1,3 +1,3 @@
+T8019480.java:21:34: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, java.util.Collection, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(int,U), (compiler.misc.arg.length.mismatch))}
T8019480.java:21:46: compiler.err.report.access: clone(), protected, java.lang.Object
-T8019480.java:21:34: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, java.util.Collection, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(int,U), (compiler.misc.arg.length.mismatch))}
2 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/InferStrict.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8078093
+ * @summary Exponential performance regression Java 8 compiler compared to Java 7 compiler
+ * @compile InferStrict.java
+ */
+import java.util.HashSet;
+import java.util.Set;
+
+class InferStrict {
+ public <T> Set<T> compute(Set<T> t) { return t; }
+ public <T> T join(Set<T> t1, Set<T> t2) { return null; }
+ public <T extends InferStrict> T compute() { return null; }
+ public void test() {
+ join(
+ compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(new HashSet<>()))))))))))))))))),
+ compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(compute(new HashSet<String>())))))))))))))))))
+ ).length();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/InferWeak.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8078093
+ * @summary Exponential performance regression Java 8 compiler compared to Java 7 compiler
+ * @compile InferWeak.java
+ */
+class InferWeak {
+ private void test() {
+ GroupLayout l = new GroupLayout();
+ l.setHorizontalGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGroup(l.createParallelGroup().addGroup(
+ l.createParallelGroup().addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object())).addGap(1).addComponent(new Object()).addGap(1)
+ .addComponent(new Object()));
+ }
+
+ static class GroupLayout {
+ <T extends ParallelGroup> T createParallelGroup() {return null;}
+ <T extends ParallelGroup> T createParallelGroup(int i) {return null;}
+ <T extends ParallelGroup> T createParallelGroup(int i, int j) {return null;}
+ void setHorizontalGroup(ParallelGroup g) { }
+ }
+
+ static class ParallelGroup {
+ <T extends ParallelGroup> T addGroup(ParallelGroup g) { return null; }
+ <T extends ParallelGroup> T addGroup(int i, ParallelGroup g) { return null; }
+ <T extends ParallelGroup> T addGap(int i) { return null; }
+ <T extends ParallelGroup> T addGap(int i, int j) { return null; }
+ <T extends ParallelGroup> T addComponent(Object c) { return null; }
+ <T extends ParallelGroup> T addComponent(int i, Object c) { return null; }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/NestedLambdaGenerics.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8078093
+ * @summary Exponential performance regression Java 8 compiler compared to Java 7 compiler
+ * @compile NestedLambdaGenerics.java
+ */
+import java.util.concurrent.Callable;
+
+class NestedLambdaGenerics {
+ void test() {
+ m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ (Callable<String>)null)))))))))))))))))))))))))))))));
+ }
+ static class A0 { }
+ static class A1 { }
+ static class A2 { }
+ static class A3 { }
+ static class A4 { }
+ <Z extends A0> Z m(A0 t, Callable<Z> ct) { return null; }
+ <Z extends A1> Z m(A1 t, Callable<Z> ct) { return null; }
+ <Z extends A2> Z m(A2 t, Callable<Z> ct) { return null; }
+ <Z extends A3> Z m(A3 t, Callable<Z> ct) { return null; }
+ <Z extends A4> Z m(A4 t, Callable<Z> ct) { return null; }
+ <Z> Z m(Object o, Callable<Z> co) { return null; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/NestedLambdaNoGenerics.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8078093
+ * @summary Exponential performance regression Java 8 compiler compared to Java 7 compiler
+ * @compile NestedLambdaNoGenerics.java
+ */
+import java.util.concurrent.Callable;
+
+class NestedLambdaNoGenerics {
+ void test() {
+ m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null, () -> m(null,
+ (Callable<String>)null)))))))))))))))))))))))))))))));
+ }
+ static class A0 { }
+ static class A1 { }
+ static class A2 { }
+ static class A3 { }
+ static class A4 { }
+ String m(A0 t, Callable<A0> ct) { return ""; }
+ String m(A1 t, Callable<A1> ct) { return ""; }
+ String m(A2 t, Callable<A2> ct) { return ""; }
+ String m(A3 t, Callable<A3> ct) { return ""; }
+ String m(A4 t, Callable<A4> ct) { return ""; }
+ String m(Object o, Callable<String> co) { return ""; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/T8055984.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8078093 8055894
+ * @summary Exponential performance regression Java 8 compiler compared to Java 7 compiler
+ * @compile T8055984.java
+ */
+
+class T8055984 {
+ static class C<U> {
+ U fu;
+
+ C() { }
+
+ C(C<U> other) {
+ this.fu = other.fu;
+ }
+
+ C(U fu) {
+ this.fu = fu;
+ }
+ }
+
+ static <U> C<U> m(C<U> src) { return new C<U>(src); }
+
+ static void test() {
+ C<String> c2 = m(new C<>(m(new C<>() )) );
+ C<String> c3 = m(new C<>(m(new C<>(m(new C<>() )) )) );
+ C<String> c4 = m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) );
+ C<String> c5 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) );
+ C<String> c6 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) )) );
+ C<String> c7 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) )) )) );
+ C<String> c8 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) )) )) )) );
+ C<String> c9 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>() )) )) )) )) )) )) )) )) );
+ C<String> c10 = m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>(m(new C<>())))))))))))))))))));
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/T8077247.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8078093 8077247
+ * @summary Exponential performance regression Java 8 compiler compared to Java 7 compiler
+ * @compile T8077247.java
+ */
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+class T8077247 {
+ public static void test() {
+ int x = add(add(add(add(add(add(add(add(add(add(1, 2), 3), 4), 5), 6), 7), 8), 9), 10), 11);
+ }
+
+ public static int add(int x, int y) {
+ long rslt = (long)x + (long)y;
+ if (Integer.MIN_VALUE <= rslt && rslt <= Integer.MAX_VALUE) {
+ return (int)rslt;
+ }
+
+ String msg = String.format("Integer overflow: %d + %d.", x, y);
+ throw new IllegalArgumentException(msg);
+ }
+
+ public static double add(double x, double y) {
+ double rslt = x + y;
+ if (Double.isInfinite(rslt)) {
+ String msg = String.format("Real overflow: %s + %s.", x, y);
+ throw new IllegalArgumentException(msg);
+ }
+ return (rslt == -0.0) ? 0.0 : rslt;
+ }
+
+ public static <T> List<T> add(List<T> x, List<T> y) {
+ List<T> rslt = new ArrayList<>(x.size() + y.size());
+ rslt.addAll(x);
+ rslt.addAll(y);
+ return rslt;
+ }
+
+ public static String add(String x, String y) {
+ return x + y;
+ }
+
+ public static <K, V> Map<K, V> add(Map<K, V> x, Map<K, V> y) {
+ Map<K, V> rslt = new HashMap<>(x);
+ rslt.putAll(y);
+ return rslt;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/speculative/T8078093.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8078093
+ * @summary Exponential performance regression Java 8 compiler compared to Java 7 compiler
+ * @compile T8078093.java
+ */
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+class T8078093 {
+ public static void test() {
+ Map<Integer, String> a = x(x(x(x(x(x(x(x(x(x(x(x(
+ new LinkedHashMap<Integer, String>(),
+ 1, "a"), 2, "b"), 3, "c"), 4, "d"),
+ 5, "e"), 6, "f"), 7, "g"), 8, "h"),
+ 9, "i"), 10, "j"), 11, "k"), 12, "l");
+ }
+
+ @SuppressWarnings("unused")
+ public static <K, V> Map<K, V> x(Map<K, V> m, K k, V v) {
+ // Replaced actual code by dummy implementation.
+ return null;
+ }
+}
--- a/make/CompileJavaModules.gmk Thu Sep 17 09:19:40 2015 -0700
+++ b/make/CompileJavaModules.gmk Tue Sep 22 11:01:54 2015 -0700
@@ -275,13 +275,6 @@
$(JDK_TOPDIR)/src/java.sql.rowset/share/classes/javax/sql/rowset/*.properties)
################################################################################
-# Exclude building of IIOP transport for RMI Connector
-
-ifeq ($(RMICONNECTOR_IIOP), false)
- java.management_EXCLUDES += com/sun/jmx/remote/protocol/iiop
-endif
-
-################################################################################
java.rmi_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
java.rmi_CLEAN_FILES := $(wildcard \
--- a/make/Main.gmk Thu Sep 17 09:19:40 2015 -0700
+++ b/make/Main.gmk Tue Sep 22 11:01:54 2015 -0700
@@ -285,9 +285,12 @@
+($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \
test-image-jdk-jtreg-native)
+build-test-lib:
+ +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
+
ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
- test-image-jdk-jtreg-native
+ test-image-jdk-jtreg-native build-test-lib
################################################################################
# Run tests
@@ -553,7 +556,7 @@
CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
images make-support test-make bundles
CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
-CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native
+CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native lib
CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS))
CLEAN_PHASES := gensrc java native include docs
CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
--- a/make/common/MakeBase.gmk Thu Sep 17 09:19:40 2015 -0700
+++ b/make/common/MakeBase.gmk Tue Sep 22 11:01:54 2015 -0700
@@ -567,16 +567,22 @@
endif
################################################################################
-# Convenience functions for working around make's limitations with $(filter ).
-containing = \
- $(strip $(foreach v,$(strip $2),$(if $(findstring $(strip $1),$v),$v)))
-not-containing = \
- $(strip $(foreach v,$(strip $2),$(if $(findstring $(strip $1),$v),,$v)))
-
# Filter out duplicate sub strings while preserving order. Keeps the first occurance.
uniq = \
$(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
+# Returns all whitespace-separated words in $2 where at least one of the
+# whitespace-separated words in $1 is a substring.
+containing = \
+ $(strip \
+ $(foreach v,$(strip $2),\
+ $(call uniq,$(foreach p,$(strip $1),$(if $(findstring $p,$v),$v)))))
+
+# Returns all whitespace-separated words in $2 where none of the
+# whitespace-separated words in $1 is a substring.
+not-containing = \
+ $(strip $(filter-out $(call containing,$1,$2),$2))
+
# Return a list of all string elements that are duplicated in $1.
dups = \
$(strip $(foreach v, $(sort $1), $(if $(filter-out 1, \
--- a/make/common/NativeCompilation.gmk Thu Sep 17 09:19:40 2015 -0700
+++ b/make/common/NativeCompilation.gmk Tue Sep 22 11:01:54 2015 -0700
@@ -102,7 +102,7 @@
################################################################################
# Extensions of files handled by this macro.
-NATIVE_SOURCE_EXTENSIONS := %.s %.c %.cpp %.m %.mm
+NATIVE_SOURCE_EXTENSIONS := %.s %.c %.cpp %.cc %.m %.mm
# Replaces native source extensions with the object file extension in a string.
# Param 1: the string containing source file names with extensions
@@ -167,7 +167,7 @@
$1_$2_FLAGS=$8 -DTHIS_FILE='"$$(<F)"'
$1_$2_COMP=$(AS)
$1_$2_DEP_FLAG:=
- else ifneq (,$$(filter %.cpp,$2)$$(filter %.mm,$2))
+ else ifneq (,$$(filter %.cpp,$2)$$(filter %.cc,$2)$$(filter %.mm,$2))
# Compile as a C++ or Objective-C++ file
$1_$2_FLAGS=$(CFLAGS_CCACHE) $6 $$($1_$(notdir $2)_CXXFLAGS) -DTHIS_FILE='"$$(<F)"' -c
$1_$2_COMP=$7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/test/BuildTestLib.gmk Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,67 @@
+#
+# Copyright (c) 2015, 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include SetupJavaCompilers.gmk
+
+TARGETS :=
+
+TEST_LIB_SOURCE_DIR := $(TOPDIR)/test/lib
+TEST_LIB_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/lib
+
+# Unfortunately, test-lib.jar does not compile properly without warnings.
+$(eval $(call SetupJavaCompiler, BOOT_JAVAC_NOWARNINGS, \
+ JAVAC := $(JAVAC), \
+ FLAGS := -XDignore.symbol.file=true -g, \
+))
+
+$(eval $(call SetupJavaCompilation, BUILD_WB_JAR, \
+ SETUP := BOOT_JAVAC, \
+ SRC := $(TEST_LIB_SOURCE_DIR)/sun, \
+ BIN := $(TEST_LIB_SUPPORT), \
+ JAR := $(TEST_LIB_SUPPORT)/wb.jar, \
+))
+
+TARGETS += $(BUILD_WB_JAR)
+
+# test-lib.jar will contain only hprof classes until JDK-8081381 is resolved
+$(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \
+ SETUP := BOOT_JAVAC_NOWARNINGS, \
+ SRC := $(TEST_LIB_SOURCE_DIR)/share/classes/jdk/test/lib/hprof, \
+ BIN := $(TEST_LIB_SUPPORT), \
+ JAR := $(TEST_LIB_SUPPORT)/test-lib.jar, \
+))
+
+TARGETS += $(BUILD_TEST_LIB_JAR)
+
+##########################################################################################
+
+all: $(TARGETS)
+
+.PHONY: default all
--- a/modules.xml Thu Sep 17 09:19:40 2015 -0700
+++ b/modules.xml Tue Sep 22 11:01:54 2015 -0700
@@ -277,6 +277,7 @@
<to>jdk.jvmstat</to>
<to>jdk.management.resource</to>
<to>jdk.pack200</to>
+ <to>jdk.scripting.nashorn</to>
<to>jdk.security.auth</to>
<to>jdk.security.jgss</to>
<to>jdk.snmp</to>
--- a/nashorn/.hgtags Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/.hgtags Tue Sep 22 11:01:54 2015 -0700
@@ -315,3 +315,4 @@
9b3eca69b88b2d1bebce92d58280ae66fc0b6091 jdk9-b79
61b401b23fc28208930977d46b690423911173c6 jdk9-b80
42d8ed4651b62572b39e6fed3fafcb7ee93f9dc2 jdk9-b81
+8bab0a9d8a638affdd680c5ec783373f71c19267 jdk9-b82
--- a/nashorn/samples/EvalWithArbitraryThis.java.orig Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of Oracle nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import javax.script.*;
-import jdk.nashorn.api.scripting.*;
-
-// Simple nashorn demo that evals a script with arbitrary script
-// object bound as "this" for the evaluated script.
-
-public class EvalWithArbitraryThis {
- public static void main(String[] args) throws Exception {
- ScriptEngineManager m = new ScriptEngineManager();
- ScriptEngine e = m.getEngineByName("nashorn");
- Object sobj = e.eval("( { foo: 343, bar: 'hello' } )");
-
- // "this" bound to sobj in this eval.
- // so it prints sobj.foo and sobj.bar.
- ((ScriptObjectMirror)sobj).eval("print(this.foo); print(this.bar)");
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/exceptionswallow.js Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,136 @@
+#// Usage: jjs exceptionswallow.js -- <directory>
+
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This example demonstrates Java subclassing by Java.extend
+// and javac Compiler and Tree API. This example looks for
+// empty catch blocks ("exception swallow") and reports those.
+
+if (arguments.length == 0) {
+ print("Usage: jjs exceptionswallow.js -- <directory>");
+ exit(1);
+}
+
+// Java types used
+var File = Java.type("java.io.File");
+var Files = Java.type("java.nio.file.Files");
+var StringArray = Java.type("java.lang.String[]");
+var ToolProvider = Java.type("javax.tools.ToolProvider");
+var Tree = Java.type("com.sun.source.tree.Tree");
+var EmptyStatementTree = Java.type("com.sun.source.tree.EmptyStatementTree");
+var Trees = Java.type("com.sun.source.util.Trees");
+var TreeScanner = Java.type("com.sun.source.util.TreeScanner");
+
+// printEmptyCatch
+
+function printEmptyCatch() {
+ // get the system compiler tool
+ var compiler = ToolProvider.systemJavaCompiler;
+ // get standard file manager
+ var fileMgr = compiler.getStandardFileManager(null, null, null);
+ // Using Java.to convert script array (arguments) to a Java String[]
+ var compUnits = fileMgr.getJavaFileObjects(
+ Java.to(arguments, StringArray));
+ // create a new compilation task
+ var task = compiler.getTask(null, fileMgr, null, null, null, compUnits);
+
+ // SourcePositions object to get positions of AST nodes
+ var sourcePositions = Trees.instance(task).sourcePositions;
+
+ // subclass SimpleTreeVisitor - to print empty catch
+ var EmptyCatchFinder = Java.extend(TreeScanner);
+
+ function hasOnlyEmptyStats(stats) {
+ var itr = stats.iterator();
+ while (itr.hasNext()) {
+ if (! (itr.next() instanceof EmptyStatementTree)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ var visitor = new EmptyCatchFinder() {
+ // current CompilationUnitTree
+ compUnit: null,
+ // current LineMap (pos -> line, column)
+ lineMap: null,
+ // current compilation unit's file name
+ fileName: null,
+
+ // overrides of TreeScanner methods
+
+ visitCompilationUnit: function(node, p) {
+ // capture info about current Compilation unit
+ this.compUnit = node;
+ this.lineMap = node.lineMap;
+ this.fileName = node.sourceFile.name;
+
+ // Using Java.super API to call super class method here
+ return Java.super(visitor).visitCompilationUnit(node, p);
+ },
+
+ visitCatch: function (node, p) {
+ var stats = node.block.statements;
+ if (stats.empty || hasOnlyEmptyStats(stats)) {
+ // print information on this empty catch
+ var pos = sourcePositions.getStartPosition(this.compUnit, node);
+ var line = this.lineMap.getLineNumber(pos);
+ var col = this.lineMap.getColumnNumber(pos);
+ print("Exception swallow" + " @ " + this.fileName + ":" + line + ":" + col);
+ // print(node);
+ }
+ }
+ }
+
+ for each (var cu in task.parse()) {
+ cu.accept(visitor, null);
+ }
+}
+
+// for each ".java" file in directory (recursively) and check it!
+function main(dir) {
+ Files.walk(dir.toPath()).
+ forEach(function(p) {
+ var name = p.toFile().absolutePath;
+ if (name.endsWith(".java")) {
+ try {
+ printEmptyCatch(p.toFile().getAbsolutePath());
+ } catch (e) {
+ print(e);
+ }
+ }
+ });
+}
+
+main(new File(arguments[0]));
--- a/nashorn/samples/find_nonfinals2.js Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/samples/find_nonfinals2.js Tue Sep 22 11:01:54 2015 -0700
@@ -43,7 +43,6 @@
// Java types used
var File = Java.type("java.io.File");
var Files = Java.type("java.nio.file.Files");
-var FileVisitOption = Java.type("java.nio.file.FileVisitOption");
var StringArray = Java.type("java.lang.String[]");
var ToolProvider = Java.type("javax.tools.ToolProvider");
var Tree = Java.type("com.sun.source.tree.Tree");
@@ -106,7 +105,7 @@
// for each ".java" file in directory (recursively).
function main(dir) {
var totalCount = 0;
- Files.walk(dir.toPath(), FileVisitOption.FOLLOW_LINKS).
+ Files.walk(dir.toPath()).
forEach(function(p) {
var name = p.toFile().absolutePath;
if (name.endsWith(".java")) {
--- a/nashorn/samples/javafoovars.js Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/samples/javafoovars.js Tue Sep 22 11:01:54 2015 -0700
@@ -42,7 +42,6 @@
// Java types used
var File = Java.type("java.io.File");
var Files = Java.type("java.nio.file.Files");
-var FileVisitOption = Java.type("java.nio.file.FileVisitOption");
var StringArray = Java.type("java.lang.String[]");
var ToolProvider = Java.type("javax.tools.ToolProvider");
var Tree = Java.type("com.sun.source.tree.Tree");
@@ -81,7 +80,7 @@
// for each ".java" file in directory (recursively) count "foo".
function main(dir) {
var totalCount = 0;
- Files.walk(dir.toPath(), FileVisitOption.FOLLOW_LINKS).
+ Files.walk(dir.toPath()).
forEach(function(p) {
var name = p.toFile().absolutePath;
if (name.endsWith(".java")) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/resourcetrysuggester.js Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,156 @@
+#// Usage: jjs resourcetrysuggester.js -- <directory>
+
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This example demonstrates Java subclassing by Java.extend
+// and javac Compiler and Tree API. This example looks for
+// finally clauses with "close" call and suggests "resource try"!
+
+if (arguments.length == 0) {
+ print("Usage: jjs resourcetrysuggester.js -- <directory>");
+ exit(1);
+}
+
+// Java types used
+var ExpressionStatementTree = Java.type("com.sun.source.tree.ExpressionStatementTree");
+var File = Java.type("java.io.File");
+var Files = Java.type("java.nio.file.Files");
+var MemberSelectTree = Java.type("com.sun.source.tree.MemberSelectTree");
+var MethodInvocationTree = Java.type("com.sun.source.tree.MethodInvocationTree");
+var StringArray = Java.type("java.lang.String[]");
+var ToolProvider = Java.type("javax.tools.ToolProvider");
+var Tree = Java.type("com.sun.source.tree.Tree");
+var Trees = Java.type("com.sun.source.util.Trees");
+var TreeScanner = Java.type("com.sun.source.util.TreeScanner");
+
+// resourceTrySuggestions
+
+function resourceTrySuggestions() {
+ // get the system compiler tool
+ var compiler = ToolProvider.systemJavaCompiler;
+ // get standard file manager
+ var fileMgr = compiler.getStandardFileManager(null, null, null);
+ // Using Java.to convert script array (arguments) to a Java String[]
+ var compUnits = fileMgr.getJavaFileObjects(
+ Java.to(arguments, StringArray));
+ // create a new compilation task
+ var task = compiler.getTask(null, fileMgr, null, null, null, compUnits);
+
+ // SourcePositions object to get positions of AST nodes
+ var sourcePositions = Trees.instance(task).sourcePositions;
+
+ // subclass SimpleTreeVisitor - to print resource try suggestions
+ var ResourceTrySuggester = Java.extend(TreeScanner);
+
+ function hasOnlyEmptyStats(stats) {
+ var itr = stats.iterator();
+ while (itr.hasNext()) {
+ if (! (itr.next() instanceof EmptyStatementTree)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // does the given statement list has an expression statement which
+ // calls "close" method (don't worry about types - just crude one will do)
+ function hasCloseCall(stats) {
+ var itr = stats.iterator();
+ while (itr.hasNext()) {
+ var stat = itr.next();
+ if (stat instanceof ExpressionStatementTree) {
+ var expr = stat.expression;
+ if (expr instanceof MethodInvocationTree) {
+ var method = expr.methodSelect;
+ if (method instanceof MemberSelectTree) {
+ return method.identifier.toString().equals("close");
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ var visitor = new ResourceTrySuggester() {
+ // current CompilationUnitTree
+ compUnit: null,
+ // current LineMap (pos -> line, column)
+ lineMap: null,
+ // current compilation unit's file name
+ fileName: null,
+
+ // overrides of TreeScanner methods
+
+ visitCompilationUnit: function(node, p) {
+ // capture info about current Compilation unit
+ this.compUnit = node;
+ this.lineMap = node.lineMap;
+ this.fileName = node.sourceFile.name;
+
+ // Using Java.super API to call super class method here
+ return Java.super(visitor).visitCompilationUnit(node, p);
+ },
+
+ visitTry: function (node, p) {
+ var finallyBlk = node.finallyBlock;
+ if (finallyBlk != null && hasCloseCall(finallyBlk.statements)) {
+ var pos = sourcePositions.getStartPosition(this.compUnit, node);
+ var line = this.lineMap.getLineNumber(pos);
+ var col = this.lineMap.getColumnNumber(pos);
+ print("Consider resource try statement " + " @ " + this.fileName + ":" + line + ":" + col);
+ // print(node);
+ }
+ }
+ }
+
+ for each (var cu in task.parse()) {
+ cu.accept(visitor, null);
+ }
+}
+
+// for each ".java" file in directory (recursively) and check it!
+function main(dir) {
+ Files.walk(dir.toPath()).
+ forEach(function(p) {
+ var name = p.toFile().absolutePath;
+ if (name.endsWith(".java")) {
+ try {
+ resourceTrySuggestions(p.toFile().getAbsolutePath());
+ } catch (e) {
+ print(e);
+ }
+ }
+ });
+}
+
+main(new File(arguments[0]));
--- a/nashorn/samples/zipfs.js Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/samples/zipfs.js Tue Sep 22 11:01:54 2015 -0700
@@ -36,13 +36,12 @@
var Files = Java.type("java.nio.file.Files")
var FileSystems = Java.type("java.nio.file.FileSystems")
-var FileVisitOption = Java.type("java.nio.file.FileVisitOption")
var Paths = Java.type("java.nio.file.Paths")
var zipfile = Paths.get(arguments[0])
var fs = FileSystems.newFileSystem(zipfile, null)
var root = fs.rootDirectories[0]
-Files.walk(root, FileVisitOption.FOLLOW_LINKS).forEach(
+Files.walk(root).forEach(
function(p) (print(p), print(Files.readAttributes(p, "zip:*")))
)
fs.close()
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/EditPad.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/EditPad.java Tue Sep 22 11:01:54 2015 -0700
@@ -49,8 +49,8 @@
private final boolean[] closeLock;
private final Consumer<String> saveHandler;
- EditPad(Consumer<String> errorHandler, String initialText,
- boolean[] closeLock, Consumer<String> saveHandler) {
+ EditPad(final Consumer<String> errorHandler, final String initialText,
+ final boolean[] closeLock, final Consumer<String> saveHandler) {
super("Edit Pad (Experimental)");
this.errorHandler = errorHandler;
this.initialText = initialText;
@@ -62,7 +62,7 @@
public void run() {
addWindowListener(new WindowAdapter() {
@Override
- public void windowClosing(WindowEvent e) {
+ public void windowClosing(final WindowEvent e) {
EditPad.this.dispose();
notifyClose();
}
@@ -77,7 +77,7 @@
setVisible(true);
}
- private JPanel buttons(JTextArea textArea) {
+ private JPanel buttons(final JTextArea textArea) {
FlowLayout flow = new FlowLayout();
flow.setHgap(35);
JPanel buttons = new JPanel(flow);
@@ -118,8 +118,8 @@
}
}
- static void edit(Consumer<String> errorHandler, String initialText,
- Consumer<String> saveHandler) {
+ static void edit(final Consumer<String> errorHandler, final String initialText,
+ final Consumer<String> saveHandler) {
boolean[] closeLock = new boolean[1];
SwingUtilities.invokeLater(
new EditPad(errorHandler, initialText, closeLock, saveHandler));
@@ -127,7 +127,7 @@
while (!closeLock[0]) {
try {
closeLock.wait();
- } catch (InterruptedException ex) {
+ } catch (final InterruptedException ex) {
// ignore and loop
}
}
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/ExternalEditor.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/ExternalEditor.java Tue Sep 22 11:01:54 2015 -0700
@@ -49,13 +49,13 @@
private Path dir;
private Path tmpfile;
- ExternalEditor(Consumer<String> errorHandler, Consumer<String> saveHandler, Console input) {
+ ExternalEditor(final Consumer<String> errorHandler, final Consumer<String> saveHandler, final Console input) {
this.errorHandler = errorHandler;
this.saveHandler = saveHandler;
this.input = input;
}
- private void edit(String cmd, String initialText) {
+ private void edit(final String cmd, final String initialText) {
try {
setupWatch(initialText);
launch(cmd);
@@ -67,7 +67,7 @@
/**
* Creates a WatchService and registers the given directory
*/
- private void setupWatch(String initialText) throws IOException {
+ private void setupWatch(final String initialText) throws IOException {
this.watcher = FileSystems.getDefault().newWatchService();
this.dir = Files.createTempDirectory("REPL");
this.tmpfile = Files.createTempFile(dir, null, ".js");
@@ -81,9 +81,9 @@
WatchKey key;
try {
key = watcher.take();
- } catch (ClosedWatchServiceException ex) {
+ } catch (final ClosedWatchServiceException ex) {
break;
- } catch (InterruptedException ex) {
+ } catch (final InterruptedException ex) {
continue; // tolerate an intrupt
}
@@ -103,7 +103,7 @@
watchedThread.start();
}
- private void launch(String cmd) throws IOException {
+ private void launch(final String cmd) throws IOException {
ProcessBuilder pb = new ProcessBuilder(cmd, tmpfile.toString());
pb = pb.inheritIO();
@@ -111,9 +111,9 @@
input.suspend();
Process process = pb.start();
process.waitFor();
- } catch (IOException ex) {
+ } catch (final IOException ex) {
errorHandler.accept("process IO failure: " + ex.getMessage());
- } catch (InterruptedException ex) {
+ } catch (final InterruptedException ex) {
errorHandler.accept("process interrupt: " + ex.getMessage());
} finally {
try {
@@ -132,7 +132,7 @@
List<String> lines;
try {
lines = Files.readAllLines(tmpfile);
- } catch (IOException ex) {
+ } catch (final IOException ex) {
errorHandler.accept("Failure read edit file: " + ex.getMessage());
return ;
}
@@ -144,8 +144,8 @@
saveHandler.accept(sb.toString());
}
- static void edit(String cmd, Consumer<String> errorHandler, String initialText,
- Consumer<String> saveHandler, Console input) {
+ static void edit(final String cmd, final Consumer<String> errorHandler, final String initialText,
+ final Consumer<String> saveHandler, final Console input) {
ExternalEditor ed = new ExternalEditor(errorHandler, saveHandler, input);
ed.edit(cmd, initialText);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java Tue Sep 22 11:01:54 2015 -0700
@@ -40,7 +40,6 @@
import jdk.nashorn.internal.ir.CallNode;
import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.Node;
@@ -384,7 +383,7 @@
callSiteTypes.pop();
explodedArguments.pop();
- return newFunctionNode.setState(lc, CompilationState.BUILTINS_TRANSFORMED);
+ return newFunctionNode;
}
private static boolean isApply(final CallNode callNode) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java Tue Sep 22 11:01:54 2015 -0700
@@ -65,7 +65,6 @@
import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IndexNode;
import jdk.nashorn.internal.ir.LexicalContext;
@@ -828,7 +827,7 @@
lc.applyTopFlags(functionNode))))
.setThisProperties(lc, thisProperties.pop().size()));
}
- return finalizedFunction.setState(lc, CompilationState.SYMBOLS_ASSIGNED);
+ return finalizedFunction;
}
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Tue Sep 22 11:01:54 2015 -0700
@@ -93,7 +93,6 @@
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.GetSplitState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IfNode;
@@ -2142,7 +2141,7 @@
markOptimistic = false;
}
- FunctionNode newFunctionNode = functionNode.setState(lc, CompilationState.BYTECODE_GENERATED);
+ FunctionNode newFunctionNode = functionNode;
if (markOptimistic) {
newFunctionNode = newFunctionNode.setFlag(lc, FunctionNode.IS_DEOPTIMIZABLE);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,32 +25,17 @@
package jdk.nashorn.internal.codegen;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.BUILTINS_TRANSFORMED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.BYTECODE_GENERATED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.BYTECODE_INSTALLED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.CONSTANT_FOLDED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.INITIALIZED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.LOCAL_VARIABLE_TYPES_CALCULATED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.LOWERED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.OPTIMISTIC_TYPES_ASSIGNED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.PARSED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.SCOPE_DEPTHS_COMPUTED;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.SPLIT;
-import static jdk.nashorn.internal.ir.FunctionNode.CompilationState.SYMBOLS_ASSIGNED;
import static jdk.nashorn.internal.runtime.logging.DebugLogger.quote;
import java.io.PrintWriter;
-import java.util.EnumSet;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import jdk.nashorn.internal.AssertsEnabled;
import jdk.nashorn.internal.codegen.Compiler.CompilationPhases;
import jdk.nashorn.internal.ir.Block;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.LiteralNode;
import jdk.nashorn.internal.ir.Node;
@@ -67,15 +52,9 @@
* A compilation phase is a step in the processes of turning a JavaScript
* FunctionNode into bytecode. It has an optional return value.
*/
-enum CompilationPhase {
- /**
- * Constant folding pass Simple constant folding that will make elementary
- * constructs go away
- */
- CONSTANT_FOLDING_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED)) {
+abstract class CompilationPhase {
+
+ private static final class ConstantFoldingPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
return transformFunction(fn, new FoldConstants(compiler));
@@ -85,20 +64,15 @@
public String toString() {
return "'Constant Folding'";
}
- },
+ }
/**
- * Lower (Control flow pass) Finalizes the control flow. Clones blocks for
- * finally constructs and similar things. Establishes termination criteria
- * for nodes Guarantee return instructions to method making sure control
- * flow cannot fall off the end. Replacing high level nodes with lower such
- * as runtime nodes where applicable.
+ * Constant folding pass Simple constant folding that will make elementary
+ * constructs go away
*/
- LOWERING_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED)) {
+ static final CompilationPhase CONSTANT_FOLDING_PHASE = new ConstantFoldingPhase();
+
+ private static final class LoweringPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
return transformFunction(fn, new Lower(compiler));
@@ -108,42 +82,35 @@
public String toString() {
return "'Control Flow Lowering'";
}
- },
+ }
/**
- * Phase used only when doing optimistic code generation. It assigns all potentially
- * optimistic ops a program point so that an UnwarrantedException knows from where
- * a guess went wrong when creating the continuation to roll back this execution
+ * Lower (Control flow pass) Finalizes the control flow. Clones blocks for
+ * finally constructs and similar things. Establishes termination criteria
+ * for nodes Guarantee return instructions to method making sure control
+ * flow cannot fall off the end. Replacing high level nodes with lower such
+ * as runtime nodes where applicable.
*/
- TRANSFORM_BUILTINS_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED)) {
- //we only do this if we have a param type map, otherwise this is not a specialized recompile
+ static final CompilationPhase LOWERING_PHASE = new LoweringPhase();
+
+ private static final class ApplySpecializationPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
- return setStates(transformFunction(fn, new ApplySpecialization(compiler)), BUILTINS_TRANSFORMED);
+ return transformFunction(fn, new ApplySpecialization(compiler));
}
@Override
public String toString() {
return "'Builtin Replacement'";
}
- },
+ };
/**
- * Splitter Split the AST into several compile units based on a heuristic size calculation.
- * Split IR can lead to scope information being changed.
+ * Phase used to transform Function.prototype.apply.
*/
- SPLITTING_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED)) {
+ static final CompilationPhase APPLY_SPECIALIZATION_PHASE = new ApplySpecializationPhase();
+
+ private static final class SplittingPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
final CompileUnit outermostCompileUnit = compiler.addCompileUnit(0L);
@@ -170,16 +137,15 @@
public String toString() {
return "'Code Splitting'";
}
- },
+ };
- PROGRAM_POINT_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT)) {
+ /**
+ * Splitter Split the AST into several compile units based on a heuristic size calculation.
+ * Split IR can lead to scope information being changed.
+ */
+ static final CompilationPhase SPLITTING_PHASE = new SplittingPhase();
+
+ private static final class ProgramPointPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
return transformFunction(fn, new ProgramPoints());
@@ -189,16 +155,16 @@
public String toString() {
return "'Program Point Calculation'";
}
- },
+ };
- CACHE_AST(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT)) {
+ /**
+ * Phase used only when doing optimistic code generation. It assigns all potentially
+ * optimistic ops a program point so that an UnwarrantedException knows from where
+ * a guess went wrong when creating the continuation to roll back this execution
+ */
+ static final CompilationPhase PROGRAM_POINT_PHASE = new ProgramPointPhase();
+
+ private static final class CacheAstPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
if (!compiler.isOnDemandCompilation()) {
@@ -217,16 +183,11 @@
public String toString() {
return "'Cache ASTs'";
}
- },
+ };
- SYMBOL_ASSIGNMENT_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT)) {
+ static final CompilationPhase CACHE_AST_PHASE = new CacheAstPhase();
+
+ private static final class SymbolAssignmentPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
return transformFunction(fn, new AssignSymbols(compiler));
@@ -236,17 +197,11 @@
public String toString() {
return "'Symbol Assignment'";
}
- },
+ };
- SCOPE_DEPTH_COMPUTATION_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT,
- SYMBOLS_ASSIGNED)) {
+ static final CompilationPhase SYMBOL_ASSIGNMENT_PHASE = new SymbolAssignmentPhase();
+
+ private static final class ScopeDepthComputationPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
return transformFunction(fn, new FindScopeDepths(compiler));
@@ -256,18 +211,11 @@
public String toString() {
return "'Scope Depth Computation'";
}
- },
+ }
- DECLARE_LOCAL_SYMBOLS_TO_COMPILER(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT,
- SYMBOLS_ASSIGNED,
- SCOPE_DEPTHS_COMPUTED)) {
+ static final CompilationPhase SCOPE_DEPTH_COMPUTATION_PHASE = new ScopeDepthComputationPhase();
+
+ private static final class DeclareLocalSymbolsPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
// It's not necessary to guard the marking of symbols as locals with this "if" condition for
@@ -301,43 +249,28 @@
public String toString() {
return "'Local Symbols Declaration'";
}
- },
+ };
- OPTIMISTIC_TYPE_ASSIGNMENT_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT,
- SYMBOLS_ASSIGNED,
- SCOPE_DEPTHS_COMPUTED)) {
+ static final CompilationPhase DECLARE_LOCAL_SYMBOLS_PHASE = new DeclareLocalSymbolsPhase();
+
+ private static final class OptimisticTypeAssignmentPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
if (compiler.useOptimisticTypes()) {
return transformFunction(fn, new OptimisticTypesCalculator(compiler));
}
- return setStates(fn, OPTIMISTIC_TYPES_ASSIGNED);
+ return fn;
}
@Override
public String toString() {
return "'Optimistic Type Assignment'";
}
- },
+ }
- LOCAL_VARIABLE_TYPE_CALCULATION_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT,
- SYMBOLS_ASSIGNED,
- SCOPE_DEPTHS_COMPUTED,
- OPTIMISTIC_TYPES_ASSIGNED)) {
+ static final CompilationPhase OPTIMISTIC_TYPE_ASSIGNMENT_PHASE = new OptimisticTypeAssignmentPhase();
+
+ private static final class LocalVariableTypeCalculationPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
final FunctionNode newFunctionNode = transformFunction(fn, new LocalVariableTypesCalculator(compiler));
@@ -362,25 +295,11 @@
public String toString() {
return "'Local Variable Type Calculation'";
}
- },
-
+ };
- /**
- * Reuse compile units, if they are already present. We are using the same compiler
- * to recompile stuff
- */
- REUSE_COMPILE_UNITS_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT,
- SYMBOLS_ASSIGNED,
- SCOPE_DEPTHS_COMPUTED,
- OPTIMISTIC_TYPES_ASSIGNED,
- LOCAL_VARIABLE_TYPES_CALCULATED)) {
+ static final CompilationPhase LOCAL_VARIABLE_TYPE_CALCULATION_PHASE = new LocalVariableTypeCalculationPhase();
+
+ private static final class ReuseCompileUnitsPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
assert phases.isRestOfCompilation() : "reuse compile units currently only used for Rest-Of methods";
@@ -428,16 +347,15 @@
public String toString() {
return "'Reuse Compile Units'";
}
- },
+ }
- REINITIALIZE_CACHED(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT)) {
+ /**
+ * Reuse compile units, if they are already present. We are using the same compiler
+ * to recompile stuff
+ */
+ static final CompilationPhase REUSE_COMPILE_UNITS_PHASE = new ReuseCompileUnitsPhase();
+
+ private static final class ReinitializeCachedPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
final Set<CompileUnit> unitSet = CompileUnit.createCompileUnitSet();
@@ -480,26 +398,11 @@
public String toString() {
return "'Reinitialize cached'";
}
- },
+ }
- /**
- * Bytecode generation:
- *
- * Generate the byte code class(es) resulting from the compiled FunctionNode
- */
- BYTECODE_GENERATION_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT,
- SYMBOLS_ASSIGNED,
- SCOPE_DEPTHS_COMPUTED,
- OPTIMISTIC_TYPES_ASSIGNED,
- LOCAL_VARIABLE_TYPES_CALCULATED)) {
+ static final CompilationPhase REINITIALIZE_CACHED = new ReinitializeCachedPhase();
+ private static final class BytecodeGenerationPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
final ScriptEnvironment senv = compiler.getScriptEnvironment();
@@ -517,7 +420,7 @@
try {
// Explicitly set BYTECODE_GENERATED here; it can not be set in case of skipping codegen for :program
// in the lazy + optimistic world. See CodeGenerator.skipFunction().
- newFunctionNode = transformFunction(newFunctionNode, codegen).setState(null, BYTECODE_GENERATED);
+ newFunctionNode = transformFunction(newFunctionNode, codegen);
codegen.generateScopeCalls();
} catch (final VerifyError e) {
if (senv._verify_code || senv._print_code) {
@@ -565,22 +468,16 @@
public String toString() {
return "'Bytecode Generation'";
}
- },
+ }
- INSTALL_PHASE(
- EnumSet.of(
- INITIALIZED,
- PARSED,
- CONSTANT_FOLDED,
- LOWERED,
- BUILTINS_TRANSFORMED,
- SPLIT,
- SYMBOLS_ASSIGNED,
- SCOPE_DEPTHS_COMPUTED,
- OPTIMISTIC_TYPES_ASSIGNED,
- LOCAL_VARIABLE_TYPES_CALCULATED,
- BYTECODE_GENERATED)) {
+ /**
+ * Bytecode generation:
+ *
+ * Generate the byte code class(es) resulting from the compiled FunctionNode
+ */
+ static final CompilationPhase BYTECODE_GENERATION_PHASE = new BytecodeGenerationPhase();
+ private static final class InstallPhase extends CompilationPhase {
@Override
FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode fn) {
final DebugLogger log = compiler.getLogger();
@@ -591,8 +488,9 @@
Class<?> rootClass = null;
long length = 0L;
- final CodeInstaller codeInstaller = compiler.getCodeInstaller();
- final Map<String, byte[]> bytecode = compiler.getBytecode();
+ final CodeInstaller origCodeInstaller = compiler.getCodeInstaller();
+ final Map<String, byte[]> bytecode = compiler.getBytecode();
+ final CodeInstaller codeInstaller = bytecode.size() > 1 ? origCodeInstaller.getMultiClassCodeInstaller() : origCodeInstaller;
for (final Entry<String, byte[]> entry : bytecode.entrySet()) {
final String className = entry.getKey();
@@ -648,18 +546,16 @@
log.fine(sb.toString());
}
- return setStates(fn.setRootClass(null, rootClass), BYTECODE_INSTALLED);
+ return fn.setRootClass(null, rootClass);
}
@Override
public String toString() {
return "'Class Installation'";
}
-
- };
+ }
- /** pre conditions required for function node to which this transform is to be applied */
- private final EnumSet<CompilationState> pre;
+ static final CompilationPhase INSTALL_PHASE = new InstallPhase();
/** start time of transform - used for timing, see {@link jdk.nashorn.internal.runtime.Timing} */
private long startTime;
@@ -670,21 +566,7 @@
/** boolean that is true upon transform completion */
private boolean isFinished;
- private CompilationPhase(final EnumSet<CompilationState> pre) {
- this.pre = pre;
- }
-
- private static FunctionNode setStates(final FunctionNode functionNode, final CompilationState state) {
- if (!AssertsEnabled.assertsEnabled()) {
- return functionNode;
- }
- return transformFunction(functionNode, new NodeVisitor<LexicalContext>(new LexicalContext()) {
- @Override
- public Node leaveFunctionNode(final FunctionNode fn) {
- return fn.setState(lc, state);
- }
- });
- }
+ private CompilationPhase() {}
/**
* Start a compilation phase
@@ -694,23 +576,7 @@
*/
protected FunctionNode begin(final Compiler compiler, final FunctionNode functionNode) {
compiler.getLogger().indent();
-
- assert pre != null;
-
- if (!functionNode.hasState(pre)) {
- final StringBuilder sb = new StringBuilder("Compilation phase ");
- sb.append(this).
- append(" is not applicable to ").
- append(quote(functionNode.getName())).
- append("\n\tFunctionNode state = ").
- append(functionNode.getState()).
- append("\n\tRequired state = ").
- append(this.pre);
-
- throw new CompilationException(sb.toString());
- }
-
- startTime = System.nanoTime();
+ startTime = System.nanoTime();
return functionNode;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Tue Sep 22 11:01:54 2015 -0700
@@ -172,17 +172,17 @@
"Common initial phases",
CompilationPhase.CONSTANT_FOLDING_PHASE,
CompilationPhase.LOWERING_PHASE,
- CompilationPhase.TRANSFORM_BUILTINS_PHASE,
+ CompilationPhase.APPLY_SPECIALIZATION_PHASE,
CompilationPhase.SPLITTING_PHASE,
CompilationPhase.PROGRAM_POINT_PHASE,
CompilationPhase.SYMBOL_ASSIGNMENT_PHASE,
CompilationPhase.SCOPE_DEPTH_COMPUTATION_PHASE,
- CompilationPhase.CACHE_AST
+ CompilationPhase.CACHE_AST_PHASE
);
private final static CompilationPhases COMPILE_CACHED_UPTO_BYTECODE = new CompilationPhases(
"After common phases, before bytecode generator",
- CompilationPhase.DECLARE_LOCAL_SYMBOLS_TO_COMPILER,
+ CompilationPhase.DECLARE_LOCAL_SYMBOLS_PHASE,
CompilationPhase.OPTIMISTIC_TYPE_ASSIGNMENT_PHASE,
CompilationPhase.LOCAL_VARIABLE_TYPE_CALCULATION_PHASE
);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java Tue Sep 22 11:01:54 2015 -0700
@@ -34,7 +34,6 @@
import java.util.Set;
import jdk.nashorn.internal.ir.Block;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.Node;
@@ -180,8 +179,7 @@
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
final String name = functionNode.getName();
- FunctionNode newFunctionNode = functionNode.setState(lc, CompilationState.SCOPE_DEPTHS_COMPUTED);
-
+ FunctionNode newFunctionNode = functionNode;
if (compiler.isOnDemandCompilation()) {
final RecompilableScriptFunctionData data = compiler.getScriptFunctionData(newFunctionNode.getId());
if (data.inDynamicContext()) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java Tue Sep 22 11:01:54 2015 -0700
@@ -37,7 +37,6 @@
import jdk.nashorn.internal.ir.EmptyNode;
import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IfNode;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.LiteralNode;
@@ -101,7 +100,7 @@
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
- return functionNode.setState(lc, CompilationState.CONSTANT_FOLDED);
+ return functionNode;
}
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java Tue Sep 22 11:01:54 2015 -0700
@@ -54,7 +54,6 @@
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.GetSplitState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IfNode;
@@ -1478,7 +1477,6 @@
newFunction = newFunction.setReturnType(lc, returnType);
- newFunction = newFunction.setState(lc, CompilationState.LOCAL_VARIABLE_TYPES_CALCULATED);
newFunction = newFunction.setParameters(lc, newFunction.visitParameters(applyChangesVisitor));
return newFunction;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java Tue Sep 22 11:01:54 2015 -0700
@@ -52,7 +52,6 @@
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IfNode;
import jdk.nashorn.internal.ir.IndexNode;
@@ -276,7 +275,7 @@
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
log.info("END FunctionNode: ", functionNode.getName());
- return functionNode.setState(lc, CompilationState.LOWERED);
+ return functionNode;
}
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java Tue Sep 22 11:01:54 2015 -0700
@@ -38,7 +38,6 @@
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IfNode;
import jdk.nashorn.internal.ir.IndexNode;
@@ -208,7 +207,7 @@
@Override
public Node leaveFunctionNode(final FunctionNode functionNode) {
neverOptimistic.pop();
- return functionNode.setState(lc, CompilationState.OPTIMISTIC_TYPES_ASSIGNED);
+ return functionNode;
}
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ReplaceCompileUnits.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ReplaceCompileUnits.java Tue Sep 22 11:01:54 2015 -0700
@@ -29,7 +29,6 @@
import java.util.List;
import jdk.nashorn.internal.ir.CompileUnitHolder;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.LiteralNode;
import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
@@ -64,7 +63,7 @@
@Override
public Node leaveFunctionNode(final FunctionNode node) {
- return node.setCompileUnit(lc, getExistingReplacement(node)).setState(lc, CompilationState.COMPILE_UNITS_REUSED);
+ return node.setCompileUnit(lc, getExistingReplacement(node));
}
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SplitIntoFunctions.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SplitIntoFunctions.java Tue Sep 22 11:01:54 2015 -0700
@@ -47,7 +47,6 @@
import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.GetSplitState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IfNode;
@@ -176,11 +175,9 @@
// we still use IS_SPLIT as the criteria in CompilationPhase.SERIALIZE_SPLIT_PHASE.
FunctionNode.IS_ANONYMOUS | FunctionNode.USES_ANCESTOR_SCOPE | FunctionNode.IS_SPLIT,
body,
- CompilationState.INITIALIZED,
null
)
- .setCompileUnit(lc, splitNode.getCompileUnit())
- .copyCompilationState(lc, originalFn);
+ .setCompileUnit(lc, splitNode.getCompileUnit());
// Call the function:
// either "(function () { ... }).call(this)"
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Splitter.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Splitter.java Tue Sep 22 11:01:54 2015 -0700
@@ -33,7 +33,6 @@
import java.util.Map;
import jdk.nashorn.internal.ir.Block;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.LiteralNode;
import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
@@ -158,7 +157,7 @@
assert functionNode.getCompileUnit() != null;
- return functionNode.setState(null, CompilationState.SPLIT);
+ return functionNode;
}
private static List<FunctionNode> directChildren(final FunctionNode functionNode) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java Tue Sep 22 11:01:54 2015 -0700
@@ -33,10 +33,8 @@
import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.CALLSITE_TRACE_VALUES;
import java.util.Collections;
-import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
-import jdk.nashorn.internal.AssertsEnabled;
import jdk.nashorn.internal.codegen.CompileUnit;
import jdk.nashorn.internal.codegen.Compiler;
import jdk.nashorn.internal.codegen.CompilerConstants;
@@ -74,40 +72,6 @@
SETTER
}
- /** Compilation states available */
- public enum CompilationState {
- /** compiler is ready */
- INITIALIZED,
- /** method has been parsed */
- PARSED,
- /** method has been parsed */
- PARSE_ERROR,
- /** constant folding pass */
- CONSTANT_FOLDED,
- /** method has been lowered */
- LOWERED,
- /** program points have been assigned to unique locations */
- PROGRAM_POINTS_ASSIGNED,
- /** any transformations of builtins have taken place, e.g. apply=>call */
- BUILTINS_TRANSFORMED,
- /** method has been split */
- SPLIT,
- /** method has had symbols assigned */
- SYMBOLS_ASSIGNED,
- /** computed scope depths for symbols */
- SCOPE_DEPTHS_COMPUTED,
- /** method has had types calculated*/
- OPTIMISTIC_TYPES_ASSIGNED,
- /** method has had types calculated */
- LOCAL_VARIABLE_TYPES_CALCULATED,
- /** compile units reused (optional) */
- COMPILE_UNITS_REUSED,
- /** method has been emitted to bytecode */
- BYTECODE_GENERATED,
- /** method has been installed */
- BYTECODE_INSTALLED
- }
-
/** Source of entity. */
private transient final Source source;
@@ -145,10 +109,6 @@
/** Method's namespace. */
private transient final Namespace namespace;
- /** Current compilation state */
- @Ignore
- private final EnumSet<CompilationState> compilationState;
-
/** Number of properties of "this" object assigned in this function */
@Ignore
private final int thisProperties;
@@ -306,7 +266,6 @@
* @param kind kind of function as in {@link FunctionNode.Kind}
* @param flags initial flags
* @param body body of the function
- * @param state The initial state from the parser. Must be one of {@link CompilationState#PARSED} and {@link CompilationState#PARSE_ERROR}
* @param endParserState The parser state at the end of the parsing.
*/
public FunctionNode(
@@ -323,7 +282,6 @@
final FunctionNode.Kind kind,
final int flags,
final Block body,
- final CompilationState state,
final Object endParserState) {
super(token, finish);
@@ -336,7 +294,6 @@
this.firstToken = firstToken;
this.lastToken = lastToken;
this.namespace = namespace;
- this.compilationState = EnumSet.of(CompilationState.INITIALIZED, state);
this.flags = flags;
this.compileUnit = null;
this.body = body;
@@ -353,7 +310,6 @@
final String name,
final Type returnType,
final CompileUnit compileUnit,
- final EnumSet<CompilationState> compilationState,
final Block body,
final List<IdentNode> parameters,
final int thisProperties,
@@ -368,7 +324,6 @@
this.returnType = returnType;
this.compileUnit = compileUnit;
this.lastToken = lastToken;
- this.compilationState = compilationState;
this.body = body;
this.parameters = parameters;
this.thisProperties = thisProperties;
@@ -468,7 +423,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -544,80 +498,6 @@
}
/**
- * Get the compilation state of this function
- * @return the compilation state
- */
- public EnumSet<CompilationState> getState() {
- return compilationState;
- }
-
- /**
- * Check whether this FunctionNode has reached a give CompilationState.
- *
- * @param state the state to check for
- * @return true of the node is in the given state
- */
- public boolean hasState(final EnumSet<CompilationState> state) {
- return !AssertsEnabled.assertsEnabled() || compilationState.containsAll(state);
- }
-
- /**
- * Add a state to the total CompilationState of this node, e.g. if
- * FunctionNode has been lowered, the compiler will add
- * {@code CompilationState#LOWERED} to the state vector
- *
- * @param lc lexical context
- * @param state {@link CompilationState} to add
- * @return function node or a new one if state was changed
- */
- public FunctionNode setState(final LexicalContext lc, final CompilationState state) {
- if (!AssertsEnabled.assertsEnabled() || this.compilationState.contains(state)) {
- return this;
- }
- final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
- newState.add(state);
- return setCompilationState(lc, newState);
- }
-
- /**
- * Copy a compilation state from an original function to this function. Used when creating synthetic
- * function nodes by the splitter.
- *
- * @param lc lexical context
- * @param original the original function node to copy compilation state from
- * @return function node or a new one if state was changed
- */
- public FunctionNode copyCompilationState(final LexicalContext lc, final FunctionNode original) {
- final EnumSet<CompilationState> origState = original.compilationState;
- if (!AssertsEnabled.assertsEnabled() || this.compilationState.containsAll(origState)) {
- return this;
- }
- final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
- newState.addAll(origState);
- return setCompilationState(lc, newState);
- }
-
- private FunctionNode setCompilationState(final LexicalContext lc, final EnumSet<CompilationState> compilationState) {
- return Node.replaceInLexicalContext(
- lc,
- this,
- new FunctionNode(
- this,
- lastToken,
- endParserState,
- flags,
- name,
- returnType,
- compileUnit,
- compilationState,
- body,
- parameters,
- thisProperties,
- rootClass, source, namespace));
- }
-
-
- /**
* Create a unique name in the namespace of this FunctionNode
* @param base prefix for name
* @return base if no collision exists, otherwise a name prefix with base
@@ -682,7 +562,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -823,7 +702,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -919,7 +797,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -996,7 +873,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -1070,7 +946,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -1158,7 +1033,6 @@
name,
type,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -1224,7 +1098,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
@@ -1280,7 +1153,6 @@
name,
returnType,
compileUnit,
- compilationState,
body,
parameters,
thisProperties,
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java Tue Sep 22 11:01:54 2015 -0700
@@ -627,7 +627,7 @@
return new GuardedInvocation(MH.dropArguments(MH.constant(Object.class,
func.createBound(this, new Object[] { name })), 0, Object.class),
testJSAdaptor(adaptee, null, null, null),
- adaptee.getProtoSwitchPoint(__call__, find.getOwner()));
+ adaptee.getProtoSwitchPoints(__call__, find.getOwner()), null);
}
}
throw typeError("no.such.function", desc.getNameToken(2), ScriptRuntime.safeToString(this));
@@ -698,7 +698,7 @@
return new GuardedInvocation(
methodHandle,
testJSAdaptor(adaptee, findData.getGetter(Object.class, INVALID_PROGRAM_POINT, null), findData.getOwner(), func),
- adaptee.getProtoSwitchPoint(hook, findData.getOwner()));
+ adaptee.getProtoSwitchPoints(hook, findData.getOwner()), null);
}
}
}
@@ -710,7 +710,7 @@
final MethodHandle methodHandle = hook.equals(__put__) ?
MH.asType(Lookup.EMPTY_SETTER, type) :
Lookup.emptyGetter(type.returnType());
- return new GuardedInvocation(methodHandle, testJSAdaptor(adaptee, null, null, null), adaptee.getProtoSwitchPoint(hook, null));
+ return new GuardedInvocation(methodHandle, testJSAdaptor(adaptee, null, null, null), adaptee.getProtoSwitchPoints(hook, null), null);
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Tue Sep 22 11:01:54 2015 -0700
@@ -345,7 +345,8 @@
/**
* Given a script object and a Java type, converts the script object into the desired Java type. Currently it
* performs shallow creation of Java arrays, as well as wrapping of objects in Lists, Dequeues, Queues,
- * and Collections. Example:
+ * and Collections. If conversion is not possible or fails for some reason, TypeError is thrown.
+ * Example:
* <pre>
* var anArray = [1, "13", false]
* var javaIntArray = Java.to(anArray, "int[]")
@@ -389,7 +390,11 @@
}
if(targetClass.isArray()) {
- return JSType.toJavaArray(obj, targetClass.getComponentType());
+ try {
+ return JSType.toJavaArray(obj, targetClass.getComponentType());
+ } catch (final Exception exp) {
+ throw typeError(exp, "java.array.conversion.failed", targetClass.getName());
+ }
}
if (targetClass == List.class || targetClass == Deque.class || targetClass == Queue.class || targetClass == Collection.class) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java Tue Sep 22 11:01:54 2015 -0700
@@ -134,7 +134,7 @@
}
@Override
- protected Object invokeNoSuchProperty(final String name, final int programPoint) {
+ protected Object invokeNoSuchProperty(final String name, final boolean isScope, final int programPoint) {
final Object retval = createProperty(name);
if (isValid(programPoint)) {
throw new UnwarrantedOptimismException(retval, programPoint);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Tue Sep 22 11:01:54 2015 -0700
@@ -84,7 +84,6 @@
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IfNode;
import jdk.nashorn.internal.ir.IndexNode;
@@ -487,7 +486,6 @@
}
private FunctionNode createFunctionNode(final ParserContextFunctionNode function, final long startToken, final IdentNode ident, final List<IdentNode> parameters, final FunctionNode.Kind kind, final int functionLine, final Block body){
- final CompilationState state = errors.hasErrors() ? CompilationState.PARSE_ERROR : CompilationState.PARSED;
// Start new block.
final FunctionNode functionNode =
new FunctionNode(
@@ -504,7 +502,6 @@
kind,
function.getFlags(),
body,
- state,
function.getEndParserState());
printAST(functionNode);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java Tue Sep 22 11:01:54 2015 -0700
@@ -29,6 +29,7 @@
import java.io.Serializable;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
+import java.lang.ref.WeakReference;
import jdk.nashorn.internal.codegen.Compiler;
import jdk.nashorn.internal.codegen.CompilerConstants;
import jdk.nashorn.internal.codegen.ObjectClassGenerator;
@@ -53,6 +54,9 @@
/** lazily generated allocator */
private transient MethodHandle allocator;
+ /** Last used allocator map */
+ private transient AllocatorMap lastMap;
+
/**
* Construct an allocation strategy with the given map and class name.
* @param fieldCount number of fields in the allocated object
@@ -71,11 +75,49 @@
return allocatorClassName;
}
- PropertyMap getAllocatorMap() {
- // Create a new map for each function instance
- return PropertyMap.newMap(null, getAllocatorClassName(), 0, fieldCount, 0);
+ /**
+ * Get the property map for the allocated object.
+ * @param prototype the prototype object
+ * @return the property map
+ */
+ synchronized PropertyMap getAllocatorMap(final ScriptObject prototype) {
+ assert prototype != null;
+ final PropertyMap protoMap = prototype.getMap();
+
+ if (lastMap != null) {
+ if (!lastMap.hasSharedProtoMap()) {
+ if (lastMap.hasSamePrototype(prototype)) {
+ return lastMap.allocatorMap;
+ }
+ if (lastMap.hasSameProtoMap(protoMap) && lastMap.hasUnchangedProtoMap()) {
+ // Convert to shared prototype map. Allocated objects will use the same property map
+ // that can be used as long as none of the prototypes modify the shared proto map.
+ final PropertyMap allocatorMap = PropertyMap.newMap(null, getAllocatorClassName(), 0, fieldCount, 0);
+ final SharedPropertyMap sharedProtoMap = new SharedPropertyMap(protoMap);
+ allocatorMap.setSharedProtoMap(sharedProtoMap);
+ prototype.setMap(sharedProtoMap);
+ lastMap = new AllocatorMap(prototype, protoMap, allocatorMap);
+ return allocatorMap;
+ }
+ }
+
+ if (lastMap.hasValidSharedProtoMap() && lastMap.hasSameProtoMap(protoMap)) {
+ prototype.setMap(lastMap.getSharedProtoMap());
+ return lastMap.allocatorMap;
+ }
+ }
+
+ final PropertyMap allocatorMap = PropertyMap.newMap(null, getAllocatorClassName(), 0, fieldCount, 0);
+ lastMap = new AllocatorMap(prototype, protoMap, allocatorMap);
+
+ return allocatorMap;
}
+ /**
+ * Allocate an object with the given property map
+ * @param map the property map
+ * @return the allocated object
+ */
ScriptObject allocate(final PropertyMap map) {
try {
if (allocator == null) {
@@ -94,4 +136,43 @@
public String toString() {
return "AllocationStrategy[fieldCount=" + fieldCount + "]";
}
+
+ static class AllocatorMap {
+ final private WeakReference<ScriptObject> prototype;
+ final private WeakReference<PropertyMap> prototypeMap;
+
+ private PropertyMap allocatorMap;
+
+ AllocatorMap(final ScriptObject prototype, final PropertyMap protoMap, final PropertyMap allocMap) {
+ this.prototype = new WeakReference<>(prototype);
+ this.prototypeMap = new WeakReference<>(protoMap);
+ this.allocatorMap = allocMap;
+ }
+
+ boolean hasSamePrototype(final ScriptObject proto) {
+ return prototype.get() == proto;
+ }
+
+ boolean hasSameProtoMap(final PropertyMap protoMap) {
+ return prototypeMap.get() == protoMap || allocatorMap.getSharedProtoMap() == protoMap;
+ }
+
+ boolean hasUnchangedProtoMap() {
+ final ScriptObject proto = prototype.get();
+ return proto != null && proto.getMap() == prototypeMap.get();
+ }
+
+ boolean hasSharedProtoMap() {
+ return getSharedProtoMap() != null;
+ }
+
+ boolean hasValidSharedProtoMap() {
+ return hasSharedProtoMap() && getSharedProtoMap().isValidSharedProtoMap();
+ }
+
+ PropertyMap getSharedProtoMap() {
+ return allocatorMap.getSharedProtoMap();
+ }
+
+ }
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java Tue Sep 22 11:01:54 2015 -0700
@@ -101,16 +101,24 @@
public StoredScript loadScript(Source source, String functionKey);
/**
- * Returns a new code installer that shares most of the functionality of this code installer, but uses a
- * new, independent class loader.
- * @return a new code installer with a new independent class loader.
+ * Returns a code installer {@code #isCompatibleWith(CodeInstaller) compatible with} this installer, but
+ * is suitable for on-demand compilations. Can return itself if it is itself suitable.
+ * @return a compatible code installer suitable for on-demand compilations.
*/
- public CodeInstaller withNewLoader();
+ public CodeInstaller getOnDemandCompilationInstaller();
+
+ /**
+ * Returns a code installer {@code #isCompatibleWith(CodeInstaller) compatible with} this installer, but
+ * is suitable for installation of multiple classes that reference each other by name. Should be used when
+ * a compilation job produces multiple compilation units. Can return itself if it is itself suitable.
+ * @return a compatible code installer suitable for installation of multiple classes.
+ */
+ public CodeInstaller getMultiClassCodeInstaller();
/**
* Returns true if this code installer is compatible with the other code installer. Compatibility is expected to be
* an equivalence relation, and installers are supposed to be compatible with those they create using
- * {@link #withNewLoader()}.
+ * {@link #getOnDemandCompilationInstaller()}.
* @param other the other code installer tested for compatibility with this code installer.
* @return true if this code installer is compatible with the other code installer.
*/
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Tue Sep 22 11:01:54 2015 -0700
@@ -25,6 +25,7 @@
package jdk.nashorn.internal.runtime;
+import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
import static jdk.nashorn.internal.codegen.CompilerConstants.CONSTANTS;
import static jdk.nashorn.internal.codegen.CompilerConstants.CREATE_PROGRAM_FUNCTION;
import static jdk.nashorn.internal.codegen.CompilerConstants.SOURCE;
@@ -41,8 +42,10 @@
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.invoke.SwitchPoint;
+import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
+import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.MalformedURLException;
@@ -61,14 +64,18 @@
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.atomic.LongAdder;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.logging.Level;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
import jdk.nashorn.api.scripting.ClassFilter;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
@@ -87,6 +94,7 @@
import jdk.nashorn.internal.runtime.logging.Logger;
import jdk.nashorn.internal.runtime.options.LoggingOption.LoggerInfo;
import jdk.nashorn.internal.runtime.options.Options;
+import sun.misc.Unsafe;
/**
* This class manages the global state of execution. Context is immutable.
@@ -128,9 +136,12 @@
private static final String LOAD_FX = "fx:";
private static final String LOAD_NASHORN = "nashorn:";
- private static MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
- private static MethodType CREATE_PROGRAM_FUNCTION_TYPE = MethodType.methodType(ScriptFunction.class, ScriptObject.class);
+ private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+ private static final MethodType CREATE_PROGRAM_FUNCTION_TYPE = MethodType.methodType(ScriptFunction.class, ScriptObject.class);
+ private static final LongAdder NAMED_INSTALLED_SCRIPT_COUNT = new LongAdder();
+ private static final LongAdder ANONYMOUS_INSTALLED_SCRIPT_COUNT = new LongAdder();
+ private static final boolean DISABLE_VM_ANONYMOUS_CLASSES = Options.getBooleanProperty("nashorn.disableVmAnonymousClasses");
/**
* Should scripts use only object slots for fields, or dual long/object slots? The default
* behaviour is to couple this to optimistic types, using dual representation if optimistic types are enabled
@@ -163,25 +174,24 @@
DebuggerSupport.FORCELOAD = true;
}
+ static long getNamedInstalledScriptCount() {
+ return NAMED_INSTALLED_SCRIPT_COUNT.sum();
+ }
+
+ static long getAnonymousInstalledScriptCount() {
+ return ANONYMOUS_INSTALLED_SCRIPT_COUNT.sum();
+ }
+
/**
* ContextCodeInstaller that has the privilege of installing classes in the Context.
* Can only be instantiated from inside the context and is opaque to other classes
*/
- public static class ContextCodeInstaller implements CodeInstaller {
- private final Context context;
- private final ScriptLoader loader;
- private final CodeSource codeSource;
- private int usageCount = 0;
- private int bytesDefined = 0;
+ private abstract static class ContextCodeInstaller implements CodeInstaller {
+ final Context context;
+ final CodeSource codeSource;
- // We reuse this installer for 10 compilations or 200000 defined bytes. Usually the first condition
- // will occur much earlier, the second is a safety measure for very large scripts/functions.
- private final static int MAX_USAGES = 10;
- private final static int MAX_BYTES_DEFINED = 200_000;
-
- private ContextCodeInstaller(final Context context, final ScriptLoader loader, final CodeSource codeSource) {
- this.context = context;
- this.loader = loader;
+ ContextCodeInstaller(final Context context, final CodeSource codeSource) {
+ this.context = context;
this.codeSource = codeSource;
}
@@ -191,14 +201,6 @@
}
@Override
- public Class<?> install(final String className, final byte[] bytecode) {
- usageCount++;
- bytesDefined += bytecode.length;
- final String binaryName = Compiler.binaryName(className);
- return loader.installClass(binaryName, bytecode, codeSource);
- }
-
- @Override
public void initialize(final Collection<Class<?>> classes, final Source source, final Object[] constants) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
@@ -250,15 +252,6 @@
}
@Override
- public CodeInstaller withNewLoader() {
- // Reuse this installer if we're within our limits.
- if (usageCount < MAX_USAGES && bytesDefined < MAX_BYTES_DEFINED) {
- return this;
- }
- return new ContextCodeInstaller(context, context.createNewLoader(), codeSource);
- }
-
- @Override
public boolean isCompatibleWith(final CodeInstaller other) {
if (other instanceof ContextCodeInstaller) {
final ContextCodeInstaller cci = (ContextCodeInstaller)other;
@@ -268,6 +261,116 @@
}
}
+ private static class NamedContextCodeInstaller extends ContextCodeInstaller {
+ private final ScriptLoader loader;
+ private int usageCount = 0;
+ private int bytesDefined = 0;
+
+ // We reuse this installer for 10 compilations or 200000 defined bytes. Usually the first condition
+ // will occur much earlier, the second is a safety measure for very large scripts/functions.
+ private final static int MAX_USAGES = 10;
+ private final static int MAX_BYTES_DEFINED = 200_000;
+
+ private NamedContextCodeInstaller(final Context context, final CodeSource codeSource, final ScriptLoader loader) {
+ super(context, codeSource);
+ this.loader = loader;
+ }
+
+ @Override
+ public Class<?> install(final String className, final byte[] bytecode) {
+ usageCount++;
+ bytesDefined += bytecode.length;
+ NAMED_INSTALLED_SCRIPT_COUNT.increment();
+ return loader.installClass(Compiler.binaryName(className), bytecode, codeSource);
+ }
+
+ @Override
+ public CodeInstaller getOnDemandCompilationInstaller() {
+ // Reuse this installer if we're within our limits.
+ if (usageCount < MAX_USAGES && bytesDefined < MAX_BYTES_DEFINED) {
+ return this;
+ }
+ return new NamedContextCodeInstaller(context, codeSource, context.createNewLoader());
+ }
+
+ @Override
+ public CodeInstaller getMultiClassCodeInstaller() {
+ // This installer is perfectly suitable for installing multiple classes that reference each other
+ // as it produces classes with resolvable names, all defined in a single class loader.
+ return this;
+ }
+ }
+
+ private final Map<CodeSource, Reference<Class<?>>> anonymousHostClasses = new ConcurrentHashMap<>();
+
+ private static final class AnonymousContextCodeInstaller extends ContextCodeInstaller {
+ private static final Unsafe UNSAFE = getUnsafe();
+ private static final String ANONYMOUS_HOST_CLASS_NAME = Compiler.SCRIPTS_PACKAGE.replace('/', '.') + ".AnonymousHost";
+ private static final byte[] ANONYMOUS_HOST_CLASS_BYTES = getAnonymousHostClassBytes();
+
+ private final Class<?> hostClass;
+
+ private AnonymousContextCodeInstaller(final Context context, final CodeSource codeSource) {
+ super(context, codeSource);
+ hostClass = getAnonymousHostClass();
+ }
+
+ @Override
+ public Class<?> install(final String className, final byte[] bytecode) {
+ ANONYMOUS_INSTALLED_SCRIPT_COUNT.increment();
+ return UNSAFE.defineAnonymousClass(hostClass, bytecode, null);
+ }
+
+ @Override
+ public CodeInstaller getOnDemandCompilationInstaller() {
+ // This code loader can be indefinitely reused for on-demand recompilations for the same code source.
+ return this;
+ }
+
+ @Override
+ public CodeInstaller getMultiClassCodeInstaller() {
+ // This code loader can not be used to install multiple classes that reference each other, as they
+ // would have no resolvable names. Therefore, in such situation we must revert to an installer that
+ // produces named classes.
+ return new NamedContextCodeInstaller(context, codeSource, context.createNewLoader());
+ }
+
+ private Class<?> getAnonymousHostClass() {
+ final Reference<Class<?>> ref = context.anonymousHostClasses.get(codeSource);
+ if (ref != null) {
+ final Class<?> existingHostClass = ref.get();
+ if (existingHostClass != null) {
+ return existingHostClass;
+ }
+ }
+ final Class<?> newHostClass = context.createNewLoader().installClass(ANONYMOUS_HOST_CLASS_NAME, ANONYMOUS_HOST_CLASS_BYTES, codeSource);
+ context.anonymousHostClasses.put(codeSource, new WeakReference<>(newHostClass));
+ return newHostClass;
+ }
+
+ private static final byte[] getAnonymousHostClassBytes() {
+ final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
+ cw.visit(V1_7, Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT, ANONYMOUS_HOST_CLASS_NAME.replace('.', '/'), null, "java/lang/Object", null);
+ cw.visitEnd();
+ return cw.toByteArray();
+ }
+
+ private static Unsafe getUnsafe() {
+ return AccessController.doPrivileged(new PrivilegedAction<Unsafe>() {
+ @Override
+ public Unsafe run() {
+ try {
+ final Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe");
+ theUnsafeField.setAccessible(true);
+ return (Unsafe)theUnsafeField.get(null);
+ } catch (final ReflectiveOperationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ }
+ }
+
/** Is Context global debug mode enabled ? */
public static final boolean DEBUG = Options.getBooleanProperty("nashorn.debug");
@@ -1294,9 +1397,15 @@
}
final URL url = source.getURL();
- final ScriptLoader loader = env._loader_per_compile ? createNewLoader() : scriptLoader;
final CodeSource cs = new CodeSource(url, (CodeSigner[])null);
- final CodeInstaller installer = new ContextCodeInstaller(this, loader, cs);
+ final CodeInstaller installer;
+ if (DISABLE_VM_ANONYMOUS_CLASSES || env._persistent_cache || !env._lazy_compilation) {
+ // Persistent code cache and eager compilation preclude use of VM anonymous classes
+ final ScriptLoader loader = env._loader_per_compile ? createNewLoader() : scriptLoader;
+ installer = new NamedContextCodeInstaller(this, cs, loader);
+ } else {
+ installer = new AnonymousContextCodeInstaller(this, cs);
+ }
if (storedScript == null) {
final CompilationPhases phases = Compiler.CompilationPhases.COMPILE_ALL;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Debug.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Debug.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,6 +26,8 @@
package jdk.nashorn.internal.runtime;
import static jdk.nashorn.internal.parser.TokenType.EOF;
+
+import jdk.nashorn.api.scripting.NashornException;
import jdk.nashorn.internal.parser.Lexer;
import jdk.nashorn.internal.parser.Token;
import jdk.nashorn.internal.parser.TokenStream;
@@ -63,6 +65,15 @@
}
/**
+ * Return a formatted script stack trace string with frames information separated by '\n'.
+ * This is a shortcut for {@code NashornException.getScriptStackString(new Throwable())}.
+ * @return formatted stack trace string
+ */
+ public static String scriptStack() {
+ return NashornException.getScriptStackString(new Throwable());
+ }
+
+ /**
* Return the system identity hashcode for an object as a human readable
* string
*
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NativeJavaPackage.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NativeJavaPackage.java Tue Sep 22 11:01:54 2015 -0700
@@ -206,7 +206,7 @@
}
@Override
- protected Object invokeNoSuchProperty(final String key, final int programPoint) {
+ protected Object invokeNoSuchProperty(final String key, final boolean isScope, final int programPoint) {
final Object retval = createProperty(key);
if (isValid(programPoint)) {
throw new UnwarrantedOptimismException(retval, programPoint);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java Tue Sep 22 11:01:54 2015 -0700
@@ -75,16 +75,20 @@
}
/**
- * Return listeners added to this ScriptObject.
+ * Return number of listeners added to a ScriptObject.
* @param obj the object
* @return the listener count
*/
public static int getListenerCount(final ScriptObject obj) {
- final PropertyListeners propertyListeners = obj.getMap().getListeners();
- if (propertyListeners != null) {
- return propertyListeners.listeners == null ? 0 : propertyListeners.listeners.size();
- }
- return 0;
+ return obj.getMap().getListenerCount();
+ }
+
+ /**
+ * Return the number of listeners added to this PropertyListeners instance.
+ * @return the listener count;
+ */
+ public int getListenerCount() {
+ return listeners == null ? 0 : listeners.size();
}
// Property listener management methods
@@ -156,7 +160,7 @@
final WeakPropertyMapSet set = listeners.get(prop.getKey());
if (set != null) {
for (final PropertyMap propertyMap : set.elements()) {
- propertyMap.propertyAdded(prop);
+ propertyMap.propertyAdded(prop, false);
}
listeners.remove(prop.getKey());
if (Context.DEBUG) {
@@ -176,7 +180,7 @@
final WeakPropertyMapSet set = listeners.get(prop.getKey());
if (set != null) {
for (final PropertyMap propertyMap : set.elements()) {
- propertyMap.propertyDeleted(prop);
+ propertyMap.propertyDeleted(prop, false);
}
listeners.remove(prop.getKey());
if (Context.DEBUG) {
@@ -198,7 +202,7 @@
final WeakPropertyMapSet set = listeners.get(oldProp.getKey());
if (set != null) {
for (final PropertyMap propertyMap : set.elements()) {
- propertyMap.propertyModified(oldProp, newProp);
+ propertyMap.propertyModified(oldProp, newProp, false);
}
listeners.remove(oldProp.getKey());
if (Context.DEBUG) {
@@ -215,7 +219,7 @@
if (listeners != null) {
for (final WeakPropertyMapSet set : listeners.values()) {
for (final PropertyMap propertyMap : set.elements()) {
- propertyMap.protoChanged();
+ propertyMap.protoChanged(false);
}
}
listeners.clear();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java Tue Sep 22 11:01:54 2015 -0700
@@ -54,32 +54,36 @@
* All property maps are immutable. If a property is added, modified or removed, the mutator
* will return a new map.
*/
-public final class PropertyMap implements Iterable<Object>, Serializable {
+public class PropertyMap implements Iterable<Object>, Serializable {
/** Used for non extensible PropertyMaps, negative logic as the normal case is extensible. See {@link ScriptObject#preventExtensions()} */
- public static final int NOT_EXTENSIBLE = 0b0000_0001;
+ private static final int NOT_EXTENSIBLE = 0b0000_0001;
/** Does this map contain valid array keys? */
- public static final int CONTAINS_ARRAY_KEYS = 0b0000_0010;
+ private static final int CONTAINS_ARRAY_KEYS = 0b0000_0010;
/** Map status flags. */
- private int flags;
+ private final int flags;
/** Map of properties. */
private transient PropertyHashMap properties;
/** Number of fields in use. */
- private int fieldCount;
+ private final int fieldCount;
/** Number of fields available. */
private final int fieldMaximum;
/** Length of spill in use. */
- private int spillLength;
+ private final int spillLength;
/** Structure class name */
- private String className;
+ private final String className;
+
+ /** A reference to the expected shared prototype property map. If this is set this
+ * property map should only be used if it the same as the actual prototype map. */
+ private transient SharedPropertyMap sharedProtoMap;
/** {@link SwitchPoint}s for gets on inherited properties. */
- private transient HashMap<String, SwitchPoint> protoGetSwitches;
+ private transient HashMap<String, SwitchPoint> protoSwitches;
/** History of maps, used to limit map duplication. */
private transient WeakHashMap<Property, SoftReference<PropertyMap>> history;
@@ -95,24 +99,21 @@
private static final long serialVersionUID = -7041836752008732533L;
/**
- * Constructor.
+ * Constructs a new property map.
*
* @param properties A {@link PropertyHashMap} with initial contents.
* @param fieldCount Number of fields in use.
* @param fieldMaximum Number of fields available.
* @param spillLength Number of spill slots used.
- * @param containsArrayKeys True if properties contain numeric keys
*/
- private PropertyMap(final PropertyHashMap properties, final String className, final int fieldCount,
- final int fieldMaximum, final int spillLength, final boolean containsArrayKeys) {
+ private PropertyMap(final PropertyHashMap properties, final int flags, final String className,
+ final int fieldCount, final int fieldMaximum, final int spillLength) {
this.properties = properties;
this.className = className;
this.fieldCount = fieldCount;
this.fieldMaximum = fieldMaximum;
this.spillLength = spillLength;
- if (containsArrayKeys) {
- setContainsArrayKeys();
- }
+ this.flags = flags;
if (Context.DEBUG) {
count.increment();
@@ -120,20 +121,22 @@
}
/**
- * Cloning constructor.
+ * Constructs a clone of {@code propertyMap} with changed properties, flags, or boundaries.
*
* @param propertyMap Existing property map.
* @param properties A {@link PropertyHashMap} with a new set of properties.
*/
- private PropertyMap(final PropertyMap propertyMap, final PropertyHashMap properties) {
+ private PropertyMap(final PropertyMap propertyMap, final PropertyHashMap properties, final int flags, final int fieldCount, final int spillLength) {
this.properties = properties;
- this.flags = propertyMap.flags;
- this.spillLength = propertyMap.spillLength;
- this.fieldCount = propertyMap.fieldCount;
+ this.flags = flags;
+ this.spillLength = spillLength;
+ this.fieldCount = fieldCount;
this.fieldMaximum = propertyMap.fieldMaximum;
+ this.className = propertyMap.className;
// We inherit the parent property listeners instance. It will be cloned when a new listener is added.
this.listeners = propertyMap.listeners;
this.freeSlots = propertyMap.freeSlots;
+ this.sharedProtoMap = propertyMap.sharedProtoMap;
if (Context.DEBUG) {
count.increment();
@@ -142,12 +145,12 @@
}
/**
- * Cloning constructor.
+ * Constructs an exact clone of {@code propertyMap}.
*
* @param propertyMap Existing property map.
*/
- private PropertyMap(final PropertyMap propertyMap) {
- this(propertyMap, propertyMap.properties);
+ protected PropertyMap(final PropertyMap propertyMap) {
+ this(propertyMap, propertyMap.properties, propertyMap.flags, propertyMap.fieldCount, propertyMap.spillLength);
}
private void writeObject(final ObjectOutputStream out) throws IOException {
@@ -183,7 +186,7 @@
*/
public static PropertyMap newMap(final Collection<Property> properties, final String className, final int fieldCount, final int fieldMaximum, final int spillLength) {
final PropertyHashMap newProperties = EMPTY_HASHMAP.immutableAdd(properties);
- return new PropertyMap(newProperties, className, fieldCount, fieldMaximum, spillLength, false);
+ return new PropertyMap(newProperties, 0, className, fieldCount, fieldMaximum, spillLength);
}
/**
@@ -205,7 +208,7 @@
* @return New empty {@link PropertyMap}.
*/
public static PropertyMap newMap(final Class<? extends ScriptObject> clazz) {
- return new PropertyMap(EMPTY_HASHMAP, clazz.getName(), 0, 0, 0, false);
+ return new PropertyMap(EMPTY_HASHMAP, 0, clazz.getName(), 0, 0, 0);
}
/**
@@ -227,12 +230,12 @@
}
/**
- * Get the listeners of this map, or null if none exists
+ * Get the number of listeners of this map
*
- * @return the listeners
+ * @return the number of listeners
*/
- public PropertyListeners getListeners() {
- return listeners;
+ public int getListenerCount() {
+ return listeners == null ? 0 : listeners.getListenerCount();
}
/**
@@ -253,9 +256,12 @@
* A new property is being added.
*
* @param property The new Property added.
+ * @param isSelf was the property added to this map?
*/
- public void propertyAdded(final Property property) {
- invalidateProtoGetSwitchPoint(property);
+ public void propertyAdded(final Property property, final boolean isSelf) {
+ if (!isSelf) {
+ invalidateProtoSwitchPoint(property.getKey());
+ }
if (listeners != null) {
listeners.propertyAdded(property);
}
@@ -265,9 +271,12 @@
* An existing property is being deleted.
*
* @param property The property being deleted.
+ * @param isSelf was the property deleted from this map?
*/
- public void propertyDeleted(final Property property) {
- invalidateProtoGetSwitchPoint(property);
+ public void propertyDeleted(final Property property, final boolean isSelf) {
+ if (!isSelf) {
+ invalidateProtoSwitchPoint(property.getKey());
+ }
if (listeners != null) {
listeners.propertyDeleted(property);
}
@@ -278,9 +287,12 @@
*
* @param oldProperty The old property
* @param newProperty The new property
+ * @param isSelf was the property modified on this map?
*/
- public void propertyModified(final Property oldProperty, final Property newProperty) {
- invalidateProtoGetSwitchPoint(oldProperty);
+ public void propertyModified(final Property oldProperty, final Property newProperty, final boolean isSelf) {
+ if (!isSelf) {
+ invalidateProtoSwitchPoint(oldProperty.getKey());
+ }
if (listeners != null) {
listeners.propertyModified(oldProperty, newProperty);
}
@@ -288,9 +300,15 @@
/**
* The prototype of an object associated with this {@link PropertyMap} is changed.
+ *
+ * @param isSelf was the prototype changed on the object using this map?
*/
- public void protoChanged() {
- invalidateAllProtoGetSwitchPoints();
+ public void protoChanged(final boolean isSelf) {
+ if (!isSelf) {
+ invalidateAllProtoSwitchPoints();
+ } else if (sharedProtoMap != null) {
+ sharedProtoMap.invalidateSwitchPoint();
+ }
if (listeners != null) {
listeners.protoChanged();
}
@@ -303,14 +321,14 @@
* @return A shared {@link SwitchPoint} for the property.
*/
public synchronized SwitchPoint getSwitchPoint(final String key) {
- if (protoGetSwitches == null) {
- protoGetSwitches = new HashMap<>();
+ if (protoSwitches == null) {
+ protoSwitches = new HashMap<>();
}
- SwitchPoint switchPoint = protoGetSwitches.get(key);
+ SwitchPoint switchPoint = protoSwitches.get(key);
if (switchPoint == null) {
switchPoint = new SwitchPoint();
- protoGetSwitches.put(key, switchPoint);
+ protoSwitches.put(key, switchPoint);
}
return switchPoint;
@@ -319,19 +337,17 @@
/**
* Indicate that a prototype property has changed.
*
- * @param property {@link Property} to invalidate.
+ * @param key {@link Property} key to invalidate.
*/
- synchronized void invalidateProtoGetSwitchPoint(final Property property) {
- if (protoGetSwitches != null) {
-
- final String key = property.getKey();
- final SwitchPoint sp = protoGetSwitches.get(key);
+ synchronized void invalidateProtoSwitchPoint(final String key) {
+ if (protoSwitches != null) {
+ final SwitchPoint sp = protoSwitches.get(key);
if (sp != null) {
- protoGetSwitches.remove(key);
+ protoSwitches.remove(key);
if (Context.DEBUG) {
protoInvalidations.increment();
}
- SwitchPoint.invalidateAll(new SwitchPoint[] { sp });
+ SwitchPoint.invalidateAll(new SwitchPoint[]{sp});
}
}
}
@@ -339,15 +355,15 @@
/**
* Indicate that proto itself has changed in hierarchy somewhere.
*/
- synchronized void invalidateAllProtoGetSwitchPoints() {
- if (protoGetSwitches != null) {
- final int size = protoGetSwitches.size();
+ synchronized void invalidateAllProtoSwitchPoints() {
+ if (protoSwitches != null) {
+ final int size = protoSwitches.size();
if (size > 0) {
if (Context.DEBUG) {
protoInvalidations.add(size);
}
- SwitchPoint.invalidateAll(protoGetSwitches.values().toArray(new SwitchPoint[size]));
- protoGetSwitches.clear();
+ SwitchPoint.invalidateAll(protoSwitches.values().toArray(new SwitchPoint[size]));
+ protoSwitches.clear();
}
}
}
@@ -363,7 +379,7 @@
* @return New {@link PropertyMap} with {@link Property} added.
*/
PropertyMap addPropertyBind(final AccessorProperty property, final Object bindTo) {
- // No need to store bound property in the history as bound properties can't be reused.
+ // We must not store bound property in the history as bound properties can't be reused.
return addPropertyNoHistory(new AccessorProperty(property, bindTo));
}
@@ -376,16 +392,16 @@
return property.isSpill() ? slot + fieldMaximum : slot;
}
- // Update boundaries and flags after a property has been added
- private void updateFlagsAndBoundaries(final Property newProperty) {
- if(newProperty.isSpill()) {
- spillLength = Math.max(spillLength, newProperty.getSlot() + 1);
- } else {
- fieldCount = Math.max(fieldCount, newProperty.getSlot() + 1);
- }
- if (isValidArrayIndex(getArrayIndex(newProperty.getKey()))) {
- setContainsArrayKeys();
- }
+ private int newSpillLength(final Property newProperty) {
+ return newProperty.isSpill() ? Math.max(spillLength, newProperty.getSlot() + 1) : spillLength;
+ }
+
+ private int newFieldCount(final Property newProperty) {
+ return !newProperty.isSpill() ? Math.max(fieldCount, newProperty.getSlot() + 1) : fieldCount;
+ }
+
+ private int newFlags(final Property newProperty) {
+ return isValidArrayIndex(getArrayIndex(newProperty.getKey())) ? flags | CONTAINS_ARRAY_KEYS : flags;
}
// Update the free slots bitmap for a property that has been deleted and/or added. This method is not synchronized
@@ -420,13 +436,10 @@
* @param property {@link Property} being added.
* @return New {@link PropertyMap} with {@link Property} added.
*/
- public PropertyMap addPropertyNoHistory(final Property property) {
- if (listeners != null) {
- listeners.propertyAdded(property);
- }
+ public final PropertyMap addPropertyNoHistory(final Property property) {
+ propertyAdded(property, true);
final PropertyHashMap newProperties = properties.immutableAdd(property);
- final PropertyMap newMap = new PropertyMap(this, newProperties);
- newMap.updateFlagsAndBoundaries(property);
+ final PropertyMap newMap = new PropertyMap(this, newProperties, newFlags(property), newFieldCount(property), newSpillLength(property));
newMap.updateFreeSlots(null, property);
return newMap;
@@ -439,16 +452,13 @@
*
* @return New {@link PropertyMap} with {@link Property} added.
*/
- public synchronized PropertyMap addProperty(final Property property) {
- if (listeners != null) {
- listeners.propertyAdded(property);
- }
+ public final synchronized PropertyMap addProperty(final Property property) {
+ propertyAdded(property, true);
PropertyMap newMap = checkHistory(property);
if (newMap == null) {
final PropertyHashMap newProperties = properties.immutableAdd(property);
- newMap = new PropertyMap(this, newProperties);
- newMap.updateFlagsAndBoundaries(property);
+ newMap = new PropertyMap(this, newProperties, newFlags(property), newFieldCount(property), newSpillLength(property));
newMap.updateFreeSlots(null, property);
addToHistory(property, newMap);
}
@@ -463,10 +473,8 @@
*
* @return New {@link PropertyMap} with {@link Property} removed or {@code null} if not found.
*/
- public synchronized PropertyMap deleteProperty(final Property property) {
- if (listeners != null) {
- listeners.propertyDeleted(property);
- }
+ public final synchronized PropertyMap deleteProperty(final Property property) {
+ propertyDeleted(property, true);
PropertyMap newMap = checkHistory(property);
final String key = property.getKey();
@@ -477,13 +485,13 @@
// If deleted property was last field or spill slot we can make it reusable by reducing field/slot count.
// Otherwise mark it as free in free slots bitset.
if (isSpill && slot >= 0 && slot == spillLength - 1) {
- newMap = new PropertyMap(newProperties, className, fieldCount, fieldMaximum, spillLength - 1, containsArrayKeys());
+ newMap = new PropertyMap(this, newProperties, flags, fieldCount, spillLength - 1);
newMap.freeSlots = freeSlots;
} else if (!isSpill && slot >= 0 && slot == fieldCount - 1) {
- newMap = new PropertyMap(newProperties, className, fieldCount - 1, fieldMaximum, spillLength, containsArrayKeys());
+ newMap = new PropertyMap(this, newProperties, flags, fieldCount - 1, spillLength);
newMap.freeSlots = freeSlots;
} else {
- newMap = new PropertyMap(this, newProperties);
+ newMap = new PropertyMap(this, newProperties, flags, fieldCount, spillLength);
newMap.updateFreeSlots(property, null);
}
addToHistory(property, newMap);
@@ -500,13 +508,8 @@
*
* @return New {@link PropertyMap} with {@link Property} replaced.
*/
- public PropertyMap replaceProperty(final Property oldProperty, final Property newProperty) {
- if (listeners != null) {
- listeners.propertyModified(oldProperty, newProperty);
- }
- // Add replaces existing property.
- final PropertyHashMap newProperties = properties.immutableReplace(oldProperty, newProperty);
- final PropertyMap newMap = new PropertyMap(this, newProperties);
+ public final PropertyMap replaceProperty(final Property oldProperty, final Property newProperty) {
+ propertyModified(oldProperty, newProperty, true);
/*
* See ScriptObject.modifyProperty and ScriptObject.setUserAccessors methods.
*
@@ -528,14 +531,17 @@
newProperty instanceof UserAccessorProperty :
"arbitrary replaceProperty attempted " + sameType + " oldProperty=" + oldProperty.getClass() + " newProperty=" + newProperty.getClass() + " [" + oldProperty.getLocalType() + " => " + newProperty.getLocalType() + "]";
- newMap.flags = flags;
-
/*
* spillLength remains same in case (1) and (2) because of slot reuse. Only for case (3), we need
* to add spill count of the newly added UserAccessorProperty property.
*/
+ final int newSpillLength = sameType ? spillLength : Math.max(spillLength, newProperty.getSlot() + 1);
+
+ // Add replaces existing property.
+ final PropertyHashMap newProperties = properties.immutableReplace(oldProperty, newProperty);
+ final PropertyMap newMap = new PropertyMap(this, newProperties, flags, fieldCount, newSpillLength);
+
if (!sameType) {
- newMap.spillLength = Math.max(spillLength, newProperty.getSlot() + 1);
newMap.updateFreeSlots(oldProperty, newProperty);
}
return newMap;
@@ -551,7 +557,7 @@
* @param propertyFlags attribute flags of the property
* @return the newly created UserAccessorProperty
*/
- public UserAccessorProperty newUserAccessors(final String key, final int propertyFlags) {
+ public final UserAccessorProperty newUserAccessors(final String key, final int propertyFlags) {
return new UserAccessorProperty(key, propertyFlags, getFreeSpillSlot());
}
@@ -562,7 +568,7 @@
*
* @return {@link Property} matching key.
*/
- public Property findProperty(final String key) {
+ public final Property findProperty(final String key) {
return properties.find(key);
}
@@ -573,12 +579,12 @@
*
* @return New {@link PropertyMap} with added properties.
*/
- public PropertyMap addAll(final PropertyMap other) {
+ public final PropertyMap addAll(final PropertyMap other) {
assert this != other : "adding property map to itself";
final Property[] otherProperties = other.properties.getProperties();
final PropertyHashMap newProperties = properties.immutableAdd(otherProperties);
- final PropertyMap newMap = new PropertyMap(this, newProperties);
+ final PropertyMap newMap = new PropertyMap(this, newProperties, flags, fieldCount, spillLength);
for (final Property property : otherProperties) {
// This method is only safe to use with non-slotted, native getter/setter properties
assert property.getSlot() == -1;
@@ -593,7 +599,7 @@
*
* @return Properties as an array.
*/
- public Property[] getProperties() {
+ public final Property[] getProperties() {
return properties.getProperties();
}
@@ -602,7 +608,7 @@
*
* @return class name of owner objects.
*/
- public String getClassName() {
+ public final String getClassName() {
return className;
}
@@ -612,9 +618,7 @@
* @return New map with {@link #NOT_EXTENSIBLE} flag set.
*/
PropertyMap preventExtensions() {
- final PropertyMap newMap = new PropertyMap(this);
- newMap.flags |= NOT_EXTENSIBLE;
- return newMap;
+ return new PropertyMap(this, properties, flags | NOT_EXTENSIBLE, fieldCount, spillLength);
}
/**
@@ -630,10 +634,7 @@
newProperties = newProperties.immutableAdd(oldProperty.addFlags(Property.NOT_CONFIGURABLE));
}
- final PropertyMap newMap = new PropertyMap(this, newProperties);
- newMap.flags |= NOT_EXTENSIBLE;
-
- return newMap;
+ return new PropertyMap(this, newProperties, flags | NOT_EXTENSIBLE, fieldCount, spillLength);
}
/**
@@ -655,10 +656,7 @@
newProperties = newProperties.immutableAdd(oldProperty.addFlags(propertyFlags));
}
- final PropertyMap newMap = new PropertyMap(this, newProperties);
- newMap.flags |= NOT_EXTENSIBLE;
-
- return newMap;
+ return new PropertyMap(this, newProperties, flags | NOT_EXTENSIBLE, fieldCount, spillLength);
}
/**
@@ -830,13 +828,6 @@
}
/**
- * Flag this object as having array keys in defined properties
- */
- private void setContainsArrayKeys() {
- flags |= CONTAINS_ARRAY_KEYS;
- }
-
- /**
* Test to see if {@link PropertyMap} is extensible.
*
* @return {@code true} if {@link PropertyMap} can be added to.
@@ -914,12 +905,72 @@
setProtoNewMapCount.increment();
}
- final PropertyMap newMap = new PropertyMap(this);
+ final PropertyMap newMap = makeUnsharedCopy();
addToProtoHistory(newProto, newMap);
return newMap;
}
+ /**
+ * Make a copy of this property map with the shared prototype field set to null. Note that this is
+ * only necessary for shared maps of top-level objects. Shared prototype maps represented by
+ * {@link SharedPropertyMap} are automatically converted to plain property maps when they evolve.
+ *
+ * @return a copy with the shared proto map unset
+ */
+ PropertyMap makeUnsharedCopy() {
+ final PropertyMap newMap = new PropertyMap(this);
+ newMap.sharedProtoMap = null;
+ return newMap;
+ }
+
+ /**
+ * Set a reference to the expected parent prototype map. This is used for class-like
+ * structures where we only want to use a top-level property map if all of the
+ * prototype property maps have not been modified.
+ *
+ * @param protoMap weak reference to the prototype property map
+ */
+ void setSharedProtoMap(final SharedPropertyMap protoMap) {
+ sharedProtoMap = protoMap;
+ }
+
+ /**
+ * Get the expected prototype property map if it is known, or null.
+ *
+ * @return parent map or null
+ */
+ public PropertyMap getSharedProtoMap() {
+ return sharedProtoMap;
+ }
+
+ /**
+ * Returns {@code true} if this map has been used as a shared prototype map (i.e. as a prototype
+ * for a JavaScript constructor function) and has not had properties added, deleted or replaced since then.
+ * @return true if this is a valid shared prototype map
+ */
+ boolean isValidSharedProtoMap() {
+ return false;
+ }
+
+ /**
+ * Returns the shared prototype switch point, or null if this is not a shared prototype map.
+ * @return the shared prototype switch point, or null
+ */
+ SwitchPoint getSharedProtoSwitchPoint() {
+ return null;
+ }
+
+ /**
+ * Return true if this map has a shared prototype map which has either been invalidated or does
+ * not match the map of {@code proto}.
+ * @param prototype the prototype object
+ * @return true if this is an invalid shared map for {@code prototype}
+ */
+ boolean isInvalidSharedMapFor(final ScriptObject prototype) {
+ return sharedProtoMap != null
+ && (!sharedProtoMap.isValidSharedProtoMap() || prototype == null || sharedProtoMap != prototype.getMap());
+ }
/**
* {@link PropertyMap} iterator.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Tue Sep 22 11:01:54 2015 -0700
@@ -368,8 +368,8 @@
}
@Override
- PropertyMap getAllocatorMap() {
- return allocationStrategy.getAllocatorMap();
+ PropertyMap getAllocatorMap(final ScriptObject prototype) {
+ return allocationStrategy.getAllocatorMap(prototype);
}
@Override
@@ -649,7 +649,7 @@
*/
private CodeInstaller getInstallerForNewCode() {
final ScriptEnvironment env = installer.getContext().getEnv();
- return env._optimistic_types || env._loader_per_compile ? installer.withNewLoader() : installer;
+ return env._optimistic_types || env._loader_per_compile ? installer.getOnDemandCompilationInstaller() : installer;
}
Compiler getCompiler(final FunctionNode functionNode, final MethodType actualCallSiteType,
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java Tue Sep 22 11:01:54 2015 -0700
@@ -521,35 +521,39 @@
assert !isBoundFunction(); // allocate never invoked on bound functions
- final ScriptObject object = data.allocate(getAllocatorMap());
+ final ScriptObject prototype = getAllocatorPrototype();
+ final ScriptObject object = data.allocate(getAllocatorMap(prototype));
if (object != null) {
- final Object prototype = getPrototype();
- if (prototype instanceof ScriptObject) {
- object.setInitialProto((ScriptObject) prototype);
- }
-
- if (object.getProto() == null) {
- object.setInitialProto(getObjectPrototype());
- }
+ object.setInitialProto(prototype);
}
return object;
}
- private PropertyMap getAllocatorMap() {
- if (allocatorMap == null) {
- allocatorMap = data.getAllocatorMap();
+ /**
+ * Get the property map used by "allocate"
+ * @param prototype actual prototype object
+ * @return property map
+ */
+ private synchronized PropertyMap getAllocatorMap(final ScriptObject prototype) {
+ if (allocatorMap == null || allocatorMap.isInvalidSharedMapFor(prototype)) {
+ // The prototype map has changed since this function was last used as constructor.
+ // Get a new allocator map.
+ allocatorMap = data.getAllocatorMap(prototype);
}
return allocatorMap;
}
/**
- * Return Object.prototype - used by "allocate"
- *
- * @return Object.prototype
+ * Return the actual prototype used by "allocate"
+ * @return allocator prototype
*/
- protected final ScriptObject getObjectPrototype() {
+ private ScriptObject getAllocatorPrototype() {
+ final Object prototype = getPrototype();
+ if (prototype instanceof ScriptObject) {
+ return (ScriptObject) prototype;
+ }
return Global.objectPrototype();
}
@@ -591,10 +595,10 @@
*
* @param newPrototype new prototype object
*/
- public final void setPrototype(Object newPrototype) {
+ public synchronized final void setPrototype(final Object newPrototype) {
if (newPrototype instanceof ScriptObject && newPrototype != this.prototype && allocatorMap != null) {
- // Replace our current allocator map with one that is associated with the new prototype.
- allocatorMap = allocatorMap.changeProto((ScriptObject) newPrototype);
+ // Unset allocator map to be replaced with one matching the new prototype.
+ allocatorMap = null;
}
this.prototype = newPrototype;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java Tue Sep 22 11:01:54 2015 -0700
@@ -389,9 +389,10 @@
/**
* Get the property map to use for objects allocated by this function.
*
+ * @param prototype the prototype of the allocated object
* @return the property map for allocated objects.
*/
- PropertyMap getAllocatorMap() {
+ PropertyMap getAllocatorMap(final ScriptObject prototype) {
return null;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java Tue Sep 22 11:01:54 2015 -0700
@@ -149,7 +149,7 @@
/** Method handle to retrieve prototype of this object */
public static final MethodHandle GETPROTO = findOwnMH_V("getProto", ScriptObject.class);
- static final MethodHandle MEGAMORPHIC_GET = findOwnMH_V("megamorphicGet", Object.class, String.class, boolean.class);
+ static final MethodHandle MEGAMORPHIC_GET = findOwnMH_V("megamorphicGet", Object.class, String.class, boolean.class, boolean.class);
static final MethodHandle GLOBALFILTER = findOwnMH_S("globalFilter", Object.class, Object.class);
static final MethodHandle DECLARE_AND_SET = findOwnMH_V("declareAndSet", void.class, String.class, Object.class);
@@ -809,9 +809,11 @@
if (deep) {
final ScriptObject myProto = getProto();
- if (myProto != null) {
- return myProto.findProperty(key, deep, start);
- }
+ final FindProperty find = myProto == null ? null : myProto.findProperty(key, true, start);
+ // checkSharedProtoMap must be invoked after myProto.checkSharedProtoMap to propagate
+ // shared proto invalidation up the prototype chain. It also must be invoked when prototype is null.
+ checkSharedProtoMap();
+ return find;
}
return null;
@@ -832,7 +834,7 @@
if (deep) {
final ScriptObject myProto = getProto();
if (myProto != null) {
- return myProto.hasProperty(key, deep);
+ return myProto.hasProperty(key, true);
}
}
@@ -1258,11 +1260,8 @@
if (oldProto != newProto) {
proto = newProto;
- // Let current listeners know that the prototype has changed and set our map
- final PropertyListeners listeners = getMap().getListeners();
- if (listeners != null) {
- listeners.protoChanged();
- }
+ // Let current listeners know that the prototype has changed
+ getMap().protoChanged(true);
// Replace our current allocator map with one that is associated with the new prototype.
setMap(getMap().changeProto(newProto));
}
@@ -1314,7 +1313,7 @@
}
p = p.getProto();
}
- setProto((ScriptObject)newProto);
+ setProto((ScriptObject) newProto);
} else {
throw typeError("cant.set.proto.to.non.object", ScriptRuntime.safeToString(this), ScriptRuntime.safeToString(newProto));
}
@@ -2012,11 +2011,11 @@
final ScriptObject owner = find.getOwner();
final Class<ClassCastException> exception = explicitInstanceOfCheck ? null : ClassCastException.class;
- final SwitchPoint protoSwitchPoint;
+ final SwitchPoint[] protoSwitchPoints;
if (mh == null) {
mh = Lookup.emptyGetter(returnType);
- protoSwitchPoint = getProtoSwitchPoint(name, owner);
+ protoSwitchPoints = getProtoSwitchPoints(name, owner);
} else if (!find.isSelf()) {
assert mh.type().returnType().equals(returnType) :
"return type mismatch for getter " + mh.type().returnType() + " != " + returnType;
@@ -2024,30 +2023,30 @@
// Add a filter that replaces the self object with the prototype owning the property.
mh = addProtoFilter(mh, find.getProtoChainLength());
}
- protoSwitchPoint = getProtoSwitchPoint(name, owner);
+ protoSwitchPoints = getProtoSwitchPoints(name, owner);
} else {
- protoSwitchPoint = null;
+ protoSwitchPoints = null;
}
- final GuardedInvocation inv = new GuardedInvocation(mh, guard, protoSwitchPoint, exception);
+ final GuardedInvocation inv = new GuardedInvocation(mh, guard, protoSwitchPoints, exception);
return inv.addSwitchPoint(findBuiltinSwitchPoint(name));
}
private static GuardedInvocation findMegaMorphicGetMethod(final CallSiteDescriptor desc, final String name, final boolean isMethod) {
Context.getContextTrusted().getLogger(ObjectClassGenerator.class).warning("Megamorphic getter: " + desc + " " + name + " " +isMethod);
- final MethodHandle invoker = MH.insertArguments(MEGAMORPHIC_GET, 1, name, isMethod);
+ final MethodHandle invoker = MH.insertArguments(MEGAMORPHIC_GET, 1, name, isMethod, NashornCallSiteDescriptor.isScope(desc));
final MethodHandle guard = getScriptObjectGuard(desc.getMethodType(), true);
return new GuardedInvocation(invoker, guard);
}
@SuppressWarnings("unused")
- private Object megamorphicGet(final String key, final boolean isMethod) {
+ private Object megamorphicGet(final String key, final boolean isMethod, final boolean isScope) {
final FindProperty find = findProperty(key, true);
if (find != null) {
return find.getObjectValue();
}
- return isMethod ? getNoSuchMethod(key, INVALID_PROGRAM_POINT) : invokeNoSuchProperty(key, INVALID_PROGRAM_POINT);
+ return isMethod ? getNoSuchMethod(key, isScope, INVALID_PROGRAM_POINT) : invokeNoSuchProperty(key, isScope, INVALID_PROGRAM_POINT);
}
// Marks a property as declared and sets its value. Used as slow path for block-scoped LET and CONST
@@ -2128,17 +2127,32 @@
* @param owner the property owner, null if property is not defined
* @return a SwitchPoint or null
*/
- public final SwitchPoint getProtoSwitchPoint(final String name, final ScriptObject owner) {
+ public final SwitchPoint[] getProtoSwitchPoints(final String name, final ScriptObject owner) {
if (owner == this || getProto() == null) {
return null;
}
+ final List<SwitchPoint> switchPoints = new ArrayList<>();
for (ScriptObject obj = this; obj != owner && obj.getProto() != null; obj = obj.getProto()) {
final ScriptObject parent = obj.getProto();
parent.getMap().addListener(name, obj.getMap());
+ final SwitchPoint sp = parent.getMap().getSharedProtoSwitchPoint();
+ if (sp != null && !sp.hasBeenInvalidated()) {
+ switchPoints.add(sp);
+ }
}
- return getMap().getSwitchPoint(name);
+ switchPoints.add(getMap().getSwitchPoint(name));
+ return switchPoints.toArray(new SwitchPoint[switchPoints.size()]);
+ }
+
+ private void checkSharedProtoMap() {
+ // Check if our map has an expected shared prototype property map. If it has, make sure that
+ // the prototype map has not been invalidated, and that it does match the actual map of the prototype.
+ if (getMap().isInvalidSharedMapFor(getProto())) {
+ // Change our own map to one that does not assume a shared prototype map.
+ setMap(getMap().makeUnsharedCopy());
+ }
}
/**
@@ -2220,7 +2234,7 @@
return new GuardedInvocation(
Lookup.EMPTY_SETTER,
NashornGuards.getMapGuard(getMap(), explicitInstanceOfCheck),
- getProtoSwitchPoint(name, null),
+ getProtoSwitchPoints(name, null),
explicitInstanceOfCheck ? null : ClassCastException.class);
}
@@ -2366,7 +2380,7 @@
find.getGetter(Object.class, INVALID_PROGRAM_POINT, request),
find.getProtoChainLength(),
func),
- getProtoSwitchPoint(NO_SUCH_PROPERTY_NAME, find.getOwner()),
+ getProtoSwitchPoints(NO_SUCH_PROPERTY_NAME, find.getOwner()),
//TODO this doesn't need a ClassCastException as guard always checks script object
null);
}
@@ -2382,20 +2396,21 @@
/**
* Invoke fall back if a property is not found.
* @param name Name of property.
+ * @param isScope is this a scope access?
* @param programPoint program point
* @return Result from call.
*/
- protected Object invokeNoSuchProperty(final String name, final int programPoint) {
+ protected Object invokeNoSuchProperty(final String name, final boolean isScope, final int programPoint) {
final FindProperty find = findProperty(NO_SUCH_PROPERTY_NAME, true);
+ final Object func = (find != null)? find.getObjectValue() : null;
Object ret = UNDEFINED;
-
- if (find != null) {
- final Object func = find.getObjectValue();
-
- if (func instanceof ScriptFunction) {
- ret = ScriptRuntime.apply((ScriptFunction)func, this, name);
- }
+ if (func instanceof ScriptFunction) {
+ final ScriptFunction sfunc = (ScriptFunction)func;
+ final Object self = isScope && sfunc.isStrict()? UNDEFINED : this;
+ ret = ScriptRuntime.apply(sfunc, self, name);
+ } else if (isScope) {
+ throw referenceError("not.defined", name);
}
if (isValid(programPoint)) {
@@ -2409,21 +2424,27 @@
/**
* Get __noSuchMethod__ as a function bound to this object and {@code name} if it is defined.
* @param name the method name
+ * @param isScope is this a scope access?
* @return the bound function, or undefined
*/
- private Object getNoSuchMethod(final String name, final int programPoint) {
+ private Object getNoSuchMethod(final String name, final boolean isScope, final int programPoint) {
final FindProperty find = findProperty(NO_SUCH_METHOD_NAME, true);
if (find == null) {
- return invokeNoSuchProperty(name, programPoint);
+ return invokeNoSuchProperty(name, isScope, programPoint);
}
final Object value = find.getObjectValue();
if (!(value instanceof ScriptFunction)) {
+ if (isScope) {
+ throw referenceError("not.defined", name);
+ }
return UNDEFINED;
}
- return ((ScriptFunction)value).createBound(this, new Object[] {name});
+ final ScriptFunction func = (ScriptFunction)value;
+ final Object self = isScope && func.isStrict()? UNDEFINED : this;
+ return func.createBound(self, new Object[] {name});
}
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck, final String name) {
@@ -2432,7 +2453,7 @@
}
return new GuardedInvocation(Lookup.emptyGetter(desc.getMethodType().returnType()),
- NashornGuards.getMapGuard(getMap(), explicitInstanceOfCheck), getProtoSwitchPoint(name, null),
+ NashornGuards.getMapGuard(getMap(), explicitInstanceOfCheck), getProtoSwitchPoints(name, null),
explicitInstanceOfCheck ? null : ClassCastException.class);
}
@@ -2738,7 +2759,7 @@
}
}
- return JSType.toInt32(invokeNoSuchProperty(key, programPoint));
+ return JSType.toInt32(invokeNoSuchProperty(key, false, programPoint));
}
@Override
@@ -2820,7 +2841,7 @@
}
}
- return JSType.toLong(invokeNoSuchProperty(key, programPoint));
+ return JSType.toLong(invokeNoSuchProperty(key, false, programPoint));
}
@Override
@@ -2902,7 +2923,7 @@
}
}
- return JSType.toNumber(invokeNoSuchProperty(key, INVALID_PROGRAM_POINT));
+ return JSType.toNumber(invokeNoSuchProperty(key, false, INVALID_PROGRAM_POINT));
}
@Override
@@ -2983,7 +3004,7 @@
}
}
- return invokeNoSuchProperty(key, INVALID_PROGRAM_POINT);
+ return invokeNoSuchProperty(key, false, INVALID_PROGRAM_POINT);
}
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java Tue Sep 22 11:01:54 2015 -0700
@@ -186,10 +186,7 @@
private SetMethod createNewPropertySetter(final SwitchPoint builtinSwitchPoint) {
final SetMethod sm = map.getFreeFieldSlot() > -1 ? createNewFieldSetter(builtinSwitchPoint) : createNewSpillPropertySetter(builtinSwitchPoint);
- final PropertyListeners listeners = map.getListeners();
- if (listeners != null) {
- listeners.propertyAdded(sm.property);
- }
+ map.propertyAdded(sm.property, true);
return sm;
}
@@ -204,7 +201,7 @@
//fast type specific setter
final MethodHandle fastSetter = property.getSetter(type, newMap); //0 sobj, 1 value, slot folded for spill property already
- //slow setter, that calls ScriptObject.set with appropraite type and key name
+ //slow setter, that calls ScriptObject.set with appropriate type and key name
MethodHandle slowSetter = ScriptObject.SET_SLOW[getAccessorTypeIndex(type)];
slowSetter = MH.insertArguments(slowSetter, 3, NashornCallSiteDescriptor.getFlags(desc));
slowSetter = MH.insertArguments(slowSetter, 1, name);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SharedPropertyMap.java Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 jdk.nashorn.internal.runtime;
+
+import java.lang.invoke.SwitchPoint;
+
+/**
+ * This class represents a property map that can be shared among multiple prototype objects, allowing all inheriting
+ * top-level objects to also share one property map. This is class is only used for prototype objects, the
+ * top-level objects use ordinary {@link PropertyMap}s with the {@link PropertyMap#sharedProtoMap} field
+ * set to the expected shared prototype map.
+ *
+ * <p>When an instance of this class is evolved because a property is added, removed, or modified in an object
+ * using it, the {@link #invalidateSwitchPoint()} method is invoked to signal to all callsites and inheriting
+ * objects that the assumption of a single shared prototype map is no longer valid. The property map resulting
+ * from the modification will no longer be an instance of this class.</p>
+ */
+public final class SharedPropertyMap extends PropertyMap {
+
+ private SwitchPoint switchPoint;
+
+ private static final long serialVersionUID = 2166297719721778876L;
+
+ /**
+ * Create a new shared property map from the given {@code map}.
+ * @param map property map to copy
+ */
+ public SharedPropertyMap(final PropertyMap map) {
+ super(map);
+ this.switchPoint = new SwitchPoint();
+ }
+
+ @Override
+ public void propertyAdded(final Property property, final boolean isSelf) {
+ if (isSelf) {
+ invalidateSwitchPoint();
+ }
+ super.propertyAdded(property, isSelf);
+ }
+
+ @Override
+ public void propertyDeleted(final Property property, final boolean isSelf) {
+ if (isSelf) {
+ invalidateSwitchPoint();
+ }
+ super.propertyDeleted(property, isSelf);
+ }
+
+ @Override
+ public void propertyModified(final Property oldProperty, final Property newProperty, final boolean isSelf) {
+ if (isSelf) {
+ invalidateSwitchPoint();
+ }
+ super.propertyModified(oldProperty, newProperty, isSelf);
+ }
+
+ @Override
+ synchronized boolean isValidSharedProtoMap() {
+ return switchPoint != null;
+ }
+
+ @Override
+ synchronized SwitchPoint getSharedProtoSwitchPoint() {
+ return switchPoint;
+ }
+
+ /**
+ * Invalidate the shared prototype switch point if this is a shared prototype map.
+ */
+ synchronized void invalidateSwitchPoint() {
+ if (switchPoint != null) {
+ assert !switchPoint.hasBeenInvalidated();
+ SwitchPoint.invalidateAll(new SwitchPoint[]{ switchPoint });
+ switchPoint = null;
+ }
+ }
+}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Timing.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Timing.java Tue Sep 22 11:01:54 2015 -0700
@@ -220,19 +220,20 @@
}
final long total = t - startTime;
- sb.append('\n');
- sb.append("Total runtime: ").
+ return sb.append("\nTotal runtime: ").
append(toMillisPrint(total)).
append(" ms (Non-runtime: ").
append(toMillisPrint(knownTime)).
append(" ms [").
append((int)(knownTime * 100.0 / total)).
- append("%])");
-
- sb.append("\n\nEmitted compile units: ").
- append(CompileUnit.getEmittedUnitCount());
-
- return sb.toString();
+ append("%])").
+ append("\n\nEmitted compile units: ").
+ append(CompileUnit.getEmittedUnitCount()).
+ append("\nCompile units installed as named classes: ").
+ append(Context.getNamedInstalledScriptCount()).
+ append("\nCompile units installed as anonymous classes: ").
+ append(Context.getAnonymousInstalledScriptCount()).
+ toString();
}
private void accumulateTime(final String module, final long duration) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,6 +26,7 @@
package jdk.nashorn.internal.runtime;
import static jdk.nashorn.internal.lookup.Lookup.MH;
+import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -45,7 +46,7 @@
*
*/
public final class WithObject extends Scope {
- private static final MethodHandle WITHEXPRESSIONGUARD = findOwnMH("withExpressionGuard", boolean.class, Object.class, PropertyMap.class, SwitchPoint.class);
+ private static final MethodHandle WITHEXPRESSIONGUARD = findOwnMH("withExpressionGuard", boolean.class, Object.class, PropertyMap.class, SwitchPoint[].class);
private static final MethodHandle WITHEXPRESSIONFILTER = findOwnMH("withFilterExpression", Object.class, Object.class);
private static final MethodHandle WITHSCOPEFILTER = findOwnMH("withFilterScope", Object.class, Object.class);
private static final MethodHandle BIND_TO_EXPRESSION_OBJ = findOwnMH("bindToExpression", Object.class, Object.class, Object.class);
@@ -209,16 +210,18 @@
}
@Override
- protected Object invokeNoSuchProperty(final String name, final int programPoint) {
+ protected Object invokeNoSuchProperty(final String name, final boolean isScope, final int programPoint) {
FindProperty find = expression.findProperty(NO_SUCH_PROPERTY_NAME, true);
if (find != null) {
final Object func = find.getObjectValue();
if (func instanceof ScriptFunction) {
- return ScriptRuntime.apply((ScriptFunction)func, expression, name);
+ final ScriptFunction sfunc = (ScriptFunction)func;
+ final Object self = isScope && sfunc.isStrict()? UNDEFINED : expression;
+ return ScriptRuntime.apply(sfunc, self, name);
}
}
- return getProto().invokeNoSuchProperty(name, programPoint);
+ return getProto().invokeNoSuchProperty(name, isScope, programPoint);
}
@Override
@@ -357,13 +360,24 @@
private MethodHandle expressionGuard(final String name, final ScriptObject owner) {
final PropertyMap map = expression.getMap();
- final SwitchPoint sp = expression.getProtoSwitchPoint(name, owner);
+ final SwitchPoint[] sp = expression.getProtoSwitchPoints(name, owner);
return MH.insertArguments(WITHEXPRESSIONGUARD, 1, map, sp);
}
@SuppressWarnings("unused")
- private static boolean withExpressionGuard(final Object receiver, final PropertyMap map, final SwitchPoint sp) {
- return ((WithObject)receiver).expression.getMap() == map && (sp == null || !sp.hasBeenInvalidated());
+ private static boolean withExpressionGuard(final Object receiver, final PropertyMap map, final SwitchPoint[] sp) {
+ return ((WithObject)receiver).expression.getMap() == map && !hasBeenInvalidated(sp);
+ }
+
+ private static boolean hasBeenInvalidated(final SwitchPoint[] switchPoints) {
+ if (switchPoints != null) {
+ for (final SwitchPoint switchPoint : switchPoints) {
+ if (switchPoint.hasBeenInvalidated()) {
+ return true;
+ }
+ }
+ }
+ return false;
}
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties Tue Sep 22 11:01:54 2015 -0700
@@ -150,6 +150,7 @@
type.error.method.not.constructor=Java method {0} cannot be used as a constructor.
type.error.env.not.object=$ENV must be an Object.
type.error.unsupported.java.to.type=Unsupported Java.to target type {0}.
+type.error.java.array.conversion.failed=Java.to conversion to array type {0} failed
type.error.constructor.requires.new=Constructor {0} requires "new".
type.error.new.on.nonpublic.javatype=new cannot be used with non-public java type {0}.
--- a/nashorn/test/script/basic/JDK-8044750.js Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8044750.js Tue Sep 22 11:01:54 2015 -0700
@@ -25,6 +25,8 @@
* JDK-8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
*
* @test
+ * @fork
+ * @option -Dnashorn.unstable.relink.threshold=16
* @run
*/
@@ -40,7 +42,9 @@
}
}
-for (var i = 0; i < 20; i++) {
+var LIMIT = 20; // should be more than megamorphic threshold set via @option
+
+for (var i = 0; i < LIMIT; i++) {
var obj = {};
obj.foo = i;
obj[i] = i;
@@ -51,3 +55,30 @@
// callsite inside func should see __noSuchProperty__
// hook on global scope object.
func({});
+
+function checkFoo() {
+ with({}) {
+ try {
+ foo;
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+}
+
+var oldNoSuchProperty = this.__noSuchProperty__;
+delete this.__noSuchProperty__;
+
+// keep deleting/restorting __noSuchProperty__ alternatively
+// to make "foo" access in checkFoo function megamorphic!
+
+for (var i = 0; i < LIMIT; i++) {
+ // no __noSuchProperty__ and 'with' scope object has no 'foo'
+ delete __noSuchProperty__;
+ Assert.assertFalse(checkFoo(), "Expected false in iteration " + i);
+
+ // __noSuchProperty__ is exists but 'with' scope object has no 'foo'
+ this.__noSuchProperty__ = oldNoSuchProperty;
+ Assert.assertTrue(checkFoo(), "Expected true in iteration " + i);
+}
--- a/nashorn/test/script/basic/JDK-8134569.js Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8134569.js Tue Sep 22 11:01:54 2015 -0700
@@ -62,67 +62,146 @@
return new C();
}
+function createDeeper() {
+ function C() {
+ this.i1 = 1;
+ this.i2 = 2;
+ this.i3 = 3;
+ return this;
+ }
+ function D() {
+ this.p1 = 1;
+ this.p2 = 2;
+ this.p3 = 3;
+ return this;
+ }
+ function E() {
+ this.e1 = 1;
+ this.e2 = 2;
+ this.e3 = 3;
+ return this;
+ }
+ D.prototype = new E();
+ C.prototype = new D();
+ return new C();
+}
+
function createEval() {
return eval("Object.create({})");
}
function p(o) { print(o.x) }
-var a, b;
+function e(o) { print(o.e1) }
+
+var a, b, c;
create();
a = create();
b = create();
+c = create();
a.__proto__.x = 123;
p(a);
p(b);
+p(c);
a = create();
b = create();
+c = create();
b.__proto__.x = 123;
p(a);
p(b);
+p(c);
a = createEmpty();
b = createEmpty();
+c = createEmpty();
a.__proto__.x = 123;
p(a);
p(b);
+p(c);
a = createEmpty();
b = createEmpty();
+c = createEmpty();
b.__proto__.x = 123;
p(a);
p(b);
+p(c);
a = createDeep();
b = createDeep();
+c = createDeep();
a.__proto__.__proto__.x = 123;
p(a);
p(b);
+p(c);
a = createDeep();
b = createDeep();
+c = createDeep();
b.__proto__.__proto__.x = 123;
p(a);
p(b);
+p(c);
+
+a = createDeeper();
+b = createDeeper();
+c = createDeeper();
+a.__proto__.__proto__.__proto__.x = 123;
+
+p(a);
+p(b);
+p(c);
+
+a = createDeeper();
+b = createDeeper();
+c = createDeeper();
+b.__proto__.__proto__.__proto__.x = 123;
+
+p(a);
+p(b);
+p(c);
+
+a = createDeeper();
+b = createDeeper();
+c = createDeeper();
+a.__proto__.__proto__ = null;
+
+e(a);
+e(b);
+e(c);
+
+a = createDeeper();
+b = createDeeper();
+c = createDeeper();
+b.__proto__.__proto__ = null;
+
+e(a);
+e(b);
+e(c);
+
a = createEval();
b = createEval();
+c = createEval();
a.__proto__.x = 123;
p(a);
p(b);
+p(c);
a = createEval();
b = createEval();
+c = createEval();
b.__proto__.x = 123;
p(a);
p(b);
+p(c);
--- a/nashorn/test/script/basic/JDK-8134569.js.EXPECTED Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8134569.js.EXPECTED Tue Sep 22 11:01:54 2015 -0700
@@ -1,16 +1,36 @@
123
undefined
undefined
+undefined
123
+undefined
123
undefined
undefined
+undefined
+123
+undefined
+123
+undefined
+undefined
+undefined
123
+undefined
123
undefined
undefined
+undefined
123
+undefined
+undefined
+1
+1
+1
+undefined
+1
123
undefined
undefined
+undefined
123
+undefined
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8134609.js Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/**
+ * JDK-8134609: Allow constructors with same prototoype map to share the allocator map
+ *
+ * @test
+ * @run
+ * @fork
+ * @option -Dnashorn.debug
+ */
+
+function createProto(members) {
+ function P() {
+ for (var id in members) {
+ if (members.hasOwnProperty(id)) {
+ this[id] = members[id];
+ }
+ }
+ return this;
+ }
+ return new P();
+}
+
+function createSubclass(prototype, members) {
+ function C() {
+ for (var id in members) {
+ if (members.hasOwnProperty(id)) {
+ this[id] = members[id];
+ }
+ }
+ return this;
+ }
+
+ C.prototype = prototype;
+
+ return new C();
+}
+
+function assertP1(object, value) {
+ Assert.assertTrue(object.p1 === value);
+}
+
+// First prototype will have non-shared proto-map. Second and third will be shared.
+var proto0 = createProto({p1: 0, p2: 1});
+var proto1 = createProto({p1: 1, p2: 2});
+var proto2 = createProto({p1: 2, p2: 3});
+
+Assert.assertTrue(Debug.map(proto1) === Debug.map(proto2));
+
+assertP1(proto1, 1);
+assertP1(proto2, 2);
+
+// First instantiation will have a non-shared prototype map, from the second one
+// maps will be shared until a different proto map comes along.
+var child0 = createSubclass(proto1, {c1: 1, c2: 2});
+var child1 = createSubclass(proto2, {c1: 2, c2: 3});
+var child2 = createSubclass(proto1, {c1: 3, c2: 4});
+var child3 = createSubclass(proto2, {c1: 1, c2: 2});
+var child4 = createSubclass(proto0, {c1: 3, c2: 2});
+
+Assert.assertTrue(Debug.map(child1) === Debug.map(child2));
+Assert.assertTrue(Debug.map(child1) === Debug.map(child3));
+Assert.assertTrue(Debug.map(child3) !== Debug.map(child4));
+
+assertP1(child1, 2);
+assertP1(child2, 1);
+assertP1(child3, 2);
+assertP1(child4, 0);
+
+Assert.assertTrue(delete proto2.p1);
+
+assertP1(child3, undefined);
+assertP1(child2, 1);
+Assert.assertTrue(Debug.map(child1) !== Debug.map(child3));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8136544.js Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/**
+ * JDK-8136544: Call site switching to megamorphic causes incorrect property read
+ *
+ * @test
+ * @fork
+ * @option -Dnashorn.unstable.relink.threshold=8
+ * @run
+ */
+
+var ScriptContext = Java.type("javax.script.ScriptContext");
+var ScriptEngineManager = Java.type("javax.script.ScriptEngineManager");
+var m = new ScriptEngineManager();
+var e = m.getEngineByName("nashorn");
+
+var scope = e.getBindings(ScriptContext.ENGINE_SCOPE);
+var MYVAR = "myvar";
+
+function loopupVar() {
+ try {
+ e.eval(MYVAR);
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+// make sure we exercise callsite beyond megamorphic threshold we set
+// in this test via nashorn.unstable.relink.threshold property
+// In each iteration, callsite is exercised twice (two evals)
+// So, LIMIT should be more than 4 to exercise megamorphic callsites.
+
+var LIMIT = 5; // This LIMIT should be more than 4
+
+for (var i = 0; i < LIMIT; i++) {
+ // remove the variable and lookup
+ delete scope[MYVAR];
+ Assert.assertFalse(loopupVar(), "Expected true in iteration " + i);
+
+ // set that variable and check again
+ scope[MYVAR] = "foo";
+ Assert.assertTrue(loopupVar(), "Expected false in iteration " + i);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8136694.js Tue Sep 22 11:01:54 2015 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/**
+ * JDK-8136694: Megemorphic scope access does not throw ReferenceError when property is missing
+ *
+ * @test
+ * @fork
+ * @option -Dnashorn.unstable.relink.threshold=16
+ * @run
+ */
+
+function checkFoo() {
+ try {
+ // The 'foo' access becomes megamorphic
+ foo;
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+
+// Similar check for 'with' blocks as well.
+function checkFooInWith() {
+ with({}) {
+ try {
+ // The 'foo' access becomes megamorphic
+ foo;
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }
+}
+
+function loop(checker) {
+ // LIMIT has to be more than the megamorphic threashold
+ // set via @option in this test header!
+ var LIMIT = 20;
+ for (var i = 0; i < LIMIT; i++) {
+ // make sure global has no "foo"
+ delete foo;
+ Assert.assertFalse(checker(), "Expected false in interation " + i);
+
+ // now add 'foo' in global
+ foo = 44;
+ Assert.assertTrue(checker(), "Expected true in interation " + i);
+ }
+}
+
+
+loop(checkFoo);
+loop(checkFooInWith);
--- a/nashorn/test/script/basic/javaarrayconversion.js Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/test/script/basic/javaarrayconversion.js Tue Sep 22 11:01:54 2015 -0700
@@ -128,24 +128,32 @@
// Converting to string, toString takes precedence over valueOf
test({ valueOf: function() { return "42"; }, toString: function() { return "43"; } }, "java.lang.String", "43")
+function assertCanConvert(sourceType, targetType) {
+ Java.to([new (Java.type(sourceType))()], targetType + "[]")
+ ++testCount;
+}
+
function assertCantConvert(sourceType, targetType) {
try {
- Java.to([new Java.type(sourceType)()], targetType + "[]")
+ Java.to([new (Java.type(sourceType))()], targetType + "[]")
throw "no TypeError encountered"
} catch(e) {
- if(!(e instanceof TypeError)) {
+ if(!(e instanceof TypeError) ||
+ !e.message.startsWith("Java.to conversion to array type")) {
throw e;
}
++testCount;
}
}
+// Arbitrary POJOs to JS Primitive type should work
+assertCanConvert("java.util.BitSet", "int")
+assertCanConvert("java.util.BitSet", "double")
+assertCanConvert("java.util.BitSet", "long")
+assertCanConvert("java.util.BitSet", "boolean")
+assertCanConvert("java.util.BitSet", "java.lang.String")
+
// Arbitrary POJOs can't be converted to Java values
-assertCantConvert("java.util.BitSet", "int")
-assertCantConvert("java.util.BitSet", "double")
-assertCantConvert("java.util.BitSet", "long")
-assertCantConvert("java.util.BitSet", "boolean")
-assertCantConvert("java.util.BitSet", "java.lang.String")
assertCantConvert("java.util.BitSet", "java.lang.Double")
assertCantConvert("java.util.BitSet", "java.lang.Long")
--- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScopeTest.java Thu Sep 17 09:19:40 2015 -0700
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScopeTest.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,6 +26,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import javax.script.Bindings;
@@ -820,4 +821,38 @@
public void recursiveEvalCallScriptContextTest() throws ScriptException {
new RecursiveEval().program();
}
+
+ private static final String VAR_NAME = "myvar";
+
+ private static boolean lookupVar(final ScriptEngine engine, final String varName) {
+ try {
+ engine.eval(varName);
+ return true;
+ } catch (final ScriptException se) {
+ return false;
+ }
+ }
+
+ // @bug 8136544: Call site switching to megamorphic causes incorrect property read
+ @Test
+ public void megamorphicPropertyReadTest() throws ScriptException {
+ final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+ final ScriptEngine engine = factory.getScriptEngine();
+ final Bindings scope = engine.getBindings(ScriptContext.ENGINE_SCOPE);
+ boolean ret;
+
+ // Why 16 is the upper limit of this loop? The default nashorn dynalink megamorphic threshold is 16.
+ // See jdk.nashorn.internal.runtime.linker.Bootstrap.NASHORN_DEFAULT_UNSTABLE_RELINK_THRESHOLD
+ // We do, 'eval' of the same in this loop twice. So, 16*2 = 32 times that callsite in the script
+ // is exercised - much beyond the default megamorphic threshold.
+
+ for (int i = 0; i < 16; i++) {
+ scope.remove(VAR_NAME);
+ ret = lookupVar(engine, VAR_NAME);
+ assertFalse(ret, "Expected false in iteration " + i);
+ scope.put(VAR_NAME, "foo");
+ ret = lookupVar(engine, VAR_NAME);
+ assertTrue(ret, "Expected true in iteration " + i);
+ }
+ }
}
--- a/test/Makefile Thu Sep 17 09:19:40 2015 -0700
+++ b/test/Makefile Tue Sep 22 11:01:54 2015 -0700
@@ -57,6 +57,9 @@
# All testing
all: jdk_all langtools_all jaxp_all
+# Bring in closed test targets if present
+-include $(TOPDIR)/closed/test/Makefile
+
# Test targets
langtools_% :
@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
--- a/test/lib/Makefile Thu Sep 17 09:19:40 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#
-# Copyright (c) 2013, 2015, 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.
-#
-
-# Utility Makefile that creates wb.jar, which is used to simplify using
-# the Whitebox API outside the jtreg-testbase.
-
-ifneq "x$(ALT_BOOTDIR)" "x"
- BOOTDIR := $(ALT_BOOTDIR)
-endif
-
-ifeq "x$(BOOTDIR)" "x"
- JDK_HOME := $(shell dirname $(shell which java))/..
-else
- JDK_HOME := $(BOOTDIR)
-endif
-
-SRC_DIR = ./
-BUILD_DIR = build
-OUTPUT_DIR = $(BUILD_DIR)/classes
-
-JAVAC = $(JDK_HOME)/bin/javac
-JAR = $(JDK_HOME)/bin/jar
-
-WB_SRC_FILES = $(shell find $(SRC_DIR)/sun/hotspot -name '*.java')
-# test-lib.jar will contain only hprof classes until JDK-8081381 is resolved
-SHARE_SRC_FILES = $(shell find $(SRC_DIR)/share/classes/jdk/test/lib/hprof -name '*.java')
-
-.PHONY: wb.filelist share.filelist clean cleantmp
-
-all: wb.jar test-lib.jar cleantmp
-
-wb.jar: wb.filelist
- @mkdir -p $(OUTPUT_DIR)
- $(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp $(OUTPUT_DIR) @wb.filelist
- $(JAR) cf wb.jar -C $(OUTPUT_DIR) .
- @rm -rf $(OUTPUT_DIR)
-
-wb.filelist: $(WB_SRC_FILES)
- @rm -f $@
- @echo $(WB_SRC_FILES) > $@
-
-test-lib.jar: share.filelist
- @mkdir -p $(OUTPUT_DIR)
- $(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp $(OUTPUT_DIR) @share.filelist
- $(JAR) cf test-lib.jar -C $(OUTPUT_DIR) .
- @rm -rf $(OUTPUT_DIR)
-
-share.filelist: $(SHARE_SRC_FILES)
- @rm -f $@
- @echo $(SHARE_SRC_FILES) > $@
-
-clean: cleantmp
- @rm -rf wb.jar
- @rm -rf test-list.jar
-
-cleantmp:
- @rm -rf wb.filelist
- @rm -rf share.filelist
- @rm -rf $(BUILD_DIR)
--- a/test/lib/sun/hotspot/WhiteBox.java Thu Sep 17 09:19:40 2015 -0700
+++ b/test/lib/sun/hotspot/WhiteBox.java Tue Sep 22 11:01:54 2015 -0700
@@ -26,12 +26,10 @@
import java.lang.management.MemoryUsage;
import java.lang.reflect.Executable;
-import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
-import java.util.stream.Stream;
import java.security.BasicPermission;
import java.util.Objects;
@@ -85,6 +83,7 @@
public native int getVMPageSize();
public native long getVMAllocationGranularity();
public native long getVMLargePageSize();
+ public native long getHeapSpaceAlignment();
private native boolean isObjectInOldGen0(Object o);
public boolean isObjectInOldGen(Object o) {
@@ -144,6 +143,10 @@
return parseCommandLine0(commandline, delim, args);
}
+ // Parallel GC
+ public native long psVirtualSpaceAlignment();
+ public native long psHeapGenerationAlignment();
+
// NMT
public native long NMTMalloc(long size);
public native void NMTFree(long mem);
@@ -386,23 +389,6 @@
.orElse(null);
}
- public native boolean readImageFile(String imagePath);
- public native long imageOpenImage(String imagePath, boolean bigEndian);
- public native void imageCloseImage(long id);
- public native long imageGetIndexAddress(long id);
- public native long imageGetDataAddress(long id);
- public native boolean imageReadCompressed(long id, long offset,
- ByteBuffer compressedBuffer, long compressedSize,
- ByteBuffer uncompressedBuffer, long uncompressedSize);
- public native boolean imageRead(long id, long offset,
- ByteBuffer uncompressedBuffer, long uncompressedSize);
- public native byte[] imageGetStringBytes(long id, int offset);
- public native long imageGetStringsSize(long id);
- public native long[] imageGetAttributes(long id, int offset);
- public native long[] imageFindAttributes(long id, byte[] path);
- public native int[] imageAttributeOffsets(long id);
- public native int imageGetIntAtAddress(long address, int offset, boolean big_endian);
-
// Safepoint Checking
public native void assertMatchingSafepointCalls(boolean mutexSafepointValue, boolean attemptedNoSafepointValue);
--- a/test/make/TestMakeBase.gmk Thu Sep 17 09:19:40 2015 -0700
+++ b/test/make/TestMakeBase.gmk Tue Sep 22 11:01:54 2015 -0700
@@ -73,6 +73,37 @@
TEST_TARGETS += $(ESCAPE_DOLLAR_DIR)/_escape_dollar
################################################################################
+# Test containing and not-containing
+
+CONT_LIST := foo bar baz foobar foobaz
+
+# Param 1 - string to look for
+# Param 2 - expected result
+define TestContaining
+ value := $$(call containing, $1, $(CONT_LIST))
+ ifneq ($$(value), $2)
+ $$(info (call containing, $1, $(CONT_LIST)))
+ $$(error result >$$(value)<, expected >$2<)
+ endif
+endef
+
+$(eval $(call TestContaining,bar,bar foobar))
+$(eval $(call TestContaining,foo bar,foo bar foobar foobaz))
+
+# Param 1 - string to look for
+# Param 2 - expected result
+define TestNotContaining
+ value := $$(call not-containing, $1, $(CONT_LIST))
+ ifneq ($$(value), $2)
+ $$(info (call not-containing, $1, $(CONT_LIST)))
+ $$(error result >$$(value)<, expected >$2<)
+ endif
+endef
+
+$(eval $(call TestNotContaining,bar,foo baz foobaz))
+$(eval $(call TestNotContaining,foo bar,baz))
+
+################################################################################
# Test Equals
EQUALS_VALUE1 := value1$(SPACE)