diff --git a/jdk/make/Import.gmk b/jdk/make/Import.gmk
index 9e743349437..ffe2869897f 100644
--- a/jdk/make/Import.gmk
+++ b/jdk/make/Import.gmk
@@ -32,11 +32,11 @@ include MakeBase.gmk
# Put the libraries here. Different locations for different target OS types.
ifneq ($(OPENJDK_TARGET_OS), windows)
- HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+ HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent$(OPENJDK_TARGET_CPU_LIBDIR)
else
- HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/bin
+ HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/bin
BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent
endif
@@ -80,11 +80,11 @@ SA_TARGETS := $(COPY_HOTSPOT_SA)
################################################################################
ifeq ($(OPENJDK_TARGET_OS), macosx)
- JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
- $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
+ JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
+ $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
else
- JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
- $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
+ JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
+ $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
endif
ifneq ($(OPENJDK_TARGET_OS), windows)
diff --git a/jdk/make/lib/Lib-java.instrument.gmk b/jdk/make/lib/Lib-java.instrument.gmk
index 5b668c87872..b0eb7e858db 100644
--- a/jdk/make/lib/Lib-java.instrument.gmk
+++ b/jdk/make/lib/Lib-java.instrument.gmk
@@ -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
@@ -25,6 +25,9 @@
include LibCommon.gmk
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.instrument.gmk))
+
################################################################################
LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/java.instrument/share/native/libinstrument \
diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk
index 29d5c081665..3da181b0d1a 100644
--- a/jdk/make/lib/Lib-java.management.gmk
+++ b/jdk/make/lib/Lib-java.management.gmk
@@ -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
@@ -30,10 +30,10 @@ $(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.management.gmk))
################################################################################
-BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \
+LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \
$(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement
-BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
- $(addprefix -I,$(BUILD_LIBMANAGEMENT_SRC)) \
+LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
+ $(addprefix -I,$(LIBMANAGEMENT_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.management \
$(LIBJAVA_HEADER_FLAGS) \
#
@@ -43,20 +43,6 @@ BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/i
# See MSDN documentation for GetProcessMemoryInfo for more information.
BUILD_LIBMANAGEMENT_CFLAGS += -DPSAPI_VERSION=1
-BUILD_LIBMANAGEMENT_EXCLUDES :=
-
-ifneq ($(OPENJDK_TARGET_OS), solaris)
- BUILD_LIBMANAGEMENT_EXCLUDES += SolarisOperatingSystem.c
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), linux)
- BUILD_LIBMANAGEMENT_EXCLUDES += LinuxOperatingSystem.c
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- BUILD_LIBMANAGEMENT_EXCLUDES += MacosxOperatingSystem.c
-endif
-
LIBMANAGEMENT_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
@@ -64,17 +50,13 @@ ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
endif
endif
-# Make it possible to override this variable
-LIBMANAGEMENT_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers
-
$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \
LIBRARY := management, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(BUILD_LIBMANAGEMENT_SRC), \
- EXCLUDE_FILES := $(BUILD_LIBMANAGEMENT_EXCLUDES), \
+ SRC := $(LIBMANAGEMENT_SRC), \
OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
- CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(BUILD_LIBMANAGEMENT_CFLAGS), \
- MAPFILE := $(LIBMANAGEMENT_MAPFILE), \
+ CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(LIBMANAGEMENT_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_solaris := -lkstat, \
diff --git a/jdk/make/lib/Lib-jdk.management.gmk b/jdk/make/lib/Lib-jdk.management.gmk
new file mode 100644
index 00000000000..819bef81252
--- /dev/null
+++ b/jdk/make/lib/Lib-jdk.management.gmk
@@ -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. 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.
+#
+
+include LibCommon.gmk
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/Lib-jdk.management.gmk))
+
+################################################################################
+
+LIBMANAGEMENT_EXT_SRC += $(JDK_TOPDIR)/src/jdk.management/share/native/libmanagement_ext \
+ $(JDK_TOPDIR)/src/jdk.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement_ext \
+ $(JDK_TOPDIR)/src/jdk.management/$(OPENJDK_TARGET_OS)/native/libmanagement_ext
+LIBMANAGEMENT_EXT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
+ $(addprefix -I,$(LIBMANAGEMENT_EXT_SRC)) \
+ -I$(SUPPORT_OUTPUTDIR)/headers/jdk.management \
+ $(LIBJAVA_HEADER_FLAGS) \
+ #
+
+LIBMANAGEMENT_EXT_OPTIMIZATION := HIGH
+ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
+ ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ LIBMANAGEMENT_EXT_OPTIMIZATION := LOW
+ endif
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT_EXT, \
+ LIBRARY := management_ext, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBMANAGEMENT_EXT_SRC), \
+ LANG := C, \
+ OPTIMIZATION := $(LIBMANAGEMENT_EXT_OPTIMIZATION), \
+ CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(LIBMANAGEMENT_EXT_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmanagement_ext/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_solaris := -lkstat, \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX_windows := jvm.lib psapi.lib $(WIN_JAVA_LIB) advapi32.lib, \
+ LDFLAGS_SUFFIX_aix := -lperfstat,\
+ VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=management_ext.dll" \
+ -D "JDK_INTERNAL_NAME=management_ext" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_ext, \
+ DEBUG_SYMBOLS := true))
+
+$(BUILD_LIBMANAGEMENT_EXT): $(call FindLib, java.base, java)
+
+TARGETS += $(BUILD_LIBMANAGEMENT_EXT)
+
+################################################################################
diff --git a/jdk/make/mapfiles/libmanagement/mapfile-vers b/jdk/make/mapfiles/libmanagement/mapfile-vers
index a4cb163806a..228ef93abb6 100644
--- a/jdk/make/mapfiles/libmanagement/mapfile-vers
+++ b/jdk/make/mapfiles/libmanagement/mapfile-vers
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -27,37 +27,10 @@
SUNWprivate_1.1 {
global:
- Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0;
- Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0;
- Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0;
- Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount0;
- Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount0;
- Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0;
- Java_sun_management_OperatingSystemImpl_getProcessCpuTime0;
- Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0;
- Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0;
- Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0;
- Java_sun_management_OperatingSystemImpl_initialize0;
Java_sun_management_ClassLoadingImpl_setVerboseClass;
- Java_sun_management_DiagnosticCommandImpl_executeDiagnosticCommand;
- Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommands;
- Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommandInfo;
- Java_sun_management_DiagnosticCommandImpl_setNotificationEnabled;
- Java_sun_management_FileSystemImpl_isAccessUserOnly0;
- Java_sun_management_Flag_getAllFlagNames;
- Java_sun_management_Flag_getFlags;
- Java_sun_management_Flag_getInternalFlagCount;
- Java_sun_management_Flag_initialize;
- Java_sun_management_Flag_setLongValue;
- Java_sun_management_Flag_setBooleanValue;
- Java_sun_management_Flag_setStringValue;
- Java_sun_management_GarbageCollectorImpl_getCollectionCount;
+ Java_sun_management_FileSystemImpl_isAccessUserOnly0;
+ Java_sun_management_GarbageCollectorImpl_getCollectionCount;
Java_sun_management_GarbageCollectorImpl_getCollectionTime;
- Java_sun_management_GarbageCollectorImpl_setNotificationEnabled;
- Java_sun_management_GcInfoBuilder_fillGcAttributeInfo;
- Java_sun_management_GcInfoBuilder_getLastGcInfo0;
- Java_sun_management_GcInfoBuilder_getNumGcExtAttributes;
- Java_sun_management_HotSpotDiagnostic_dumpHeap0;
Java_sun_management_HotspotThread_getInternalThreadCount;
Java_sun_management_HotspotThread_getInternalThreadTimes0;
Java_sun_management_MemoryImpl_getMemoryManagers0;
diff --git a/jdk/make/mapfiles/libmanagement_ext/mapfile-vers b/jdk/make/mapfiles/libmanagement_ext/mapfile-vers
new file mode 100644
index 00000000000..b8397bf9c1b
--- /dev/null
+++ b/jdk/make/mapfiles/libmanagement_ext/mapfile-vers
@@ -0,0 +1,60 @@
+#
+# 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.
+#
+
+# Define library interface.
+
+SUNWprivate_1.1 {
+ global:
+ Java_com_sun_management_internal_OperatingSystemImpl_getCommittedVirtualMemorySize0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getFreePhysicalMemorySize0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getFreeSwapSpaceSize0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getMaxFileDescriptorCount0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getOpenFileDescriptorCount0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuTime0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getSystemCpuLoad0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getTotalPhysicalMemorySize0;
+ Java_com_sun_management_internal_OperatingSystemImpl_getTotalSwapSpaceSize0;
+ Java_com_sun_management_internal_OperatingSystemImpl_initialize0;
+ Java_com_sun_management_internal_DiagnosticCommandImpl_executeDiagnosticCommand;
+ Java_com_sun_management_internal_DiagnosticCommandImpl_getDiagnosticCommands;
+ Java_com_sun_management_internal_DiagnosticCommandImpl_getDiagnosticCommandInfo;
+ Java_com_sun_management_internal_DiagnosticCommandImpl_setNotificationEnabled;
+ Java_com_sun_management_internal_Flag_getAllFlagNames;
+ Java_com_sun_management_internal_Flag_getFlags;
+ Java_com_sun_management_internal_Flag_getInternalFlagCount;
+ Java_com_sun_management_internal_Flag_initialize;
+ Java_com_sun_management_internal_Flag_setLongValue;
+ Java_com_sun_management_internal_Flag_setBooleanValue;
+ Java_com_sun_management_internal_Flag_setStringValue;
+ Java_com_sun_management_internal_GarbageCollectorExtImpl_setNotificationEnabled;
+ Java_com_sun_management_internal_GcInfoBuilder_fillGcAttributeInfo;
+ Java_com_sun_management_internal_GcInfoBuilder_getLastGcInfo0;
+ Java_com_sun_management_internal_GcInfoBuilder_getNumGcExtAttributes;
+ Java_com_sun_management_internal_HotSpotDiagnostic_dumpHeap0;
+ JNI_OnLoad;
+ local:
+ *;
+};
diff --git a/jdk/make/src/classes/build/tools/module/boot.modules b/jdk/make/src/classes/build/tools/module/boot.modules
index 2c32d09526f..eb0ac74d739 100644
--- a/jdk/make/src/classes/build/tools/module/boot.modules
+++ b/jdk/make/src/classes/build/tools/module/boot.modules
@@ -22,6 +22,7 @@ jdk.deploy.osx
jdk.hprof.agent
jdk.httpserver
jdk.jfr
+jdk.management
jdk.management.cmm
jdk.naming.rmi
jdk.sctp
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java
index d4cd740af7b..f8a3eaa0a4c 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/GCTR.java
@@ -38,7 +38,17 @@ import static com.sun.crypto.provider.AESConstants.AES_BLOCK_SIZE;
* under section 6.5. It needs to be constructed w/ an initialized
* cipher object, and initial counter block(ICB). Given an input X
* of arbitrary length, it processes and returns an output which has
- * the same length as X.
+ * the same length as X. The invariants of this class are:
+ *
+ * (1) The length of intialCounterBlk (and also of its clones, e.g.,
+ * fields counter and counterSave) is equal to AES_BLOCK_SIZE.
+ *
+ * (2) After construction, the field counter never becomes null, it
+ * always contains a byte array of length AES_BLOCK_SIZE.
+ *
+ * If any invariant is broken, failures can occur because the
+ * AESCrypt.encryptBlock method can be intrinsified on the HotSpot VM
+ * (see JDK-8067648 for details).
*
*
This function is used in the implementation of GCM mode.
*
@@ -59,6 +69,10 @@ final class GCTR {
// NOTE: cipher should already be initialized
GCTR(SymmetricCipher cipher, byte[] initialCounterBlk) {
this.aes = cipher;
+ if (initialCounterBlk.length != AES_BLOCK_SIZE) {
+ throw new RuntimeException("length of initial counter block (" + initialCounterBlk.length +
+ ") not equal to AES_BLOCK_SIZE (" + AES_BLOCK_SIZE + ")");
+ }
this.icb = initialCounterBlk;
this.counter = icb.clone();
}
@@ -137,6 +151,8 @@ final class GCTR {
* Restores the content of this object to the previous saved one.
*/
void restore() {
- this.counter = this.counterSave;
+ if (this.counterSave != null) {
+ this.counter = this.counterSave;
+ }
}
}
diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java
index 9748cc6c804..3aefe6ee2fb 100644
--- a/jdk/src/java.base/share/classes/java/lang/Class.java
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java
@@ -1312,7 +1312,7 @@ public final class Class implements java.io.Serializable,
// e) Anonymous classes
- // JVM Spec 4.8.6: A class must have an EnclosingMethod
+ // JVM Spec 4.7.7: A class must have an EnclosingMethod
// attribute if and only if it is a local class or an
// anonymous class.
EnclosingMethodInfo enclosingInfo = getEnclosingMethodInfo();
@@ -1357,28 +1357,7 @@ public final class Class implements java.io.Serializable,
simpleName = getName();
return simpleName.substring(simpleName.lastIndexOf('.')+1); // strip the package name
}
- // According to JLS3 "Binary Compatibility" (13.1) the binary
- // name of non-package classes (not top level) is the binary
- // name of the immediately enclosing class followed by a '$' followed by:
- // (for nested and inner classes): the simple name.
- // (for local classes): 1 or more digits followed by the simple name.
- // (for anonymous classes): 1 or more digits.
-
- // Since getSimpleBinaryName() will strip the binary name of
- // the immediately enclosing class, we are now looking at a
- // string that matches the regular expression "\$[0-9]*"
- // followed by a simple name (considering the simple of an
- // anonymous class to be the empty string).
-
- // Remove leading "\$[0-9]*" from the name
- int length = simpleName.length();
- if (length < 1 || simpleName.charAt(0) != '$')
- throw new InternalError("Malformed class name");
- int index = 1;
- while (index < length && isAsciiDigit(simpleName.charAt(index)))
- index++;
- // Eventually, this is the empty string iff this is an anonymous class
- return simpleName.substring(index);
+ return simpleName;
}
/**
@@ -1489,20 +1468,20 @@ public final class Class implements java.io.Serializable,
Class> enclosingClass = getEnclosingClass();
if (enclosingClass == null) // top level class
return null;
- // Otherwise, strip the enclosing class' name
- try {
- return getName().substring(enclosingClass.getName().length());
- } catch (IndexOutOfBoundsException ex) {
- throw new InternalError("Malformed class name", ex);
- }
+ String name = getSimpleBinaryName0();
+ if (name == null) // anonymous class
+ return "";
+ return name;
}
+ private native String getSimpleBinaryName0();
+
/**
* Returns {@code true} if this is a local class or an anonymous
* class. Returns {@code false} otherwise.
*/
private boolean isLocalOrAnonymousClass() {
- // JVM Spec 4.8.6: A class must have an EnclosingMethod
+ // JVM Spec 4.7.7: A class must have an EnclosingMethod
// attribute if and only if it is a local class or an
// anonymous class.
return getEnclosingMethodInfo() != null;
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java b/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java
index 10ac1c0716e..11e452b96c9 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/CallSite.java
@@ -25,9 +25,10 @@
package java.lang.invoke;
-import sun.invoke.empty.Empty;
import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
+import java.lang.reflect.Field;
+import sun.misc.Cleaner;
/**
* A {@code CallSite} is a holder for a variable {@link MethodHandle},
@@ -135,6 +136,50 @@ public class CallSite {
this.target = boundTarget;
}
+ /**
+ * {@code CallSite} dependency context.
+ * VM uses context class to store nmethod dependencies on the call site target.
+ * Can be in 2 states: (a) null; or (b) {@code Cleaner} instance pointing to some Class instance.
+ * Lazily initialized when CallSite instance is linked to some indy call site or VM needs
+ * it to store dependencies. As a corollary, "null" context means there are no dependencies
+ * registered yet. {@code Cleaner} is used in 2 roles:
+ * (a) context class access for VM;
+ * (b) stale context class cleanup.
+ * {@code Cleaner} holds the context class until cleanup action is finished (see {@code PhantomReference}).
+ * Though it's impossible to get the context class using {@code Reference.get()}, VM extracts it directly
+ * from {@code Reference.referent} field.
+ */
+ private volatile Cleaner context = null;
+
+ /**
+ * Default context.
+ * VM uses it to initialize non-linked CallSite context.
+ */
+ private static class DefaultContext {}
+ private static final Cleaner DEFAULT_CONTEXT = makeContext(DefaultContext.class, null);
+
+ private static Cleaner makeContext(Class> referent, final CallSite holder) {
+ return Cleaner.create(referent,
+ new Runnable() {
+ @Override public void run() {
+ MethodHandleNatives.invalidateDependentNMethods(holder);
+ }
+ });
+ }
+
+ /** Initialize context class used for nmethod dependency tracking */
+ /*package-private*/
+ void initContext(Class> newContext) {
+ // If there are concurrent actions, exactly one succeeds.
+ if (context == null) {
+ UNSAFE.compareAndSwapObject(this, CONTEXT_OFFSET, /*expected=*/null, makeContext(newContext, this));
+ // No need to care about failed CAS attempt.
+ // Since initContext is called from indy call site linkage in newContext class, there's no risk
+ // that the context class becomes dead while corresponding context cleaner is alive (causing cleanup
+ // action in the wrong context).
+ }
+ }
+
/**
* Returns the type of this call site's target.
* Although targets may change, any call site's type is permanent, and can never change to an unequal type.
@@ -246,11 +291,13 @@ public class CallSite {
}
// unsafe stuff:
- private static final long TARGET_OFFSET;
+ private static final long TARGET_OFFSET;
+ private static final long CONTEXT_OFFSET;
static {
try {
- TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target"));
- } catch (Exception ex) { throw new Error(ex); }
+ TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target"));
+ CONTEXT_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("context"));
+ } catch (Exception ex) { throw newInternalError(ex); }
}
/*package-private*/
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
index 7cdb8c5e982..f02ed74aae5 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
@@ -691,10 +691,4 @@ class DirectMethodHandle extends MethodHandle {
}
}
}
-
- @Override
- void customize() {
- assert(form.customized == null);
- // No need to customize DMHs.
- }
}
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
index b44f9adf62f..225b998efb3 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@@ -847,11 +847,7 @@ class InvokerBytecodeGenerator {
refKind = REF_invokeVirtual;
}
- if (member.getDeclaringClass().isInterface() && refKind == REF_invokeVirtual) {
- // Methods from Object declared in an interface can be resolved by JVM to invokevirtual kind.
- // Need to convert it back to invokeinterface to pass verification and make the invocation works as expected.
- refKind = REF_invokeInterface;
- }
+ assert(!(member.getDeclaringClass().isInterface() && refKind == REF_invokeVirtual));
// push arguments
emitPushArguments(name);
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
index 43cf38f12bd..e674829338e 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
@@ -281,7 +281,7 @@ class Invokers {
outArgs[0] = names[CHECK_TYPE];
}
if (CHECK_CUSTOM != -1) {
- names[CHECK_CUSTOM] = new Name(NF_checkCustomized, names[CALL_MH]);
+ names[CHECK_CUSTOM] = new Name(NF_checkCustomized, outArgs[0]);
}
names[LINKER_CALL] = new Name(outCallType, outArgs);
lform = new LambdaForm(debugName, INARG_LIMIT, names);
@@ -394,6 +394,7 @@ class Invokers {
@ForceInline
void checkCustomized(Object o) {
MethodHandle mh = (MethodHandle)o;
+ if (MethodHandleImpl.isCompileConstant(mh)) return;
if (mh.form.customized == null) {
maybeCustomize(mh);
}
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
index c138676a8fb..d1c1d6984f8 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -722,6 +722,13 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
return result;
}
+ // Intrinsified by C2. Returns true if obj is a compile-time constant.
+ @LambdaForm.Hidden
+ static
+ boolean isCompileConstant(Object obj) {
+ return false;
+ }
+
static
MethodHandle makeGuardWithTest(MethodHandle test,
MethodHandle target,
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
index 01c3b33001d..3d3c47f689c 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -55,121 +55,42 @@ class MethodHandleNatives {
static native Object staticFieldBase(MemberName self); // e.g., returns clazz
static native Object getMemberVMInfo(MemberName self); // returns {vmindex,vmtarget}
- /// MethodHandle support
-
- /** Fetch MH-related JVM parameter.
- * which=0 retrieves MethodHandlePushLimit
- * which=1 retrieves stack slot push size (in address units)
- */
- static native int getConstant(int which);
-
- static final boolean COUNT_GWT;
-
/// CallSite support
/** Tell the JVM that we need to change the target of a CallSite. */
static native void setCallSiteTargetNormal(CallSite site, MethodHandle target);
static native void setCallSiteTargetVolatile(CallSite site, MethodHandle target);
+ /** Invalidate CallSite context: clean up dependent nmethods and reset call site context to initial state (null). */
+ static native void invalidateDependentNMethods(CallSite site);
+
private static native void registerNatives();
static {
registerNatives();
- COUNT_GWT = getConstant(Constants.GC_COUNT_GWT) != 0;
// The JVM calls MethodHandleNatives.. Cascade the calls as needed:
MethodHandleImpl.initStatics();
}
- // All compile-time constants go here.
- // There is an opportunity to check them against the JVM's idea of them.
+ /**
+ * Compile-time constants go here. This collection exists not only for
+ * reference from clients, but also for ensuring the VM and JDK agree on the
+ * values of these constants (see {@link #verifyConstants()}).
+ */
static class Constants {
Constants() { } // static only
- // MethodHandleImpl
- static final int // for getConstant
- GC_COUNT_GWT = 4,
- GC_LAMBDA_SUPPORT = 5;
- // MemberName
- // The JVM uses values of -2 and above for vtable indexes.
- // Field values are simple positive offsets.
- // Ref: src/share/vm/oops/methodOop.hpp
- // This value is negative enough to avoid such numbers,
- // but not too negative.
static final int
- MN_IS_METHOD = 0x00010000, // method (not constructor)
- MN_IS_CONSTRUCTOR = 0x00020000, // constructor
- MN_IS_FIELD = 0x00040000, // field
- MN_IS_TYPE = 0x00080000, // nested type
- MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected
- MN_REFERENCE_KIND_SHIFT = 24, // refKind
- MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
- // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
- MN_SEARCH_SUPERCLASSES = 0x00100000,
- MN_SEARCH_INTERFACES = 0x00200000;
-
- /**
- * Basic types as encoded in the JVM. These code values are not
- * intended for use outside this class. They are used as part of
- * a private interface between the JVM and this class.
- */
- static final int
- T_BOOLEAN = 4,
- T_CHAR = 5,
- T_FLOAT = 6,
- T_DOUBLE = 7,
- T_BYTE = 8,
- T_SHORT = 9,
- T_INT = 10,
- T_LONG = 11,
- T_OBJECT = 12,
- //T_ARRAY = 13
- T_VOID = 14,
- //T_ADDRESS = 15
- T_ILLEGAL = 99;
-
- /**
- * Constant pool entry types.
- */
- static final byte
- CONSTANT_Utf8 = 1,
- CONSTANT_Integer = 3,
- CONSTANT_Float = 4,
- CONSTANT_Long = 5,
- CONSTANT_Double = 6,
- CONSTANT_Class = 7,
- CONSTANT_String = 8,
- CONSTANT_Fieldref = 9,
- CONSTANT_Methodref = 10,
- CONSTANT_InterfaceMethodref = 11,
- CONSTANT_NameAndType = 12,
- CONSTANT_MethodHandle = 15, // JSR 292
- CONSTANT_MethodType = 16, // JSR 292
- CONSTANT_InvokeDynamic = 18,
- CONSTANT_LIMIT = 19; // Limit to tags found in classfiles
-
- /**
- * Access modifier flags.
- */
- static final char
- ACC_PUBLIC = 0x0001,
- ACC_PRIVATE = 0x0002,
- ACC_PROTECTED = 0x0004,
- ACC_STATIC = 0x0008,
- ACC_FINAL = 0x0010,
- ACC_SYNCHRONIZED = 0x0020,
- ACC_VOLATILE = 0x0040,
- ACC_TRANSIENT = 0x0080,
- ACC_NATIVE = 0x0100,
- ACC_INTERFACE = 0x0200,
- ACC_ABSTRACT = 0x0400,
- ACC_STRICT = 0x0800,
- ACC_SYNTHETIC = 0x1000,
- ACC_ANNOTATION = 0x2000,
- ACC_ENUM = 0x4000,
- // aliases:
- ACC_SUPER = ACC_SYNCHRONIZED,
- ACC_BRIDGE = ACC_VOLATILE,
- ACC_VARARGS = ACC_TRANSIENT;
+ MN_IS_METHOD = 0x00010000, // method (not constructor)
+ MN_IS_CONSTRUCTOR = 0x00020000, // constructor
+ MN_IS_FIELD = 0x00040000, // field
+ MN_IS_TYPE = 0x00080000, // nested type
+ MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected
+ MN_REFERENCE_KIND_SHIFT = 24, // refKind
+ MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
+ // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
+ MN_SEARCH_SUPERCLASSES = 0x00100000,
+ MN_SEARCH_INTERFACES = 0x00200000;
/**
* Constant pool reference-kind codes, as used by CONSTANT_MethodHandle CP entries.
@@ -314,6 +235,7 @@ class MethodHandleNatives {
return Invokers.linkToTargetMethod(type);
} else {
appendixResult[0] = callSite;
+ callSite.initContext(caller);
return Invokers.linkToCallSiteMethod(type);
}
}
diff --git a/jdk/src/java.base/share/classes/java/nio/Bits.java b/jdk/src/java.base/share/classes/java/nio/Bits.java
index c7f2b78422b..d23e35e82aa 100644
--- a/jdk/src/java.base/share/classes/java/nio/Bits.java
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, 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
@@ -567,32 +567,13 @@ class Bits { // package-private
// -- Processor and memory-system properties --
- private static final ByteOrder byteOrder;
+ private static final ByteOrder byteOrder
+ = unsafe.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
static ByteOrder byteOrder() {
- if (byteOrder == null)
- throw new Error("Unknown byte order");
return byteOrder;
}
- static {
- long a = unsafe.allocateMemory(8);
- try {
- unsafe.putLong(a, 0x0102030405060708L);
- byte b = unsafe.getByte(a);
- switch (b) {
- case 0x01: byteOrder = ByteOrder.BIG_ENDIAN; break;
- case 0x08: byteOrder = ByteOrder.LITTLE_ENDIAN; break;
- default:
- assert false;
- byteOrder = null;
- }
- } finally {
- unsafe.freeMemory(a);
- }
- }
-
-
private static int pageSize = -1;
static int pageSize() {
@@ -605,17 +586,9 @@ class Bits { // package-private
return (int)(size + (long)pageSize() - 1L) / pageSize();
}
- private static boolean unaligned;
- private static boolean unalignedKnown = false;
+ private static boolean unaligned = unsafe.unalignedAccess();
static boolean unaligned() {
- if (unalignedKnown)
- return unaligned;
- String arch = AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("os.arch"));
- unaligned = arch.equals("i386") || arch.equals("x86")
- || arch.equals("amd64") || arch.equals("x86_64");
- unalignedKnown = true;
return unaligned;
}
diff --git a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
index e8639c4d21f..3876b147093 100644
--- a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template
@@ -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
@@ -27,6 +27,7 @@
package java.nio;
+import sun.misc.Unsafe;
/**
#if[rw]
@@ -52,6 +53,16 @@ class Heap$Type$Buffer$RW$
#end[rw]
*/
+#if[byte]
+
+ // Cached unsafe-access object
+ private static final Unsafe unsafe = Bits.unsafe();
+
+ // Cached array base offset
+ private static final long arrayBaseOffset = unsafe.arrayBaseOffset($type$[].class);
+
+#end[byte]
+
Heap$Type$Buffer$RW$(int cap, int lim) { // package-private
#if[rw]
super(-1, 0, lim, cap, new $type$[cap], 0);
@@ -131,6 +142,12 @@ class Heap$Type$Buffer$RW$
return i + offset;
}
+#if[byte]
+ private long byteOffset(long i) {
+ return arrayBaseOffset + i + offset;
+ }
+#end[byte]
+
public $type$ get() {
return hb[ix(nextGetIndex())];
}
@@ -256,18 +273,18 @@ class Heap$Type$Buffer$RW$
#if[rw]
public char getChar() {
- return Bits.getChar(this, ix(nextGetIndex(2)), bigEndian);
+ return unsafe.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
}
public char getChar(int i) {
- return Bits.getChar(this, ix(checkIndex(i, 2)), bigEndian);
+ return unsafe.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
}
#end[rw]
public $Type$Buffer putChar(char x) {
#if[rw]
- Bits.putChar(this, ix(nextPutIndex(2)), x, bigEndian);
+ unsafe.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -276,7 +293,7 @@ class Heap$Type$Buffer$RW$
public $Type$Buffer putChar(int i, char x) {
#if[rw]
- Bits.putChar(this, ix(checkIndex(i, 2)), x, bigEndian);
+ unsafe.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -307,18 +324,18 @@ class Heap$Type$Buffer$RW$
#if[rw]
public short getShort() {
- return Bits.getShort(this, ix(nextGetIndex(2)), bigEndian);
+ return unsafe.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
}
public short getShort(int i) {
- return Bits.getShort(this, ix(checkIndex(i, 2)), bigEndian);
+ return unsafe.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
}
#end[rw]
public $Type$Buffer putShort(short x) {
#if[rw]
- Bits.putShort(this, ix(nextPutIndex(2)), x, bigEndian);
+ unsafe.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -327,7 +344,7 @@ class Heap$Type$Buffer$RW$
public $Type$Buffer putShort(int i, short x) {
#if[rw]
- Bits.putShort(this, ix(checkIndex(i, 2)), x, bigEndian);
+ unsafe.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -358,18 +375,18 @@ class Heap$Type$Buffer$RW$
#if[rw]
public int getInt() {
- return Bits.getInt(this, ix(nextGetIndex(4)), bigEndian);
+ return unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
}
public int getInt(int i) {
- return Bits.getInt(this, ix(checkIndex(i, 4)), bigEndian);
+ return unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
}
#end[rw]
public $Type$Buffer putInt(int x) {
#if[rw]
- Bits.putInt(this, ix(nextPutIndex(4)), x, bigEndian);
+ unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -378,7 +395,7 @@ class Heap$Type$Buffer$RW$
public $Type$Buffer putInt(int i, int x) {
#if[rw]
- Bits.putInt(this, ix(checkIndex(i, 4)), x, bigEndian);
+ unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -409,18 +426,18 @@ class Heap$Type$Buffer$RW$
#if[rw]
public long getLong() {
- return Bits.getLong(this, ix(nextGetIndex(8)), bigEndian);
+ return unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
}
public long getLong(int i) {
- return Bits.getLong(this, ix(checkIndex(i, 8)), bigEndian);
+ return unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
}
#end[rw]
public $Type$Buffer putLong(long x) {
#if[rw]
- Bits.putLong(this, ix(nextPutIndex(8)), x, bigEndian);
+ unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -429,7 +446,7 @@ class Heap$Type$Buffer$RW$
public $Type$Buffer putLong(int i, long x) {
#if[rw]
- Bits.putLong(this, ix(checkIndex(i, 8)), x, bigEndian);
+ unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -460,18 +477,21 @@ class Heap$Type$Buffer$RW$
#if[rw]
public float getFloat() {
- return Bits.getFloat(this, ix(nextGetIndex(4)), bigEndian);
+ int x = unsafe.getIntUnaligned(hb, byteOffset(nextPutIndex(4)), bigEndian);
+ return Float.intBitsToFloat(x);
}
public float getFloat(int i) {
- return Bits.getFloat(this, ix(checkIndex(i, 4)), bigEndian);
+ int x = unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+ return Float.intBitsToFloat(x);
}
#end[rw]
public $Type$Buffer putFloat(float x) {
#if[rw]
- Bits.putFloat(this, ix(nextPutIndex(4)), x, bigEndian);
+ int y = Float.floatToRawIntBits(x);
+ unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -480,7 +500,8 @@ class Heap$Type$Buffer$RW$
public $Type$Buffer putFloat(int i, float x) {
#if[rw]
- Bits.putFloat(this, ix(checkIndex(i, 4)), x, bigEndian);
+ int y = Float.floatToRawIntBits(x);
+ unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -511,18 +532,21 @@ class Heap$Type$Buffer$RW$
#if[rw]
public double getDouble() {
- return Bits.getDouble(this, ix(nextGetIndex(8)), bigEndian);
+ long x = unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+ return Double.longBitsToDouble(x);
}
public double getDouble(int i) {
- return Bits.getDouble(this, ix(checkIndex(i, 8)), bigEndian);
+ long x = unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+ return Double.longBitsToDouble(x);
}
#end[rw]
public $Type$Buffer putDouble(double x) {
#if[rw]
- Bits.putDouble(this, ix(nextPutIndex(8)), x, bigEndian);
+ long y = Double.doubleToRawLongBits(x);
+ unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -531,7 +555,8 @@ class Heap$Type$Buffer$RW$
public $Type$Buffer putDouble(int i, double x) {
#if[rw]
- Bits.putDouble(this, ix(checkIndex(i, 8)), x, bigEndian);
+ long y = Double.doubleToRawLongBits(x);
+ unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
diff --git a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
index 5ca9cb3059d..1d3454e281e 100644
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
@@ -183,7 +183,7 @@ public final class Unsafe {
*
* Unless the reference {@code x} being stored is either null
* or matches the field type, the results are undefined.
- * If the reference {@code o} is non-null, car marks or
+ * If the reference {@code o} is non-null, card marks or
* other store barriers for that object (if the VM requires them)
* are updated.
* @see #putInt(Object, long, int)
@@ -219,6 +219,35 @@ public final class Unsafe {
/** @see #putInt(Object, long, int) */
public native void putDouble(Object o, long offset, double x);
+ // These read VM internal data.
+
+ /**
+ * Fetches an uncompressed reference value from a given native variable
+ * ignoring the VM's compressed references mode.
+ *
+ * @param address a memory address locating the variable
+ * @return the value fetched from the indicated native variable
+ */
+ public native Object getUncompressedObject(long address);
+
+ /**
+ * Fetches the {@link java.lang.Class} Java mirror for the given native
+ * metaspace {@code Klass} pointer.
+ *
+ * @param metaspaceKlass a native metaspace {@code Klass} pointer
+ * @return the {@link java.lang.Class} Java mirror
+ */
+ public native Class> getJavaMirror(long metaspaceKlass);
+
+ /**
+ * Fetches a native metaspace {@code Klass} pointer for the given Java
+ * object.
+ *
+ * @param o Java heap object for which to fetch the class pointer
+ * @return a native metaspace {@code Klass} pointer
+ */
+ public native long getKlassPointer(Object o);
+
// These work on values in the C heap.
/**
@@ -934,4 +963,347 @@ public final class Unsafe {
private static void throwIllegalAccessError() {
throw new IllegalAccessError();
}
+
+ /**
+ * @return Returns true if the native byte ordering of this
+ * platform is big-endian, false if it is little-endian.
+ */
+ public final boolean isBigEndian() { return BE; }
+
+ /**
+ * @return Returns true if this platform is capable of performing
+ * accesses at addresses which are not aligned for the type of the
+ * primitive type being accessed, false otherwise.
+ */
+ public final boolean unalignedAccess() { return unalignedAccess; }
+
+ /**
+ * Fetches a value at some byte offset into a given Java object.
+ * More specifically, fetches a value within the given object
+ * o at the given offset, or (if o is
+ * null) from the memory address whose numerical value is the
+ * given offset.
+ *
+ * The specification of this method is the same as {@link
+ * #getLong(Object, long)} except that the offset does not need to
+ * have been obtained from {@link #objectFieldOffset} on the
+ * {@link java.lang.reflect.Field} of some Java field. The value
+ * in memory is raw data, and need not correspond to any Java
+ * variable. Unless o is null, the value accessed
+ * must be entirely within the allocated object. The endianness
+ * of the value in memory is the endianness of the native platform.
+ *
+ *
The read will be atomic with respect to the largest power
+ * of two that divides the GCD of the offset and the storage size.
+ * For example, getLongUnaligned will make atomic reads of 2-, 4-,
+ * or 8-byte storage units if the offset is zero mod 2, 4, or 8,
+ * respectively. There are no other guarantees of atomicity.
+ *
+ * 8-byte atomicity is only guaranteed on platforms on which
+ * support atomic accesses to longs.
+ *
+ * @param o Java heap object in which the value resides, if any, else
+ * null
+ * @param offset The offset in bytes from the start of the object
+ * @return the value fetched from the indicated object
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ * @since 1.9
+ */
+ public final long getLongUnaligned(Object o, long offset) {
+ if ((offset & 7) == 0) {
+ return getLong(o, offset);
+ } else if ((offset & 3) == 0) {
+ return makeLong(getInt(o, offset),
+ getInt(o, offset + 4));
+ } else if ((offset & 1) == 0) {
+ return makeLong(getShort(o, offset),
+ getShort(o, offset + 2),
+ getShort(o, offset + 4),
+ getShort(o, offset + 6));
+ } else {
+ return makeLong(getByte(o, offset),
+ getByte(o, offset + 1),
+ getByte(o, offset + 2),
+ getByte(o, offset + 3),
+ getByte(o, offset + 4),
+ getByte(o, offset + 5),
+ getByte(o, offset + 6),
+ getByte(o, offset + 7));
+ }
+ }
+ /**
+ * As {@link #getLongUnaligned(Object, long)} but with an
+ * additional argument which specifies the endianness of the value
+ * as stored in memory.
+ *
+ * @param o Java heap object in which the variable resides
+ * @param offset The offset in bytes from the start of the object
+ * @param bigEndian The endianness of the value
+ * @return the value fetched from the indicated object
+ * @since 1.9
+ */
+ public final long getLongUnaligned(Object o, long offset, boolean bigEndian) {
+ return convEndian(bigEndian, getLongUnaligned(o, offset));
+ }
+
+ /** @see #getLongUnaligned(Object, long) */
+ public final int getIntUnaligned(Object o, long offset) {
+ if ((offset & 3) == 0) {
+ return getInt(o, offset);
+ } else if ((offset & 1) == 0) {
+ return makeInt(getShort(o, offset),
+ getShort(o, offset + 2));
+ } else {
+ return makeInt(getByte(o, offset),
+ getByte(o, offset + 1),
+ getByte(o, offset + 2),
+ getByte(o, offset + 3));
+ }
+ }
+ /** @see #getLongUnaligned(Object, long, boolean) */
+ public final int getIntUnaligned(Object o, long offset, boolean bigEndian) {
+ return convEndian(bigEndian, getIntUnaligned(o, offset));
+ }
+
+ /** @see #getLongUnaligned(Object, long) */
+ public final short getShortUnaligned(Object o, long offset) {
+ if ((offset & 1) == 0) {
+ return getShort(o, offset);
+ } else {
+ return makeShort(getByte(o, offset),
+ getByte(o, offset + 1));
+ }
+ }
+ /** @see #getLongUnaligned(Object, long, boolean) */
+ public final short getShortUnaligned(Object o, long offset, boolean bigEndian) {
+ return convEndian(bigEndian, getShortUnaligned(o, offset));
+ }
+
+ /** @see #getLongUnaligned(Object, long) */
+ public final char getCharUnaligned(Object o, long offset) {
+ return (char)getShortUnaligned(o, offset);
+ }
+ /** @see #getLongUnaligned(Object, long, boolean) */
+ public final char getCharUnaligned(Object o, long offset, boolean bigEndian) {
+ return convEndian(bigEndian, getCharUnaligned(o, offset));
+ }
+
+ /**
+ * Stores a value at some byte offset into a given Java object.
+ *
+ * The specification of this method is the same as {@link
+ * #getLong(Object, long)} except that the offset does not need to
+ * have been obtained from {@link #objectFieldOffset} on the
+ * {@link java.lang.reflect.Field} of some Java field. The value
+ * in memory is raw data, and need not correspond to any Java
+ * variable. The endianness of the value in memory is the
+ * endianness of the native platform.
+ *
+ * The write will be atomic with respect to the largest power of
+ * two that divides the GCD of the offset and the storage size.
+ * For example, putLongUnaligned will make atomic writes of 2-, 4-,
+ * or 8-byte storage units if the offset is zero mod 2, 4, or 8,
+ * respectively. There are no other guarantees of atomicity.
+ *
+ * 8-byte atomicity is only guaranteed on platforms on which
+ * support atomic accesses to longs.
+ *
+ *
+ * @param o Java heap object in which the value resides, if any, else
+ * null
+ * @param offset The offset in bytes from the start of the object
+ * @param x the value to store
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ * @since 1.9
+ */
+ public final void putLongUnaligned(Object o, long offset, long x) {
+ if ((offset & 7) == 0) {
+ putLong(o, offset, x);
+ } else if ((offset & 3) == 0) {
+ putLongParts(o, offset,
+ (int)(x >> 0),
+ (int)(x >>> 32));
+ } else if ((offset & 1) == 0) {
+ putLongParts(o, offset,
+ (short)(x >>> 0),
+ (short)(x >>> 16),
+ (short)(x >>> 32),
+ (short)(x >>> 48));
+ } else {
+ putLongParts(o, offset,
+ (byte)(x >>> 0),
+ (byte)(x >>> 8),
+ (byte)(x >>> 16),
+ (byte)(x >>> 24),
+ (byte)(x >>> 32),
+ (byte)(x >>> 40),
+ (byte)(x >>> 48),
+ (byte)(x >>> 56));
+ }
+ }
+ /**
+ * As {@link #putLongUnaligned(Object, long, long)} but with an additional
+ * argument which specifies the endianness of the value as stored in memory.
+ * @param o Java heap object in which the value resides
+ * @param offset The offset in bytes from the start of the object
+ * @param x the value to store
+ * @param bigEndian The endianness of the value
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ * @since 1.9
+ */
+ public final void putLongUnaligned(Object o, long offset, long x, boolean bigEndian) {
+ putLongUnaligned(o, offset, convEndian(bigEndian, x));
+ }
+
+ /** @see #putLongUnaligned(Object, long, long) */
+ public final void putIntUnaligned(Object o, long offset, int x) {
+ if ((offset & 3) == 0) {
+ putInt(o, offset, x);
+ } else if ((offset & 1) == 0) {
+ putIntParts(o, offset,
+ (short)(x >> 0),
+ (short)(x >>> 16));
+ } else {
+ putIntParts(o, offset,
+ (byte)(x >>> 0),
+ (byte)(x >>> 8),
+ (byte)(x >>> 16),
+ (byte)(x >>> 24));
+ }
+ }
+ /** @see #putLongUnaligned(Object, long, long, boolean) */
+ public final void putIntUnaligned(Object o, long offset, int x, boolean bigEndian) {
+ putIntUnaligned(o, offset, convEndian(bigEndian, x));
+ }
+
+ /** @see #putLongUnaligned(Object, long, long) */
+ public final void putShortUnaligned(Object o, long offset, short x) {
+ if ((offset & 1) == 0) {
+ putShort(o, offset, x);
+ } else {
+ putShortParts(o, offset,
+ (byte)(x >>> 0),
+ (byte)(x >>> 8));
+ }
+ }
+ /** @see #putLongUnaligned(Object, long, long, boolean) */
+ public final void putShortUnaligned(Object o, long offset, short x, boolean bigEndian) {
+ putShortUnaligned(o, offset, convEndian(bigEndian, x));
+ }
+
+ /** @see #putLongUnaligned(Object, long, long) */
+ public final void putCharUnaligned(Object o, long offset, char x) {
+ putShortUnaligned(o, offset, (short)x);
+ }
+ /** @see #putLongUnaligned(Object, long, long, boolean) */
+ public final void putCharUnaligned(Object o, long offset, char x, boolean bigEndian) {
+ putCharUnaligned(o, offset, convEndian(bigEndian, x));
+ }
+
+ // JVM interface methods
+ private native boolean unalignedAccess0();
+ private native boolean isBigEndian0();
+
+ // BE is true iff the native endianness of this platform is big.
+ private static final boolean BE = theUnsafe.isBigEndian0();
+
+ // unalignedAccess is true iff this platform can perform unaligned accesses.
+ private static final boolean unalignedAccess = theUnsafe.unalignedAccess0();
+
+ private static int pickPos(int top, int pos) { return BE ? top - pos : pos; }
+
+ // These methods construct integers from bytes. The byte ordering
+ // is the native endianness of this platform.
+ private static long makeLong(byte i0, byte i1, byte i2, byte i3, byte i4, byte i5, byte i6, byte i7) {
+ return ((toUnsignedLong(i0) << pickPos(56, 0))
+ | (toUnsignedLong(i1) << pickPos(56, 8))
+ | (toUnsignedLong(i2) << pickPos(56, 16))
+ | (toUnsignedLong(i3) << pickPos(56, 24))
+ | (toUnsignedLong(i4) << pickPos(56, 32))
+ | (toUnsignedLong(i5) << pickPos(56, 40))
+ | (toUnsignedLong(i6) << pickPos(56, 48))
+ | (toUnsignedLong(i7) << pickPos(56, 56)));
+ }
+ private static long makeLong(short i0, short i1, short i2, short i3) {
+ return ((toUnsignedLong(i0) << pickPos(48, 0))
+ | (toUnsignedLong(i1) << pickPos(48, 16))
+ | (toUnsignedLong(i2) << pickPos(48, 32))
+ | (toUnsignedLong(i3) << pickPos(48, 48)));
+ }
+ private static long makeLong(int i0, int i1) {
+ return (toUnsignedLong(i0) << pickPos(32, 0))
+ | (toUnsignedLong(i1) << pickPos(32, 32));
+ }
+ private static int makeInt(short i0, short i1) {
+ return (toUnsignedInt(i0) << pickPos(16, 0))
+ | (toUnsignedInt(i1) << pickPos(16, 16));
+ }
+ private static int makeInt(byte i0, byte i1, byte i2, byte i3) {
+ return ((toUnsignedInt(i0) << pickPos(24, 0))
+ | (toUnsignedInt(i1) << pickPos(24, 8))
+ | (toUnsignedInt(i2) << pickPos(24, 16))
+ | (toUnsignedInt(i3) << pickPos(24, 24)));
+ }
+ private static short makeShort(byte i0, byte i1) {
+ return (short)((toUnsignedInt(i0) << pickPos(8, 0))
+ | (toUnsignedInt(i1) << pickPos(8, 8)));
+ }
+
+ private static byte pick(byte le, byte be) { return BE ? be : le; }
+ private static short pick(short le, short be) { return BE ? be : le; }
+ private static int pick(int le, int be) { return BE ? be : le; }
+
+ // These methods write integers to memory from smaller parts
+ // provided by their caller. The ordering in which these parts
+ // are written is the native endianness of this platform.
+ private void putLongParts(Object o, long offset, byte i0, byte i1, byte i2, byte i3, byte i4, byte i5, byte i6, byte i7) {
+ putByte(o, offset + 0, pick(i0, i7));
+ putByte(o, offset + 1, pick(i1, i6));
+ putByte(o, offset + 2, pick(i2, i5));
+ putByte(o, offset + 3, pick(i3, i4));
+ putByte(o, offset + 4, pick(i4, i3));
+ putByte(o, offset + 5, pick(i5, i2));
+ putByte(o, offset + 6, pick(i6, i1));
+ putByte(o, offset + 7, pick(i7, i0));
+ }
+ private void putLongParts(Object o, long offset, short i0, short i1, short i2, short i3) {
+ putShort(o, offset + 0, pick(i0, i3));
+ putShort(o, offset + 2, pick(i1, i2));
+ putShort(o, offset + 4, pick(i2, i1));
+ putShort(o, offset + 6, pick(i3, i0));
+ }
+ private void putLongParts(Object o, long offset, int i0, int i1) {
+ putInt(o, offset + 0, pick(i0, i1));
+ putInt(o, offset + 4, pick(i1, i0));
+ }
+ private void putIntParts(Object o, long offset, short i0, short i1) {
+ putShort(o, offset + 0, pick(i0, i1));
+ putShort(o, offset + 2, pick(i1, i0));
+ }
+ private void putIntParts(Object o, long offset, byte i0, byte i1, byte i2, byte i3) {
+ putByte(o, offset + 0, pick(i0, i3));
+ putByte(o, offset + 1, pick(i1, i2));
+ putByte(o, offset + 2, pick(i2, i1));
+ putByte(o, offset + 3, pick(i3, i0));
+ }
+ private void putShortParts(Object o, long offset, byte i0, byte i1) {
+ putByte(o, offset + 0, pick(i0, i1));
+ putByte(o, offset + 1, pick(i1, i0));
+ }
+
+ // Zero-extend an integer
+ private static int toUnsignedInt(byte n) { return n & 0xff; }
+ private static int toUnsignedInt(short n) { return n & 0xffff; }
+ private static long toUnsignedLong(byte n) { return n & 0xffl; }
+ private static long toUnsignedLong(short n) { return n & 0xffffl; }
+ private static long toUnsignedLong(int n) { return n & 0xffffffffl; }
+
+ // Maybe byte-reverse an integer
+ private static char convEndian(boolean big, char n) { return big == BE ? n : Character.reverseBytes(n); }
+ private static short convEndian(boolean big, short n) { return big == BE ? n : Short.reverseBytes(n) ; }
+ private static int convEndian(boolean big, int n) { return big == BE ? n : Integer.reverseBytes(n) ; }
+ private static long convEndian(boolean big, long n) { return big == BE ? n : Long.reverseBytes(n) ; }
}
diff --git a/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java b/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java
index e06832bf3c6..1669429a4fa 100644
--- a/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java
+++ b/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2013, 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
@@ -88,13 +88,8 @@ final class ByteArrayAccess {
// Return whether this platform supports full speed int/long memory access
// at unaligned addresses.
- // This code was copied from java.nio.Bits because there is no equivalent
- // public API.
private static boolean unaligned() {
- String arch = java.security.AccessController.doPrivileged
- (new sun.security.action.GetPropertyAction("os.arch", ""));
- return arch.equals("i386") || arch.equals("x86") || arch.equals("amd64")
- || arch.equals("x86_64");
+ return unsafe.unalignedAccess();
}
/**
diff --git a/jdk/src/java.base/share/native/include/jvm.h b/jdk/src/java.base/share/native/include/jvm.h
index 7177f2e1d1e..91decb2ed82 100644
--- a/jdk/src/java.base/share/native/include/jvm.h
+++ b/jdk/src/java.base/share/native/include/jvm.h
@@ -395,6 +395,9 @@ JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass);
JNIEXPORT jclass JNICALL
JVM_GetDeclaringClass(JNIEnv *env, jclass ofClass);
+JNIEXPORT jstring JNICALL
+JVM_GetSimpleBinaryName(JNIEnv *env, jclass ofClass);
+
/* Generics support (JDK 1.5) */
JNIEXPORT jstring JNICALL
JVM_GetClassSignature(JNIEnv *env, jclass cls);
diff --git a/jdk/src/java.base/share/native/libjava/Class.c b/jdk/src/java.base/share/native/libjava/Class.c
index ae759514a79..07a3f6db716 100644
--- a/jdk/src/java.base/share/native/libjava/Class.c
+++ b/jdk/src/java.base/share/native/libjava/Class.c
@@ -67,6 +67,7 @@ static JNINativeMethod methods[] = {
{"getProtectionDomain0", "()" PD, (void *)&JVM_GetProtectionDomain},
{"getDeclaredClasses0", "()[" CLS, (void *)&JVM_GetDeclaredClasses},
{"getDeclaringClass0", "()" CLS, (void *)&JVM_GetDeclaringClass},
+ {"getSimpleBinaryName0", "()" STR, (void *)&JVM_GetSimpleBinaryName},
{"getGenericSignature0", "()" STR, (void *)&JVM_GetClassSignature},
{"getRawAnnotations", "()" BA, (void *)&JVM_GetClassAnnotations},
{"getConstantPool", "()" CPL, (void *)&JVM_GetClassConstantPool},
diff --git a/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java b/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java
index 128b0ba8afd..f265f4c44fe 100644
--- a/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java
+++ b/jdk/src/java.management/share/classes/java/lang/management/DefaultPlatformMBeanProvider.java
@@ -33,7 +33,6 @@ import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import javax.management.DynamicMBean;
import javax.management.ObjectName;
import sun.management.ManagementFactoryHelper;
import sun.management.spi.PlatformMBeanProvider;
@@ -162,8 +161,7 @@ class DefaultPlatformMBeanProvider extends PlatformMBeanProvider {
@Override
public Set> mbeanInterfaces() {
return Stream.of(MemoryManagerMXBean.class,
- GarbageCollectorMXBean.class,
- com.sun.management.GarbageCollectorMXBean.class).collect(Collectors.toSet());
+ GarbageCollectorMXBean.class).collect(Collectors.toSet());
}
@Override
@@ -464,39 +462,6 @@ class DefaultPlatformMBeanProvider extends PlatformMBeanProvider {
});
- /**
- * DynamicMBean
- */
- HashMap dynmbeans
- = ManagementFactoryHelper.getPlatformDynamicMBeans();
- final Set dynamicMBeanInterfaceNames =
- Collections.unmodifiableSet(Collections.singleton("javax.management.DynamicMBean"));
- for (Map.Entry e : dynmbeans.entrySet()) {
- initMBeanList.add(new PlatformComponent() {
- @Override
- public Set> mbeanInterfaces() {
- return Collections.emptySet();
- }
-
- @Override
- public Set mbeanInterfaceNames() {
- return dynamicMBeanInterfaceNames;
- }
-
- @Override
- public String getObjectNamePattern() {
- return e.getKey().getCanonicalName();
- }
-
- @Override
- public Map nameToMBeanMap() {
- return Collections.singletonMap(
- e.getKey().getCanonicalName(),
- e.getValue());
- }
- });
- }
-
initMBeanList.trimToSize();
return initMBeanList;
}
diff --git a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java
index 9a0e1ebbd61..82508822954 100644
--- a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java
+++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java
@@ -582,7 +582,7 @@ public class ManagementFactory {
final Class> cls = mxbeanInterface;
ClassLoader loader =
AccessController.doPrivileged(
- (PrivilegedAction) () -> cls.getClassLoader());
+ (PrivilegedAction) () -> cls.getClassLoader());
if (!sun.misc.VM.isSystemDomainLoader(loader)) {
throw new IllegalArgumentException(mxbeanName +
" is not a platform MXBean");
@@ -883,7 +883,7 @@ public class ManagementFactory {
all.add(new DefaultPlatformMBeanProvider());
return all;
}, null, new FilePermission("<>", "read"),
- new RuntimePermission("sun.management.spi.PlatformMBeanProvider"));
+ new RuntimePermission("sun.management.spi.PlatformMBeanProvider.subclass"));
// load all platform components into a map
componentMap = providers.stream()
@@ -970,4 +970,11 @@ public class ManagementFactory {
return singleton;
}
}
+
+ static {
+ AccessController.doPrivileged((PrivilegedAction) () -> {
+ System.loadLibrary("management");
+ return null;
+ });
+ }
}
diff --git a/jdk/src/java.management/share/classes/sun/management/Agent.java b/jdk/src/java.management/share/classes/sun/management/Agent.java
index 3128ca442ea..ffb3105255e 100644
--- a/jdk/src/java.management/share/classes/sun/management/Agent.java
+++ b/jdk/src/java.management/share/classes/sun/management/Agent.java
@@ -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
@@ -34,6 +34,7 @@ import java.lang.management.ManagementFactory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetAddress;
+import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.text.MessageFormat;
import java.util.MissingResourceException;
@@ -55,6 +56,125 @@ import sun.misc.VMSupport;
* system class loader. Also jmx framework could be started by jcmd
*/
public class Agent {
+ /**
+ * Agent status collector strategy class
+ */
+ private static abstract class StatusCollector {
+ final protected StringBuilder sb = new StringBuilder();
+ final public String collect() {
+ Properties agentProps = VMSupport.getAgentProperties();
+ String localConnAddr = (String)agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP);
+ if (localConnAddr != null || jmxServer != null) {
+ addAgentStatus(true);
+ appendConnections(localConnAddr);
+ } else {
+ addAgentStatus(false);
+ }
+ return sb.toString();
+ }
+
+ private void appendConnections(String localConnAddr) {
+ appendConnectionsHeader();
+ if (localConnAddr != null) {
+ try {
+ JMXServiceURL u = new JMXServiceURL(localConnAddr);
+ addConnection(false, u);
+ } catch (MalformedURLException e) {
+ // will never happen
+ }
+
+ }
+ if (jmxServer != null) {
+ addConnection(true, jmxServer.getAddress());
+ }
+ appendConnectionsFooter();
+ }
+
+ private void addConnection(boolean remote, JMXServiceURL u) {
+ appendConnectionHeader(remote);
+ addConnectionDetails(u);
+ if (remote) {
+ addConfigProperties();
+ }
+ appendConnectionFooter(remote);
+ }
+
+ private void addConfigProperties() {
+ appendConfigPropsHeader();
+ boolean[] first = new boolean[] {true};
+ configProps.entrySet().stream().forEach((e) -> {
+ String key = (String)e.getKey();
+ if (key.startsWith("com.sun.management.")) {
+ addConfigProp(key, e.getValue(), first[0]);
+ first[0] = false;
+ }
+ });
+ appendConfigPropsFooter();
+ }
+
+ abstract protected void addAgentStatus(boolean enabled);
+ abstract protected void appendConnectionsHeader();
+ abstract protected void appendConnectionsFooter();
+ abstract protected void addConnectionDetails(JMXServiceURL u);
+ abstract protected void appendConnectionHeader(boolean remote);
+ abstract protected void appendConnectionFooter(boolean remote);
+ abstract protected void appendConfigPropsHeader();
+ abstract protected void appendConfigPropsFooter();
+ abstract protected void addConfigProp(String key, Object value, boolean first);
+ }
+
+ /**
+ * Free-text status collector strategy implementation
+ */
+ final private static class TextStatusCollector extends StatusCollector {
+
+ @Override
+ protected void addAgentStatus(boolean enabled) {
+ sb.append("Agent: ").append(enabled ? "enabled" : "disabled").append('\n');
+ }
+
+ @Override
+ protected void appendConnectionsHeader() {
+ sb.append('\n');
+ }
+
+ @Override
+ protected void addConnectionDetails(JMXServiceURL u) {
+ sb.append("Protocol : ").append(u.getProtocol()).append('\n')
+ .append("Host : ").append(u.getHost()).append('\n')
+ .append("URL : ").append(u).append('\n');
+ }
+
+ @Override
+ protected void appendConnectionHeader(boolean remote) {
+ sb.append("Connection Type: ").append(remote ? "remote" : "local").append('\n');
+ }
+
+ @Override
+ protected void appendConfigPropsHeader() {
+ sb.append("Properties :\n");
+ }
+
+ @Override
+ protected void addConfigProp(String key, Object value, boolean first) {
+ if (!first) {
+ sb.append('\n');
+ }
+ sb.append(" ").append(key).append(" = ").append(value);
+ }
+
+ @Override
+ protected void appendConnectionsFooter() {}
+
+ @Override
+ protected void appendConnectionFooter(boolean remote) {
+ sb.append('\n');
+ }
+
+ @Override
+ protected void appendConfigPropsFooter() {}
+ }
+
// management properties
private static Properties mgmtProps;
@@ -81,6 +201,8 @@ public class Agent {
// The only active agent allowed
private static JMXConnectorServer jmxServer = null;
+ // The properties used to configure the server
+ private static Properties configProps = null;
// Parse string com.sun.management.prop=xxx,com.sun.management.prop=yyyy
// and return property set if args is null or empty
@@ -161,7 +283,7 @@ public class Agent {
try {
Properties argProps = parseString(args);
- Properties configProps = new Properties();
+ configProps = new Properties();
// Load the management properties from the config file
// if config file is not specified readConfiguration implicitly
@@ -228,9 +350,14 @@ public class Agent {
// Don't cause any errors.
jmxServer.stop();
jmxServer = null;
+ configProps = null;
}
}
+ private static synchronized String getManagementAgentStatus() throws Exception {
+ return new TextStatusCollector().collect();
+ }
+
private static void startAgent(Properties props) throws Exception {
String snmpPort = props.getProperty(SNMP_PORT);
String jmxremote = props.getProperty(JMXREMOTE);
diff --git a/jdk/src/java.management/share/classes/sun/management/GarbageCollectorImpl.java b/jdk/src/java.management/share/classes/sun/management/GarbageCollectorImpl.java
index 251dad43e04..9c1373f854e 100644
--- a/jdk/src/java.management/share/classes/sun/management/GarbageCollectorImpl.java
+++ b/jdk/src/java.management/share/classes/sun/management/GarbageCollectorImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, 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
@@ -25,168 +25,31 @@
package sun.management;
-import com.sun.management.GarbageCollectorMXBean;
-import com.sun.management.GarbageCollectionNotificationInfo;
+import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryPoolMXBean;
-import java.lang.management.MemoryUsage;
-
-import com.sun.management.GcInfo;
-import javax.management.openmbean.CompositeData;
-import javax.management.MBeanInfo;
-import javax.management.MBeanAttributeInfo;
import javax.management.ObjectName;
-import javax.management.MBeanNotificationInfo;
-import javax.management.Notification;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.ListenerNotFoundException;
-
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
/**
* Implementation class for the garbage collector.
- * Standard and committed hotspot-specific metrics if any.
*
* ManagementFactory.getGarbageCollectorMXBeans() returns a list
* of instances of this class.
*/
-class GarbageCollectorImpl extends MemoryManagerImpl
+public class GarbageCollectorImpl extends MemoryManagerImpl
implements GarbageCollectorMXBean {
- GarbageCollectorImpl(String name) {
+ protected GarbageCollectorImpl(String name) {
super(name);
}
+ @Override
public native long getCollectionCount();
+
+ @Override
public native long getCollectionTime();
-
- // The memory pools are static and won't be changed.
- // TODO: If the hotspot implementation begins to have pools
- // dynamically created and removed, this needs to be modified.
- private String[] poolNames = null;
- synchronized String[] getAllPoolNames() {
- if (poolNames == null) {
- List pools = ManagementFactory.getMemoryPoolMXBeans();
- poolNames = new String[pools.size()];
- int i = 0;
- for (MemoryPoolMXBean m : pools) {
- poolNames[i++] = m.getName();
- }
- }
- return poolNames;
- }
-
- // Sun JDK extension
- private GcInfoBuilder gcInfoBuilder;
-
- private synchronized GcInfoBuilder getGcInfoBuilder() {
- if(gcInfoBuilder == null) {
- gcInfoBuilder = new GcInfoBuilder(this, getAllPoolNames());
- }
- return gcInfoBuilder;
- }
-
- public GcInfo getLastGcInfo() {
- GcInfo info = getGcInfoBuilder().getLastGcInfo();
- return info;
- }
-
- private final static String notifName =
- "javax.management.Notification";
-
- private final static String[] gcNotifTypes = {
- GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION
- };
-
- private MBeanNotificationInfo[] notifInfo = null;
- public MBeanNotificationInfo[] getNotificationInfo() {
- synchronized (this) {
- if (notifInfo == null) {
- notifInfo = new MBeanNotificationInfo[1];
- notifInfo[0] = new MBeanNotificationInfo(gcNotifTypes,
- notifName,
- "GC Notification");
- }
- }
- return notifInfo;
- }
-
- private static long seqNumber = 0;
- private static long getNextSeqNumber() {
- return ++seqNumber;
- }
-
- void createGCNotification(long timestamp,
- String gcName,
- String gcAction,
- String gcCause,
- GcInfo gcInfo) {
-
- if (!hasListeners()) {
- return;
- }
-
- Notification notif = new Notification(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION,
- getObjectName(),
- getNextSeqNumber(),
- timestamp,
- gcName);
- GarbageCollectionNotificationInfo info =
- new GarbageCollectionNotificationInfo(gcName,
- gcAction,
- gcCause,
- gcInfo);
-
- CompositeData cd =
- GarbageCollectionNotifInfoCompositeData.toCompositeData(info);
- notif.setUserData(cd);
- sendNotification(notif);
- }
-
- public synchronized void addNotificationListener(NotificationListener listener,
- NotificationFilter filter,
- Object handback)
- {
- boolean before = hasListeners();
- super.addNotificationListener(listener, filter, handback);
- boolean after = hasListeners();
- if (!before && after) {
- setNotificationEnabled(this, true);
- }
- }
-
- public synchronized void removeNotificationListener(NotificationListener listener)
- throws ListenerNotFoundException {
- boolean before = hasListeners();
- super.removeNotificationListener(listener);
- boolean after = hasListeners();
- if (before && !after) {
- setNotificationEnabled(this,false);
- }
- }
-
- public synchronized void removeNotificationListener(NotificationListener listener,
- NotificationFilter filter,
- Object handback)
- throws ListenerNotFoundException
- {
- boolean before = hasListeners();
- super.removeNotificationListener(listener,filter,handback);
- boolean after = hasListeners();
- if (before && !after) {
- setNotificationEnabled(this,false);
- }
- }
-
+ @Override
public ObjectName getObjectName() {
return Util.newObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE, getName());
}
-
- native void setNotificationEnabled(GarbageCollectorMXBean gc,
- boolean enabled);
-
}
diff --git a/jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java b/jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java
index 935f09a156b..8d9c4c03b5f 100644
--- a/jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java
+++ b/jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2012, 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
@@ -115,28 +115,28 @@ public abstract class LazyCompositeData
protected abstract CompositeData getCompositeData();
// Helper methods
- static String getString(CompositeData cd, String itemName) {
+ public static String getString(CompositeData cd, String itemName) {
if (cd == null)
throw new IllegalArgumentException("Null CompositeData");
return (String) cd.get(itemName);
}
- static boolean getBoolean(CompositeData cd, String itemName) {
+ public static boolean getBoolean(CompositeData cd, String itemName) {
if (cd == null)
throw new IllegalArgumentException("Null CompositeData");
return ((Boolean) cd.get(itemName)).booleanValue();
}
- static long getLong(CompositeData cd, String itemName) {
+ public static long getLong(CompositeData cd, String itemName) {
if (cd == null)
throw new IllegalArgumentException("Null CompositeData");
return ((Long) cd.get(itemName)).longValue();
}
- static int getInt(CompositeData cd, String itemName) {
+ public static int getInt(CompositeData cd, String itemName) {
if (cd == null)
throw new IllegalArgumentException("Null CompositeData");
diff --git a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java
index c06fb71b27d..a8d4279d862 100644
--- a/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java
+++ b/jdk/src/java.management/share/classes/sun/management/ManagementFactoryHelper.java
@@ -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
@@ -26,8 +26,6 @@
package sun.management;
import java.lang.management.*;
-
-import javax.management.DynamicMBean;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanServer;
@@ -38,30 +36,35 @@ import javax.management.RuntimeOperationsException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-
import sun.util.logging.LoggingSupport;
-
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import com.sun.management.DiagnosticCommandMBean;
-import com.sun.management.HotSpotDiagnosticMXBean;
/**
* ManagementFactoryHelper provides static factory methods to create
* instances of the management interface.
*/
public class ManagementFactoryHelper {
+ static {
+ // make sure that the management lib is loaded within
+ // java.lang.management.ManagementFactory
+ sun.misc.Unsafe.getUnsafe().ensureClassInitialized(ManagementFactory.class);
+ }
+
+ private static final VMManagement jvm = new VMManagementImpl();
+
private ManagementFactoryHelper() {};
- private static VMManagement jvm;
+ public static VMManagement getVMManagement() {
+ return jvm;
+ }
private static ClassLoadingImpl classMBean = null;
private static MemoryImpl memoryMBean = null;
private static ThreadImpl threadMBean = null;
private static RuntimeImpl runtimeMBean = null;
private static CompilationImpl compileMBean = null;
- private static OperatingSystemImpl osMBean = null;
+ private static BaseOperatingSystemImpl osMBean = null;
public static synchronized ClassLoadingMXBean getClassLoadingMXBean() {
if (classMBean == null) {
@@ -100,7 +103,7 @@ public class ManagementFactoryHelper {
public static synchronized OperatingSystemMXBean getOperatingSystemMXBean() {
if (osMBean == null) {
- osMBean = new OperatingSystemImpl(jvm);
+ osMBean = new BaseOperatingSystemImpl(jvm);
}
return osMBean;
}
@@ -123,7 +126,7 @@ public class ManagementFactoryHelper {
return result;
}
- public static List getGarbageCollectorMXBeans() {
+ public static List getGarbageCollectorMXBeans() {
MemoryManagerMXBean[] mgrs = MemoryImpl.getMemoryManagers();
List result = new ArrayList<>(mgrs.length);
for (MemoryManagerMXBean m : mgrs) {
@@ -257,20 +260,11 @@ public class ManagementFactoryHelper {
};
}
- private static HotSpotDiagnostic hsDiagMBean = null;
private static HotspotRuntime hsRuntimeMBean = null;
private static HotspotClassLoading hsClassMBean = null;
private static HotspotThread hsThreadMBean = null;
private static HotspotCompilation hsCompileMBean = null;
private static HotspotMemory hsMemoryMBean = null;
- private static DiagnosticCommandImpl hsDiagCommandMBean = null;
-
- public static synchronized HotSpotDiagnosticMXBean getDiagnosticMXBean() {
- if (hsDiagMBean == null) {
- hsDiagMBean = new HotSpotDiagnostic();
- }
- return hsDiagMBean;
- }
/**
* This method is for testing only.
@@ -312,14 +306,6 @@ public class ManagementFactoryHelper {
return hsMemoryMBean;
}
- public static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() {
- // Remote Diagnostic Commands may not be supported
- if (hsDiagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) {
- hsDiagCommandMBean = new DiagnosticCommandImpl(jvm);
- }
- return hsDiagCommandMBean;
- }
-
/**
* This method is for testing only.
*/
@@ -374,18 +360,6 @@ public class ManagementFactoryHelper {
private final static String HOTSPOT_THREAD_MBEAN_NAME =
"sun.management:type=HotspotThreading";
- final static String HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME =
- "com.sun.management:type=DiagnosticCommand";
-
- public static HashMap getPlatformDynamicMBeans() {
- HashMap map = new HashMap<>();
- DiagnosticCommandMBean diagMBean = getDiagnosticCommandMBean();
- if (diagMBean != null) {
- map.put(Util.newObjectName(HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME), diagMBean);
- }
- return map;
- }
-
static void registerInternalMBeans(MBeanServer mbs) {
// register all internal MBeans if not registered
// No exception is thrown if a MBean with that object name
@@ -441,17 +415,6 @@ public class ManagementFactoryHelper {
}
}
- static {
- AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Void run() {
- System.loadLibrary("management");
- return null;
- }
- });
- jvm = new VMManagementImpl();
- }
-
public static boolean isThreadSuspended(int state) {
return ((state & JMM_THREAD_STATE_FLAG_SUSPENDED) != 0);
}
@@ -471,4 +434,20 @@ public class ManagementFactoryHelper {
private static final int JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000;
private static final int JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000;
+ // Invoked by the VM
+ private static MemoryPoolMXBean createMemoryPool
+ (String name, boolean isHeap, long uThreshold, long gcThreshold) {
+ return new MemoryPoolImpl(name, isHeap, uThreshold, gcThreshold);
+ }
+
+ private static MemoryManagerMXBean createMemoryManager(String name) {
+ return new MemoryManagerImpl(name);
+ }
+
+ private static GarbageCollectorMXBean
+ createGarbageCollector(String name, String type) {
+
+ // ignore type parameter which is for future extension
+ return new GarbageCollectorImpl(name);
+ }
}
diff --git a/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java b/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java
index 04ab87153f8..85cdfdf1833 100644
--- a/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java
+++ b/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2012, 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
@@ -38,10 +38,8 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import javax.management.*;
import javax.management.openmbean.*;
import static javax.management.openmbean.SimpleType.*;
-import com.sun.management.VMOption;
/**
* A mapped mxbean type maps a Java type to an open type.
@@ -113,7 +111,7 @@ public abstract class MappedMXBeanType {
return mt;
}
- static synchronized MappedMXBeanType getMappedType(Type t)
+ public static synchronized MappedMXBeanType getMappedType(Type t)
throws OpenDataException {
MappedMXBeanType mt = convertedTypes.get(t);
if (mt == null) {
@@ -152,7 +150,7 @@ public abstract class MappedMXBeanType {
}
// Return the mapped open type
- OpenType> getOpenType() {
+ public OpenType> getOpenType() {
return openType;
}
@@ -177,10 +175,10 @@ public abstract class MappedMXBeanType {
// return name of the class or the generic type
abstract String getName();
- abstract Object toOpenTypeData(Object javaTypeData)
+ public abstract Object toOpenTypeData(Object javaTypeData)
throws OpenDataException;
- abstract Object toJavaTypeData(Object openTypeData)
+ public abstract Object toJavaTypeData(Object openTypeData)
throws OpenDataException, InvalidObjectException;
// Basic Types - Classes that do not require data conversion
@@ -208,11 +206,11 @@ public abstract class MappedMXBeanType {
return basicType.getName();
}
- Object toOpenTypeData(Object data) throws OpenDataException {
+ public Object toOpenTypeData(Object data) throws OpenDataException {
return data;
}
- Object toJavaTypeData(Object data)
+ public Object toJavaTypeData(Object data)
throws OpenDataException, InvalidObjectException {
return data;
@@ -243,11 +241,11 @@ public abstract class MappedMXBeanType {
return enumClass.getName();
}
- Object toOpenTypeData(Object data) throws OpenDataException {
+ public Object toOpenTypeData(Object data) throws OpenDataException {
return ((Enum) data).name();
}
- Object toJavaTypeData(Object data)
+ public Object toJavaTypeData(Object data)
throws OpenDataException, InvalidObjectException {
try {
@@ -315,7 +313,7 @@ public abstract class MappedMXBeanType {
return arrayClass.getName();
}
- Object toOpenTypeData(Object data) throws OpenDataException {
+ public Object toOpenTypeData(Object data) throws OpenDataException {
// If the base element type is a basic type
// return the data as no conversion is needed.
// Primitive types are not converted to wrappers.
@@ -340,7 +338,7 @@ public abstract class MappedMXBeanType {
}
- Object toJavaTypeData(Object data)
+ public Object toJavaTypeData(Object data)
throws OpenDataException, InvalidObjectException {
// If the base element type is a basic type
@@ -457,7 +455,7 @@ public abstract class MappedMXBeanType {
return typeName;
}
- Object toOpenTypeData(Object data) throws OpenDataException {
+ public Object toOpenTypeData(Object data) throws OpenDataException {
final List