# HG changeset patch
# User jprovino
# Date 1451668104 0
# Node ID e18371fa3e760f247404d1412a9cae2509023b73
# Parent abe1866e51e3b103043b1bc981d2b49e9c27a12e# Parent 87b434f45259a7092be4e4c2c1a5b66594f7c188
Merge
diff -r abe1866e51e3 -r e18371fa3e76 jdk/make/gensrc/Gensrc-jdk.jdi.gmk
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk Fri Jan 01 17:08:24 2016 +0000
@@ -70,7 +70,7 @@
# Filter com.sun.jdi.connect.Connector
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
$(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
- $(HOTSPOT_TOPDIR)/agent/src/share/classes/META-INF/services/com.sun.jdi.connect.Connector
+ $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/META-INF/services/com.sun.jdi.connect.Connector
$(process-provider)
# Copy the same service file into jdk.hotspot.agent so that they are kept the same.
diff -r abe1866e51e3 -r e18371fa3e76 jdk/make/lib/CoreLibraries.gmk
--- a/jdk/make/lib/CoreLibraries.gmk Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/make/lib/CoreLibraries.gmk Fri Jan 01 17:08:24 2016 +0000
@@ -25,6 +25,10 @@
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/CoreLibraries.gmk))
+
+
##########################################################################################
# libfdlibm is statically linked with libjava below and not delivered into the
# product on its own.
@@ -119,6 +123,9 @@
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
+# Make it possible to override this variable
+LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
+
ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
@@ -146,7 +153,7 @@
System.c_CFLAGS := $(VERSION_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
- MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
+ MAPFILE := $(LIBJAVA_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
diff -r abe1866e51e3 -r e18371fa3e76 jdk/make/lib/LibCommon.gmk
--- a/jdk/make/lib/LibCommon.gmk Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/make/lib/LibCommon.gmk Fri Jan 01 17:08:24 2016 +0000
@@ -27,6 +27,11 @@
include MakeBase.gmk
include NativeCompilation.gmk
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/LibCommon.gmk))
+
+################################################################################
+
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
@@ -56,7 +61,7 @@
# Find the default set of src dirs for a native library.
# Param 1 - module name
# Param 2 - library name
-FindSrcDirsForLib = \
+FindSrcDirsForLib += \
$(call uniq, $(wildcard \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
diff -r abe1866e51e3 -r e18371fa3e76 jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java
--- a/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java Fri Jan 01 17:08:24 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, 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
@@ -29,23 +29,20 @@
/**
* Phantom reference objects, which are enqueued after the collector
* determines that their referents may otherwise be reclaimed. Phantom
- * references are most often used for scheduling pre-mortem cleanup actions in
- * a more flexible way than is possible with the Java finalization mechanism.
+ * references are most often used to schedule post-mortem cleanup actions.
*
- *
If the garbage collector determines at a certain point in time that the
- * referent of a phantom reference is phantom reachable, then at that
- * time or at some later time it will enqueue the reference.
+ *
Suppose the garbage collector determines at a certain point in time
+ * that an object is
+ * phantom reachable. At that time it will atomically clear
+ * all phantom references to that object and all phantom references to
+ * any other phantom-reachable objects from which that object is reachable.
+ * At the same time or at some later time it will enqueue those newly-cleared
+ * phantom references that are registered with reference queues.
*
*
In order to ensure that a reclaimable object remains so, the referent of
* a phantom reference may not be retrieved: The {@code get} method of a
* phantom reference always returns {@code null}.
*
- *
Unlike soft and weak references, phantom references are not
- * automatically cleared by the garbage collector as they are enqueued. An
- * object that is reachable via phantom references will remain so until all
- * such references are cleared or themselves become unreachable.
- *
* @author Mark Reinhold
* @since 1.2
*/
@@ -69,8 +66,8 @@
*
*
It is possible to create a phantom reference with a {@code null}
* queue, but such a reference is completely useless: Its {@code get}
- * method will always return null and, since it does not have a queue, it
- * will never be enqueued.
+ * method will always return {@code null} and, since it does not have a queue,
+ * it will never be enqueued.
*
* @param referent the object the new phantom reference will refer to
* @param q the queue with which the reference is to be registered,
diff -r abe1866e51e3 -r e18371fa3e76 jdk/src/java.base/share/classes/java/lang/ref/package-info.java
--- a/jdk/src/java.base/share/classes/java/lang/ref/package-info.java Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java Fri Jan 01 17:08:24 2016 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -43,8 +43,7 @@
* implementing memory-sensitive caches, weak references are for
* implementing canonicalizing mappings that do not prevent their keys
* (or values) from being reclaimed, and phantom references are for
- * scheduling pre-mortem cleanup actions in a more flexible way than
- * is possible with the Java finalization mechanism.
+ * scheduling post-mortem cleanup actions.
*
*
Each reference-object type is implemented by a subclass of the
* abstract base {@link java.lang.ref.Reference} class.
@@ -64,9 +63,9 @@
* object with a reference queue at the time the reference
* object is created. Some time after the garbage collector
* determines that the reachability of the referent has changed to the
- * value corresponding to the type of the reference, it will add the
- * reference to the associated queue. At this point, the reference is
- * considered to be enqueued. The program may remove
+ * value corresponding to the type of the reference, it will clear the
+ * reference and add it to the associated queue. At this point, the
+ * reference is considered to be enqueued. The program may remove
* references from a queue either by polling or by blocking until a
* reference becomes available. Reference queues are implemented by
* the {@link java.lang.ref.ReferenceQueue} class.
@@ -92,16 +91,6 @@
* structure, this check will add little overhead to the hashtable
* access methods.
*
- *
Automatically-cleared references
- *
- * Soft and weak references are automatically cleared by the collector
- * before being added to the queues with which they are registered, if
- * any. Therefore soft and weak references need not be registered
- * with a queue in order to be useful, while phantom references do.
- * An object that is reachable via phantom references will remain so
- * until all such references are cleared or themselves become
- * unreachable.
- *
*
*
Reachability
*
diff -r abe1866e51e3 -r e18371fa3e76 jdk/src/java.base/share/native/include/jvm.h
--- a/jdk/src/java.base/share/native/include/jvm.h Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/src/java.base/share/native/include/jvm.h Fri Jan 01 17:08:24 2016 +0000
@@ -208,6 +208,9 @@
JNIEXPORT void JNICALL
JVM_SetMethodInfo(JNIEnv* env, jobject frame);
+JNIEXPORT jobjectArray JNICALL
+JVM_GetVmArguments(JNIEnv *env);
+
/*
* java.lang.Thread
*/
diff -r abe1866e51e3 -r e18371fa3e76 jdk/src/java.base/share/native/libjava/jni_util.c
--- a/jdk/src/java.base/share/native/libjava/jni_util.c Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/src/java.base/share/native/libjava/jni_util.c Fri Jan 01 17:08:24 2016 +0000
@@ -660,7 +660,8 @@
*/
if ((strcmp(encname, "8859_1") == 0) ||
(strcmp(encname, "ISO8859-1") == 0) ||
- (strcmp(encname, "ISO8859_1") == 0))
+ (strcmp(encname, "ISO8859_1") == 0) ||
+ (strcmp(encname, "ISO-8859-1") == 0))
fastEncoding = FAST_8859_1;
else if (strcmp(encname, "ISO646-US") == 0)
fastEncoding = FAST_646_US;
diff -r abe1866e51e3 -r e18371fa3e76 jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Fri Jan 01 17:08:24 2016 +0000
@@ -30,9 +30,12 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
@@ -40,6 +43,7 @@
import java.rmi.registry.Registry;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
+import java.rmi.server.RMISocketFactory;
import java.rmi.server.RemoteObject;
import java.rmi.server.UnicastRemoteObject;
import java.security.KeyStore;
@@ -60,6 +64,8 @@
import javax.management.remote.rmi.RMIConnectorServer;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManagerFactory;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory;
@@ -107,6 +113,8 @@
public static final String PORT =
"com.sun.management.jmxremote.port";
+ public static final String HOST =
+ "com.sun.management.jmxremote.host";
public static final String RMI_PORT =
"com.sun.management.jmxremote.rmi.port";
public static final String CONFIG_FILE_NAME =
@@ -424,10 +432,14 @@
checkAccessFile(accessFileName);
}
+ final String bindAddress =
+ props.getProperty(PropertyNames.HOST);
+
if (log.debugOn()) {
log.debug("startRemoteConnectorServer",
Agent.getText("jmxremote.ConnectorBootstrap.starting") +
"\n\t" + PropertyNames.PORT + "=" + port +
+ (bindAddress == null ? "" : "\n\t" + PropertyNames.HOST + "=" + bindAddress) +
"\n\t" + PropertyNames.RMI_PORT + "=" + rmiPort +
"\n\t" + PropertyNames.USE_SSL + "=" + useSsl +
"\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl +
@@ -458,7 +470,7 @@
sslConfigFileName, enabledCipherSuitesList,
enabledProtocolsList, sslNeedClientAuth,
useAuthentication, loginConfigName,
- passwordFileName, accessFileName);
+ passwordFileName, accessFileName, bindAddress);
cs = data.jmxConnectorServer;
url = data.jmxRemoteURL;
log.config("startRemoteConnectorServer",
@@ -628,12 +640,13 @@
String sslConfigFileName,
String[] enabledCipherSuites,
String[] enabledProtocols,
- boolean sslNeedClientAuth) {
+ boolean sslNeedClientAuth,
+ String bindAddress) {
if (sslConfigFileName == null) {
- return new SslRMIServerSocketFactory(
+ return new HostAwareSslSocketFactory(
enabledCipherSuites,
enabledProtocols,
- sslNeedClientAuth);
+ sslNeedClientAuth, bindAddress);
} else {
checkRestrictedFile(sslConfigFileName);
try {
@@ -687,11 +700,11 @@
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
- return new SslRMIServerSocketFactory(
+ return new HostAwareSslSocketFactory(
ctx,
enabledCipherSuites,
enabledProtocols,
- sslNeedClientAuth);
+ sslNeedClientAuth, bindAddress);
} catch (Exception e) {
throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
}
@@ -711,7 +724,8 @@
boolean useAuthentication,
String loginConfigName,
String passwordFileName,
- String accessFileName)
+ String accessFileName,
+ String bindAddress)
throws IOException, MalformedURLException {
/* Make sure we use non-guessable RMI object IDs. Otherwise
@@ -719,7 +733,7 @@
* IDs. */
System.setProperty("java.rmi.server.randomIDs", "true");
- JMXServiceURL url = new JMXServiceURL("rmi", null, rmiPort);
+ JMXServiceURL url = new JMXServiceURL("rmi", bindAddress, rmiPort);
Map env = new HashMap<>();
@@ -727,6 +741,8 @@
env.put(RMIExporter.EXPORTER_ATTRIBUTE, exporter);
+ boolean useSocketFactory = bindAddress != null && !useSsl;
+
if (useAuthentication) {
if (loginConfigName != null) {
env.put("jmx.remote.x.login.config", loginConfigName);
@@ -751,7 +767,7 @@
csf = new SslRMIClientSocketFactory();
ssf = createSslRMIServerSocketFactory(
sslConfigFileName, enabledCipherSuites,
- enabledProtocols, sslNeedClientAuth);
+ enabledProtocols, sslNeedClientAuth, bindAddress);
}
if (useSsl) {
@@ -761,6 +777,12 @@
ssf);
}
+ if (useSocketFactory) {
+ ssf = new HostAwareSocketFactory(bindAddress);
+ env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE,
+ ssf);
+ }
+
JMXConnectorServer connServer = null;
try {
connServer =
@@ -780,6 +802,10 @@
registry =
new SingleEntryRegistry(port, csf, ssf,
"jmxrmi", exporter.firstExported);
+ } else if (useSocketFactory) {
+ registry =
+ new SingleEntryRegistry(port, csf, ssf,
+ "jmxrmi", exporter.firstExported);
} else {
registry =
new SingleEntryRegistry(port,
@@ -813,4 +839,172 @@
private static final ClassLogger log =
new ClassLogger(ConnectorBootstrap.class.getPackage().getName(),
"ConnectorBootstrap");
+
+ private static class HostAwareSocketFactory implements RMIServerSocketFactory {
+
+ private final String bindAddress;
+
+ private HostAwareSocketFactory(String bindAddress) {
+ this.bindAddress = bindAddress;
+ }
+
+ @Override
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (bindAddress == null) {
+ return new ServerSocket(port);
+ } else {
+ try {
+ InetAddress addr = InetAddress.getByName(bindAddress);
+ return new ServerSocket(port, 0, addr);
+ } catch (UnknownHostException e) {
+ return new ServerSocket(port);
+ }
+ }
+ }
+ }
+
+ private static class HostAwareSslSocketFactory extends SslRMIServerSocketFactory {
+
+ private final String bindAddress;
+ private final String[] enabledCipherSuites;
+ private final String[] enabledProtocols;
+ private final boolean needClientAuth;
+ private final SSLContext context;
+
+ private HostAwareSslSocketFactory(String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) throws IllegalArgumentException {
+ this(null, enabledCipherSuites, enabledProtocols, sslNeedClientAuth, bindAddress);
+ }
+
+ private HostAwareSslSocketFactory(SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean sslNeedClientAuth,
+ String bindAddress) throws IllegalArgumentException {
+ this.context = ctx;
+ this.bindAddress = bindAddress;
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = sslNeedClientAuth;
+ checkValues(ctx, enabledCipherSuites, enabledProtocols);
+ }
+
+ @Override
+ public ServerSocket createServerSocket(int port) throws IOException {
+ if (bindAddress != null) {
+ try {
+ InetAddress addr = InetAddress.getByName(bindAddress);
+ return new SslServerSocket(port, 0, addr, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ } catch (UnknownHostException e) {
+ return new SslServerSocket(port, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ }
+ } else {
+ return new SslServerSocket(port, context,
+ enabledCipherSuites, enabledProtocols, needClientAuth);
+ }
+ }
+
+ private static void checkValues(SSLContext context,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols) throws IllegalArgumentException {
+ // Force the initialization of the default at construction time,
+ // rather than delaying it to the first time createServerSocket()
+ // is called.
+ //
+ final SSLSocketFactory sslSocketFactory =
+ context == null ?
+ (SSLSocketFactory)SSLSocketFactory.getDefault() : context.getSocketFactory();
+ SSLSocket sslSocket = null;
+ if (enabledCipherSuites != null || enabledProtocols != null) {
+ try {
+ sslSocket = (SSLSocket) sslSocketFactory.createSocket();
+ } catch (Exception e) {
+ final String msg = "Unable to check if the cipher suites " +
+ "and protocols to enable are supported";
+ throw (IllegalArgumentException)
+ new IllegalArgumentException(msg).initCause(e);
+ }
+ }
+
+ // Check if all the cipher suites and protocol versions to enable
+ // are supported by the underlying SSL/TLS implementation and if
+ // true create lists from arrays.
+ //
+ if (enabledCipherSuites != null) {
+ sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+ }
+ if (enabledProtocols != null) {
+ sslSocket.setEnabledProtocols(enabledProtocols);
+ }
+ }
+ }
+
+ private static class SslServerSocket extends ServerSocket {
+
+ private static SSLSocketFactory defaultSSLSocketFactory;
+ private final String[] enabledCipherSuites;
+ private final String[] enabledProtocols;
+ private final boolean needClientAuth;
+ private final SSLContext context;
+
+ private SslServerSocket(int port,
+ SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth) throws IOException {
+ super(port);
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = needClientAuth;
+ this.context = ctx;
+ }
+
+ private SslServerSocket(int port,
+ int backlog,
+ InetAddress bindAddr,
+ SSLContext ctx,
+ String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth) throws IOException {
+ super(port, backlog, bindAddr);
+ this.enabledProtocols = enabledProtocols;
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.needClientAuth = needClientAuth;
+ this.context = ctx;
+ }
+
+ @Override
+ public Socket accept() throws IOException {
+ final SSLSocketFactory sslSocketFactory =
+ context == null ?
+ getDefaultSSLSocketFactory() : context.getSocketFactory();
+ Socket socket = super.accept();
+ SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(
+ socket, socket.getInetAddress().getHostName(),
+ socket.getPort(), true);
+ sslSocket.setUseClientMode(false);
+ if (enabledCipherSuites != null) {
+ sslSocket.setEnabledCipherSuites(enabledCipherSuites);
+ }
+ if (enabledProtocols != null) {
+ sslSocket.setEnabledProtocols(enabledProtocols);
+ }
+ sslSocket.setNeedClientAuth(needClientAuth);
+ return sslSocket;
+ }
+
+ private static synchronized SSLSocketFactory getDefaultSSLSocketFactory() {
+ if (defaultSSLSocketFactory == null) {
+ defaultSSLSocketFactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
+ return defaultSSLSocketFactory;
+ } else {
+ return defaultSSLSocketFactory;
+ }
+ }
+
+ }
}
diff -r abe1866e51e3 -r e18371fa3e76 jdk/src/java.management/share/conf/management.properties
--- a/jdk/src/java.management/share/conf/management.properties Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/src/java.management/share/conf/management.properties Fri Jan 01 17:08:24 2016 +0000
@@ -316,3 +316,16 @@
# For a non-default password file location use the following line
# com.sun.management.jmxremote.access.file=filepath
+#
+
+# ################ Management agent listen interface #########################
+#
+# com.sun.management.jmxremote.host=
+# Specifies the local interface on which the JMX RMI agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
diff -r abe1866e51e3 -r e18371fa3e76 jdk/src/java.management/share/native/include/jmm.h
--- a/jdk/src/java.management/share/native/include/jmm.h Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/src/java.management/share/native/include/jmm.h Fri Jan 01 17:08:24 2016 +0000
@@ -227,16 +227,10 @@
jint (JNICALL *GetOptionalSupport) (JNIEnv *env,
jmmOptionalSupport* support_ptr);
- /* This is used by JDK 6 and earlier.
- * For JDK 7 and after, use GetInputArgumentArray.
- */
- jobject (JNICALL *GetInputArguments) (JNIEnv *env);
-
jint (JNICALL *GetThreadInfo) (JNIEnv *env,
jlongArray ids,
jint maxDepth,
jobjectArray infoArray);
- jobjectArray (JNICALL *GetInputArgumentArray) (JNIEnv *env);
jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr);
diff -r abe1866e51e3 -r e18371fa3e76 jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c
--- a/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/src/java.management/share/native/libmanagement/VMManagementImpl.c Fri Jan 01 17:08:24 2016 +0000
@@ -112,7 +112,7 @@
Java_sun_management_VMManagementImpl_getVmArguments0
(JNIEnv *env, jobject dummy)
{
- return jmm_interface->GetInputArgumentArray(env);
+ return JVM_GetVmArguments(env);
}
JNIEXPORT jlong JNICALL
diff -r abe1866e51e3 -r e18371fa3e76 jdk/test/com/sun/jdi/BreakpointWithFullGC.sh
--- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh Fri Dec 18 09:37:18 2015 -0800
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh Fri Jan 01 17:08:24 2016 +0000
@@ -121,7 +121,8 @@
jdbFailIfNotPresent 'System\..*end of test'
# make sure we had at least one full GC
-debuggeeFailIfNotPresent 'Full GC'
+# Prior to JDK9-B95, the pattern was 'Full GC'
+debuggeeMatchRegexp '^.*?\bPause Full\b\(System.gc\(\)\)\b.*?$'
# check for error message due to thread ID change
debuggeeFailIfPresent \
diff -r abe1866e51e3 -r e18371fa3e76 jdk/test/java/lang/ref/PhantomReferentClearing.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/ref/PhantomReferentClearing.java Fri Jan 01 17:08:24 2016 +0000
@@ -0,0 +1,101 @@
+/*
+ * 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 8071507
+ * @summary Test that PhantomReferences are cleared when notified.
+ * @run main/othervm PhantomReferentClearing
+ */
+
+import java.lang.ref.PhantomReference;
+import java.lang.ref.ReferenceQueue;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PhantomReferentClearing {
+
+ private static final long ENQUEUE_TIMEOUT = 1000; // 1 sec, in millis
+
+ // P1 & P2 are PhantomReference objects
+ // O1 & O2 are objects
+ //
+ // -> is a strong reference
+ // => is a referent reference
+ //
+ // root -> P1
+ // root -> P2
+ // root -> O1
+ // root -> O2
+ // O1 -> O2
+ // P1 => O1
+ // P2 => O2
+ //
+ // (1) Remove root -> O1 and collect. P1 notified, P2 !notified.
+ // (2) Remove root -> O2 and collect.
+ //
+ // If phantom references are cleared when notified, as proposed by
+ // 8071507, then P2 should be notified, and the test passes.
+ //
+ // Otherwise, P2 does not get notified because it remains reachable
+ // from O1, which is being retained by P1. This fails the test.
+
+ private static final ReferenceQueue