Merge
This commit is contained in:
commit
69b8d4a1c9
3
.hgtags
3
.hgtags
@ -383,3 +383,6 @@ e384420383a5b79fa0012ebcb25d8f83cff7f777 jdk-9+135
|
||||
d273dfe9a126d3bffe92072547fef2cd1361b0eb jdk-9+138
|
||||
65477538bec32963dc41153d89c4417eb46c45fc jdk-9+139
|
||||
0875007901f7d364a08220b052f0c81003e9c8c5 jdk-9+140
|
||||
9aadd2163b568d76f8969ad2fb404a63733da359 jdk-9+141
|
||||
df0e03e3ca0ed1307793017dfc1a054c8726131c jdk-9+142
|
||||
d62173b931bf5b6bffc6e80a9060bb2e8b8efc75 jdk-9+143
|
||||
|
@ -383,3 +383,6 @@ d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137
|
||||
67c4388142bdf58aec8fefa4475faaa8a5d7380c jdk-9+138
|
||||
7dcf453eacae79ee86a6bcc75fd0b546fc99b48a jdk-9+139
|
||||
a5815c6098a241d3a1df64d22b84b3524e4a77df jdk-9+140
|
||||
f64afae7f1a5608e438585bbf0bc23785e69cba0 jdk-9+141
|
||||
2b3e5caafe3594ea507c37675c4d3086f415dc64 jdk-9+142
|
||||
1fc62b1c629fb80fdaa639d3b59452a184f0d705 jdk-9+143
|
||||
|
@ -280,7 +280,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
|
||||
else
|
||||
# Default works for linux, might work on other platforms as well.
|
||||
SHARED_LIBRARY_FLAGS='-shared'
|
||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
|
||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
|
||||
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
||||
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
|
||||
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
|
||||
@ -305,7 +305,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
|
||||
# Default works for linux, might work on other platforms as well.
|
||||
PICFLAG='-fPIC'
|
||||
SHARED_LIBRARY_FLAGS='-shared'
|
||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
|
||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
|
||||
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
||||
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
|
||||
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
|
||||
@ -315,7 +315,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
|
||||
C_FLAG_REORDER='-xF'
|
||||
CXX_FLAG_REORDER='-xF'
|
||||
SHARED_LIBRARY_FLAGS="-G"
|
||||
SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN[$]1'
|
||||
SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN[$]1'
|
||||
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
||||
SET_SHARED_LIBRARY_NAME='-h [$]1'
|
||||
SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
|
||||
@ -759,6 +759,10 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
s390 )
|
||||
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
|
||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
* )
|
||||
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
||||
@ -895,7 +899,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
elif test "x$OPENJDK_$1_OS" = xsolaris; then
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -DSOLARIS"
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -template=no%extdef -features=no%split_init \
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -xwe -features=no%except"
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
|
||||
elif test "x$OPENJDK_$1_OS" = xmacosx; then
|
||||
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -D_ALLBSD_SOURCE"
|
||||
@ -940,6 +944,10 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
||||
fi
|
||||
elif test "x$OPENJDK_$1_CPU" = xs390x; then
|
||||
if test "x$OPENJDK_$1_OS" = xlinux; then
|
||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mbackchain -march=z10"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
|
||||
@ -999,6 +1007,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
||||
|
||||
# Setup some hard coded includes
|
||||
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
|
||||
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
|
||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
|
||||
|
@ -5093,7 +5093,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1476275292
|
||||
DATE_WHEN_GENERATED=1478524503
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -49070,7 +49070,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
|
||||
else
|
||||
# Default works for linux, might work on other platforms as well.
|
||||
SHARED_LIBRARY_FLAGS='-shared'
|
||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN$1'
|
||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN$1'
|
||||
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
||||
SET_SHARED_LIBRARY_NAME='-Wl,-soname=$1'
|
||||
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=$1'
|
||||
@ -49095,7 +49095,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
|
||||
# Default works for linux, might work on other platforms as well.
|
||||
PICFLAG='-fPIC'
|
||||
SHARED_LIBRARY_FLAGS='-shared'
|
||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN$1'
|
||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN$1'
|
||||
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
||||
SET_SHARED_LIBRARY_NAME='-Wl,-soname=$1'
|
||||
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=$1'
|
||||
@ -49105,7 +49105,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
|
||||
C_FLAG_REORDER='-xF'
|
||||
CXX_FLAG_REORDER='-xF'
|
||||
SHARED_LIBRARY_FLAGS="-G"
|
||||
SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN$1'
|
||||
SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN$1'
|
||||
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
||||
SET_SHARED_LIBRARY_NAME='-h $1'
|
||||
SET_SHARED_LIBRARY_MAPFILE='-M$1'
|
||||
@ -49840,6 +49840,10 @@ $as_echo "$supports" >&6; }
|
||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
s390 )
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
* )
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||
@ -50077,7 +50081,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
||||
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
|
||||
JVM_CFLAGS="$JVM_CFLAGS -DSOLARIS"
|
||||
JVM_CFLAGS="$JVM_CFLAGS -template=no%extdef -features=no%split_init \
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -xwe -features=no%except"
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
|
||||
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
|
||||
JVM_CFLAGS="$JVM_CFLAGS -D_ALLBSD_SOURCE"
|
||||
@ -50122,6 +50126,10 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
||||
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
||||
JVM_CFLAGS="$JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
||||
fi
|
||||
elif test "x$OPENJDK_TARGET_CPU" = xs390x; then
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||
JVM_CFLAGS="$JVM_CFLAGS -mbackchain -march=z10"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
|
||||
@ -50270,6 +50278,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
||||
|
||||
# Setup some hard coded includes
|
||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
|
||||
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
|
||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
|
||||
@ -50655,6 +50664,10 @@ $as_echo "$supports" >&6; }
|
||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
s390 )
|
||||
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
|
||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
|
||||
;;
|
||||
* )
|
||||
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
|
||||
@ -50892,7 +50905,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
||||
elif test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -DSOLARIS"
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -template=no%extdef -features=no%split_init \
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -xwe -features=no%except"
|
||||
-D_Crun_inline_placement -library=%none -KPIC -mt -features=no%except"
|
||||
elif test "x$OPENJDK_BUILD_OS" = xmacosx; then
|
||||
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -D_ALLBSD_SOURCE"
|
||||
@ -50937,6 +50950,10 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
||||
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
||||
fi
|
||||
elif test "x$OPENJDK_BUILD_CPU" = xs390x; then
|
||||
if test "x$OPENJDK_BUILD_OS" = xlinux; then
|
||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -mbackchain -march=z10"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_BUILD_CPU_ENDIAN" = xlittle; then
|
||||
@ -51085,6 +51102,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
||||
|
||||
# Setup some hard coded includes
|
||||
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK \
|
||||
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_BUILD_OS/native/include \
|
||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/include \
|
||||
|
@ -265,6 +265,10 @@ IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
|
||||
BUNDLES_OUTPUTDIR=$(BUILD_OUTPUT)/bundles
|
||||
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make
|
||||
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
|
||||
|
||||
# By default, output javadoc directly into image
|
||||
JAVADOC_OUTPUTDIR = $(DOCS_IMAGE_DIR)
|
||||
|
||||
# This does not get overridden in a bootcycle build
|
||||
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
|
||||
BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
|
||||
@ -784,11 +788,12 @@ SYMBOLS_IMAGE_SUBDIR:=symbols
|
||||
SYMBOLS_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(SYMBOLS_IMAGE_SUBDIR)
|
||||
|
||||
# Interim image
|
||||
INTERIM_JMODS_DIR := $(SUPPORT_OUTPUTDIR)/interim-jmods
|
||||
INTERIM_IMAGE_DIR := $(SUPPORT_OUTPUTDIR)/interim-image
|
||||
|
||||
# Docs image
|
||||
DOCS_IMAGE_SUBDIR := docs
|
||||
DOCS_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR)
|
||||
DOCS_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR)
|
||||
|
||||
# Macosx bundles directory definitions
|
||||
JDK_MACOSX_BUNDLE_SUBDIR=jdk-bundle
|
||||
|
@ -383,3 +383,6 @@ aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136
|
||||
27bb44be32076861a0951bcefb07a1d92509a4b6 jdk-9+138
|
||||
8c9da7fc5b07c606afd571c7012441b77dda83b2 jdk-9+139
|
||||
9f3fc931bc230f44f2a58d75f7f6360af98bb113 jdk-9+140
|
||||
b32f998da32b488ec7c4e9dbb3c750841b48e74d jdk-9+141
|
||||
408c9c621938ca028e20bced0459f815de47eba8 jdk-9+142
|
||||
6211236ef15ec796806357608b1dd1b70c258ece jdk-9+143
|
||||
|
@ -31,22 +31,17 @@
|
||||
|
||||
package com.sun.corba.se.impl.io;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StreamCorruptedException;
|
||||
import java.io.ObjectInputValidation;
|
||||
import java.io.NotActiveException;
|
||||
import java.io.InvalidObjectException;
|
||||
import java.io.InvalidClassException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.OptionalDataException;
|
||||
import java.io.WriteAbortedException;
|
||||
import java.io.Externalizable;
|
||||
import java.io.EOFException;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.Vector;
|
||||
import java.util.Stack;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import sun.corba.Bridge ;
|
||||
@ -54,7 +49,6 @@ import sun.corba.Bridge ;
|
||||
import java.security.AccessController ;
|
||||
import java.security.PrivilegedAction ;
|
||||
|
||||
import com.sun.corba.se.impl.io.ObjectStreamClass;
|
||||
import com.sun.corba.se.impl.util.Utility;
|
||||
|
||||
import org.omg.CORBA.portable.ValueInputStream;
|
||||
@ -71,14 +65,12 @@ import org.omg.CORBA.TypeCode;
|
||||
import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
|
||||
import com.sun.org.omg.SendingContext.CodeBase;
|
||||
|
||||
import javax.rmi.PortableRemoteObject;
|
||||
import javax.rmi.CORBA.Util;
|
||||
import javax.rmi.CORBA.ValueHandler;
|
||||
|
||||
import java.security.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.corba.se.impl.orbutil.ObjectUtility ;
|
||||
import com.sun.corba.se.impl.logging.OMGSystemException ;
|
||||
import com.sun.corba.se.impl.logging.UtilSystemException ;
|
||||
|
||||
@ -182,75 +174,6 @@ public class IIOPInputStream
|
||||
|
||||
private byte streamFormatVersion;
|
||||
|
||||
// Since java.io.OptionalDataException's constructors are
|
||||
// package private, but we need to throw it in some special
|
||||
// cases, we try to do it by reflection.
|
||||
private static final Constructor OPT_DATA_EXCEPTION_CTOR;
|
||||
|
||||
private Object[] readObjectArgList = { this } ;
|
||||
|
||||
static {
|
||||
OPT_DATA_EXCEPTION_CTOR = getOptDataExceptionCtor();
|
||||
}
|
||||
|
||||
// Grab the OptionalDataException boolean ctor and make
|
||||
// it accessible. Note that any exceptions
|
||||
// will be wrapped in ExceptionInInitializerErrors.
|
||||
private static Constructor getOptDataExceptionCtor() {
|
||||
|
||||
try {
|
||||
|
||||
Constructor result =
|
||||
|
||||
(Constructor) AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction() {
|
||||
public java.lang.Object run()
|
||||
throws NoSuchMethodException,
|
||||
SecurityException {
|
||||
|
||||
Constructor boolCtor
|
||||
= OptionalDataException.class.getDeclaredConstructor(
|
||||
new Class[] {
|
||||
Boolean.TYPE });
|
||||
|
||||
boolCtor.setAccessible(true);
|
||||
|
||||
return boolCtor;
|
||||
}});
|
||||
|
||||
if (result == null)
|
||||
// XXX I18N, logging needed.
|
||||
throw new Error("Unable to find OptionalDataException constructor");
|
||||
|
||||
return result;
|
||||
|
||||
} catch (Exception ex) {
|
||||
// XXX I18N, logging needed.
|
||||
throw new ExceptionInInitializerError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new OptionalDataException with the EOF marker
|
||||
// set to true. See handleOptionalDataMarshalException.
|
||||
private OptionalDataException createOptionalDataException() {
|
||||
try {
|
||||
OptionalDataException result
|
||||
= (OptionalDataException)
|
||||
OPT_DATA_EXCEPTION_CTOR.newInstance(new Object[] {
|
||||
Boolean.TRUE });
|
||||
|
||||
if (result == null)
|
||||
// XXX I18N, logging needed.
|
||||
throw new Error("Created null OptionalDataException");
|
||||
|
||||
return result;
|
||||
|
||||
} catch (Exception ex) {
|
||||
// XXX I18N, logging needed.
|
||||
throw new Error("Couldn't create OptionalDataException", ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the stream format version currently being used
|
||||
// to deserialize an object
|
||||
protected byte getStreamFormatVersion() {
|
||||
@ -395,7 +318,6 @@ public class IIOPInputStream
|
||||
int offset)
|
||||
/* throws OptionalDataException, ClassNotFoundException, IOException */
|
||||
{
|
||||
|
||||
/* Save the current state and get ready to read an object. */
|
||||
Object prevObject = currentObject;
|
||||
ObjectStreamClass prevClassDesc = currentClassDesc;
|
||||
@ -947,7 +869,7 @@ public class IIOPInputStream
|
||||
if (!objectRead)
|
||||
result = new EOFException("No more optional data");
|
||||
else
|
||||
result = createOptionalDataException();
|
||||
result = bridge.newOptionalDataExceptionForSerialization(true);
|
||||
|
||||
result.initCause(marshalException);
|
||||
|
||||
@ -1230,8 +1152,7 @@ public class IIOPInputStream
|
||||
|
||||
readObjectState.beginUnmarshalCustomValue(this,
|
||||
calledDefaultWriteObject,
|
||||
(currentClassDesc.readObjectMethod
|
||||
!= null));
|
||||
currentClassDesc.hasReadObject());
|
||||
} else {
|
||||
if (currentClassDesc.hasReadObject())
|
||||
setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
|
||||
@ -1556,8 +1477,7 @@ public class IIOPInputStream
|
||||
|
||||
readObjectState.beginUnmarshalCustomValue(this,
|
||||
calledDefaultWriteObject,
|
||||
(currentClassDesc.readObjectMethod
|
||||
!= null));
|
||||
currentClassDesc.hasReadObject());
|
||||
}
|
||||
|
||||
boolean usedReadObject = false;
|
||||
@ -1714,13 +1634,8 @@ public class IIOPInputStream
|
||||
throws InvalidClassException, StreamCorruptedException,
|
||||
ClassNotFoundException, IOException
|
||||
{
|
||||
if (osc.readObjectMethod == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
osc.readObjectMethod.invoke( obj, readObjectArgList ) ;
|
||||
return true;
|
||||
return osc.invokeReadObject( obj, this ) ;
|
||||
} catch (InvocationTargetException e) {
|
||||
Throwable t = e.getTargetException();
|
||||
if (t instanceof ClassNotFoundException)
|
||||
@ -1734,8 +1649,6 @@ public class IIOPInputStream
|
||||
else
|
||||
// XXX I18N, logging needed.
|
||||
throw new Error("internal error");
|
||||
} catch (IllegalAccessException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,33 +31,23 @@
|
||||
|
||||
package com.sun.corba.se.impl.io;
|
||||
|
||||
import org.omg.CORBA.INTERNAL;
|
||||
import org.omg.CORBA.portable.OutputStream;
|
||||
|
||||
import java.security.AccessController ;
|
||||
import java.security.PrivilegedAction ;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.io.InvalidClassException;
|
||||
import java.io.StreamCorruptedException;
|
||||
import java.io.Externalizable;
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.NotSerializableException;
|
||||
import java.io.NotActiveException;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import javax.rmi.CORBA.Util;
|
||||
import javax.rmi.CORBA.ValueHandlerMultiFormat;
|
||||
|
||||
import sun.corba.Bridge ;
|
||||
|
||||
import com.sun.corba.se.impl.io.ObjectStreamClass;
|
||||
import com.sun.corba.se.impl.util.Utility;
|
||||
import com.sun.corba.se.impl.util.RepositoryId;
|
||||
|
||||
@ -621,7 +611,7 @@ public class IIOPOutputStream
|
||||
writeObjectState.enterWriteObject(this);
|
||||
|
||||
// writeObject(obj, c, this);
|
||||
osc.writeObjectMethod.invoke( obj, writeObjectArgList ) ;
|
||||
osc.invokeWriteObject( obj, this ) ;
|
||||
|
||||
writeObjectState.exitWriteObject(this);
|
||||
|
||||
@ -636,8 +626,6 @@ public class IIOPOutputStream
|
||||
else
|
||||
// XXX I18N, Logging needed.
|
||||
throw new Error("invokeObjectWriter internal error",e);
|
||||
} catch (IllegalAccessException e) {
|
||||
// cannot happen
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,59 +749,52 @@ public class IIOPOutputStream
|
||||
*/
|
||||
private void outputClassFields(Object o, Class cl,
|
||||
ObjectStreamField[] fields)
|
||||
throws IOException, InvalidClassException {
|
||||
throws IOException {
|
||||
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].getField() == null)
|
||||
// XXX I18N, Logging needed.
|
||||
throw new InvalidClassException(cl.getName(),
|
||||
"Nonexistent field " + fields[i].getName());
|
||||
|
||||
try {
|
||||
switch (fields[i].getTypeCode()) {
|
||||
case 'B':
|
||||
byte byteValue = fields[i].getField().getByte( o ) ;
|
||||
orbStream.write_octet(byteValue);
|
||||
break;
|
||||
case 'C':
|
||||
char charValue = fields[i].getField().getChar( o ) ;
|
||||
orbStream.write_wchar(charValue);
|
||||
break;
|
||||
case 'F':
|
||||
float floatValue = fields[i].getField().getFloat( o ) ;
|
||||
orbStream.write_float(floatValue);
|
||||
break;
|
||||
case 'D' :
|
||||
double doubleValue = fields[i].getField().getDouble( o ) ;
|
||||
orbStream.write_double(doubleValue);
|
||||
break;
|
||||
case 'I':
|
||||
int intValue = fields[i].getField().getInt( o ) ;
|
||||
orbStream.write_long(intValue);
|
||||
break;
|
||||
case 'J':
|
||||
long longValue = fields[i].getField().getLong( o ) ;
|
||||
orbStream.write_longlong(longValue);
|
||||
break;
|
||||
case 'S':
|
||||
short shortValue = fields[i].getField().getShort( o ) ;
|
||||
orbStream.write_short(shortValue);
|
||||
break;
|
||||
case 'Z':
|
||||
boolean booleanValue = fields[i].getField().getBoolean( o ) ;
|
||||
orbStream.write_boolean(booleanValue);
|
||||
break;
|
||||
case '[':
|
||||
case 'L':
|
||||
Object objectValue = fields[i].getField().get( o ) ;
|
||||
writeObjectField(fields[i], objectValue);
|
||||
break;
|
||||
default:
|
||||
// XXX I18N, Logging needed.
|
||||
throw new InvalidClassException(cl.getName());
|
||||
}
|
||||
} catch (IllegalAccessException exc) {
|
||||
throw wrapper.illegalFieldAccess( exc, fields[i].getName() ) ;
|
||||
switch (fields[i].getTypeCode()) {
|
||||
case 'B':
|
||||
byte byteValue = bridge.getByte(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_octet(byteValue);
|
||||
break;
|
||||
case 'C':
|
||||
char charValue = bridge.getChar(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_wchar(charValue);
|
||||
break;
|
||||
case 'F':
|
||||
float floatValue = bridge.getFloat(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_float(floatValue);
|
||||
break;
|
||||
case 'D' :
|
||||
double doubleValue = bridge.getDouble(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_double(doubleValue);
|
||||
break;
|
||||
case 'I':
|
||||
int intValue = bridge.getInt(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_long(intValue);
|
||||
break;
|
||||
case 'J':
|
||||
long longValue = bridge.getLong(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_longlong(longValue);
|
||||
break;
|
||||
case 'S':
|
||||
short shortValue = bridge.getShort(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_short(shortValue);
|
||||
break;
|
||||
case 'Z':
|
||||
boolean booleanValue = bridge.getBoolean(o, fields[i].getFieldID()) ;
|
||||
orbStream.write_boolean(booleanValue);
|
||||
break;
|
||||
case '[':
|
||||
case 'L':
|
||||
Object objectValue = bridge.getObject(o, fields[i].getFieldID()) ;
|
||||
writeObjectField(fields[i], objectValue);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidClassException(cl.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,16 +31,16 @@
|
||||
|
||||
package com.sun.corba.se.impl.io;
|
||||
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.DigestOutputStream;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Member;
|
||||
import java.lang.reflect.Method;
|
||||
@ -80,9 +80,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
|
||||
public static final long kDefaultUID = -1;
|
||||
|
||||
private static Object noArgsList[] = {};
|
||||
private static Class<?> noTypesList[] = {};
|
||||
|
||||
/** true if represents enum type */
|
||||
private boolean isEnum;
|
||||
|
||||
@ -311,12 +308,37 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final boolean invokeWriteObject(Object obj, ObjectOutputStream ois) throws InvocationTargetException {
|
||||
if (!hasWriteObject()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
writeObjectMethod.invoke(obj, ois);
|
||||
} catch (Throwable t) {
|
||||
throw new InvocationTargetException(t, "writeObject");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean invokeReadObject(Object obj, ObjectInputStream ois) throws InvocationTargetException {
|
||||
if (hasReadObject()) {
|
||||
try {
|
||||
readObjectMethod.invoke(obj, ois);
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
throw new InvocationTargetException(t, "readObject");
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Serializable writeReplace(Serializable value) {
|
||||
if (writeReplaceObjectMethod != null) {
|
||||
try {
|
||||
return (Serializable) writeReplaceObjectMethod.invoke(value,noArgsList);
|
||||
} catch(Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
return (Serializable) writeReplaceObjectMethod.invoke(value);
|
||||
} catch (Throwable t) {
|
||||
throw new InternalError("unexpected error", t);
|
||||
}
|
||||
}
|
||||
else return value;
|
||||
@ -325,9 +347,9 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
public Object readResolve(Object value) {
|
||||
if (readResolveObjectMethod != null) {
|
||||
try {
|
||||
return readResolveObjectMethod.invoke(value,noArgsList);
|
||||
} catch(Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
return readResolveObjectMethod.invoke(value);
|
||||
} catch (Throwable t) {
|
||||
throw new InternalError("unexpected error", t);
|
||||
}
|
||||
}
|
||||
else return value;
|
||||
@ -382,31 +404,34 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
*/
|
||||
}
|
||||
|
||||
private static final class PersistentFieldsValue
|
||||
static final class PersistentFieldsValue
|
||||
extends ClassValue<ObjectStreamField[]> {
|
||||
PersistentFieldsValue() { }
|
||||
|
||||
protected ObjectStreamField[] computeValue(Class<?> type) {
|
||||
try {
|
||||
bridge.ensureClassInitialized(type);
|
||||
Field pf = type.getDeclaredField("serialPersistentFields");
|
||||
int mods = pf.getModifiers();
|
||||
if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) &&
|
||||
Modifier.isFinal(mods)) {
|
||||
pf.setAccessible(true);
|
||||
long offset = bridge.staticFieldOffset(pf);
|
||||
java.io.ObjectStreamField[] fields =
|
||||
(java.io.ObjectStreamField[])pf.get(type);
|
||||
(java.io.ObjectStreamField[])bridge.getObject(type, offset);
|
||||
return translateFields(fields);
|
||||
}
|
||||
} catch (NoSuchFieldException | IllegalAccessException |
|
||||
} catch (NoSuchFieldException |
|
||||
IllegalArgumentException | ClassCastException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ObjectStreamField[] translateFields(
|
||||
java.io.ObjectStreamField[] fields) {
|
||||
private static ObjectStreamField[] translateFields(java.io.ObjectStreamField[] fields) {
|
||||
if (fields == null) {
|
||||
return null;
|
||||
}
|
||||
ObjectStreamField[] translation =
|
||||
new ObjectStreamField[fields.length];
|
||||
new ObjectStreamField[fields.length];
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
translation[i] = new ObjectStreamField(fields[i].getName(),
|
||||
fields[i].getType());
|
||||
@ -450,13 +475,11 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
* If it is declared, use the declared serialPersistentFields.
|
||||
* Otherwise, extract the fields from the class itself.
|
||||
*/
|
||||
fields = persistentFieldsValue.get(cl);
|
||||
fields = persistentFieldsValue.get(cl);
|
||||
|
||||
if (fields == null) {
|
||||
/* Get all of the declared fields for this
|
||||
* Class. setAccessible on all fields so they
|
||||
* can be accessed later. Create a temporary
|
||||
* ObjectStreamField array to hold each
|
||||
/* Get all of the declared fields for this Class.
|
||||
* Create a temporary ObjectStreamField array to hold each
|
||||
* non-static, non-transient field. Then copy the
|
||||
* temporary array into an array of the correct
|
||||
* size once the number of fields is known.
|
||||
@ -471,7 +494,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
int modifiers = fld.getModifiers();
|
||||
if (!Modifier.isStatic(modifiers) &&
|
||||
!Modifier.isTransient(modifiers)) {
|
||||
fld.setAccessible(true) ;
|
||||
tempFields[numFields++] = new ObjectStreamField(fld);
|
||||
}
|
||||
}
|
||||
@ -487,7 +509,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
try {
|
||||
Field reflField = cl.getDeclaredField(fields[j].getName());
|
||||
if (fields[j].getType() == reflField.getType()) {
|
||||
reflField.setAccessible(true);
|
||||
fields[j].setField(reflField);
|
||||
}
|
||||
} catch (NoSuchFieldException e) {
|
||||
@ -527,8 +548,8 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
int mods = f.getModifiers();
|
||||
// SerialBug 5: static final SUID should be read
|
||||
if (Modifier.isStatic(mods) && Modifier.isFinal(mods) ) {
|
||||
f.setAccessible(true);
|
||||
suid = f.getLong(cl);
|
||||
long offset = bridge.staticFieldOffset(f);
|
||||
suid = bridge.getLong(cl, offset);
|
||||
// SerialBug 2: should be computed after writeObject
|
||||
// actualSuid = computeStructuralUID(cl);
|
||||
} else {
|
||||
@ -540,16 +561,12 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
suid = _computeSerialVersionUID(cl);
|
||||
// SerialBug 2: should be computed after writeObject
|
||||
// actualSuid = computeStructuralUID(cl);
|
||||
} catch (IllegalAccessException ex) {
|
||||
suid = _computeSerialVersionUID(cl);
|
||||
}
|
||||
}
|
||||
|
||||
writeReplaceObjectMethod = ObjectStreamClass.getInheritableMethod(cl,
|
||||
"writeReplace", noTypesList, Object.class);
|
||||
writeReplaceObjectMethod = bridge.writeReplaceForSerialization(cl);
|
||||
|
||||
readResolveObjectMethod = ObjectStreamClass.getInheritableMethod(cl,
|
||||
"readResolve", noTypesList, Object.class);
|
||||
readResolveObjectMethod = bridge.readResolveForSerialization(cl);
|
||||
|
||||
if (externalizable)
|
||||
cons = getExternalizableConstructor(cl) ;
|
||||
@ -557,14 +574,8 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
cons = getSerializableConstructor(cl) ;
|
||||
|
||||
if (serializable && !forProxyClass) {
|
||||
/* Look for the writeObject method
|
||||
* Set the accessible flag on it here. ObjectOutputStream
|
||||
* will call it as necessary.
|
||||
*/
|
||||
writeObjectMethod = getPrivateMethod( cl, "writeObject",
|
||||
new Class<?>[] { java.io.ObjectOutputStream.class }, Void.TYPE ) ;
|
||||
readObjectMethod = getPrivateMethod( cl, "readObject",
|
||||
new Class<?>[] { java.io.ObjectInputStream.class }, Void.TYPE ) ;
|
||||
writeObjectMethod = bridge.writeObjectForSerialization(cl) ;
|
||||
readObjectMethod = bridge.readObjectForSerialization(cl);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -585,27 +596,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns non-static private method with given signature defined by given
|
||||
* class, or null if none found. Access checks are disabled on the
|
||||
* returned method (if any).
|
||||
*/
|
||||
private static Method getPrivateMethod(Class<?> cl, String name,
|
||||
Class<?>[] argTypes,
|
||||
Class<?> returnType)
|
||||
{
|
||||
try {
|
||||
Method meth = cl.getDeclaredMethod(name, argTypes);
|
||||
meth.setAccessible(true);
|
||||
int mods = meth.getModifiers();
|
||||
return ((meth.getReturnType() == returnType) &&
|
||||
((mods & Modifier.STATIC) == 0) &&
|
||||
((mods & Modifier.PRIVATE) != 0)) ? meth : null;
|
||||
} catch (NoSuchMethodException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Specific to RMI-IIOP
|
||||
/**
|
||||
* Java to IDL ptc-02-01-12 1.5.1
|
||||
@ -848,6 +838,22 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
return writeObjectMethod != null ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if represented class is serializable or externalizable and
|
||||
* defines a conformant writeReplace method. Otherwise, returns false.
|
||||
*/
|
||||
boolean hasWriteReplaceMethod() {
|
||||
return (writeReplaceObjectMethod != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if represented class is serializable or externalizable and
|
||||
* defines a conformant readResolve method. Otherwise, returns false.
|
||||
*/
|
||||
boolean hasReadResolveMethod() {
|
||||
return (readResolveObjectMethod != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns when or not this class should be custom
|
||||
* marshaled (use chunking). This should happen if
|
||||
@ -904,7 +910,7 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
{
|
||||
if (cons != null) {
|
||||
try {
|
||||
return cons.newInstance(new Object[0]);
|
||||
return cons.newInstance();
|
||||
} catch (IllegalAccessException ex) {
|
||||
// should not occur, as access checks have been suppressed
|
||||
InternalError ie = new InternalError();
|
||||
@ -912,7 +918,7 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
throw ie ;
|
||||
}
|
||||
} else {
|
||||
throw new UnsupportedOperationException();
|
||||
throw new UnsupportedOperationException("no constructor for " + ofClass);
|
||||
}
|
||||
}
|
||||
|
||||
@ -921,15 +927,8 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
* Access checks are disabled on the returned constructor (if any), since
|
||||
* the defining class may still be non-public.
|
||||
*/
|
||||
private static Constructor getExternalizableConstructor(Class<?> cl) {
|
||||
try {
|
||||
Constructor cons = cl.getDeclaredConstructor(new Class<?>[0]);
|
||||
cons.setAccessible(true);
|
||||
return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ?
|
||||
cons : null;
|
||||
} catch (NoSuchMethodException ex) {
|
||||
return null;
|
||||
}
|
||||
private static Constructor<?> getExternalizableConstructor(Class<?> cl) {
|
||||
return bridge.newConstructorForExternalization(cl);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -937,28 +936,8 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
* superclass, or null if none found. Access checks are disabled on the
|
||||
* returned constructor (if any).
|
||||
*/
|
||||
private static Constructor getSerializableConstructor(Class<?> cl) {
|
||||
Class<?> initCl = cl;
|
||||
while (Serializable.class.isAssignableFrom(initCl)) {
|
||||
if ((initCl = initCl.getSuperclass()) == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
try {
|
||||
Constructor cons = initCl.getDeclaredConstructor(new Class<?>[0]);
|
||||
int mods = cons.getModifiers();
|
||||
if ((mods & Modifier.PRIVATE) != 0 ||
|
||||
((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
|
||||
!packageEquals(cl, initCl)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
cons = bridge.newConstructorForSerialization(cl, cons);
|
||||
cons.setAccessible(true);
|
||||
return cons;
|
||||
} catch (NoSuchMethodException ex) {
|
||||
return null;
|
||||
}
|
||||
private static Constructor<?> getSerializableConstructor(Class<?> cl) {
|
||||
return bridge.newConstructorForSerialization(cl);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1522,11 +1501,11 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
* @since JDK 1.2
|
||||
*/
|
||||
private boolean hasExternalizableBlockData;
|
||||
Method writeObjectMethod;
|
||||
Method readObjectMethod;
|
||||
private transient Method writeReplaceObjectMethod;
|
||||
private transient Method readResolveObjectMethod;
|
||||
private Constructor cons ;
|
||||
private transient MethodHandle writeObjectMethod;
|
||||
private transient MethodHandle readObjectMethod;
|
||||
private transient MethodHandle writeReplaceObjectMethod;
|
||||
private transient MethodHandle readResolveObjectMethod;
|
||||
private transient Constructor<?> cons;
|
||||
|
||||
/**
|
||||
* Beginning in Java to IDL ptc/02-01-12, RMI-IIOP has a
|
||||
@ -1543,44 +1522,12 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
*/
|
||||
private ObjectStreamClass localClassDesc;
|
||||
|
||||
/* Find out if the class has a static class initializer <clinit> */
|
||||
private static Method hasStaticInitializerMethod = null;
|
||||
/**
|
||||
* Returns true if the given class defines a static initializer method,
|
||||
* false otherwise.
|
||||
*/
|
||||
private static boolean hasStaticInitializer(Class<?> cl) {
|
||||
if (hasStaticInitializerMethod == null) {
|
||||
Class<?> classWithThisMethod = null;
|
||||
|
||||
try {
|
||||
if (classWithThisMethod == null)
|
||||
classWithThisMethod = java.io.ObjectStreamClass.class;
|
||||
|
||||
hasStaticInitializerMethod =
|
||||
classWithThisMethod.getDeclaredMethod("hasStaticInitializer",
|
||||
new Class<?>[] { Class.class });
|
||||
} catch (NoSuchMethodException ex) {
|
||||
}
|
||||
|
||||
if (hasStaticInitializerMethod == null) {
|
||||
// XXX I18N, logging needed
|
||||
throw new InternalError("Can't find hasStaticInitializer method on "
|
||||
+ classWithThisMethod.getName());
|
||||
}
|
||||
hasStaticInitializerMethod.setAccessible(true);
|
||||
}
|
||||
|
||||
try {
|
||||
Boolean retval = (Boolean)
|
||||
hasStaticInitializerMethod.invoke(null, new Object[] { cl });
|
||||
return retval.booleanValue();
|
||||
} catch (Exception ex) {
|
||||
// XXX I18N, logging needed
|
||||
InternalError ie = new InternalError( "Error invoking hasStaticInitializer" ) ;
|
||||
ie.initCause( ex ) ;
|
||||
throw ie ;
|
||||
}
|
||||
return bridge.hasStaticInitializerForSerialization(cl);
|
||||
}
|
||||
|
||||
|
||||
@ -1754,7 +1701,6 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
if ((meth == null) || (meth.getReturnType() != returnType)) {
|
||||
return null;
|
||||
}
|
||||
meth.setAccessible(true);
|
||||
int mods = meth.getModifiers();
|
||||
if ((mods & (Modifier.STATIC | Modifier.ABSTRACT)) != 0) {
|
||||
return null;
|
||||
|
@ -32,6 +32,7 @@ module java.corba {
|
||||
requires java.logging;
|
||||
requires java.naming;
|
||||
requires java.transaction;
|
||||
requires jdk.unsupported;
|
||||
|
||||
exports javax.activity;
|
||||
exports javax.rmi;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2016, 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,25 +25,24 @@
|
||||
|
||||
package sun.corba ;
|
||||
|
||||
import java.io.OptionalDataException;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.reflect.Field ;
|
||||
import java.lang.reflect.Method ;
|
||||
import java.lang.reflect.Constructor ;
|
||||
import java.lang.reflect.InvocationTargetException ;
|
||||
|
||||
import java.io.ObjectInputStream ;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.Permission;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import jdk.internal.misc.Unsafe ;
|
||||
import jdk.internal.reflect.ReflectionFactory;
|
||||
import sun.misc.Unsafe;
|
||||
import sun.reflect.ReflectionFactory;
|
||||
|
||||
/** This class provides the methods for fundamental JVM operations
|
||||
* needed in the ORB that are not part of the public Java API. This includes:
|
||||
* <ul>
|
||||
* <li>throwException, which can throw undeclared checked exceptions.
|
||||
* This is needed to handle throwing arbitrary exceptions across a standardized OMG interface that (incorrectly) does not specify appropriate exceptions.</li>
|
||||
* This is needed to handle throwing arbitrary exceptions across a standardized
|
||||
* OMG interface that (incorrectly) does not specify appropriate exceptions.</li>
|
||||
* <li>putXXX/getXXX methods that allow unchecked access to fields of objects.
|
||||
* This is used for setting uninitialzed non-static final fields (which is
|
||||
* impossible with reflection) and for speed.</li>
|
||||
@ -71,88 +70,28 @@ import jdk.internal.reflect.ReflectionFactory;
|
||||
*/
|
||||
public final class Bridge
|
||||
{
|
||||
private static final Class[] NO_ARGS = new Class[] {};
|
||||
private static final Permission getBridgePermission =
|
||||
new BridgePermission( "getBridge" ) ;
|
||||
new BridgePermission("getBridge");
|
||||
private static Bridge bridge = null ;
|
||||
|
||||
// latestUserDefinedLoader() is a private static method
|
||||
// in ObjectInputStream in JDK 1.3 through 1.5.
|
||||
// We use reflection in a doPrivileged block to get a
|
||||
// Method reference and make it accessible.
|
||||
private final Method latestUserDefinedLoaderMethod ;
|
||||
private final Unsafe unsafe ;
|
||||
/** Access to Unsafe to read/write fields. */
|
||||
private static final Unsafe unsafe = AccessController.doPrivileged(
|
||||
(PrivilegedAction<Unsafe>)() -> {
|
||||
try {
|
||||
Field field = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
field.setAccessible(true);
|
||||
return (Unsafe)field.get(null);
|
||||
|
||||
} catch (NoSuchFieldException |IllegalAccessException ex) {
|
||||
throw new InternalError("Unsafe.theUnsafe field not available", ex);
|
||||
}
|
||||
}
|
||||
) ;
|
||||
|
||||
private final ReflectionFactory reflectionFactory ;
|
||||
|
||||
private Method getLatestUserDefinedLoaderMethod()
|
||||
{
|
||||
return (Method) AccessController.doPrivileged(
|
||||
new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
Method result = null;
|
||||
|
||||
try {
|
||||
Class io = ObjectInputStream.class;
|
||||
result = io.getDeclaredMethod(
|
||||
"latestUserDefinedLoader", NO_ARGS);
|
||||
result.setAccessible(true);
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
Error err = new Error( "java.io.ObjectInputStream" +
|
||||
" latestUserDefinedLoader " + nsme );
|
||||
err.initCause(nsme) ;
|
||||
throw err ;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private Unsafe getUnsafe() {
|
||||
Field fld = (Field)AccessController.doPrivileged(
|
||||
new PrivilegedAction()
|
||||
{
|
||||
public Object run()
|
||||
{
|
||||
Field fld = null ;
|
||||
|
||||
try {
|
||||
Class unsafeClass = jdk.internal.misc.Unsafe.class ;
|
||||
fld = unsafeClass.getDeclaredField( "theUnsafe" ) ;
|
||||
fld.setAccessible( true ) ;
|
||||
return fld ;
|
||||
} catch (NoSuchFieldException exc) {
|
||||
Error err = new Error( "Could not access Unsafe" ) ;
|
||||
err.initCause( exc ) ;
|
||||
throw err ;
|
||||
}
|
||||
}
|
||||
}
|
||||
) ;
|
||||
|
||||
Unsafe unsafe = null;
|
||||
|
||||
try {
|
||||
unsafe = (Unsafe)(fld.get( null )) ;
|
||||
} catch (Throwable t) {
|
||||
Error err = new Error( "Could not access Unsafe" ) ;
|
||||
err.initCause( t ) ;
|
||||
throw err ;
|
||||
}
|
||||
|
||||
return unsafe ;
|
||||
}
|
||||
|
||||
|
||||
private Bridge()
|
||||
{
|
||||
latestUserDefinedLoaderMethod = getLatestUserDefinedLoaderMethod();
|
||||
unsafe = getUnsafe() ;
|
||||
reflectionFactory = (ReflectionFactory)AccessController.doPrivileged(
|
||||
new ReflectionFactory.GetReflectionFactoryAction());
|
||||
private Bridge() {
|
||||
reflectionFactory = ReflectionFactory.getReflectionFactory();
|
||||
}
|
||||
|
||||
/** Fetch the Bridge singleton. This requires the following
|
||||
@ -182,23 +121,8 @@ public final class Bridge
|
||||
/** Obtain the latest user defined ClassLoader from the call stack.
|
||||
* This is required by the RMI-IIOP specification.
|
||||
*/
|
||||
public final ClassLoader getLatestUserDefinedLoader()
|
||||
{
|
||||
try {
|
||||
// Invoke the ObjectInputStream.latestUserDefinedLoader method
|
||||
return (ClassLoader)latestUserDefinedLoaderMethod.invoke(null,
|
||||
(Object[])NO_ARGS);
|
||||
} catch (InvocationTargetException ite) {
|
||||
Error err = new Error(
|
||||
"sun.corba.Bridge.latestUserDefinedLoader: " + ite ) ;
|
||||
err.initCause( ite ) ;
|
||||
throw err ;
|
||||
} catch (IllegalAccessException iae) {
|
||||
Error err = new Error(
|
||||
"sun.corba.Bridge.latestUserDefinedLoader: " + iae ) ;
|
||||
err.initCause( iae ) ;
|
||||
throw err ;
|
||||
}
|
||||
public final ClassLoader getLatestUserDefinedLoader() {
|
||||
return jdk.internal.misc.VM.latestUserDefinedLoader();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -345,6 +269,23 @@ public final class Bridge
|
||||
return unsafe.objectFieldOffset( f ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the offset of a static field.
|
||||
*/
|
||||
public final long staticFieldOffset(Field f)
|
||||
{
|
||||
return unsafe.staticFieldOffset( f ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the class has been initalized.
|
||||
* @param cl the class to ensure is initialized
|
||||
*/
|
||||
public final void ensureClassInitialized(Class<?> cl) {
|
||||
unsafe.ensureClassInitialized(cl);
|
||||
}
|
||||
|
||||
|
||||
/** Throw the exception.
|
||||
* The exception may be an undeclared checked exception.
|
||||
*/
|
||||
@ -353,16 +294,55 @@ public final class Bridge
|
||||
unsafe.throwException( ee ) ;
|
||||
}
|
||||
|
||||
/** Obtain a constructor for Class cl using constructor cons which
|
||||
* may be the constructor defined in a superclass of cl. This is
|
||||
* used to create a constructor for Serializable classes that
|
||||
* constructs an instance of the Serializable class using the
|
||||
/**
|
||||
* Obtain a constructor for Class cl.
|
||||
* This is used to create a constructor for Serializable classes that
|
||||
* construct an instance of the Serializable class using the
|
||||
* no args constructor of the first non-Serializable superclass
|
||||
* of the Serializable class.
|
||||
*/
|
||||
public final Constructor newConstructorForSerialization( Class cl,
|
||||
Constructor cons )
|
||||
{
|
||||
return reflectionFactory.newConstructorForSerialization( cl, cons ) ;
|
||||
public final Constructor<?> newConstructorForSerialization( Class<?> cl ) {
|
||||
return reflectionFactory.newConstructorForSerialization( cl ) ;
|
||||
}
|
||||
|
||||
public final Constructor<?> newConstructorForExternalization(Class<?> cl) {
|
||||
return reflectionFactory.newConstructorForExternalization( cl ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given class defines a static initializer method,
|
||||
* false otherwise.
|
||||
*/
|
||||
public final boolean hasStaticInitializerForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.hasStaticInitializerForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle writeObjectForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.writeObjectForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle readObjectForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.readObjectForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle readObjectNoDataForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.readObjectNoDataForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle readResolveForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.readResolveForSerialization(cl);
|
||||
}
|
||||
|
||||
public final MethodHandle writeReplaceForSerialization(Class<?> cl) {
|
||||
return reflectionFactory.writeReplaceForSerialization(cl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new OptionalDataException instance.
|
||||
* @return a new OptionalDataException instance
|
||||
*/
|
||||
public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool) {
|
||||
return reflectionFactory.newOptionalDataExceptionForSerialization(bool);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,13 +25,13 @@
|
||||
|
||||
package sun.corba;
|
||||
|
||||
import com.sun.corba.se.impl.io.ValueUtility;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import com.sun.corba.se.impl.io.ValueUtility;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
/** A repository of "shared secrets", which are a mechanism for
|
||||
calling implementation-private methods in another package without
|
||||
using reflection. A package-private class implements a public
|
||||
@ -43,22 +43,22 @@ import java.security.PrivilegedAction;
|
||||
|
||||
// SharedSecrets cloned in corba repo to avoid build issues
|
||||
public class SharedSecrets {
|
||||
private static final Unsafe unsafe = getUnsafe();
|
||||
private static JavaCorbaAccess javaCorbaAccess;
|
||||
|
||||
private static Unsafe getUnsafe() {
|
||||
PrivilegedAction<Unsafe> pa = () -> {
|
||||
Class<?> unsafeClass = jdk.internal.misc.Unsafe.class ;
|
||||
try {
|
||||
Field f = unsafeClass.getDeclaredField("theUnsafe");
|
||||
f.setAccessible(true);
|
||||
return (Unsafe) f.get(null);
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
};
|
||||
return AccessController.doPrivileged(pa);
|
||||
}
|
||||
/** Access to Unsafe to read/write fields. */
|
||||
private static final Unsafe unsafe = AccessController.doPrivileged(
|
||||
(PrivilegedAction<Unsafe>)() -> {
|
||||
try {
|
||||
Field field = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
field.setAccessible(true);
|
||||
return (Unsafe)field.get(null);
|
||||
|
||||
} catch (NoSuchFieldException |IllegalAccessException ex) {
|
||||
throw new InternalError("Unsafe.theUnsafe field not available", ex);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
private static JavaCorbaAccess javaCorbaAccess;
|
||||
|
||||
public static JavaCorbaAccess getJavaCorbaAccess() {
|
||||
if (javaCorbaAccess == null) {
|
||||
|
@ -543,3 +543,6 @@ dfcbf839e299e7e2bba1da69bdb347617ea4c7e8 jdk-9+137
|
||||
fc0956308c7a586267c5dd35dff74f773aa9c3eb jdk-9+138
|
||||
08492e67bf3226784dab3bf9ae967382ddbc1af5 jdk-9+139
|
||||
fec31089c2ef5a12dd64f401b0bf2e00f56ee0d0 jdk-9+140
|
||||
160a00bc6ed0af1fdf8418fc65e6bddbbc0c536d jdk-9+141
|
||||
7b48d63dfd6b8e2657288de3d7b1f153dee02d7e jdk-9+142
|
||||
d87d5d430c42342f0320ca7f5cbe0cbd1f9d62ba jdk-9+143
|
||||
|
@ -135,14 +135,14 @@ TARGETS += $(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp
|
||||
# Copy jvmti.h to include dir
|
||||
|
||||
# The file is the same regardless of jvm variant. Only let one do the copy.
|
||||
#ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
|
||||
# $(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
|
||||
# DEST := $(SUPPORT_OUTPUTDIR)/modules_include/java.base, \
|
||||
# FILES := $(JVMTI_OUTPUTDIR)/jvmti.h, \
|
||||
# ))
|
||||
ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
|
||||
$(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
|
||||
DEST := $(SUPPORT_OUTPUTDIR)/modules_include/java.base, \
|
||||
FILES := $(JVMTI_OUTPUTDIR)/jvmti.h, \
|
||||
))
|
||||
|
||||
# TARGETS += $(COPY_JVMTI_H)
|
||||
#endif
|
||||
TARGETS += $(COPY_JVMTI_H)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Create trace files in gensrc/tracefiles
|
||||
|
@ -176,6 +176,11 @@ endif
|
||||
|
||||
JVM_OPTIMIZATION ?= HIGHEST_JVM
|
||||
|
||||
# Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS
|
||||
# parameter to SetupNativeCompilation allows an empty value to override the
|
||||
# default.
|
||||
JVM_STRIPFLAGS ?= $(STRIPFLAGS)
|
||||
|
||||
################################################################################
|
||||
# Now set up the actual compilation of the main hotspot native library
|
||||
|
||||
@ -204,6 +209,7 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
|
||||
OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \
|
||||
MAPFILE := $(JVM_MAPFILE), \
|
||||
USE_MAPFILE_FOR_SYMBOLS := true, \
|
||||
STRIPFLAGS := $(JVM_STRIPFLAGS), \
|
||||
EMBED_MANIFEST := true, \
|
||||
RC_FLAGS := $(JVM_RCFLAGS), \
|
||||
VERSIONINFO_RESOURCE := $(HOTSPOT_TOPDIR)/src/os/windows/vm/version.rc, \
|
||||
|
@ -59,6 +59,10 @@ endif
|
||||
|
||||
ifeq ($(call check-jvm-feature, minimal), true)
|
||||
JVM_CFLAGS_FEATURES += -DMINIMAL_JVM -DVMTYPE=\"Minimal\"
|
||||
ifeq ($(OPENJDK_TARGET_OS), linux)
|
||||
# Override the default -g with a more liberal strip policy for the minimal JVM
|
||||
JVM_STRIPFLAGS := --strip-unneeded
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(call check-jvm-feature, dtrace), true)
|
||||
|
@ -125,7 +125,6 @@ JVM_GetPrimitiveArrayElement
|
||||
JVM_GetProtectionDomain
|
||||
JVM_GetSimpleBinaryName
|
||||
JVM_GetStackAccessControlContext
|
||||
JVM_GetStackTraceElements
|
||||
JVM_GetSystemPackage
|
||||
JVM_GetSystemPackages
|
||||
JVM_GetTemporaryDirectory
|
||||
@ -135,6 +134,8 @@ JVM_HasReferencePendingList
|
||||
JVM_HoldsLock
|
||||
JVM_IHashCode
|
||||
JVM_InitProperties
|
||||
JVM_InitStackTraceElement
|
||||
JVM_InitStackTraceElementArray
|
||||
JVM_InternString
|
||||
JVM_Interrupt
|
||||
JVM_InvokeMethod
|
||||
@ -178,7 +179,6 @@ JVM_StartThread
|
||||
JVM_StopThread
|
||||
JVM_SupportsCX8
|
||||
JVM_SuspendThread
|
||||
JVM_ToStackTraceElement
|
||||
JVM_TotalMemory
|
||||
JVM_UnloadLibrary
|
||||
JVM_WaitForReferencePendingList
|
||||
|
@ -45,6 +45,7 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/jni/8025979 \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/jni/8033445 \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/jni/checked \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/jni/PrivateInterfaceMethods \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/jni/ToStringInInterfaceTest \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/modules/getModuleJNI \
|
||||
$(HOTSPOT_TOPDIR)/test/runtime/SameObject \
|
||||
|
@ -3496,6 +3496,16 @@ bool Matcher::narrow_klass_use_complex_address() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Matcher::const_oop_prefer_decode() {
|
||||
// Prefer ConN+DecodeN over ConP in simple compressed oops mode.
|
||||
return Universe::narrow_oop_base() == NULL;
|
||||
}
|
||||
|
||||
bool Matcher::const_klass_prefer_decode() {
|
||||
// Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
|
||||
return Universe::narrow_klass_base() == NULL;
|
||||
}
|
||||
|
||||
// Is it better to copy float constants, or load them directly from
|
||||
// memory? Intel can load a float constant from a direct address,
|
||||
// requiring no extra registers. Most RISCs will have to materialize
|
||||
@ -15502,6 +15512,24 @@ instruct string_indexof_conLU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2,
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
||||
instruct string_indexofU_char(iRegP_R1 str1, iRegI_R2 cnt1, iRegI_R3 ch,
|
||||
iRegI_R0 result, iRegI tmp1, iRegI tmp2,
|
||||
iRegI tmp3, rFlagsReg cr)
|
||||
%{
|
||||
match(Set result (StrIndexOfChar (Binary str1 cnt1) ch));
|
||||
effect(USE_KILL str1, USE_KILL cnt1, USE_KILL ch,
|
||||
TEMP tmp1, TEMP tmp2, TEMP tmp3, KILL cr);
|
||||
|
||||
format %{ "String IndexOf char[] $str1,$cnt1,$ch -> $result" %}
|
||||
|
||||
ins_encode %{
|
||||
__ string_indexof_char($str1$$Register, $cnt1$$Register, $ch$$Register,
|
||||
$result$$Register, $tmp1$$Register, $tmp2$$Register,
|
||||
$tmp3$$Register);
|
||||
%}
|
||||
ins_pipe(pipe_class_memory);
|
||||
%}
|
||||
|
||||
instruct string_equalsL(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
|
||||
iRegI_R0 result, rFlagsReg cr)
|
||||
%{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -130,8 +130,8 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
|
||||
if (_num_fp_args < Argument::n_float_register_parameters_c) {
|
||||
__ ldrs(as_FloatRegister(_num_fp_args++), src);
|
||||
} else {
|
||||
__ ldrh(r0, src);
|
||||
__ strh(r0, Address(to(), _stack_offset));
|
||||
__ ldrw(r0, src);
|
||||
__ strw(r0, Address(to(), _stack_offset));
|
||||
_stack_offset += wordSize;
|
||||
_num_fp_args++;
|
||||
}
|
||||
@ -349,7 +349,7 @@ class SlowSignatureHandler
|
||||
_num_fp_args++;
|
||||
} else {
|
||||
*_to++ = from_obj;
|
||||
_num_int_args++;
|
||||
_num_fp_args++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ class SlowSignatureHandler
|
||||
_num_fp_args++;
|
||||
} else {
|
||||
*_to++ = from_obj;
|
||||
_num_int_args++;
|
||||
_num_fp_args++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,12 +60,12 @@ void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle constant, TRAPS)
|
||||
void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) {
|
||||
address pc = _instructions->start() + pc_offset;
|
||||
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
|
||||
narrowKlass narrowOop = record_narrow_metadata_reference(constant, CHECK);
|
||||
narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, CHECK);
|
||||
TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop);
|
||||
Unimplemented();
|
||||
} else {
|
||||
NativeMovConstReg* move = nativeMovConstReg_at(pc);
|
||||
void* reference = record_metadata_reference(constant, CHECK);
|
||||
void* reference = record_metadata_reference(_instructions, pc, constant, CHECK);
|
||||
move->set_data((intptr_t) reference);
|
||||
TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference));
|
||||
}
|
||||
|
@ -4508,6 +4508,67 @@ void MacroAssembler::string_indexof(Register str2, Register str1,
|
||||
typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr);
|
||||
typedef void (MacroAssembler::* uxt_insn)(Register Rd, Register Rn);
|
||||
|
||||
void MacroAssembler::string_indexof_char(Register str1, Register cnt1,
|
||||
Register ch, Register result,
|
||||
Register tmp1, Register tmp2, Register tmp3)
|
||||
{
|
||||
Label CH1_LOOP, HAS_ZERO, DO1_SHORT, DO1_LOOP, MATCH, NOMATCH, DONE;
|
||||
Register cnt1_neg = cnt1;
|
||||
Register ch1 = rscratch1;
|
||||
Register result_tmp = rscratch2;
|
||||
|
||||
cmp(cnt1, 4);
|
||||
br(LT, DO1_SHORT);
|
||||
|
||||
orr(ch, ch, ch, LSL, 16);
|
||||
orr(ch, ch, ch, LSL, 32);
|
||||
|
||||
sub(cnt1, cnt1, 4);
|
||||
mov(result_tmp, cnt1);
|
||||
lea(str1, Address(str1, cnt1, Address::uxtw(1)));
|
||||
sub(cnt1_neg, zr, cnt1, LSL, 1);
|
||||
|
||||
mov(tmp3, 0x0001000100010001);
|
||||
|
||||
BIND(CH1_LOOP);
|
||||
ldr(ch1, Address(str1, cnt1_neg));
|
||||
eor(ch1, ch, ch1);
|
||||
sub(tmp1, ch1, tmp3);
|
||||
orr(tmp2, ch1, 0x7fff7fff7fff7fff);
|
||||
bics(tmp1, tmp1, tmp2);
|
||||
br(NE, HAS_ZERO);
|
||||
adds(cnt1_neg, cnt1_neg, 8);
|
||||
br(LT, CH1_LOOP);
|
||||
|
||||
cmp(cnt1_neg, 8);
|
||||
mov(cnt1_neg, 0);
|
||||
br(LT, CH1_LOOP);
|
||||
b(NOMATCH);
|
||||
|
||||
BIND(HAS_ZERO);
|
||||
rev(tmp1, tmp1);
|
||||
clz(tmp1, tmp1);
|
||||
add(cnt1_neg, cnt1_neg, tmp1, LSR, 3);
|
||||
b(MATCH);
|
||||
|
||||
BIND(DO1_SHORT);
|
||||
mov(result_tmp, cnt1);
|
||||
lea(str1, Address(str1, cnt1, Address::uxtw(1)));
|
||||
sub(cnt1_neg, zr, cnt1, LSL, 1);
|
||||
BIND(DO1_LOOP);
|
||||
ldrh(ch1, Address(str1, cnt1_neg));
|
||||
cmpw(ch, ch1);
|
||||
br(EQ, MATCH);
|
||||
adds(cnt1_neg, cnt1_neg, 2);
|
||||
br(LT, DO1_LOOP);
|
||||
BIND(NOMATCH);
|
||||
mov(result, -1);
|
||||
b(DONE);
|
||||
BIND(MATCH);
|
||||
add(result, result_tmp, cnt1_neg, ASR, 1);
|
||||
BIND(DONE);
|
||||
}
|
||||
|
||||
// Compare strings.
|
||||
void MacroAssembler::string_compare(Register str1, Register str2,
|
||||
Register cnt1, Register cnt2, Register result,
|
||||
|
@ -1229,6 +1229,9 @@ public:
|
||||
Register tmp1, Register tmp2,
|
||||
Register tmp3, Register tmp4,
|
||||
int int_cnt1, Register result, int ae);
|
||||
void string_indexof_char(Register str1, Register cnt1,
|
||||
Register ch, Register result,
|
||||
Register tmp1, Register tmp2, Register tmp3);
|
||||
private:
|
||||
void add2_with_carry(Register final_dest_hi, Register dest_hi, Register dest_lo,
|
||||
Register src1, Register src2);
|
||||
|
@ -989,7 +989,16 @@ static void object_move(MacroAssembler* masm,
|
||||
|
||||
// A float arg may have to do float reg int reg conversion
|
||||
static void float_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
|
||||
if (src.first() != dst.first()) {
|
||||
assert(src.first()->is_stack() && dst.first()->is_stack() ||
|
||||
src.first()->is_reg() && dst.first()->is_reg(), "Unexpected error");
|
||||
if (src.first()->is_stack()) {
|
||||
if (dst.first()->is_stack()) {
|
||||
__ ldrw(rscratch1, Address(rfp, reg2offset_in(src.first())));
|
||||
__ strw(rscratch1, Address(sp, reg2offset_out(dst.first())));
|
||||
} else {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
} else if (src.first() != dst.first()) {
|
||||
if (src.is_single_phys_reg() && dst.is_single_phys_reg())
|
||||
__ fmovs(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister());
|
||||
else
|
||||
@ -1023,7 +1032,16 @@ static void long_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
|
||||
|
||||
// A double move
|
||||
static void double_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
|
||||
if (src.first() != dst.first()) {
|
||||
assert(src.first()->is_stack() && dst.first()->is_stack() ||
|
||||
src.first()->is_reg() && dst.first()->is_reg(), "Unexpected error");
|
||||
if (src.first()->is_stack()) {
|
||||
if (dst.first()->is_stack()) {
|
||||
__ ldr(rscratch1, Address(rfp, reg2offset_in(src.first())));
|
||||
__ str(rscratch1, Address(sp, reg2offset_out(dst.first())));
|
||||
} else {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
} else if (src.first() != dst.first()) {
|
||||
if (src.is_single_phys_reg() && dst.is_single_phys_reg())
|
||||
__ fmovd(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister());
|
||||
else
|
||||
|
@ -2743,7 +2743,7 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ align(CodeEntryAlignment);
|
||||
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
|
||||
|
||||
Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52;
|
||||
Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52, _L_finish;
|
||||
|
||||
const Register from = c_rarg0; // source array address
|
||||
const Register to = c_rarg1; // destination array address
|
||||
@ -2754,9 +2754,12 @@ class StubGenerator: public StubCodeGenerator {
|
||||
const Register keylen = rscratch1;
|
||||
|
||||
address start = __ pc();
|
||||
|
||||
__ enter();
|
||||
|
||||
__ mov(rscratch2, len_reg);
|
||||
__ subsw(rscratch2, len_reg, zr);
|
||||
__ br(Assembler::LE, _L_finish);
|
||||
|
||||
__ ldrw(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
|
||||
|
||||
__ ld1(v0, __ T16B, rvec);
|
||||
@ -2814,11 +2817,13 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ eor(v0, __ T16B, v0, v31);
|
||||
|
||||
__ st1(v0, __ T16B, __ post(to, 16));
|
||||
__ sub(len_reg, len_reg, 16);
|
||||
__ cbnz(len_reg, L_aes_loop);
|
||||
|
||||
__ subw(len_reg, len_reg, 16);
|
||||
__ cbnzw(len_reg, L_aes_loop);
|
||||
|
||||
__ st1(v0, __ T16B, rvec);
|
||||
|
||||
__ BIND(_L_finish);
|
||||
__ mov(r0, rscratch2);
|
||||
|
||||
__ leave();
|
||||
@ -2844,7 +2849,7 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ align(CodeEntryAlignment);
|
||||
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
|
||||
|
||||
Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52;
|
||||
Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52, _L_finish;
|
||||
|
||||
const Register from = c_rarg0; // source array address
|
||||
const Register to = c_rarg1; // destination array address
|
||||
@ -2855,9 +2860,12 @@ class StubGenerator: public StubCodeGenerator {
|
||||
const Register keylen = rscratch1;
|
||||
|
||||
address start = __ pc();
|
||||
|
||||
__ enter();
|
||||
|
||||
__ mov(rscratch2, len_reg);
|
||||
__ subsw(rscratch2, len_reg, zr);
|
||||
__ br(Assembler::LE, _L_finish);
|
||||
|
||||
__ ldrw(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
|
||||
|
||||
__ ld1(v2, __ T16B, rvec);
|
||||
@ -2920,11 +2928,12 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ st1(v0, __ T16B, __ post(to, 16));
|
||||
__ orr(v2, __ T16B, v1, v1);
|
||||
|
||||
__ sub(len_reg, len_reg, 16);
|
||||
__ cbnz(len_reg, L_aes_loop);
|
||||
__ subw(len_reg, len_reg, 16);
|
||||
__ cbnzw(len_reg, L_aes_loop);
|
||||
|
||||
__ st1(v2, __ T16B, rvec);
|
||||
|
||||
__ BIND(_L_finish);
|
||||
__ mov(r0, rscratch2);
|
||||
|
||||
__ leave();
|
||||
|
@ -454,8 +454,9 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
|
||||
__ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
// Check if we need to take lock at entry of synchronized method.
|
||||
if (UseJVMCICompiler) {
|
||||
// Check if we need to take lock at entry of synchronized method. This can
|
||||
// only occur on method entry so emit it only for vtos with step 0.
|
||||
if (UseJVMCICompiler && state == vtos && step == 0) {
|
||||
Label L;
|
||||
__ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
|
||||
__ cbz(rscratch1, L);
|
||||
@ -464,8 +465,17 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
|
||||
// Take lock.
|
||||
lock_method();
|
||||
__ bind(L);
|
||||
}
|
||||
} else {
|
||||
#ifdef ASSERT
|
||||
if (UseJVMCICompiler) {
|
||||
Label L;
|
||||
__ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
|
||||
__ cbz(rscratch1, L);
|
||||
__ stop("unexpected pending monitor in deopt entry");
|
||||
__ bind(L);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// handle exceptions
|
||||
{
|
||||
Label L;
|
||||
|
@ -3717,19 +3717,15 @@ void TemplateTable::monitorenter()
|
||||
|
||||
// allocate one if there's no free slot
|
||||
{
|
||||
Label entry, loop, no_adjust;
|
||||
Label entry, loop;
|
||||
// 1. compute new pointers // rsp: old expression stack top
|
||||
__ ldr(c_rarg1, monitor_block_bot); // c_rarg1: old expression stack bottom
|
||||
__ sub(esp, esp, entry_size); // move expression stack top
|
||||
__ sub(esp, esp, entry_size); // move expression stack top
|
||||
__ sub(c_rarg1, c_rarg1, entry_size); // move expression stack bottom
|
||||
__ mov(c_rarg3, esp); // set start value for copy loop
|
||||
__ str(c_rarg1, monitor_block_bot); // set new monitor block bottom
|
||||
|
||||
__ cmp(sp, c_rarg3); // Check if we need to move sp
|
||||
__ br(Assembler::LO, no_adjust); // to allow more stack space
|
||||
// for our new esp
|
||||
__ sub(sp, sp, 2 * wordSize);
|
||||
__ bind(no_adjust);
|
||||
__ sub(sp, sp, entry_size); // make room for the monitor
|
||||
|
||||
__ b(entry);
|
||||
// 2. move expression stack contents
|
||||
|
@ -1894,6 +1894,22 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
|
||||
__ beq(combined_check, slow);
|
||||
}
|
||||
|
||||
if (flags & LIR_OpArrayCopy::type_check) {
|
||||
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::dst_objarray)) {
|
||||
__ load_klass(tmp, dst);
|
||||
__ lwz(tmp2, in_bytes(Klass::layout_helper_offset()), tmp);
|
||||
__ cmpwi(CCR0, tmp2, Klass::_lh_neutral_value);
|
||||
__ bge(CCR0, slow);
|
||||
}
|
||||
|
||||
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::src_objarray)) {
|
||||
__ load_klass(tmp, src);
|
||||
__ lwz(tmp2, in_bytes(Klass::layout_helper_offset()), tmp);
|
||||
__ cmpwi(CCR0, tmp2, Klass::_lh_neutral_value);
|
||||
__ bge(CCR0, slow);
|
||||
}
|
||||
}
|
||||
|
||||
// Higher 32bits must be null.
|
||||
__ extsw(length, length);
|
||||
|
||||
|
@ -64,17 +64,16 @@ void C1_MacroAssembler::explicit_null_check(Register base) {
|
||||
|
||||
|
||||
void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes) {
|
||||
assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
|
||||
// Avoid stack bang as first instruction. It may get overwritten by patch_verified_entry.
|
||||
const Register return_pc = R20;
|
||||
mflr(return_pc);
|
||||
|
||||
// Make sure there is enough stack space for this method's activation.
|
||||
assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
|
||||
generate_stack_overflow_check(bang_size_in_bytes);
|
||||
|
||||
// Create the frame.
|
||||
const Register return_pc = R0;
|
||||
|
||||
mflr(return_pc);
|
||||
// Get callers sp.
|
||||
std(return_pc, _abi(lr), R1_SP); // SP->lr = return_pc
|
||||
push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
|
||||
std(return_pc, _abi(lr), R1_SP); // SP->lr = return_pc
|
||||
push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
|
||||
}
|
||||
|
||||
|
||||
|
@ -1097,21 +1097,19 @@ EmitCallOffsets emit_call_with_trampoline_stub(MacroAssembler &_masm, address en
|
||||
// No entry point given, use the current pc.
|
||||
if (entry_point == NULL) entry_point = __ pc();
|
||||
|
||||
if (!Compile::current()->in_scratch_emit_size()) {
|
||||
// Put the entry point as a constant into the constant pool.
|
||||
const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
|
||||
if (entry_point_toc_addr == NULL) {
|
||||
ciEnv::current()->record_out_of_memory_failure();
|
||||
return offsets;
|
||||
}
|
||||
const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
|
||||
|
||||
// Emit the trampoline stub which will be related to the branch-and-link below.
|
||||
CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
|
||||
if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
|
||||
__ relocate(rtype);
|
||||
// Put the entry point as a constant into the constant pool.
|
||||
const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
|
||||
if (entry_point_toc_addr == NULL) {
|
||||
ciEnv::current()->record_out_of_memory_failure();
|
||||
return offsets;
|
||||
}
|
||||
|
||||
const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
|
||||
|
||||
// Emit the trampoline stub which will be related to the branch-and-link below.
|
||||
CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
|
||||
if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
|
||||
__ relocate(rtype);
|
||||
|
||||
// Note: At this point we do not have the address of the trampoline
|
||||
// stub, and the entry point might be too far away for bl, so __ pc()
|
||||
// serves as dummy and the bl will be patched later.
|
||||
@ -2166,6 +2164,16 @@ bool Matcher::narrow_klass_use_complex_address() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Matcher::const_oop_prefer_decode() {
|
||||
// Prefer ConN+DecodeN over ConP in simple compressed oops mode.
|
||||
return Universe::narrow_oop_base() == NULL;
|
||||
}
|
||||
|
||||
bool Matcher::const_klass_prefer_decode() {
|
||||
// Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
|
||||
return Universe::narrow_klass_base() == NULL;
|
||||
}
|
||||
|
||||
// Is it better to copy float constants, or load them directly from memory?
|
||||
// Intel can load a float constant from a direct address, requiring no
|
||||
// extra registers. Most RISCs will have to materialize an address into a
|
||||
@ -2424,23 +2432,21 @@ encode %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
int toc_offset = 0;
|
||||
|
||||
if (!ra_->C->in_scratch_emit_size()) {
|
||||
address const_toc_addr;
|
||||
// Create a non-oop constant, no relocation needed.
|
||||
// If it is an IC, it has a virtual_call_Relocation.
|
||||
const_toc_addr = __ long_constant((jlong)$src$$constant);
|
||||
if (const_toc_addr == NULL) {
|
||||
ciEnv::current()->record_out_of_memory_failure();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the constant's TOC offset.
|
||||
toc_offset = __ offset_to_method_toc(const_toc_addr);
|
||||
|
||||
// Keep the current instruction offset in mind.
|
||||
((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
|
||||
address const_toc_addr;
|
||||
// Create a non-oop constant, no relocation needed.
|
||||
// If it is an IC, it has a virtual_call_Relocation.
|
||||
const_toc_addr = __ long_constant((jlong)$src$$constant);
|
||||
if (const_toc_addr == NULL) {
|
||||
ciEnv::current()->record_out_of_memory_failure();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get the constant's TOC offset.
|
||||
toc_offset = __ offset_to_method_toc(const_toc_addr);
|
||||
|
||||
// Keep the current instruction offset in mind.
|
||||
((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
|
||||
|
||||
__ ld($dst$$Register, toc_offset, $toc$$Register);
|
||||
%}
|
||||
|
||||
@ -2576,32 +2582,30 @@ encode %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
int toc_offset = 0;
|
||||
|
||||
if (!ra_->C->in_scratch_emit_size()) {
|
||||
intptr_t val = $src$$constant;
|
||||
relocInfo::relocType constant_reloc = $src->constant_reloc(); // src
|
||||
address const_toc_addr;
|
||||
if (constant_reloc == relocInfo::oop_type) {
|
||||
// Create an oop constant and a corresponding relocation.
|
||||
AddressLiteral a = __ allocate_oop_address((jobject)val);
|
||||
const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
|
||||
__ relocate(a.rspec());
|
||||
} else if (constant_reloc == relocInfo::metadata_type) {
|
||||
AddressLiteral a = __ constant_metadata_address((Metadata *)val);
|
||||
const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
|
||||
__ relocate(a.rspec());
|
||||
} else {
|
||||
// Create a non-oop constant, no relocation needed.
|
||||
const_toc_addr = __ long_constant((jlong)$src$$constant);
|
||||
}
|
||||
|
||||
if (const_toc_addr == NULL) {
|
||||
ciEnv::current()->record_out_of_memory_failure();
|
||||
return;
|
||||
}
|
||||
// Get the constant's TOC offset.
|
||||
toc_offset = __ offset_to_method_toc(const_toc_addr);
|
||||
intptr_t val = $src$$constant;
|
||||
relocInfo::relocType constant_reloc = $src->constant_reloc(); // src
|
||||
address const_toc_addr;
|
||||
if (constant_reloc == relocInfo::oop_type) {
|
||||
// Create an oop constant and a corresponding relocation.
|
||||
AddressLiteral a = __ allocate_oop_address((jobject)val);
|
||||
const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
|
||||
__ relocate(a.rspec());
|
||||
} else if (constant_reloc == relocInfo::metadata_type) {
|
||||
AddressLiteral a = __ constant_metadata_address((Metadata *)val);
|
||||
const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
|
||||
__ relocate(a.rspec());
|
||||
} else {
|
||||
// Create a non-oop constant, no relocation needed.
|
||||
const_toc_addr = __ long_constant((jlong)$src$$constant);
|
||||
}
|
||||
|
||||
if (const_toc_addr == NULL) {
|
||||
ciEnv::current()->record_out_of_memory_failure();
|
||||
return;
|
||||
}
|
||||
// Get the constant's TOC offset.
|
||||
toc_offset = __ offset_to_method_toc(const_toc_addr);
|
||||
|
||||
__ ld($dst$$Register, toc_offset, $toc$$Register);
|
||||
%}
|
||||
|
||||
@ -3272,28 +3276,26 @@ encode %{
|
||||
} else {
|
||||
// Remember the offset not the address.
|
||||
const int start_offset = __ offset();
|
||||
|
||||
// The trampoline stub.
|
||||
if (!Compile::current()->in_scratch_emit_size()) {
|
||||
// No entry point given, use the current pc.
|
||||
// Make sure branch fits into
|
||||
if (entry_point == 0) entry_point = __ pc();
|
||||
// No entry point given, use the current pc.
|
||||
// Make sure branch fits into
|
||||
if (entry_point == 0) entry_point = __ pc();
|
||||
|
||||
// Put the entry point as a constant into the constant pool.
|
||||
const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
|
||||
if (entry_point_toc_addr == NULL) {
|
||||
ciEnv::current()->record_out_of_memory_failure();
|
||||
return;
|
||||
}
|
||||
const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
|
||||
|
||||
|
||||
// Emit the trampoline stub which will be related to the branch-and-link below.
|
||||
CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
|
||||
if (ciEnv::current()->failing()) { return; } // Code cache may be full.
|
||||
int method_index = resolved_method_index(cbuf);
|
||||
__ relocate(_optimized_virtual ? opt_virtual_call_Relocation::spec(method_index)
|
||||
: static_call_Relocation::spec(method_index));
|
||||
// Put the entry point as a constant into the constant pool.
|
||||
const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
|
||||
if (entry_point_toc_addr == NULL) {
|
||||
ciEnv::current()->record_out_of_memory_failure();
|
||||
return;
|
||||
}
|
||||
const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
|
||||
|
||||
// Emit the trampoline stub which will be related to the branch-and-link below.
|
||||
CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
|
||||
if (ciEnv::current()->failing()) { return; } // Code cache may be full.
|
||||
int method_index = resolved_method_index(cbuf);
|
||||
__ relocate(_optimized_virtual ? opt_virtual_call_Relocation::spec(method_index)
|
||||
: static_call_Relocation::spec(method_index));
|
||||
|
||||
// The real call.
|
||||
// Note: At this point we do not have the address of the trampoline
|
||||
|
@ -2550,7 +2550,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
__ lbzx(R17_tos, Rclass_or_obj, Roffset);
|
||||
__ extsb(R17_tos, R17_tos);
|
||||
__ push(ztos);
|
||||
if (!is_static) {
|
||||
if (!is_static && rc == may_rewrite) {
|
||||
// use btos rewriting, no truncating to t/f bit is needed for getfield.
|
||||
patch_bytecode(Bytecodes::_fast_bgetfield, Rbc, Rscratch);
|
||||
}
|
||||
@ -2874,7 +2874,9 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
|
||||
if (!is_static) { pop_and_check_object(Rclass_or_obj); } // Kills R11_scratch1.
|
||||
__ andi(R17_tos, R17_tos, 0x1);
|
||||
__ stbx(R17_tos, Rclass_or_obj, Roffset);
|
||||
if (!is_static) { patch_bytecode(Bytecodes::_fast_zputfield, Rbc, Rscratch, true, byte_no); }
|
||||
if (!is_static && rc == may_rewrite) {
|
||||
patch_bytecode(Bytecodes::_fast_zputfield, Rbc, Rscratch, true, byte_no);
|
||||
}
|
||||
if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {
|
||||
__ beq(CR_is_vol, Lvolatile); // Volatile?
|
||||
}
|
||||
|
@ -2034,6 +2034,27 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
|
||||
__ delayed()->nop();
|
||||
}
|
||||
|
||||
// If the compiler was not able to prove that exact type of the source or the destination
|
||||
// of the arraycopy is an array type, check at runtime if the source or the destination is
|
||||
// an instance type.
|
||||
if (flags & LIR_OpArrayCopy::type_check) {
|
||||
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::dst_objarray)) {
|
||||
__ load_klass(dst, tmp);
|
||||
__ lduw(tmp, in_bytes(Klass::layout_helper_offset()), tmp2);
|
||||
__ cmp(tmp2, Klass::_lh_neutral_value);
|
||||
__ br(Assembler::greaterEqual, false, Assembler::pn, *stub->entry());
|
||||
__ delayed()->nop();
|
||||
}
|
||||
|
||||
if (!(flags & LIR_OpArrayCopy::LIR_OpArrayCopy::src_objarray)) {
|
||||
__ load_klass(src, tmp);
|
||||
__ lduw(tmp, in_bytes(Klass::layout_helper_offset()), tmp2);
|
||||
__ cmp(tmp2, Klass::_lh_neutral_value);
|
||||
__ br(Assembler::greaterEqual, false, Assembler::pn, *stub->entry());
|
||||
__ delayed()->nop();
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & LIR_OpArrayCopy::src_pos_positive_check) {
|
||||
// test src_pos register
|
||||
__ cmp_zero_and_br(Assembler::less, src_pos, *stub->entry());
|
||||
|
@ -71,7 +71,7 @@ void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, T
|
||||
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
|
||||
#ifdef _LP64
|
||||
NativeMovConstReg32* move = nativeMovConstReg32_at(pc);
|
||||
narrowKlass narrowOop = record_narrow_metadata_reference(constant, CHECK);
|
||||
narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, CHECK);
|
||||
move->set_data((intptr_t)narrowOop);
|
||||
TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop);
|
||||
#else
|
||||
@ -79,7 +79,7 @@ void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, T
|
||||
#endif
|
||||
} else {
|
||||
NativeMovConstReg* move = nativeMovConstReg_at(pc);
|
||||
void* reference = record_metadata_reference(constant, CHECK);
|
||||
void* reference = record_metadata_reference(_instructions, pc, constant, CHECK);
|
||||
move->set_data((intptr_t)reference);
|
||||
TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference));
|
||||
}
|
||||
|
@ -2003,6 +2003,20 @@ bool Matcher::narrow_klass_use_complex_address() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Matcher::const_oop_prefer_decode() {
|
||||
// TODO: Check if loading ConP from TOC in heap-based mode is better:
|
||||
// Prefer ConN+DecodeN over ConP in simple compressed oops mode.
|
||||
// return Universe::narrow_oop_base() == NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Matcher::const_klass_prefer_decode() {
|
||||
// TODO: Check if loading ConP from TOC in heap-based mode is better:
|
||||
// Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
|
||||
// return Universe::narrow_klass_base() == NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Is it better to copy float constants, or load them directly from memory?
|
||||
// Intel can load a float constant from a direct address, requiring no
|
||||
// extra registers. Most RISCs will have to materialize an address into a
|
||||
|
@ -384,8 +384,9 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
|
||||
address entry = __ pc();
|
||||
__ get_constant_pool_cache(LcpoolCache); // load LcpoolCache
|
||||
#if INCLUDE_JVMCI
|
||||
// Check if we need to take lock at entry of synchronized method.
|
||||
if (UseJVMCICompiler) {
|
||||
// Check if we need to take lock at entry of synchronized method. This can
|
||||
// only occur on method entry so emit it only for vtos with step 0.
|
||||
if (UseJVMCICompiler && state == vtos && step == 0) {
|
||||
Label L;
|
||||
Address pending_monitor_enter_addr(G2_thread, JavaThread::pending_monitorenter_offset());
|
||||
__ ldbool(pending_monitor_enter_addr, Gtemp); // Load if pending monitor enter
|
||||
@ -395,6 +396,17 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
|
||||
// Take lock.
|
||||
lock_method();
|
||||
__ bind(L);
|
||||
} else {
|
||||
#ifdef ASSERT
|
||||
if (UseJVMCICompiler) {
|
||||
Label L;
|
||||
Address pending_monitor_enter_addr(G2_thread, JavaThread::pending_monitorenter_offset());
|
||||
__ ldbool(pending_monitor_enter_addr, Gtemp); // Load if pending monitor enter
|
||||
__ cmp_and_br_short(Gtemp, G0, Assembler::equal, Assembler::pn, L);
|
||||
__ stop("unexpected pending monitor in deopt entry");
|
||||
__ bind(L);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
{ Label L;
|
||||
|
@ -84,7 +84,6 @@
|
||||
declare_constant(VM_Version::sun4v_m) \
|
||||
declare_constant(VM_Version::blk_init_instructions_m) \
|
||||
declare_constant(VM_Version::fmaf_instructions_m) \
|
||||
declare_constant(VM_Version::fmau_instructions_m) \
|
||||
declare_constant(VM_Version::sparc64_family_m) \
|
||||
declare_constant(VM_Version::M_family_m) \
|
||||
declare_constant(VM_Version::T_family_m) \
|
||||
|
@ -179,7 +179,7 @@ void VM_Version::initialize() {
|
||||
assert((OptoLoopAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
|
||||
|
||||
char buf[512];
|
||||
jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
||||
jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
||||
(has_v9() ? ", v9" : (has_v8() ? ", v8" : "")),
|
||||
(has_hardware_popc() ? ", popc" : ""),
|
||||
(has_vis1() ? ", vis1" : ""),
|
||||
@ -193,6 +193,7 @@ void VM_Version::initialize() {
|
||||
(has_sha512() ? ", sha512" : ""),
|
||||
(has_crc32c() ? ", crc32c" : ""),
|
||||
(is_ultra3() ? ", ultra3" : ""),
|
||||
(has_sparc5_instr() ? ", sparc5" : ""),
|
||||
(is_sun4v() ? ", sun4v" : ""),
|
||||
(is_niagara_plus() ? ", niagara_plus" : (is_niagara() ? ", niagara" : "")),
|
||||
(is_sparc64() ? ", sparc64" : ""),
|
||||
@ -487,16 +488,11 @@ int VM_Version::parse_features(const char* implementation) {
|
||||
if (strstr(impl, "SPARC-T1") != NULL) {
|
||||
features |= T1_model_m;
|
||||
}
|
||||
} else if (strstr(impl, "SUN4V-CPU") != NULL) {
|
||||
// Generic or migration class LDOM
|
||||
features |= T_family_m;
|
||||
} else {
|
||||
if (strstr(impl, "SPARC") == NULL) {
|
||||
#ifndef PRODUCT
|
||||
// kstat on Solaris 8 virtual machines (branded zones)
|
||||
// returns "(unsupported)" implementation. Solaris 8 is not
|
||||
// supported anymore, but include this check to be on the
|
||||
// safe side.
|
||||
warning("Can't parse CPU implementation = '%s', assume generic SPARC", impl);
|
||||
#endif
|
||||
}
|
||||
log_info(os, cpu)("Failed to parse CPU implementation = '%s'", impl);
|
||||
}
|
||||
os::free((void*)impl);
|
||||
return features;
|
||||
|
@ -34,30 +34,29 @@ class VM_Version: public Abstract_VM_Version {
|
||||
|
||||
protected:
|
||||
enum Feature_Flag {
|
||||
v8_instructions = 0,
|
||||
hardware_mul32 = 1,
|
||||
hardware_div32 = 2,
|
||||
hardware_fsmuld = 3,
|
||||
hardware_popc = 4,
|
||||
v9_instructions = 5,
|
||||
vis1_instructions = 6,
|
||||
vis2_instructions = 7,
|
||||
sun4v_instructions = 8,
|
||||
v8_instructions = 0,
|
||||
hardware_mul32 = 1,
|
||||
hardware_div32 = 2,
|
||||
hardware_fsmuld = 3,
|
||||
hardware_popc = 4,
|
||||
v9_instructions = 5,
|
||||
vis1_instructions = 6,
|
||||
vis2_instructions = 7,
|
||||
sun4v_instructions = 8,
|
||||
blk_init_instructions = 9,
|
||||
fmaf_instructions = 10,
|
||||
fmau_instructions = 11,
|
||||
vis3_instructions = 12,
|
||||
cbcond_instructions = 13,
|
||||
sparc64_family = 14,
|
||||
M_family = 15,
|
||||
T_family = 16,
|
||||
T1_model = 17,
|
||||
sparc5_instructions = 18,
|
||||
aes_instructions = 19,
|
||||
sha1_instruction = 20,
|
||||
sha256_instruction = 21,
|
||||
sha512_instruction = 22,
|
||||
crc32c_instruction = 23
|
||||
fmaf_instructions = 10,
|
||||
vis3_instructions = 11,
|
||||
cbcond_instructions = 12,
|
||||
sparc64_family = 13,
|
||||
M_family = 14,
|
||||
T_family = 15,
|
||||
T1_model = 16,
|
||||
sparc5_instructions = 17,
|
||||
aes_instructions = 18,
|
||||
sha1_instruction = 19,
|
||||
sha256_instruction = 20,
|
||||
sha512_instruction = 21,
|
||||
crc32c_instruction = 22
|
||||
};
|
||||
|
||||
enum Feature_Flag_Set {
|
||||
@ -75,7 +74,6 @@ protected:
|
||||
sun4v_m = 1 << sun4v_instructions,
|
||||
blk_init_instructions_m = 1 << blk_init_instructions,
|
||||
fmaf_instructions_m = 1 << fmaf_instructions,
|
||||
fmau_instructions_m = 1 << fmau_instructions,
|
||||
vis3_instructions_m = 1 << vis3_instructions,
|
||||
cbcond_instructions_m = 1 << cbcond_instructions,
|
||||
sparc64_family_m = 1 << sparc64_family,
|
||||
|
@ -3146,6 +3146,23 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
|
||||
__ jcc(Assembler::zero, *stub->entry());
|
||||
}
|
||||
|
||||
// If the compiler was not able to prove that exact type of the source or the destination
|
||||
// of the arraycopy is an array type, check at runtime if the source or the destination is
|
||||
// an instance type.
|
||||
if (flags & LIR_OpArrayCopy::type_check) {
|
||||
if (!(flags & LIR_OpArrayCopy::dst_objarray)) {
|
||||
__ load_klass(tmp, dst);
|
||||
__ cmpl(Address(tmp, in_bytes(Klass::layout_helper_offset())), Klass::_lh_neutral_value);
|
||||
__ jcc(Assembler::greaterEqual, *stub->entry());
|
||||
}
|
||||
|
||||
if (!(flags & LIR_OpArrayCopy::src_objarray)) {
|
||||
__ load_klass(tmp, src);
|
||||
__ cmpl(Address(tmp, in_bytes(Klass::layout_helper_offset())), Klass::_lh_neutral_value);
|
||||
__ jcc(Assembler::greaterEqual, *stub->entry());
|
||||
}
|
||||
}
|
||||
|
||||
// check if negative
|
||||
if (flags & LIR_OpArrayCopy::src_pos_positive_check) {
|
||||
__ testl(src_pos, src_pos);
|
||||
|
@ -89,14 +89,14 @@ void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, T
|
||||
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
|
||||
#ifdef _LP64
|
||||
address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand);
|
||||
*((narrowKlass*) operand) = record_narrow_metadata_reference(constant, CHECK);
|
||||
*((narrowKlass*) operand) = record_narrow_metadata_reference(_instructions, operand, constant, CHECK);
|
||||
TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
#else
|
||||
JVMCI_ERROR("compressed Klass* on 32bit");
|
||||
#endif
|
||||
} else {
|
||||
address operand = Assembler::locate_operand(pc, Assembler::imm_operand);
|
||||
*((void**) operand) = record_metadata_reference(constant, CHECK);
|
||||
*((void**) operand) = record_metadata_reference(_instructions, operand, constant, CHECK);
|
||||
TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
|
||||
}
|
||||
}
|
||||
|
@ -254,8 +254,9 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
|
||||
const Register thread = NOT_LP64(rcx) LP64_ONLY(r15_thread);
|
||||
NOT_LP64(__ get_thread(thread));
|
||||
#if INCLUDE_JVMCI
|
||||
// Check if we need to take lock at entry of synchronized method.
|
||||
if (UseJVMCICompiler) {
|
||||
// Check if we need to take lock at entry of synchronized method. This can
|
||||
// only occur on method entry so emit it only for vtos with step 0.
|
||||
if (UseJVMCICompiler && state == vtos && step == 0) {
|
||||
Label L;
|
||||
__ cmpb(Address(thread, JavaThread::pending_monitorenter_offset()), 0);
|
||||
__ jcc(Assembler::zero, L);
|
||||
@ -266,6 +267,16 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
|
||||
// Take lock.
|
||||
lock_method();
|
||||
__ bind(L);
|
||||
} else {
|
||||
#ifdef ASSERT
|
||||
if (UseJVMCICompiler) {
|
||||
Label L;
|
||||
__ cmpb(Address(r15_thread, JavaThread::pending_monitorenter_offset()), 0);
|
||||
__ jccb(Assembler::zero, L);
|
||||
__ stop("unexpected pending monitor in deopt entry");
|
||||
__ bind(L);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
// handle exceptions
|
||||
|
@ -1452,6 +1452,15 @@ bool Matcher::narrow_klass_use_complex_address() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Matcher::const_oop_prefer_decode() {
|
||||
ShouldNotCallThis();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Matcher::const_klass_prefer_decode() {
|
||||
ShouldNotCallThis();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Is it better to copy float constants, or load them directly from memory?
|
||||
// Intel can load a float constant from a direct address, requiring no
|
||||
|
@ -1660,6 +1660,19 @@ bool Matcher::narrow_klass_use_complex_address() {
|
||||
return (LogKlassAlignmentInBytes <= 3);
|
||||
}
|
||||
|
||||
bool Matcher::const_oop_prefer_decode() {
|
||||
// Prefer ConN+DecodeN over ConP.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Matcher::const_klass_prefer_decode() {
|
||||
// TODO: Either support matching DecodeNKlass (heap-based) in operand
|
||||
// or condisider the following:
|
||||
// Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
|
||||
//return Universe::narrow_klass_base() == NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Is it better to copy float constants, or load them directly from
|
||||
// memory? Intel can load a float constant from a direct address,
|
||||
// requiring no extra registers. Most RISCs will have to materialize
|
||||
|
@ -96,9 +96,6 @@ public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFacto
|
||||
if ((config.vmVersionFeatures & config.sparcFmafInstructions) != 0) {
|
||||
features.add(CPUFeature.FMAF);
|
||||
}
|
||||
if ((config.vmVersionFeatures & config.sparcFmauInstructions) != 0) {
|
||||
features.add(CPUFeature.FMAU);
|
||||
}
|
||||
if ((config.vmVersionFeatures & config.sparcSparc64Family) != 0) {
|
||||
features.add(CPUFeature.SPARC64_FAMILY);
|
||||
}
|
||||
|
@ -55,7 +55,6 @@ class SPARCHotSpotVMConfig extends HotSpotVMConfigAccess {
|
||||
final int sparcSun4v = getConstant("VM_Version::sun4v_m", Integer.class);
|
||||
final int sparcBlkInitInstructions = getConstant("VM_Version::blk_init_instructions_m", Integer.class);
|
||||
final int sparcFmafInstructions = getConstant("VM_Version::fmaf_instructions_m", Integer.class);
|
||||
final int sparcFmauInstructions = getConstant("VM_Version::fmau_instructions_m", Integer.class);
|
||||
final int sparcSparc64Family = getConstant("VM_Version::sparc64_family_m", Integer.class);
|
||||
final int sparcMFamily = getConstant("VM_Version::M_family_m", Integer.class);
|
||||
final int sparcTFamily = getConstant("VM_Version::T_family_m", Integer.class);
|
||||
|
@ -20,17 +20,13 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.vm.ci.hotspot.services;
|
||||
package jdk.vm.ci.hotspot;
|
||||
|
||||
/**
|
||||
* An empty implementation for {@link EventProvider}. This implementation is used when no logging is
|
||||
* requested.
|
||||
*/
|
||||
final class EmptyEventProvider extends EventProvider {
|
||||
|
||||
EmptyEventProvider() {
|
||||
super(null);
|
||||
}
|
||||
final class EmptyEventProvider implements EventProvider {
|
||||
|
||||
static InternalError shouldNotReachHere() {
|
||||
throw new InternalError("should not reach here");
|
@ -20,58 +20,36 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.vm.ci.hotspot.services;
|
||||
package jdk.vm.ci.hotspot;
|
||||
|
||||
import jdk.vm.ci.hotspot.services.EmptyEventProvider.EmptyCompilationEvent;
|
||||
import jdk.vm.ci.hotspot.services.EmptyEventProvider.EmptyCompilerFailureEvent;
|
||||
import jdk.vm.ci.hotspot.EmptyEventProvider.EmptyCompilationEvent;
|
||||
import jdk.vm.ci.hotspot.EmptyEventProvider.EmptyCompilerFailureEvent;
|
||||
import jdk.vm.ci.services.JVMCIPermission;
|
||||
|
||||
/**
|
||||
* Service-provider class for logging compiler related events.
|
||||
*/
|
||||
public abstract class EventProvider {
|
||||
|
||||
private static Void checkPermission() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new JVMCIPermission());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
EventProvider(Void ignore) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of this class.
|
||||
*
|
||||
* @throws SecurityException if a security manager has been installed and it denies
|
||||
* {@link JVMCIPermission}
|
||||
*/
|
||||
protected EventProvider() {
|
||||
this(checkPermission());
|
||||
}
|
||||
public interface EventProvider {
|
||||
|
||||
/**
|
||||
* Creates and returns an empty implementation for {@link EventProvider}. This implementation
|
||||
* can be used when no logging is requested.
|
||||
*/
|
||||
public static EventProvider createEmptyEventProvider() {
|
||||
static EventProvider createEmptyEventProvider() {
|
||||
return new EmptyEventProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an empty implementation for {@link CompilationEvent}.
|
||||
*/
|
||||
public static CompilationEvent createEmptyCompilationEvent() {
|
||||
static CompilationEvent createEmptyCompilationEvent() {
|
||||
return new EmptyCompilationEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an empty implementation for {@link CompilationEvent}.
|
||||
*/
|
||||
public static CompilerFailureEvent createEmptyCompilerFailureEvent() {
|
||||
static CompilerFailureEvent createEmptyCompilerFailureEvent() {
|
||||
return new EmptyCompilerFailureEvent();
|
||||
}
|
||||
|
@ -26,8 +26,10 @@ import jdk.vm.ci.code.CompilationRequest;
|
||||
import jdk.vm.ci.common.JVMCIError;
|
||||
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
|
||||
import jdk.vm.ci.runtime.JVMCICompiler;
|
||||
import jdk.vm.ci.runtime.JVMCICompilerFactory;
|
||||
import jdk.vm.ci.runtime.JVMCIRuntime;
|
||||
import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
|
||||
import jdk.vm.ci.services.JVMCIServiceLocator;
|
||||
import jdk.vm.ci.services.JVMCIPermission;
|
||||
import jdk.vm.ci.services.Services;
|
||||
|
||||
final class HotSpotJVMCICompilerConfig {
|
||||
@ -37,7 +39,7 @@ final class HotSpotJVMCICompilerConfig {
|
||||
* to perform a compilation. This allows the reflective parts of the JVMCI API to be used
|
||||
* without requiring a compiler implementation to be available.
|
||||
*/
|
||||
private static class DummyCompilerFactory extends JVMCICompilerFactory implements JVMCICompiler {
|
||||
private static class DummyCompilerFactory implements JVMCICompilerFactory, JVMCICompiler {
|
||||
|
||||
public HotSpotCompilationRequestResult compileMethod(CompilationRequest request) {
|
||||
throw new JVMCIError("no JVMCI compiler selected");
|
||||
@ -63,15 +65,16 @@ final class HotSpotJVMCICompilerConfig {
|
||||
* Gets the selected system compiler factory.
|
||||
*
|
||||
* @return the selected system compiler factory
|
||||
* @throws SecurityException if a security manager is present and it denies
|
||||
* {@link JVMCIPermission} for any {@link JVMCIServiceLocator} loaded by this method
|
||||
*/
|
||||
static JVMCICompilerFactory getCompilerFactory() {
|
||||
if (compilerFactory == null) {
|
||||
JVMCICompilerFactory factory = null;
|
||||
String compilerName = Option.Compiler.getString();
|
||||
if (compilerName != null) {
|
||||
for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
|
||||
for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) {
|
||||
if (f.getCompilerName().equals(compilerName)) {
|
||||
Services.exportJVMCITo(f.getClass());
|
||||
factory = f;
|
||||
}
|
||||
}
|
||||
@ -80,8 +83,9 @@ final class HotSpotJVMCICompilerConfig {
|
||||
}
|
||||
} else {
|
||||
// Auto select a single available compiler
|
||||
for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
|
||||
for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) {
|
||||
if (factory == null) {
|
||||
Services.exportJVMCITo(f.getClass());
|
||||
factory = f;
|
||||
} else {
|
||||
// Multiple factories seen - cancel auto selection
|
||||
|
@ -20,14 +20,14 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.vm.ci.hotspot.services;
|
||||
package jdk.vm.ci.hotspot;
|
||||
|
||||
import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
|
||||
import jdk.vm.ci.runtime.JVMCICompilerFactory;
|
||||
|
||||
/**
|
||||
* HotSpot extensions to {@link JVMCICompilerFactory}.
|
||||
*/
|
||||
public abstract class HotSpotJVMCICompilerFactory extends JVMCICompilerFactory {
|
||||
public abstract class HotSpotJVMCICompilerFactory implements JVMCICompilerFactory {
|
||||
|
||||
/**
|
||||
* Gets 0 or more prefixes identifying classes that should by compiled by C1 in simple mode
|
@ -27,13 +27,11 @@ import static jdk.vm.ci.common.InitTimer.timer;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import jdk.internal.misc.VM;
|
||||
@ -43,16 +41,15 @@ import jdk.vm.ci.code.CompiledCode;
|
||||
import jdk.vm.ci.code.InstalledCode;
|
||||
import jdk.vm.ci.common.InitTimer;
|
||||
import jdk.vm.ci.common.JVMCIError;
|
||||
import jdk.vm.ci.hotspot.services.HotSpotJVMCICompilerFactory;
|
||||
import jdk.vm.ci.hotspot.services.HotSpotJVMCICompilerFactory.CompilationLevel;
|
||||
import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
|
||||
import jdk.vm.ci.hotspot.HotSpotJVMCICompilerFactory.CompilationLevel;
|
||||
import jdk.vm.ci.meta.JavaKind;
|
||||
import jdk.vm.ci.meta.JavaType;
|
||||
import jdk.vm.ci.meta.ResolvedJavaType;
|
||||
import jdk.vm.ci.runtime.JVMCI;
|
||||
import jdk.vm.ci.runtime.JVMCIBackend;
|
||||
import jdk.vm.ci.runtime.JVMCICompiler;
|
||||
import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
|
||||
import jdk.vm.ci.runtime.JVMCICompilerFactory;
|
||||
import jdk.vm.ci.services.JVMCIServiceLocator;
|
||||
import jdk.vm.ci.services.Services;
|
||||
|
||||
/**
|
||||
@ -90,14 +87,17 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
|
||||
* A list of all supported JVMCI options.
|
||||
*/
|
||||
public enum Option {
|
||||
// @formatter:off
|
||||
Compiler(String.class, null, "Selects the system compiler."),
|
||||
// Note: The following one is not used (see InitTimer.ENABLED). It is added here
|
||||
// so that -Djvmci.PrintFlags=true shows the option.
|
||||
InitTimer(boolean.class, false, "Specifies if initialization timing is enabled."),
|
||||
PrintConfig(boolean.class, false, "Prints VM configuration available via JVMCI and exits."),
|
||||
PrintFlags(boolean.class, false, "Prints all JVMCI flags and exits."),
|
||||
ShowFlags(boolean.class, false, "Prints all JVMCI flags and continues."),
|
||||
TraceMethodDataFilter(String.class, null, "");
|
||||
// so that -XX:+JVMCIPrintProperties shows the option.
|
||||
InitTimer(Boolean.class, false, "Specifies if initialization timing is enabled."),
|
||||
PrintConfig(Boolean.class, false, "Prints VM configuration available via JVMCI."),
|
||||
TraceMethodDataFilter(String.class, null,
|
||||
"Enables tracing of profiling info when read by JVMCI.",
|
||||
"Empty value: trace all methods",
|
||||
"Non-empty value: trace methods whose fully qualified name contains the value.");
|
||||
// @formatter:on
|
||||
|
||||
/**
|
||||
* The prefix for system properties that are JVMCI options.
|
||||
@ -113,25 +113,25 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
|
||||
private Object value;
|
||||
private final Object defaultValue;
|
||||
private boolean isDefault;
|
||||
private final String help;
|
||||
private final String[] helpLines;
|
||||
|
||||
Option(Class<?> type, Object defaultValue, String help) {
|
||||
Option(Class<?> type, Object defaultValue, String... helpLines) {
|
||||
assert Character.isUpperCase(name().charAt(0)) : "Option name must start with upper-case letter: " + name();
|
||||
this.type = type;
|
||||
this.value = UNINITIALIZED;
|
||||
this.defaultValue = defaultValue;
|
||||
this.help = help;
|
||||
this.helpLines = helpLines;
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "sentinel must be String since it's a static final in an enum")
|
||||
private Object getValue() {
|
||||
if (value == UNINITIALIZED) {
|
||||
String propertyValue = VM.getSavedProperty(JVMCI_OPTION_PROPERTY_PREFIX + name());
|
||||
String propertyValue = VM.getSavedProperty(getPropertyName());
|
||||
if (propertyValue == null) {
|
||||
this.value = defaultValue;
|
||||
this.isDefault = true;
|
||||
} else {
|
||||
if (type == boolean.class) {
|
||||
if (type == Boolean.class) {
|
||||
this.value = Boolean.parseBoolean(propertyValue);
|
||||
} else if (type == String.class) {
|
||||
this.value = propertyValue;
|
||||
@ -146,6 +146,13 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of system property from which this option gets its value.
|
||||
*/
|
||||
public String getPropertyName() {
|
||||
return JVMCI_OPTION_PROPERTY_PREFIX + name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the option's value as boolean.
|
||||
*
|
||||
@ -165,16 +172,31 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints all option flags to {@code out}.
|
||||
* Prints a description of the properties used to configure shared JVMCI code.
|
||||
*
|
||||
* @param out stream to print to
|
||||
*/
|
||||
public static void printFlags(PrintStream out) {
|
||||
out.println("[List of JVMCI options]");
|
||||
for (Option option : values()) {
|
||||
public static void printProperties(PrintStream out) {
|
||||
out.println("[JVMCI properties]");
|
||||
int typeWidth = 0;
|
||||
int nameWidth = 0;
|
||||
Option[] values = values();
|
||||
for (Option option : values) {
|
||||
typeWidth = Math.max(typeWidth, option.type.getSimpleName().length());
|
||||
nameWidth = Math.max(nameWidth, option.getPropertyName().length());
|
||||
}
|
||||
for (Option option : values) {
|
||||
Object value = option.getValue();
|
||||
String assign = option.isDefault ? ":=" : " =";
|
||||
out.printf("%9s %-40s %s %-14s %s%n", option.type.getSimpleName(), option, assign, value, option.help);
|
||||
if (value instanceof String) {
|
||||
value = '"' + String.valueOf(value) + '"';
|
||||
}
|
||||
String assign = option.isDefault ? " =" : ":=";
|
||||
String format = "%" + (typeWidth + 1) + "s %-" + (nameWidth + 1) + "s %s %s%n";
|
||||
out.printf(format, option.type.getSimpleName(), option.getPropertyName(), assign, value);
|
||||
String helpFormat = "%" + (typeWidth + 1) + "s %s%n";
|
||||
for (String line : option.helpLines) {
|
||||
out.printf(helpFormat, "", line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -221,11 +243,7 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
|
||||
if (vmEventListeners == null) {
|
||||
synchronized (this) {
|
||||
if (vmEventListeners == null) {
|
||||
List<HotSpotVMEventListener> listeners = new ArrayList<>();
|
||||
for (HotSpotVMEventListener vmEventListener : ServiceLoader.load(HotSpotVMEventListener.class)) {
|
||||
listeners.add(vmEventListener);
|
||||
}
|
||||
vmEventListeners = listeners;
|
||||
vmEventListeners = JVMCIServiceLocator.getProviders(HotSpotVMEventListener.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,7 +257,6 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
|
||||
@SuppressWarnings("unused") private final String[] trivialPrefixes;
|
||||
|
||||
@SuppressWarnings("try")
|
||||
@SuppressFBWarnings(value = "DM_EXIT", justification = "PrintFlags is meant to exit the VM")
|
||||
private HotSpotJVMCIRuntime() {
|
||||
compilerToVm = new CompilerToVM();
|
||||
|
||||
@ -261,20 +278,6 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
|
||||
|
||||
metaAccessContext = new HotSpotJVMCIMetaAccessContext();
|
||||
|
||||
boolean printFlags = Option.PrintFlags.getBoolean();
|
||||
boolean showFlags = Option.ShowFlags.getBoolean();
|
||||
if (printFlags || showFlags) {
|
||||
Option.printFlags(System.out);
|
||||
if (printFlags) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (Option.PrintConfig.getBoolean()) {
|
||||
printConfig(configStore, compilerToVm);
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
compilerFactory = HotSpotJVMCICompilerConfig.getCompilerFactory();
|
||||
if (compilerFactory instanceof HotSpotJVMCICompilerFactory) {
|
||||
hsCompilerFactory = (HotSpotJVMCICompilerFactory) compilerFactory;
|
||||
@ -298,6 +301,16 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
|
||||
trivialPrefixes = null;
|
||||
compilationLevelAdjustment = config.compLevelAdjustmentNone;
|
||||
}
|
||||
|
||||
if (config.getFlag("JVMCIPrintProperties", Boolean.class)) {
|
||||
PrintStream out = new PrintStream(getLogStream());
|
||||
Option.printProperties(out);
|
||||
compilerFactory.printProperties(out);
|
||||
}
|
||||
|
||||
if (Option.PrintConfig.getBoolean()) {
|
||||
printConfig(configStore, compilerToVm);
|
||||
}
|
||||
}
|
||||
|
||||
private JVMCIBackend registerBackend(JVMCIBackend backend) {
|
||||
|
@ -53,9 +53,9 @@ final class HotSpotMethodData {
|
||||
* Reference to the C++ MethodData object.
|
||||
*/
|
||||
final long metaspaceMethodData;
|
||||
@SuppressWarnings("unused") private final HotSpotResolvedJavaMethodImpl method;
|
||||
private final HotSpotResolvedJavaMethodImpl method;
|
||||
|
||||
public HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) {
|
||||
HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) {
|
||||
this.metaspaceMethodData = metaspaceMethodData;
|
||||
this.method = method;
|
||||
}
|
||||
@ -107,6 +107,18 @@ final class HotSpotMethodData {
|
||||
return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF;
|
||||
}
|
||||
|
||||
public int getDecompileCount() {
|
||||
return UNSAFE.getInt(metaspaceMethodData + config.methodDataDecompiles);
|
||||
}
|
||||
|
||||
public int getOverflowRecompileCount() {
|
||||
return UNSAFE.getInt(metaspaceMethodData + config.methodDataOverflowRecompiles);
|
||||
}
|
||||
|
||||
public int getOverflowTrapCount() {
|
||||
return UNSAFE.getInt(metaspaceMethodData + config.methodDataOverflowTraps);
|
||||
}
|
||||
|
||||
public HotSpotMethodDataAccessor getNormalData(int position) {
|
||||
if (position >= normalDataSize()) {
|
||||
return null;
|
||||
@ -214,6 +226,12 @@ final class HotSpotMethodData {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String nl = String.format("%n");
|
||||
String nlIndent = String.format("%n%38s", "");
|
||||
sb.append("Raw method data for ");
|
||||
sb.append(method.format("%H.%n(%p)"));
|
||||
sb.append(":");
|
||||
sb.append(nl);
|
||||
sb.append(String.format("nof_decompiles(%d) nof_overflow_recompiles(%d) nof_overflow_traps(%d)%n",
|
||||
getDecompileCount(), getOverflowRecompileCount(), getOverflowTrapCount()));
|
||||
if (hasNormalData()) {
|
||||
int pos = 0;
|
||||
HotSpotMethodDataAccessor data;
|
||||
@ -427,6 +445,10 @@ final class HotSpotMethodData {
|
||||
|
||||
protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position);
|
||||
|
||||
public int getNonprofiledCount(HotSpotMethodData data, int position) {
|
||||
return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
|
||||
}
|
||||
|
||||
private JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) {
|
||||
if (profile.entries <= 0 || profile.totalCount <= 0) {
|
||||
return null;
|
||||
@ -462,7 +484,7 @@ final class HotSpotMethodData {
|
||||
TriState nullSeen = getNullSeen(data, pos);
|
||||
TriState exceptionSeen = getExceptionSeen(data, pos);
|
||||
sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen,
|
||||
getTypesNotRecordedExecutionCount(data, pos), profile.entries));
|
||||
getNonprofiledCount(data, pos), profile.entries));
|
||||
for (int i = 0; i < profile.entries; i++) {
|
||||
long count = profile.counts[i];
|
||||
sb.append(format("%n %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount));
|
||||
@ -490,7 +512,7 @@ final class HotSpotMethodData {
|
||||
|
||||
@Override
|
||||
protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) {
|
||||
return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
|
||||
return getNonprofiledCount(data, position);
|
||||
}
|
||||
}
|
||||
|
||||
@ -788,7 +810,8 @@ final class HotSpotMethodData {
|
||||
|
||||
@Override
|
||||
public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
|
||||
return null;
|
||||
sb.append("unknown profile data with tag: " + tag);
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
|
||||
@ -822,10 +845,10 @@ final class HotSpotMethodData {
|
||||
private static boolean checkAccessorTags() {
|
||||
int expectedTag = 0;
|
||||
for (HotSpotMethodDataAccessor accessor : PROFILE_DATA_ACCESSORS) {
|
||||
if (expectedTag ==0 ) {
|
||||
if (expectedTag == 0) {
|
||||
assert accessor == null;
|
||||
} else {
|
||||
assert accessor.tag == expectedTag: expectedTag + " != " + accessor.tag + " " + accessor;
|
||||
assert accessor.tag == expectedTag : expectedTag + " != " + accessor.tag + " " + accessor;
|
||||
}
|
||||
expectedTag++;
|
||||
}
|
||||
|
@ -57,6 +57,18 @@ public final class HotSpotProfilingInfo implements ProfilingInfo {
|
||||
return method.getCodeSize();
|
||||
}
|
||||
|
||||
public int getDecompileCount() {
|
||||
return methodData.getDecompileCount();
|
||||
}
|
||||
|
||||
public int getOverflowRecompileCount() {
|
||||
return methodData.getOverflowRecompileCount();
|
||||
}
|
||||
|
||||
public int getOverflowTrapCount() {
|
||||
return methodData.getOverflowTrapCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeProfile getTypeProfile(int bci) {
|
||||
if (!isMature) {
|
||||
|
@ -434,7 +434,6 @@ final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSp
|
||||
methodData = new HotSpotMethodData(metaspaceMethodData, this);
|
||||
String methodDataFilter = Option.TraceMethodDataFilter.getString();
|
||||
if (methodDataFilter != null && this.format("%H.%n").contains(methodDataFilter)) {
|
||||
System.out.println("Raw method data for " + this.format("%H.%n(%p)") + ":");
|
||||
System.out.println(methodData.toString());
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +160,10 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess {
|
||||
final int methodDataOopTrapHistoryOffset = getFieldOffset("MethodData::_trap_hist._array[0]", Integer.class, "u1");
|
||||
final int methodDataIRSizeOffset = getFieldOffset("MethodData::_jvmci_ir_size", Integer.class, "int");
|
||||
|
||||
final int methodDataDecompiles = getFieldOffset("MethodData::_nof_decompiles", Integer.class, "uint");
|
||||
final int methodDataOverflowRecompiles = getFieldOffset("MethodData::_nof_overflow_recompiles", Integer.class, "uint");
|
||||
final int methodDataOverflowTraps = getFieldOffset("MethodData::_nof_overflow_traps", Integer.class, "uint");
|
||||
|
||||
final int nmethodCompLevelOffset = getFieldOffset("nmethod::_comp_level", Integer.class, "int");
|
||||
|
||||
final int compilationLevelNone = getConstant("CompLevel_none", Integer.class);
|
||||
|
@ -20,59 +20,35 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.vm.ci.hotspot.services;
|
||||
package jdk.vm.ci.hotspot;
|
||||
|
||||
import jdk.vm.ci.code.CompiledCode;
|
||||
import jdk.vm.ci.code.InstalledCode;
|
||||
import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
|
||||
import jdk.vm.ci.services.JVMCIPermission;
|
||||
|
||||
/**
|
||||
* Service-provider class for responding to VM events.
|
||||
* Listener for responding to VM events.
|
||||
*/
|
||||
public abstract class HotSpotVMEventListener {
|
||||
|
||||
private static Void checkPermission() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new JVMCIPermission());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
HotSpotVMEventListener(Void ignore) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of this class.
|
||||
*
|
||||
* @throws SecurityException if a security manager has been installed and it denies
|
||||
* {@link JVMCIPermission}
|
||||
*/
|
||||
protected HotSpotVMEventListener() {
|
||||
this(checkPermission());
|
||||
}
|
||||
public interface HotSpotVMEventListener {
|
||||
|
||||
/**
|
||||
* Notifies this client that the VM is shutting down.
|
||||
*/
|
||||
public void notifyShutdown() {
|
||||
default void notifyShutdown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify on successful install into the code cache.
|
||||
*
|
||||
* @param hotSpotCodeCacheProvider
|
||||
* @param installedCode
|
||||
* @param compiledCode
|
||||
* @param hotSpotCodeCacheProvider the code cache into which the code was installed
|
||||
* @param installedCode the code that was installed
|
||||
* @param compiledCode the compiled code from which {@code installedCode} was produced
|
||||
*/
|
||||
public void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) {
|
||||
default void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify on completion of a bootstrap.
|
||||
*/
|
||||
public void notifyBootstrapFinished() {
|
||||
default void notifyBootstrapFinished() {
|
||||
}
|
||||
}
|
@ -20,54 +20,38 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.vm.ci.runtime.services;
|
||||
package jdk.vm.ci.runtime;
|
||||
|
||||
import jdk.vm.ci.runtime.JVMCICompiler;
|
||||
import jdk.vm.ci.runtime.JVMCIRuntime;
|
||||
import jdk.vm.ci.services.JVMCIPermission;
|
||||
import java.io.PrintStream;
|
||||
|
||||
/**
|
||||
* Service-provider class for creating JVMCI compilers.
|
||||
* Factory for creating JVMCI compilers.
|
||||
*/
|
||||
public abstract class JVMCICompilerFactory {
|
||||
|
||||
private static Void checkPermission() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new JVMCIPermission());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private JVMCICompilerFactory(Void ignore) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of this class.
|
||||
*
|
||||
* @throws SecurityException if a security manager has been installed and it denies
|
||||
* {@link JVMCIPermission}
|
||||
*/
|
||||
protected JVMCICompilerFactory() {
|
||||
this(checkPermission());
|
||||
}
|
||||
public interface JVMCICompilerFactory {
|
||||
|
||||
/**
|
||||
* Get the name of this compiler. The name is used by JVMCI to determine which factory to use.
|
||||
*/
|
||||
public abstract String getCompilerName();
|
||||
String getCompilerName();
|
||||
|
||||
/**
|
||||
* Notifies this object that it has been selected to {@linkplain #createCompiler(JVMCIRuntime)
|
||||
* create} a compiler and it should now perform any heavy weight initialization that it deferred
|
||||
* during construction.
|
||||
*/
|
||||
public void onSelection() {
|
||||
default void onSelection() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance of a {@link JVMCICompiler}.
|
||||
*/
|
||||
public abstract JVMCICompiler createCompiler(JVMCIRuntime runtime);
|
||||
JVMCICompiler createCompiler(JVMCIRuntime runtime);
|
||||
|
||||
/**
|
||||
* Prints a description of the properties used to configure this compiler.
|
||||
*
|
||||
* @param out where to print the message
|
||||
*/
|
||||
default void printProperties(PrintStream out) {
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.vm.ci.services;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service-provider class for the runtime to locate providers of JVMCI services where the latter are
|
||||
* not in packages exported by the JVMCI module. As part of instantiating
|
||||
* {@link JVMCIServiceLocator}, all JVMCI packages will be {@linkplain Services#exportJVMCITo(Class)
|
||||
* exported} to the module defining the class of the instantiated object.
|
||||
*
|
||||
* While the {@link #getProvider(Class)} method can be used directly, it's usually easier to use
|
||||
* {@link #getProviders(Class)}.
|
||||
*/
|
||||
public abstract class JVMCIServiceLocator {
|
||||
|
||||
private static Void checkPermission() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new JVMCIPermission());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private JVMCIServiceLocator(Void ignore) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a capability for accessing JVMCI. Once successfully instantiated, JVMCI exports all
|
||||
* its packages to the module defining the type of this object.
|
||||
*
|
||||
* @throws SecurityException if a security manager has been installed and it denies
|
||||
* {@link JVMCIPermission}
|
||||
*/
|
||||
protected JVMCIServiceLocator() {
|
||||
this(checkPermission());
|
||||
Services.exportJVMCITo(getClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the provider of the service defined by {@code service} or {@code null} if this object
|
||||
* does not have a provider for {@code service}.
|
||||
*/
|
||||
public abstract <S> S getProvider(Class<S> service);
|
||||
|
||||
/**
|
||||
* Gets the providers of the service defined by {@code service} by querying the
|
||||
* {@link JVMCIServiceLocator} providers obtained by {@link Services#load(Class)}.
|
||||
*/
|
||||
public static <S> List<S> getProviders(Class<S> service) {
|
||||
List<S> providers = new ArrayList<>();
|
||||
for (JVMCIServiceLocator access : Services.load(JVMCIServiceLocator.class)) {
|
||||
S provider = access.getProvider(service);
|
||||
if (provider != null) {
|
||||
providers.add(provider);
|
||||
}
|
||||
}
|
||||
return providers;
|
||||
}
|
||||
}
|
@ -349,7 +349,6 @@ public class SPARC extends Architecture {
|
||||
SUN4V,
|
||||
BLK_INIT_INSTRUCTIONS,
|
||||
FMAF,
|
||||
FMAU,
|
||||
SPARC64_FAMILY,
|
||||
M_FAMILY,
|
||||
T_FAMILY,
|
||||
|
@ -25,12 +25,9 @@
|
||||
|
||||
module jdk.vm.ci {
|
||||
exports jdk.vm.ci.services;
|
||||
exports jdk.vm.ci.runtime.services;
|
||||
exports jdk.vm.ci.hotspot.services;
|
||||
|
||||
uses jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
|
||||
uses jdk.vm.ci.services.JVMCIServiceLocator;
|
||||
uses jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
|
||||
uses jdk.vm.ci.runtime.services.JVMCICompilerFactory;
|
||||
|
||||
provides jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory with
|
||||
jdk.vm.ci.hotspot.aarch64.AArch64HotSpotJVMCIBackendFactory;
|
||||
|
@ -2563,7 +2563,7 @@ bool os::get_page_info(char *start, page_info* info) {
|
||||
uint64_t outdata[2];
|
||||
uint_t validity = 0;
|
||||
|
||||
if (os::Solaris::meminfo(&addr, 1, info_types, 2, outdata, &validity) < 0) {
|
||||
if (meminfo(&addr, 1, info_types, 2, outdata, &validity) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2601,7 +2601,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected,
|
||||
addrs_count++;
|
||||
}
|
||||
|
||||
if (os::Solaris::meminfo(addrs, addrs_count, info_types, types, outdata, validity) < 0) {
|
||||
if (meminfo(addrs, addrs_count, info_types, types, outdata, validity) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -4160,9 +4160,6 @@ void os::Solaris::install_signal_handlers() {
|
||||
void report_error(const char* file_name, int line_no, const char* title,
|
||||
const char* format, ...);
|
||||
|
||||
// (Static) wrapper for getisax(2) call.
|
||||
os::Solaris::getisax_func_t os::Solaris::_getisax = 0;
|
||||
|
||||
// (Static) wrappers for the liblgrp API
|
||||
os::Solaris::lgrp_home_func_t os::Solaris::_lgrp_home;
|
||||
os::Solaris::lgrp_init_func_t os::Solaris::_lgrp_init;
|
||||
@ -4174,9 +4171,6 @@ os::Solaris::lgrp_nlgrps_func_t os::Solaris::_lgrp_nlgrps;
|
||||
os::Solaris::lgrp_cookie_stale_func_t os::Solaris::_lgrp_cookie_stale;
|
||||
os::Solaris::lgrp_cookie_t os::Solaris::_lgrp_cookie = 0;
|
||||
|
||||
// (Static) wrapper for meminfo() call.
|
||||
os::Solaris::meminfo_func_t os::Solaris::_meminfo = 0;
|
||||
|
||||
static address resolve_symbol_lazy(const char* name) {
|
||||
address addr = (address) dlsym(RTLD_DEFAULT, name);
|
||||
if (addr == NULL) {
|
||||
@ -4300,27 +4294,6 @@ bool os::Solaris::liblgrp_init() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void os::Solaris::misc_sym_init() {
|
||||
address func;
|
||||
|
||||
// getisax
|
||||
func = resolve_symbol_lazy("getisax");
|
||||
if (func != NULL) {
|
||||
os::Solaris::_getisax = CAST_TO_FN_PTR(getisax_func_t, func);
|
||||
}
|
||||
|
||||
// meminfo
|
||||
func = resolve_symbol_lazy("meminfo");
|
||||
if (func != NULL) {
|
||||
os::Solaris::set_meminfo(CAST_TO_FN_PTR(meminfo_func_t, func));
|
||||
}
|
||||
}
|
||||
|
||||
uint_t os::Solaris::getisax(uint32_t* array, uint_t n) {
|
||||
assert(_getisax != NULL, "_getisax not set");
|
||||
return _getisax(array, n);
|
||||
}
|
||||
|
||||
// int pset_getloadavg(psetid_t pset, double loadavg[], int nelem);
|
||||
typedef long (*pset_getloadavg_type)(psetid_t pset, double loadavg[], int nelem);
|
||||
static pset_getloadavg_type pset_getloadavg_ptr = NULL;
|
||||
@ -4351,10 +4324,6 @@ void os::init(void) {
|
||||
|
||||
Solaris::initialize_system_info();
|
||||
|
||||
// Initialize misc. symbols as soon as possible, so we can use them
|
||||
// if we need them.
|
||||
Solaris::misc_sym_init();
|
||||
|
||||
int fd = ::open("/dev/zero", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fatal("os::init: cannot open /dev/zero (%s)", os::strerror(errno));
|
||||
|
@ -73,8 +73,6 @@ class Solaris {
|
||||
LGRP_VIEW_OS // what's available to operating system
|
||||
} lgrp_view_t;
|
||||
|
||||
typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n);
|
||||
|
||||
typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id);
|
||||
typedef lgrp_cookie_t (*lgrp_init_func_t)(lgrp_view_t view);
|
||||
typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie);
|
||||
@ -86,11 +84,6 @@ class Solaris {
|
||||
lgrp_rsrc_t type);
|
||||
typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie);
|
||||
typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie);
|
||||
typedef int (*meminfo_func_t)(const uint64_t inaddr[], int addr_count,
|
||||
const uint_t info_req[], int info_count,
|
||||
uint64_t outdata[], uint_t validity[]);
|
||||
|
||||
static getisax_func_t _getisax;
|
||||
|
||||
static lgrp_home_func_t _lgrp_home;
|
||||
static lgrp_init_func_t _lgrp_init;
|
||||
@ -102,8 +95,6 @@ class Solaris {
|
||||
static lgrp_cookie_stale_func_t _lgrp_cookie_stale;
|
||||
static lgrp_cookie_t _lgrp_cookie;
|
||||
|
||||
static meminfo_func_t _meminfo;
|
||||
|
||||
// Large Page Support
|
||||
static bool is_valid_page_size(size_t bytes);
|
||||
static size_t page_size_for_alignment(size_t alignment);
|
||||
@ -191,8 +182,6 @@ class Solaris {
|
||||
static void libthread_init();
|
||||
static void synchronization_init();
|
||||
static bool liblgrp_init();
|
||||
// Load miscellaneous symbols.
|
||||
static void misc_sym_init();
|
||||
// This boolean allows users to forward their own non-matching signals
|
||||
// to JVM_handle_solaris_signal, harmlessly.
|
||||
static bool signal_handlers_are_installed;
|
||||
@ -272,17 +261,6 @@ class Solaris {
|
||||
}
|
||||
static lgrp_cookie_t lgrp_cookie() { return _lgrp_cookie; }
|
||||
|
||||
static bool supports_getisax() { return _getisax != NULL; }
|
||||
static uint_t getisax(uint32_t* array, uint_t n);
|
||||
|
||||
static void set_meminfo(meminfo_func_t func) { _meminfo = func; }
|
||||
static int meminfo (const uint64_t inaddr[], int addr_count,
|
||||
const uint_t info_req[], int info_count,
|
||||
uint64_t outdata[], uint_t validity[]) {
|
||||
return _meminfo != NULL ? _meminfo(inaddr, addr_count, info_req, info_count,
|
||||
outdata, validity) : -1;
|
||||
}
|
||||
|
||||
static sigset_t* unblocked_signals();
|
||||
static sigset_t* vm_signals();
|
||||
static sigset_t* allowdebug_blocked_signals();
|
||||
|
@ -784,7 +784,7 @@ void os::set_native_thread_name(const char *name) {
|
||||
|
||||
__try {
|
||||
RaiseException (MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info );
|
||||
} __except(EXCEPTION_CONTINUE_EXECUTION) {}
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) {}
|
||||
}
|
||||
|
||||
bool os::distribute_processes(uint length, uint* distribution) {
|
||||
|
@ -1404,12 +1404,14 @@ static HANDLE open_sharedmem_object(const char* objectname, DWORD ofm_access, TR
|
||||
objectname); /* name for object */
|
||||
|
||||
if (fmh == NULL) {
|
||||
DWORD lasterror = GetLastError();
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
warning("OpenFileMapping failed for shared memory object %s:"
|
||||
" lasterror = %d\n", objectname, GetLastError());
|
||||
" lasterror = %d\n", objectname, lasterror);
|
||||
}
|
||||
THROW_MSG_(vmSymbols::java_lang_Exception(),
|
||||
"Could not open PerfMemory", INVALID_HANDLE_VALUE);
|
||||
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
err_msg("Could not open PerfMemory, error %d", lasterror),
|
||||
INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
return fmh;;
|
||||
|
@ -343,8 +343,15 @@ public:
|
||||
#define _SC_L2CACHE_LINESZ 527 /* Size of L2 cache line */
|
||||
#endif
|
||||
|
||||
// Hardware capability bits that appeared after Solaris 11.1
|
||||
#ifndef AV_SPARC_FMAF
|
||||
#define AV_SPARC_FMAF 0x00000100 /* Fused Multiply-Add */
|
||||
#endif
|
||||
#ifndef AV2_SPARC_SPARC5
|
||||
#define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */
|
||||
#endif
|
||||
|
||||
int VM_Version::platform_features(int features) {
|
||||
assert(os::Solaris::supports_getisax(), "getisax() must be available");
|
||||
|
||||
// Check 32-bit architecture.
|
||||
if (Sysinfo(SI_ARCHITECTURE_32).match("sparc")) {
|
||||
@ -357,119 +364,75 @@ int VM_Version::platform_features(int features) {
|
||||
}
|
||||
|
||||
// Extract valid instruction set extensions.
|
||||
uint_t avs[2];
|
||||
uint_t avn = os::Solaris::getisax(avs, 2);
|
||||
assert(avn <= 2, "should return two or less av's");
|
||||
uint_t av = avs[0];
|
||||
uint_t avs[AV_HW2_IDX + 1];
|
||||
uint_t avn = getisax(avs, ARRAY_SIZE(avs));
|
||||
|
||||
log_info(os, cpu)("getisax(2) returned: " PTR32_FORMAT, av);
|
||||
if (avn > 1) {
|
||||
log_info(os, cpu)(" " PTR32_FORMAT, avs[1]);
|
||||
log_info(os, cpu)("getisax(2) returned %d words:", avn);
|
||||
for (int i = 0; i < avn; i++) {
|
||||
log_info(os, cpu)(" word %d: " PTR32_FORMAT, i, avs[i]);
|
||||
}
|
||||
|
||||
if (av & AV_SPARC_MUL32) features |= hardware_mul32_m;
|
||||
if (av & AV_SPARC_DIV32) features |= hardware_div32_m;
|
||||
if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m;
|
||||
if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m;
|
||||
if (av & AV_SPARC_POPC) features |= hardware_popc_m;
|
||||
if (av & AV_SPARC_VIS) features |= vis1_instructions_m;
|
||||
if (av & AV_SPARC_VIS2) features |= vis2_instructions_m;
|
||||
if (avn > 1) {
|
||||
uint_t av2 = avs[1];
|
||||
#ifndef AV2_SPARC_SPARC5
|
||||
#define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */
|
||||
#endif
|
||||
if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m;
|
||||
uint_t av1 = avs[AV_HW1_IDX];
|
||||
if (av1 & AV_SPARC_MUL32) features |= hardware_mul32_m;
|
||||
if (av1 & AV_SPARC_DIV32) features |= hardware_div32_m;
|
||||
if (av1 & AV_SPARC_FSMULD) features |= hardware_fsmuld_m;
|
||||
if (av1 & AV_SPARC_V8PLUS) features |= v9_instructions_m;
|
||||
if (av1 & AV_SPARC_POPC) features |= hardware_popc_m;
|
||||
if (av1 & AV_SPARC_VIS) features |= vis1_instructions_m;
|
||||
if (av1 & AV_SPARC_VIS2) features |= vis2_instructions_m;
|
||||
if (av1 & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
|
||||
if (av1 & AV_SPARC_FMAF) features |= fmaf_instructions_m;
|
||||
if (av1 & AV_SPARC_VIS3) features |= vis3_instructions_m;
|
||||
if (av1 & AV_SPARC_CBCOND) features |= cbcond_instructions_m;
|
||||
if (av1 & AV_SPARC_CRC32C) features |= crc32c_instruction_m;
|
||||
if (av1 & AV_SPARC_AES) features |= aes_instructions_m;
|
||||
if (av1 & AV_SPARC_SHA1) features |= sha1_instruction_m;
|
||||
if (av1 & AV_SPARC_SHA256) features |= sha256_instruction_m;
|
||||
if (av1 & AV_SPARC_SHA512) features |= sha512_instruction_m;
|
||||
|
||||
if (avn > AV_HW2_IDX) {
|
||||
uint_t av2 = avs[AV_HW2_IDX];
|
||||
if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m;
|
||||
}
|
||||
|
||||
// We only build on Solaris 10 and up, but some of the values below
|
||||
// are not defined on all versions of Solaris 10, so we define them,
|
||||
// if necessary.
|
||||
#ifndef AV_SPARC_ASI_BLK_INIT
|
||||
#define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */
|
||||
#endif
|
||||
if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
|
||||
|
||||
#ifndef AV_SPARC_FMAF
|
||||
#define AV_SPARC_FMAF 0x0100 /* Fused Multiply-Add */
|
||||
#endif
|
||||
if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m;
|
||||
|
||||
#ifndef AV_SPARC_FMAU
|
||||
#define AV_SPARC_FMAU 0x0200 /* Unfused Multiply-Add */
|
||||
#endif
|
||||
if (av & AV_SPARC_FMAU) features |= fmau_instructions_m;
|
||||
|
||||
#ifndef AV_SPARC_VIS3
|
||||
#define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */
|
||||
#endif
|
||||
if (av & AV_SPARC_VIS3) features |= vis3_instructions_m;
|
||||
|
||||
#ifndef AV_SPARC_CBCOND
|
||||
#define AV_SPARC_CBCOND 0x10000000 /* compare and branch instrs supported */
|
||||
#endif
|
||||
if (av & AV_SPARC_CBCOND) features |= cbcond_instructions_m;
|
||||
|
||||
#ifndef AV_SPARC_CRC32C
|
||||
#define AV_SPARC_CRC32C 0x20000000 /* crc32c instruction supported */
|
||||
#endif
|
||||
if (av & AV_SPARC_CRC32C) features |= crc32c_instruction_m;
|
||||
|
||||
#ifndef AV_SPARC_AES
|
||||
#define AV_SPARC_AES 0x00020000 /* aes instrs supported */
|
||||
#endif
|
||||
if (av & AV_SPARC_AES) features |= aes_instructions_m;
|
||||
|
||||
#ifndef AV_SPARC_SHA1
|
||||
#define AV_SPARC_SHA1 0x00400000 /* sha1 instruction supported */
|
||||
#endif
|
||||
if (av & AV_SPARC_SHA1) features |= sha1_instruction_m;
|
||||
|
||||
#ifndef AV_SPARC_SHA256
|
||||
#define AV_SPARC_SHA256 0x00800000 /* sha256 instruction supported */
|
||||
#endif
|
||||
if (av & AV_SPARC_SHA256) features |= sha256_instruction_m;
|
||||
|
||||
#ifndef AV_SPARC_SHA512
|
||||
#define AV_SPARC_SHA512 0x01000000 /* sha512 instruction supported */
|
||||
#endif
|
||||
if (av & AV_SPARC_SHA512) features |= sha512_instruction_m;
|
||||
|
||||
// Determine the machine type.
|
||||
if (Sysinfo(SI_MACHINE).match("sun4v")) {
|
||||
features |= sun4v_m;
|
||||
}
|
||||
|
||||
bool use_solaris_12_api = false;
|
||||
Sysinfo impl(SI_CPUBRAND);
|
||||
if (impl.valid()) {
|
||||
// If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
|
||||
// is available to us as well
|
||||
use_solaris_12_api = true;
|
||||
features |= parse_features(impl.value());
|
||||
// If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
|
||||
// is available to us as well
|
||||
Sysinfo cpu_info(SI_CPUBRAND);
|
||||
bool use_solaris_12_api = cpu_info.valid();
|
||||
const char* impl;
|
||||
int impl_m = 0;
|
||||
if (use_solaris_12_api) {
|
||||
impl = cpu_info.value();
|
||||
log_info(os, cpu)("Parsing CPU implementation from %s", impl);
|
||||
impl_m = parse_features(impl);
|
||||
} else {
|
||||
// Otherwise use kstat to determine the machine type.
|
||||
kstat_ctl_t* kc = kstat_open();
|
||||
kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
|
||||
const char* implementation;
|
||||
bool has_implementation = false;
|
||||
if (ksp != NULL) {
|
||||
if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
|
||||
kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
|
||||
for (int i = 0; i < ksp->ks_ndata; i++) {
|
||||
if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
|
||||
implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
|
||||
has_implementation = true;
|
||||
log_info(os, cpu)("cpu_info.implementation: %s", implementation);
|
||||
features |= parse_features(implementation);
|
||||
break;
|
||||
if (kc != NULL) {
|
||||
kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
|
||||
if (ksp != NULL) {
|
||||
if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
|
||||
kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
|
||||
for (int i = 0; i < ksp->ks_ndata; i++) {
|
||||
if (strcmp((const char*)&(knm[i].name), "implementation") == 0) {
|
||||
impl = KSTAT_NAMED_STR_PTR(&knm[i]);
|
||||
log_info(os, cpu)("Parsing CPU implementation from %s", impl);
|
||||
impl_m = parse_features(impl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // for(
|
||||
}
|
||||
}
|
||||
kstat_close(kc);
|
||||
}
|
||||
assert(has_implementation, "unknown cpu info (changed kstat interface?)");
|
||||
kstat_close(kc);
|
||||
}
|
||||
assert(impl_m != 0, "Unknown CPU implementation %s", impl);
|
||||
features |= impl_m;
|
||||
|
||||
bool is_sun4v = (features & sun4v_m) != 0;
|
||||
if (use_solaris_12_api && is_sun4v) {
|
||||
|
@ -153,6 +153,8 @@ void AbstractAssembler::generate_stack_overflow_check(int frame_size_in_bytes) {
|
||||
|
||||
void Label::add_patch_at(CodeBuffer* cb, int branch_loc) {
|
||||
assert(_loc == -1, "Label is unbound");
|
||||
// Don't add patch locations during scratch emit.
|
||||
if (cb->insts()->scratch_emit()) { return; }
|
||||
if (_patch_index < PatchCacheSize) {
|
||||
_patches[_patch_index] = branch_loc;
|
||||
} else {
|
||||
|
@ -331,6 +331,8 @@ void CodeSection::relocate(address at, relocInfo::relocType rtype, int format, j
|
||||
}
|
||||
|
||||
void CodeSection::relocate(address at, RelocationHolder const& spec, int format) {
|
||||
// Do not relocate in scratch buffers.
|
||||
if (scratch_emit()) { return; }
|
||||
Relocation* reloc = spec.reloc();
|
||||
relocInfo::relocType rtype = (relocInfo::relocType) reloc->type();
|
||||
if (rtype == relocInfo::none) return;
|
||||
|
@ -92,6 +92,7 @@ class CodeSection VALUE_OBJ_CLASS_SPEC {
|
||||
address _locs_point; // last relocated position (grows upward)
|
||||
bool _locs_own; // did I allocate the locs myself?
|
||||
bool _frozen; // no more expansion of this section
|
||||
bool _scratch_emit; // Buffer is used for scratch emit, don't relocate.
|
||||
char _index; // my section number (SECT_INST, etc.)
|
||||
CodeBuffer* _outer; // enclosing CodeBuffer
|
||||
|
||||
@ -108,6 +109,7 @@ class CodeSection VALUE_OBJ_CLASS_SPEC {
|
||||
_locs_point = NULL;
|
||||
_locs_own = false;
|
||||
_frozen = false;
|
||||
_scratch_emit = false;
|
||||
debug_only(_index = (char)-1);
|
||||
debug_only(_outer = (CodeBuffer*)badAddress);
|
||||
}
|
||||
@ -166,6 +168,10 @@ class CodeSection VALUE_OBJ_CLASS_SPEC {
|
||||
bool is_frozen() const { return _frozen; }
|
||||
bool has_locs() const { return _locs_end != NULL; }
|
||||
|
||||
// Mark scratch buffer.
|
||||
void set_scratch_emit() { _scratch_emit = true; }
|
||||
bool scratch_emit() { return _scratch_emit; }
|
||||
|
||||
CodeBuffer* outer() const { return _outer; }
|
||||
|
||||
// is a given address in this section? (2nd version is end-inclusive)
|
||||
|
@ -1493,6 +1493,21 @@ void GraphBuilder::method_return(Value x, bool ignore_return) {
|
||||
// Check to see whether we are inlining. If so, Return
|
||||
// instructions become Gotos to the continuation point.
|
||||
if (continuation() != NULL) {
|
||||
|
||||
int invoke_bci = state()->caller_state()->bci();
|
||||
|
||||
if (x != NULL && !ignore_return) {
|
||||
ciMethod* caller = state()->scope()->caller()->method();
|
||||
Bytecodes::Code invoke_raw_bc = caller->raw_code_at_bci(invoke_bci);
|
||||
if (invoke_raw_bc == Bytecodes::_invokehandle || invoke_raw_bc == Bytecodes::_invokedynamic) {
|
||||
ciType* declared_ret_type = caller->get_declared_signature_at_bci(invoke_bci)->return_type();
|
||||
if (declared_ret_type->is_klass() && x->exact_type() == NULL &&
|
||||
x->declared_type() != declared_ret_type && declared_ret_type != compilation()->env()->Object_klass()) {
|
||||
x = append(new TypeCast(declared_ret_type->as_klass(), x, copy_state_before()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
|
||||
|
||||
if (compilation()->env()->dtrace_method_probes()) {
|
||||
@ -1516,7 +1531,6 @@ void GraphBuilder::method_return(Value x, bool ignore_return) {
|
||||
// State at end of inlined method is the state of the caller
|
||||
// without the method parameters on stack, including the
|
||||
// return value, if any, of the inlined method on operand stack.
|
||||
int invoke_bci = state()->caller_state()->bci();
|
||||
set_state(state()->caller_state()->copy_for_parsing());
|
||||
if (x != NULL) {
|
||||
if (!ignore_return) {
|
||||
@ -1929,7 +1943,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
|
||||
// number of implementors for decl_interface is 0 or 1. If
|
||||
// it's 0 then no class implements decl_interface and there's
|
||||
// no point in inlining.
|
||||
if (!holder->is_loaded() || decl_interface->nof_implementors() != 1 || decl_interface->has_default_methods()) {
|
||||
if (!holder->is_loaded() || decl_interface->nof_implementors() != 1 || decl_interface->has_nonstatic_concrete_methods()) {
|
||||
singleton = NULL;
|
||||
}
|
||||
}
|
||||
@ -4308,7 +4322,7 @@ void GraphBuilder::print_stats() {
|
||||
void GraphBuilder::profile_call(ciMethod* callee, Value recv, ciKlass* known_holder, Values* obj_args, bool inlined) {
|
||||
assert(known_holder == NULL || (known_holder->is_instance_klass() &&
|
||||
(!known_holder->is_interface() ||
|
||||
((ciInstanceKlass*)known_holder)->has_default_methods())), "should be default method");
|
||||
((ciInstanceKlass*)known_holder)->has_nonstatic_concrete_methods())), "should be non-static concrete method");
|
||||
if (known_holder != NULL) {
|
||||
if (known_holder->exact_klass() == NULL) {
|
||||
known_holder = compilation()->cha_exact_type(known_holder);
|
||||
|
@ -360,7 +360,8 @@ void Invoke::state_values_do(ValueVisitor* f) {
|
||||
}
|
||||
|
||||
ciType* Invoke::declared_type() const {
|
||||
ciType *t = _target->signature()->return_type();
|
||||
ciSignature* declared_signature = state()->scope()->method()->get_declared_signature_at_bci(state()->bci());
|
||||
ciType *t = declared_signature->return_type();
|
||||
assert(t->basic_type() != T_VOID, "need return value of void method?");
|
||||
return t;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) :
|
||||
_init_state = ik->init_state();
|
||||
_nonstatic_field_size = ik->nonstatic_field_size();
|
||||
_has_nonstatic_fields = ik->has_nonstatic_fields();
|
||||
_has_default_methods = ik->has_default_methods();
|
||||
_has_nonstatic_concrete_methods = ik->has_nonstatic_concrete_methods();
|
||||
_is_anonymous = ik->is_anonymous();
|
||||
_nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
|
||||
_has_injected_fields = -1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,7 +52,7 @@ private:
|
||||
bool _has_finalizer;
|
||||
bool _has_subklass;
|
||||
bool _has_nonstatic_fields;
|
||||
bool _has_default_methods;
|
||||
bool _has_nonstatic_concrete_methods;
|
||||
bool _is_anonymous;
|
||||
|
||||
ciFlags _flags;
|
||||
@ -174,9 +174,9 @@ public:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
bool has_default_methods() {
|
||||
bool has_nonstatic_concrete_methods() {
|
||||
assert(is_loaded(), "must be loaded");
|
||||
return _has_default_methods;
|
||||
return _has_nonstatic_concrete_methods;
|
||||
}
|
||||
|
||||
bool is_anonymous() {
|
||||
|
@ -256,6 +256,14 @@ class ciMethod : public ciMetadata {
|
||||
return get_method_at_bci(bci, ignored_will_link, &ignored_declared_signature);
|
||||
}
|
||||
|
||||
ciSignature* get_declared_signature_at_bci(int bci) {
|
||||
bool ignored_will_link;
|
||||
ciSignature* declared_signature;
|
||||
get_method_at_bci(bci, ignored_will_link, &declared_signature);
|
||||
assert(declared_signature != NULL, "cannot be null");
|
||||
return declared_signature;
|
||||
}
|
||||
|
||||
// Given a certain calling environment, find the monomorphic target
|
||||
// for the call. Return NULL if the call is not monomorphic in
|
||||
// its calling environment.
|
||||
|
@ -798,11 +798,11 @@ static bool put_after_lookup(const Symbol* name, const Symbol* sig, NameSigHash*
|
||||
void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
|
||||
const int itfs_len,
|
||||
ConstantPool* const cp,
|
||||
bool* const has_default_methods,
|
||||
bool* const has_nonstatic_concrete_methods,
|
||||
TRAPS) {
|
||||
assert(stream != NULL, "invariant");
|
||||
assert(cp != NULL, "invariant");
|
||||
assert(has_default_methods != NULL, "invariant");
|
||||
assert(has_nonstatic_concrete_methods != NULL, "invariant");
|
||||
|
||||
if (itfs_len == 0) {
|
||||
_local_interfaces = Universe::the_empty_klass_array();
|
||||
@ -844,8 +844,8 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
|
||||
"Implementing class");
|
||||
}
|
||||
|
||||
if (InstanceKlass::cast(interf())->has_default_methods()) {
|
||||
*has_default_methods = true;
|
||||
if (InstanceKlass::cast(interf())->has_nonstatic_concrete_methods()) {
|
||||
*has_nonstatic_concrete_methods = true;
|
||||
}
|
||||
_local_interfaces->at_put(index, interf());
|
||||
}
|
||||
@ -2830,12 +2830,12 @@ void ClassFileParser::parse_methods(const ClassFileStream* const cfs,
|
||||
bool is_interface,
|
||||
AccessFlags* promoted_flags,
|
||||
bool* has_final_method,
|
||||
bool* declares_default_methods,
|
||||
bool* declares_nonstatic_concrete_methods,
|
||||
TRAPS) {
|
||||
assert(cfs != NULL, "invariant");
|
||||
assert(promoted_flags != NULL, "invariant");
|
||||
assert(has_final_method != NULL, "invariant");
|
||||
assert(declares_default_methods != NULL, "invariant");
|
||||
assert(declares_nonstatic_concrete_methods != NULL, "invariant");
|
||||
|
||||
assert(NULL == _methods, "invariant");
|
||||
|
||||
@ -2860,11 +2860,11 @@ void ClassFileParser::parse_methods(const ClassFileStream* const cfs,
|
||||
if (method->is_final()) {
|
||||
*has_final_method = true;
|
||||
}
|
||||
// declares_default_methods: declares concrete instance methods, any access flags
|
||||
// declares_nonstatic_concrete_methods: declares concrete instance methods, any access flags
|
||||
// used for interface initialization, and default method inheritance analysis
|
||||
if (is_interface && !(*declares_default_methods)
|
||||
if (is_interface && !(*declares_nonstatic_concrete_methods)
|
||||
&& !method->is_abstract() && !method->is_static()) {
|
||||
*declares_default_methods = true;
|
||||
*declares_nonstatic_concrete_methods = true;
|
||||
}
|
||||
_methods->at_put(index, method);
|
||||
}
|
||||
@ -5250,8 +5250,8 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
|
||||
|
||||
ik->set_minor_version(_minor_version);
|
||||
ik->set_major_version(_major_version);
|
||||
ik->set_has_default_methods(_has_default_methods);
|
||||
ik->set_declares_default_methods(_declares_default_methods);
|
||||
ik->set_has_nonstatic_concrete_methods(_has_nonstatic_concrete_methods);
|
||||
ik->set_declares_nonstatic_concrete_methods(_declares_nonstatic_concrete_methods);
|
||||
|
||||
if (_host_klass != NULL) {
|
||||
assert (ik->is_anonymous(), "should be the same");
|
||||
@ -5311,12 +5311,9 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
|
||||
// check if this class overrides any final method
|
||||
check_final_method_override(ik, CHECK);
|
||||
|
||||
// check that if this class is an interface then it doesn't have static methods
|
||||
if (ik->is_interface()) {
|
||||
/* An interface in a JAVA 8 classfile can be static */
|
||||
if (_major_version < JAVA_8_VERSION) {
|
||||
check_illegal_static_method(ik, CHECK);
|
||||
}
|
||||
// reject static interface methods prior to Java 8
|
||||
if (ik->is_interface() && _major_version < JAVA_8_VERSION) {
|
||||
check_illegal_static_method(ik, CHECK);
|
||||
}
|
||||
|
||||
// Obtain this_klass' module entry
|
||||
@ -5336,9 +5333,9 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
|
||||
|
||||
assert(_all_mirandas != NULL, "invariant");
|
||||
|
||||
// Generate any default methods - default methods are interface methods
|
||||
// that have a default implementation. This is new with Lambda project.
|
||||
if (_has_default_methods ) {
|
||||
// Generate any default methods - default methods are public interface methods
|
||||
// that have a default implementation. This is new with Java 8.
|
||||
if (_has_nonstatic_concrete_methods) {
|
||||
DefaultMethods::generate_default_methods(ik,
|
||||
_all_mirandas,
|
||||
CHECK);
|
||||
@ -5523,8 +5520,8 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
|
||||
_java_fields_count(0),
|
||||
_need_verify(false),
|
||||
_relax_verify(false),
|
||||
_has_default_methods(false),
|
||||
_declares_default_methods(false),
|
||||
_has_nonstatic_concrete_methods(false),
|
||||
_declares_nonstatic_concrete_methods(false),
|
||||
_has_final_method(false),
|
||||
_has_finalizer(false),
|
||||
_has_empty_finalizer(false),
|
||||
@ -5778,9 +5775,22 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
|
||||
// Anonymous classes such as generated LambdaForm classes are also not included.
|
||||
if (SystemDictionaryShared::is_sharing_possible(_loader_data) &&
|
||||
_host_klass == NULL) {
|
||||
oop class_loader = _loader_data->class_loader();
|
||||
ResourceMark rm(THREAD);
|
||||
classlist_file->print_cr("%s", _class_name->as_C_string());
|
||||
classlist_file->flush();
|
||||
// For the boot and platform class loaders, check if the class is not found in the
|
||||
// java runtime image. Additional check for the boot class loader is if the class
|
||||
// is not found in the boot loader's appended entries. This indicates that the class
|
||||
// is not useable during run time, such as the ones found in the --patch-module entries,
|
||||
// so it should not be included in the classlist file.
|
||||
if (((class_loader == NULL && !ClassLoader::contains_append_entry(stream->source())) ||
|
||||
SystemDictionary::is_platform_class_loader(class_loader)) &&
|
||||
!ClassLoader::is_jrt(stream->source())) {
|
||||
tty->print_cr("skip writing class %s from source %s to classlist file",
|
||||
_class_name->as_C_string(), stream->source());
|
||||
} else {
|
||||
classlist_file->print_cr("%s", _class_name->as_C_string());
|
||||
classlist_file->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -5798,7 +5808,7 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
|
||||
parse_interfaces(stream,
|
||||
_itfs_len,
|
||||
cp,
|
||||
&_has_default_methods,
|
||||
&_has_nonstatic_concrete_methods,
|
||||
CHECK);
|
||||
|
||||
assert(_local_interfaces != NULL, "invariant");
|
||||
@ -5821,7 +5831,7 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
|
||||
_access_flags.is_interface(),
|
||||
&promoted_flags,
|
||||
&_has_final_method,
|
||||
&_declares_default_methods,
|
||||
&_declares_nonstatic_concrete_methods,
|
||||
CHECK);
|
||||
|
||||
assert(_methods != NULL, "invariant");
|
||||
@ -5829,8 +5839,8 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
|
||||
// promote flags from parse_methods() to the klass' flags
|
||||
_access_flags.add_promoted_flags(promoted_flags.as_int());
|
||||
|
||||
if (_declares_default_methods) {
|
||||
_has_default_methods = true;
|
||||
if (_declares_nonstatic_concrete_methods) {
|
||||
_has_nonstatic_concrete_methods = true;
|
||||
}
|
||||
|
||||
// Additional attributes/annotations
|
||||
@ -5859,6 +5869,11 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
|
||||
assert(cp != NULL, "invariant");
|
||||
assert(_loader_data != NULL, "invariant");
|
||||
|
||||
if (_class_name == vmSymbols::java_lang_Object()) {
|
||||
check_property(_local_interfaces == Universe::the_empty_klass_array(),
|
||||
"java.lang.Object cannot implement an interface in class file %s",
|
||||
CHECK);
|
||||
}
|
||||
// We check super class after class file is parsed and format is checked
|
||||
if (_super_class_index > 0 && NULL ==_super_klass) {
|
||||
Symbol* const super_class_name = cp->klass_name_at(_super_class_index);
|
||||
@ -5879,8 +5894,8 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
|
||||
}
|
||||
|
||||
if (_super_klass != NULL) {
|
||||
if (_super_klass->has_default_methods()) {
|
||||
_has_default_methods = true;
|
||||
if (_super_klass->has_nonstatic_concrete_methods()) {
|
||||
_has_nonstatic_concrete_methods = true;
|
||||
}
|
||||
|
||||
if (_super_klass->is_interface()) {
|
||||
|
@ -139,8 +139,8 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
||||
bool _need_verify;
|
||||
bool _relax_verify;
|
||||
|
||||
bool _has_default_methods;
|
||||
bool _declares_default_methods;
|
||||
bool _has_nonstatic_concrete_methods;
|
||||
bool _declares_nonstatic_concrete_methods;
|
||||
bool _has_final_method;
|
||||
|
||||
// precomputed flags
|
||||
@ -186,7 +186,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
||||
void parse_interfaces(const ClassFileStream* const stream,
|
||||
const int itfs_len,
|
||||
ConstantPool* const cp,
|
||||
bool* has_default_methods,
|
||||
bool* has_nonstatic_concrete_methods,
|
||||
TRAPS);
|
||||
|
||||
const InstanceKlass* parse_super_class(ConstantPool* const cp,
|
||||
@ -224,7 +224,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
||||
bool is_interface,
|
||||
AccessFlags* const promoted_flags,
|
||||
bool* const has_final_method,
|
||||
bool* const declares_default_methods,
|
||||
bool* const declares_nonstatic_concrete_methods,
|
||||
TRAPS);
|
||||
|
||||
const u2* parse_exception_table(const ClassFileStream* const stream,
|
||||
|
@ -81,7 +81,6 @@ typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
|
||||
typedef void (JNICALL *ZipClose_t)(jzfile *zip);
|
||||
typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *sizeP, jint *nameLen);
|
||||
typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
|
||||
typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
|
||||
typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
|
||||
typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
|
||||
typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
|
||||
@ -91,7 +90,6 @@ static ZipOpen_t ZipOpen = NULL;
|
||||
static ZipClose_t ZipClose = NULL;
|
||||
static FindEntry_t FindEntry = NULL;
|
||||
static ReadEntry_t ReadEntry = NULL;
|
||||
static ReadMappedEntry_t ReadMappedEntry = NULL;
|
||||
static GetNextEntry_t GetNextEntry = NULL;
|
||||
static canonicalize_fn_t CanonicalizeEntry = NULL;
|
||||
static ZipInflateFully_t ZipInflateFully = NULL;
|
||||
@ -353,15 +351,10 @@ u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_ter
|
||||
filename = NEW_RESOURCE_ARRAY(char, name_len + 1);
|
||||
}
|
||||
|
||||
// file found, get pointer to the entry in mmapped jar file.
|
||||
if (ReadMappedEntry == NULL ||
|
||||
!(*ReadMappedEntry)(_zip, entry, &buffer, filename)) {
|
||||
// mmapped access not available, perhaps due to compression,
|
||||
// read contents into resource array
|
||||
int size = (*filesize) + ((nul_terminate) ? 1 : 0);
|
||||
buffer = NEW_RESOURCE_ARRAY(u1, size);
|
||||
if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL;
|
||||
}
|
||||
// read contents into resource array
|
||||
int size = (*filesize) + ((nul_terminate) ? 1 : 0);
|
||||
buffer = NEW_RESOURCE_ARRAY(u1, size);
|
||||
if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL;
|
||||
|
||||
// return result
|
||||
if (nul_terminate) {
|
||||
@ -952,11 +945,11 @@ ClassPathZipEntry* ClassLoader::create_class_path_zip_entry(const char *path, bo
|
||||
}
|
||||
|
||||
// returns true if entry already on class path
|
||||
bool ClassLoader::contains_entry(ClassPathEntry *entry) {
|
||||
bool ClassLoader::contains_append_entry(const char* name) {
|
||||
ClassPathEntry* e = _first_append_entry;
|
||||
while (e != NULL) {
|
||||
// assume zip entries have been canonicalized
|
||||
if (strcmp(entry->name(), e->name()) == 0) {
|
||||
if (strcmp(name, e->name()) == 0) {
|
||||
return true;
|
||||
}
|
||||
e = e->next();
|
||||
@ -998,7 +991,7 @@ bool ClassLoader::update_class_path_entry_list(const char *path,
|
||||
|
||||
// Do not reorder the bootclasspath which would break get_system_package().
|
||||
// Add new entry to linked list
|
||||
if (!check_for_duplicates || !contains_entry(new_entry)) {
|
||||
if (!check_for_duplicates || !contains_append_entry(new_entry->name())) {
|
||||
ClassLoaderExt::add_class_path_entry(path, check_for_duplicates, new_entry);
|
||||
}
|
||||
return true;
|
||||
@ -1079,7 +1072,6 @@ void ClassLoader::load_zip_library() {
|
||||
ZipClose = CAST_TO_FN_PTR(ZipClose_t, os::dll_lookup(handle, "ZIP_Close"));
|
||||
FindEntry = CAST_TO_FN_PTR(FindEntry_t, os::dll_lookup(handle, "ZIP_FindEntry"));
|
||||
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
|
||||
ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
|
||||
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
|
||||
ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
|
||||
Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
|
||||
@ -2049,7 +2041,6 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
|
||||
if (nm != NULL && !m->is_method_handle_intrinsic()) {
|
||||
// Throw out the code so that the code cache doesn't fill up
|
||||
nm->make_not_entrant();
|
||||
m->clear_code();
|
||||
}
|
||||
CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization,
|
||||
methodHandle(), 0, CompileTask::Reason_CTW, THREAD);
|
||||
@ -2068,7 +2059,6 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
|
||||
if (nm != NULL && !m->is_method_handle_intrinsic()) {
|
||||
// Throw out the code so that the code cache doesn't fill up
|
||||
nm->make_not_entrant();
|
||||
m->clear_code();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ class ClassLoader: AllStatic {
|
||||
static void set_first_append_entry(ClassPathEntry* entry);
|
||||
|
||||
// indicates if class path already contains a entry (exact match by name)
|
||||
static bool contains_entry(ClassPathEntry* entry);
|
||||
static bool contains_append_entry(const char* name);
|
||||
|
||||
// adds a class path list
|
||||
static void add_to_list(ClassPathEntry* new_entry);
|
||||
|
@ -639,7 +639,6 @@ const char* ClassLoaderData::loader_name() {
|
||||
#undef CLD_DUMP_KLASSES
|
||||
|
||||
void ClassLoaderData::dump(outputStream * const out) {
|
||||
ResourceMark rm;
|
||||
out->print("ClassLoaderData CLD: " PTR_FORMAT ", loader: " PTR_FORMAT ", loader_klass: " PTR_FORMAT " %s {",
|
||||
p2i(this), p2i((void *)class_loader()),
|
||||
p2i(class_loader() != NULL ? class_loader()->klass() : NULL), loader_name());
|
||||
@ -656,7 +655,6 @@ void ClassLoaderData::dump(outputStream * const out) {
|
||||
|
||||
#ifdef CLD_DUMP_KLASSES
|
||||
if (Verbose) {
|
||||
ResourceMark rm;
|
||||
Klass* k = _klasses;
|
||||
while (k != NULL) {
|
||||
out->print_cr("klass " PTR_FORMAT ", %s, CT: %d, MUT: %d", k, k->name()->as_C_string(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2016, 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
|
||||
@ -914,7 +914,7 @@ static void create_defaults_and_exceptions(
|
||||
BytecodeBuffer buffer;
|
||||
|
||||
if (log_is_enabled(Debug, defaultmethods)) {
|
||||
ResourceMark rm;
|
||||
ResourceMark rm(THREAD);
|
||||
outputStream* logstream = Log(defaultmethods)::debug_stream();
|
||||
logstream->print("for slot: ");
|
||||
slot->print_on(logstream);
|
||||
@ -929,6 +929,7 @@ static void create_defaults_and_exceptions(
|
||||
if (method->has_target()) {
|
||||
Method* selected = method->get_selected_target();
|
||||
if (selected->method_holder()->is_interface()) {
|
||||
assert(!selected->is_private(), "pushing private interface method as default");
|
||||
defaults.push(selected);
|
||||
}
|
||||
} else if (method->throws_exception()) {
|
||||
|
@ -780,19 +780,26 @@ void java_lang_Class::set_mirror_module_field(KlassHandle k, Handle mirror, Hand
|
||||
// Put the class on the fixup_module_list to patch later when the java.lang.reflect.Module
|
||||
// for java.base is known.
|
||||
assert(!Universe::is_module_initialized(), "Incorrect java.lang.reflect.Module pre module system initialization");
|
||||
MutexLocker m1(Module_lock, THREAD);
|
||||
// Keep list of classes needing java.base module fixup
|
||||
if (!ModuleEntryTable::javabase_defined()) {
|
||||
if (fixup_module_field_list() == NULL) {
|
||||
GrowableArray<Klass*>* list =
|
||||
new (ResourceObj::C_HEAP, mtModule) GrowableArray<Klass*>(500, true);
|
||||
set_fixup_module_field_list(list);
|
||||
|
||||
bool javabase_was_defined = false;
|
||||
{
|
||||
MutexLocker m1(Module_lock, THREAD);
|
||||
// Keep list of classes needing java.base module fixup
|
||||
if (!ModuleEntryTable::javabase_defined()) {
|
||||
if (fixup_module_field_list() == NULL) {
|
||||
GrowableArray<Klass*>* list =
|
||||
new (ResourceObj::C_HEAP, mtModule) GrowableArray<Klass*>(500, true);
|
||||
set_fixup_module_field_list(list);
|
||||
}
|
||||
k->class_loader_data()->inc_keep_alive();
|
||||
fixup_module_field_list()->push(k());
|
||||
} else {
|
||||
javabase_was_defined = true;
|
||||
}
|
||||
k->class_loader_data()->inc_keep_alive();
|
||||
fixup_module_field_list()->push(k());
|
||||
} else {
|
||||
// java.base was defined at some point between calling create_mirror()
|
||||
// and obtaining the Module_lock, patch this particular class with java.base.
|
||||
}
|
||||
|
||||
// If java.base was already defined then patch this particular class with java.base.
|
||||
if (javabase_was_defined) {
|
||||
ModuleEntry *javabase_entry = ModuleEntryTable::javabase_moduleEntry();
|
||||
assert(javabase_entry != NULL && javabase_entry->module() != NULL,
|
||||
"Setting class module field, java.base should be defined");
|
||||
@ -2168,6 +2175,14 @@ void java_lang_StackTraceElement::fill_in(Handle element,
|
||||
const char* str = holder->external_name();
|
||||
oop classname = StringTable::intern((char*) str, CHECK);
|
||||
java_lang_StackTraceElement::set_declaringClass(element(), classname);
|
||||
java_lang_StackTraceElement::set_declaringClassObject(element(), holder->java_mirror());
|
||||
|
||||
oop loader = holder->class_loader();
|
||||
if (loader != NULL) {
|
||||
oop loader_name = java_lang_ClassLoader::name(loader);
|
||||
if (loader_name != NULL)
|
||||
java_lang_StackTraceElement::set_classLoaderName(element(), loader_name);
|
||||
}
|
||||
|
||||
// The method can be NULL if the requested class version is gone
|
||||
Symbol* sym = !method.is_null() ? method->name() : holder->constants()->symbol_at(cpref);
|
||||
@ -3426,6 +3441,7 @@ oop java_security_AccessControlContext::create(objArrayHandle context, bool isPr
|
||||
bool java_lang_ClassLoader::offsets_computed = false;
|
||||
int java_lang_ClassLoader::_loader_data_offset = -1;
|
||||
int java_lang_ClassLoader::parallelCapable_offset = -1;
|
||||
int java_lang_ClassLoader::name_offset = -1;
|
||||
int java_lang_ClassLoader::unnamedModule_offset = -1;
|
||||
|
||||
ClassLoaderData** java_lang_ClassLoader::loader_data_addr(oop loader) {
|
||||
@ -3446,6 +3462,9 @@ void java_lang_ClassLoader::compute_offsets() {
|
||||
compute_optional_offset(parallelCapable_offset,
|
||||
k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature());
|
||||
|
||||
compute_offset(name_offset,
|
||||
k1, vmSymbols::name_name(), vmSymbols::string_signature());
|
||||
|
||||
compute_offset(unnamedModule_offset,
|
||||
k1, vmSymbols::unnamedModule_name(), vmSymbols::module_signature());
|
||||
|
||||
@ -3457,6 +3476,11 @@ oop java_lang_ClassLoader::parent(oop loader) {
|
||||
return loader->obj_field(parent_offset);
|
||||
}
|
||||
|
||||
oop java_lang_ClassLoader::name(oop loader) {
|
||||
assert(is_instance(loader), "loader must be oop");
|
||||
return loader->obj_field(name_offset);
|
||||
}
|
||||
|
||||
bool java_lang_ClassLoader::isAncestor(oop loader, oop cl) {
|
||||
assert(is_instance(loader), "loader must be oop");
|
||||
assert(cl == NULL || is_instance(cl), "cl argument must be oop");
|
||||
@ -3612,12 +3636,14 @@ int java_lang_System::static_in_offset;
|
||||
int java_lang_System::static_out_offset;
|
||||
int java_lang_System::static_err_offset;
|
||||
int java_lang_System::static_security_offset;
|
||||
int java_lang_StackTraceElement::declaringClass_offset;
|
||||
int java_lang_StackTraceElement::methodName_offset;
|
||||
int java_lang_StackTraceElement::fileName_offset;
|
||||
int java_lang_StackTraceElement::lineNumber_offset;
|
||||
int java_lang_StackTraceElement::moduleName_offset;
|
||||
int java_lang_StackTraceElement::moduleVersion_offset;
|
||||
int java_lang_StackTraceElement::classLoaderName_offset;
|
||||
int java_lang_StackTraceElement::declaringClass_offset;
|
||||
int java_lang_StackTraceElement::classOrLoaderModuleClassName_offset;
|
||||
int java_lang_StackFrameInfo::_declaringClass_offset;
|
||||
int java_lang_StackFrameInfo::_memberName_offset;
|
||||
int java_lang_StackFrameInfo::_bci_offset;
|
||||
@ -3662,6 +3688,14 @@ void java_lang_StackTraceElement::set_moduleVersion(oop element, oop value) {
|
||||
element->obj_field_put(moduleVersion_offset, value);
|
||||
}
|
||||
|
||||
void java_lang_StackTraceElement::set_classLoaderName(oop element, oop value) {
|
||||
element->obj_field_put(classLoaderName_offset, value);
|
||||
}
|
||||
|
||||
void java_lang_StackTraceElement::set_declaringClassObject(oop element, oop value) {
|
||||
element->obj_field_put(classOrLoaderModuleClassName_offset, value);
|
||||
}
|
||||
|
||||
// Support for java_lang_StackFrameInfo
|
||||
void java_lang_StackFrameInfo::set_declaringClass(oop element, oop value) {
|
||||
element->obj_field_put(_declaringClass_offset, value);
|
||||
@ -3777,6 +3811,8 @@ void JavaClasses::compute_hard_coded_offsets() {
|
||||
java_lang_System::static_security_offset = java_lang_System::hc_static_security_offset * x;
|
||||
|
||||
// java_lang_StackTraceElement
|
||||
java_lang_StackTraceElement::classOrLoaderModuleClassName_offset= java_lang_StackTraceElement::hc_classOrLoaderModuleClassName_offset* x + header;
|
||||
java_lang_StackTraceElement::classLoaderName_offset = java_lang_StackTraceElement::hc_classLoaderName_offset * x + header;
|
||||
java_lang_StackTraceElement::moduleName_offset = java_lang_StackTraceElement::hc_moduleName_offset * x + header;
|
||||
java_lang_StackTraceElement::moduleVersion_offset = java_lang_StackTraceElement::hc_moduleVersion_offset * x + header;
|
||||
java_lang_StackTraceElement::declaringClass_offset = java_lang_StackTraceElement::hc_declaringClass_offset * x + header;
|
||||
@ -3978,10 +4014,14 @@ void JavaClasses::check_offsets() {
|
||||
|
||||
// java.lang.StackTraceElement
|
||||
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, declaringClass, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, methodName, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, fileName, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, lineNumber, "I");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, classOrLoaderModuleClassName, "Ljava/lang/Object;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, classLoaderName, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, moduleName, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, moduleVersion, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, declaringClass, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, methodName, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, fileName, "Ljava/lang/String;");
|
||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, lineNumber, "I");
|
||||
|
||||
// java.lang.ref.Reference
|
||||
|
||||
|
@ -1225,6 +1225,7 @@ class java_lang_ClassLoader : AllStatic {
|
||||
static bool offsets_computed;
|
||||
static int parent_offset;
|
||||
static int parallelCapable_offset;
|
||||
static int name_offset;
|
||||
static int unnamedModule_offset;
|
||||
|
||||
public:
|
||||
@ -1234,6 +1235,7 @@ class java_lang_ClassLoader : AllStatic {
|
||||
static ClassLoaderData* loader_data(oop loader);
|
||||
|
||||
static oop parent(oop loader);
|
||||
static oop name(oop loader);
|
||||
static bool isAncestor(oop loader, oop cl);
|
||||
|
||||
// Support for parallelCapable field
|
||||
@ -1291,14 +1293,18 @@ class java_lang_System : AllStatic {
|
||||
class java_lang_StackTraceElement: AllStatic {
|
||||
private:
|
||||
enum {
|
||||
hc_moduleName_offset = 0,
|
||||
hc_moduleVersion_offset = 1,
|
||||
hc_declaringClass_offset = 2,
|
||||
hc_methodName_offset = 3,
|
||||
hc_fileName_offset = 4,
|
||||
hc_lineNumber_offset = 5
|
||||
hc_classOrLoaderModuleClassName_offset = 0,
|
||||
hc_classLoaderName_offset = 1,
|
||||
hc_moduleName_offset = 2,
|
||||
hc_moduleVersion_offset = 3,
|
||||
hc_declaringClass_offset = 4,
|
||||
hc_methodName_offset = 5,
|
||||
hc_fileName_offset = 6,
|
||||
hc_lineNumber_offset = 7
|
||||
};
|
||||
|
||||
static int classOrLoaderModuleClassName_offset;
|
||||
static int classLoaderName_offset;
|
||||
static int moduleName_offset;
|
||||
static int moduleVersion_offset;
|
||||
static int declaringClass_offset;
|
||||
@ -1307,12 +1313,14 @@ class java_lang_StackTraceElement: AllStatic {
|
||||
static int lineNumber_offset;
|
||||
|
||||
// Setters
|
||||
static void set_classLoaderName(oop element, oop value);
|
||||
static void set_moduleName(oop element, oop value);
|
||||
static void set_moduleVersion(oop element, oop value);
|
||||
static void set_declaringClass(oop element, oop value);
|
||||
static void set_methodName(oop element, oop value);
|
||||
static void set_fileName(oop element, oop value);
|
||||
static void set_lineNumber(oop element, int value);
|
||||
static void set_declaringClassObject(oop element, oop value);
|
||||
|
||||
public:
|
||||
// Create an instance of StackTraceElement
|
||||
|
@ -74,7 +74,7 @@ instanceKlassHandle KlassFactory::check_shared_class_file_load_hook(
|
||||
(SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
|
||||
ClassFileStream* stream = new ClassFileStream(ptr,
|
||||
end_ptr - ptr,
|
||||
ent->_name,
|
||||
ent == NULL ? NULL : ent->_name,
|
||||
ClassFileStream::verify);
|
||||
ClassFileParser parser(stream,
|
||||
class_name,
|
||||
|
@ -368,9 +368,6 @@ void ModuleEntryTable::finalize_javabase(Handle module_handle, Symbol* version,
|
||||
|
||||
// Store pointer to the ModuleEntry for java.base in the java.lang.reflect.Module object.
|
||||
java_lang_reflect_Module::set_module_entry(module_handle(), jb_module);
|
||||
|
||||
// Patch any previously loaded classes' module field with java.base's java.lang.reflect.Module.
|
||||
patch_javabase_entries(module_handle);
|
||||
}
|
||||
|
||||
// Within java.lang.Class instances there is a java.lang.reflect.Module field
|
||||
@ -378,7 +375,6 @@ void ModuleEntryTable::finalize_javabase(Handle module_handle, Symbol* version,
|
||||
// definition, classes needing their module field set are added to the fixup_module_list.
|
||||
// Their module field is set once java.base's java.lang.reflect.Module is known to the VM.
|
||||
void ModuleEntryTable::patch_javabase_entries(Handle module_handle) {
|
||||
assert(Module_lock->owned_by_self(), "should have the Module_lock");
|
||||
if (module_handle.is_null()) {
|
||||
fatal("Unable to patch the module field of classes loaded prior to java.base's definition, invalid java.lang.reflect.Module");
|
||||
}
|
||||
|
@ -244,6 +244,12 @@ static void define_javabase_module(jobject module, jstring version,
|
||||
"Module java.base is already defined");
|
||||
}
|
||||
|
||||
// Only the thread that actually defined the base module will get here,
|
||||
// so no locking is needed.
|
||||
|
||||
// Patch any previously loaded class's module field with java.base's java.lang.reflect.Module.
|
||||
ModuleEntryTable::patch_javabase_entries(module_handle);
|
||||
|
||||
log_debug(modules)("define_javabase_module(): Definition of module: java.base,"
|
||||
" version: %s, location: %s, package #: %d",
|
||||
module_version != NULL ? module_version : "NULL",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2016, 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
|
||||
@ -203,6 +203,7 @@ class stack_map_frame {
|
||||
inline bool verify(address start, address end) const;
|
||||
|
||||
inline void print_on(outputStream* st, int current_offset) const;
|
||||
inline void print_truncated(outputStream* st, int current_offset) const;
|
||||
|
||||
// Create as_xxx and is_xxx methods for the subtypes
|
||||
#define FRAME_TYPE_DECL(stackmap_frame_type, arg1, arg2) \
|
||||
@ -263,6 +264,10 @@ class same_frame : public stack_map_frame {
|
||||
void print_on(outputStream* st, int current_offset = -1) const {
|
||||
st->print("same_frame(@%d)", offset_delta() + current_offset);
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
print_on(st, current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class same_frame_extended : public stack_map_frame {
|
||||
@ -309,6 +314,10 @@ class same_frame_extended : public stack_map_frame {
|
||||
void print_on(outputStream* st, int current_offset = -1) const {
|
||||
st->print("same_frame_extended(@%d)", offset_delta() + current_offset);
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
print_on(st, current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class same_locals_1_stack_item_frame : public stack_map_frame {
|
||||
@ -381,6 +390,11 @@ class same_locals_1_stack_item_frame : public stack_map_frame {
|
||||
types()->print_on(st);
|
||||
st->print(")");
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
st->print("same_locals_1_stack_item_frame(@%d), output truncated, Stackmap exceeds table size.",
|
||||
offset_delta() + current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class same_locals_1_stack_item_extended : public stack_map_frame {
|
||||
@ -446,6 +460,11 @@ class same_locals_1_stack_item_extended : public stack_map_frame {
|
||||
types()->print_on(st);
|
||||
st->print(")");
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
st->print("same_locals_1_stack_item_extended(@%d), output truncated, Stackmap exceeds table size.",
|
||||
offset_delta() + current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class chop_frame : public stack_map_frame {
|
||||
@ -511,6 +530,10 @@ class chop_frame : public stack_map_frame {
|
||||
void print_on(outputStream* st, int current_offset = -1) const {
|
||||
st->print("chop_frame(@%d,%d)", offset_delta() + current_offset, chops());
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
print_on(st, current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class append_frame : public stack_map_frame {
|
||||
@ -619,6 +642,11 @@ class append_frame : public stack_map_frame {
|
||||
}
|
||||
st->print(")");
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
st->print("append_frame(@%d), output truncated, Stackmap exceeds table size.",
|
||||
offset_delta() + current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
class full_frame : public stack_map_frame {
|
||||
@ -784,6 +812,11 @@ class full_frame : public stack_map_frame {
|
||||
}
|
||||
st->print("})");
|
||||
}
|
||||
|
||||
void print_truncated(outputStream* st, int current_offset = -1) const {
|
||||
st->print("full_frame(@%d), output truncated, Stackmap exceeds table size.",
|
||||
offset_delta() + current_offset);
|
||||
}
|
||||
};
|
||||
|
||||
#define VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \
|
||||
@ -841,6 +874,10 @@ void stack_map_frame::print_on(outputStream* st, int offs = -1) const {
|
||||
FOR_EACH_STACKMAP_FRAME_TYPE(VOID_VIRTUAL_DISPATCH, print_on, (st, offs));
|
||||
}
|
||||
|
||||
void stack_map_frame::print_truncated(outputStream* st, int offs = -1) const {
|
||||
FOR_EACH_STACKMAP_FRAME_TYPE(VOID_VIRTUAL_DISPATCH, print_truncated, (st, offs));
|
||||
}
|
||||
|
||||
#undef VIRTUAL_DISPATCH
|
||||
#undef VOID_VIRTUAL_DISPATCH
|
||||
|
||||
|
@ -1234,7 +1234,7 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
|
||||
SharedClassPathEntry* ent =
|
||||
(SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
|
||||
if (!Universe::is_module_initialized()) {
|
||||
assert(ent->is_jrt(),
|
||||
assert(ent != NULL && ent->is_jrt(),
|
||||
"Loading non-bootstrap classes before the module system is initialized");
|
||||
assert(class_loader.is_null(), "sanity");
|
||||
return true;
|
||||
@ -1257,6 +1257,7 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
|
||||
}
|
||||
|
||||
if (class_loader.is_null()) {
|
||||
assert(ent != NULL, "Shared class for NULL classloader must have valid SharedClassPathEntry");
|
||||
// The NULL classloader can load archived class originated from the
|
||||
// "modules" jimage and the -Xbootclasspath/a. For class from the
|
||||
// "modules" jimage, the PackageEntry/ModuleEntry must be defined
|
||||
|
@ -226,7 +226,7 @@ class SystemDictionary : AllStatic {
|
||||
WKID_LIMIT,
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(HotSpotCompiledCode_klass),
|
||||
FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(JVMCI_klass),
|
||||
LAST_JVMCI_WKID = WK_KLASS_ENUM_NAME(Value_klass),
|
||||
#endif
|
||||
|
||||
|
@ -541,8 +541,19 @@ void ErrorContext::stackmap_details(outputStream* ss, const Method* method) cons
|
||||
stack_map_frame* sm_frame = sm_table->entries();
|
||||
streamIndentor si2(ss);
|
||||
int current_offset = -1;
|
||||
// Subtract two from StackMapAttribute length because the length includes
|
||||
// two bytes for number of table entries.
|
||||
size_t sm_table_space = method->stackmap_data()->length() - 2;
|
||||
for (u2 i = 0; i < sm_table->number_of_entries(); ++i) {
|
||||
ss->indent();
|
||||
size_t sm_frame_size = sm_frame->size();
|
||||
// If the size of the next stackmap exceeds the length of the entire
|
||||
// stackmap table then print a truncated message and return.
|
||||
if (sm_frame_size > sm_table_space) {
|
||||
sm_frame->print_truncated(ss, current_offset);
|
||||
return;
|
||||
}
|
||||
sm_table_space -= sm_frame_size;
|
||||
sm_frame->print_on(ss, current_offset);
|
||||
ss->cr();
|
||||
current_offset += sm_frame->offset_delta();
|
||||
|
@ -1252,7 +1252,7 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
|
||||
if (method() != NULL && (method()->code() == this ||
|
||||
method()->from_compiled_entry() == verified_entry_point())) {
|
||||
HandleMark hm;
|
||||
method()->clear_code();
|
||||
method()->clear_code(false /* already owns Patching_lock */);
|
||||
}
|
||||
} // leave critical region under Patching_lock
|
||||
|
||||
|
@ -2340,13 +2340,11 @@ void CMSCollector::verify_after_remark_work_1() {
|
||||
{
|
||||
StrongRootsScope srs(1);
|
||||
|
||||
gch->gen_process_roots(&srs,
|
||||
GenCollectedHeap::OldGen,
|
||||
gch->cms_process_roots(&srs,
|
||||
true, // young gen as roots
|
||||
GenCollectedHeap::ScanningOption(roots_scanning_options()),
|
||||
should_unload_classes(),
|
||||
¬Older,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -2414,13 +2412,11 @@ void CMSCollector::verify_after_remark_work_2() {
|
||||
{
|
||||
StrongRootsScope srs(1);
|
||||
|
||||
gch->gen_process_roots(&srs,
|
||||
GenCollectedHeap::OldGen,
|
||||
gch->cms_process_roots(&srs,
|
||||
true, // young gen as roots
|
||||
GenCollectedHeap::ScanningOption(roots_scanning_options()),
|
||||
should_unload_classes(),
|
||||
¬Older,
|
||||
NULL,
|
||||
&cld_closure);
|
||||
}
|
||||
|
||||
@ -2903,13 +2899,11 @@ void CMSCollector::checkpointRootsInitialWork() {
|
||||
|
||||
StrongRootsScope srs(1);
|
||||
|
||||
gch->gen_process_roots(&srs,
|
||||
GenCollectedHeap::OldGen,
|
||||
gch->cms_process_roots(&srs,
|
||||
true, // young gen as roots
|
||||
GenCollectedHeap::ScanningOption(roots_scanning_options()),
|
||||
should_unload_classes(),
|
||||
¬Older,
|
||||
NULL,
|
||||
&cld_closure);
|
||||
}
|
||||
}
|
||||
@ -4290,13 +4284,11 @@ void CMSParInitialMarkTask::work(uint worker_id) {
|
||||
|
||||
CLDToOopClosure cld_closure(&par_mri_cl, true);
|
||||
|
||||
gch->gen_process_roots(_strong_roots_scope,
|
||||
GenCollectedHeap::OldGen,
|
||||
gch->cms_process_roots(_strong_roots_scope,
|
||||
false, // yg was scanned above
|
||||
GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
|
||||
_collector->should_unload_classes(),
|
||||
&par_mri_cl,
|
||||
NULL,
|
||||
&cld_closure);
|
||||
assert(_collector->should_unload_classes()
|
||||
|| (_collector->CMSCollector::roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache),
|
||||
@ -4421,13 +4413,11 @@ void CMSParRemarkTask::work(uint worker_id) {
|
||||
// ---------- remaining roots --------------
|
||||
_timer.reset();
|
||||
_timer.start();
|
||||
gch->gen_process_roots(_strong_roots_scope,
|
||||
GenCollectedHeap::OldGen,
|
||||
gch->cms_process_roots(_strong_roots_scope,
|
||||
false, // yg was scanned above
|
||||
GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
|
||||
_collector->should_unload_classes(),
|
||||
&par_mrias_cl,
|
||||
NULL,
|
||||
NULL); // The dirty klasses will be handled below
|
||||
|
||||
assert(_collector->should_unload_classes()
|
||||
@ -4970,13 +4960,11 @@ void CMSCollector::do_remark_non_parallel() {
|
||||
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
|
||||
StrongRootsScope srs(1);
|
||||
|
||||
gch->gen_process_roots(&srs,
|
||||
GenCollectedHeap::OldGen,
|
||||
gch->cms_process_roots(&srs,
|
||||
true, // young gen as roots
|
||||
GenCollectedHeap::ScanningOption(roots_scanning_options()),
|
||||
should_unload_classes(),
|
||||
&mrias_cl,
|
||||
NULL,
|
||||
NULL); // The dirty klasses will be handled below
|
||||
|
||||
assert(should_unload_classes()
|
||||
|
@ -605,14 +605,10 @@ void ParNewGenTask::work(uint worker_id) {
|
||||
false);
|
||||
|
||||
par_scan_state.start_strong_roots();
|
||||
gch->gen_process_roots(_strong_roots_scope,
|
||||
GenCollectedHeap::YoungGen,
|
||||
true, // Process younger gens, if any, as strong roots.
|
||||
GenCollectedHeap::SO_ScavengeCodeCache,
|
||||
GenCollectedHeap::StrongAndWeakRoots,
|
||||
&par_scan_state.to_space_root_closure(),
|
||||
&par_scan_state.older_gen_closure(),
|
||||
&cld_scan_closure);
|
||||
gch->young_process_roots(_strong_roots_scope,
|
||||
&par_scan_state.to_space_root_closure(),
|
||||
&par_scan_state.older_gen_closure(),
|
||||
&cld_scan_closure);
|
||||
|
||||
par_scan_state.end_strong_roots();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,99 +53,4 @@ void G1BiasedMappedArrayBase::verify_biased_index_inclusive_end(idx_t biased_ind
|
||||
biased_index, bias(), length());
|
||||
}
|
||||
|
||||
class TestMappedArray : public G1BiasedMappedArray<int> {
|
||||
protected:
|
||||
virtual int default_value() const { return 0xBAADBABE; }
|
||||
public:
|
||||
static void test_biasedarray() {
|
||||
const size_t REGION_SIZE_IN_WORDS = 512;
|
||||
const size_t NUM_REGIONS = 20;
|
||||
HeapWord* fake_heap = (HeapWord*)LP64_ONLY(0xBAAA00000) NOT_LP64(0xBA000000); // Any value that is non-zero
|
||||
|
||||
TestMappedArray array;
|
||||
array.initialize(fake_heap, fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS,
|
||||
REGION_SIZE_IN_WORDS * HeapWordSize);
|
||||
// Check address calculation (bounds)
|
||||
assert(array.bottom_address_mapped() == fake_heap,
|
||||
"bottom mapped address should be " PTR_FORMAT ", but is " PTR_FORMAT, p2i(fake_heap), p2i(array.bottom_address_mapped()));
|
||||
assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be");
|
||||
|
||||
int* bottom = array.address_mapped_to(fake_heap);
|
||||
assert((void*)bottom == (void*) array.base(), "must be");
|
||||
int* end = array.address_mapped_to(fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS);
|
||||
assert((void*)end == (void*)(array.base() + array.length()), "must be");
|
||||
// The entire array should contain default value elements
|
||||
for (int* current = bottom; current < end; current++) {
|
||||
assert(*current == array.default_value(), "must be");
|
||||
}
|
||||
|
||||
// Test setting values in the table
|
||||
|
||||
HeapWord* region_start_address = fake_heap + REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2);
|
||||
HeapWord* region_end_address = fake_heap + (REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2) + REGION_SIZE_IN_WORDS - 1);
|
||||
|
||||
// Set/get by address tests: invert some value; first retrieve one
|
||||
int actual_value = array.get_by_index(NUM_REGIONS / 2);
|
||||
array.set_by_index(NUM_REGIONS / 2, ~actual_value);
|
||||
// Get the same value by address, should correspond to the start of the "region"
|
||||
int value = array.get_by_address(region_start_address);
|
||||
assert(value == ~actual_value, "must be");
|
||||
// Get the same value by address, at one HeapWord before the start
|
||||
value = array.get_by_address(region_start_address - 1);
|
||||
assert(value == array.default_value(), "must be");
|
||||
// Get the same value by address, at the end of the "region"
|
||||
value = array.get_by_address(region_end_address);
|
||||
assert(value == ~actual_value, "must be");
|
||||
// Make sure the next value maps to another index
|
||||
value = array.get_by_address(region_end_address + 1);
|
||||
assert(value == array.default_value(), "must be");
|
||||
|
||||
// Reset the value in the array
|
||||
array.set_by_address(region_start_address + (region_end_address - region_start_address) / 2, actual_value);
|
||||
|
||||
// The entire array should have the default value again
|
||||
for (int* current = bottom; current < end; current++) {
|
||||
assert(*current == array.default_value(), "must be");
|
||||
}
|
||||
|
||||
// Set/get by index tests: invert some value
|
||||
idx_t index = NUM_REGIONS / 2;
|
||||
actual_value = array.get_by_index(index);
|
||||
array.set_by_index(index, ~actual_value);
|
||||
|
||||
value = array.get_by_index(index);
|
||||
assert(value == ~actual_value, "must be");
|
||||
|
||||
value = array.get_by_index(index - 1);
|
||||
assert(value == array.default_value(), "must be");
|
||||
|
||||
value = array.get_by_index(index + 1);
|
||||
assert(value == array.default_value(), "must be");
|
||||
|
||||
array.set_by_index(0, 0);
|
||||
value = array.get_by_index(0);
|
||||
assert(value == 0, "must be");
|
||||
|
||||
array.set_by_index(array.length() - 1, 0);
|
||||
value = array.get_by_index(array.length() - 1);
|
||||
assert(value == 0, "must be");
|
||||
|
||||
array.set_by_index(index, 0);
|
||||
|
||||
// The array should have three zeros, and default values otherwise
|
||||
size_t num_zeros = 0;
|
||||
for (int* current = bottom; current < end; current++) {
|
||||
assert(*current == array.default_value() || *current == 0, "must be");
|
||||
if (*current == 0) {
|
||||
num_zeros++;
|
||||
}
|
||||
}
|
||||
assert(num_zeros == 3, "must be");
|
||||
}
|
||||
};
|
||||
|
||||
void TestG1BiasedArray_test() {
|
||||
TestMappedArray::test_biasedarray();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -648,15 +648,10 @@ void DefNewGeneration::collect(bool full,
|
||||
// See: CardTableModRefBSForCTRS::non_clean_card_iterate_possibly_parallel.
|
||||
StrongRootsScope srs(0);
|
||||
|
||||
gch->gen_process_roots(&srs,
|
||||
GenCollectedHeap::YoungGen,
|
||||
true, // Process younger gens, if any,
|
||||
// as strong roots.
|
||||
GenCollectedHeap::SO_ScavengeCodeCache,
|
||||
GenCollectedHeap::StrongAndWeakRoots,
|
||||
&fsc_with_no_gc_barrier,
|
||||
&fsc_with_gc_barrier,
|
||||
&cld_scan_closure);
|
||||
gch->young_process_roots(&srs,
|
||||
&fsc_with_no_gc_barrier,
|
||||
&fsc_with_gc_barrier,
|
||||
&cld_scan_closure);
|
||||
}
|
||||
|
||||
// "evacuate followers".
|
||||
|
@ -196,14 +196,13 @@ void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
|
||||
{
|
||||
StrongRootsScope srs(1);
|
||||
|
||||
gch->gen_process_roots(&srs,
|
||||
GenCollectedHeap::OldGen,
|
||||
false, // Younger gens are not roots.
|
||||
GenCollectedHeap::SO_None,
|
||||
ClassUnloading,
|
||||
&follow_root_closure,
|
||||
&follow_root_closure,
|
||||
&follow_cld_closure);
|
||||
gch->full_process_roots(&srs,
|
||||
false, // not the adjust phase
|
||||
GenCollectedHeap::SO_None,
|
||||
ClassUnloading, // only strong roots if ClassUnloading
|
||||
// is enabled
|
||||
&follow_root_closure,
|
||||
&follow_cld_closure);
|
||||
}
|
||||
|
||||
// Process reference objects found during marking
|
||||
@ -295,14 +294,12 @@ void GenMarkSweep::mark_sweep_phase3() {
|
||||
{
|
||||
StrongRootsScope srs(1);
|
||||
|
||||
gch->gen_process_roots(&srs,
|
||||
GenCollectedHeap::OldGen,
|
||||
false, // Younger gens are not roots.
|
||||
GenCollectedHeap::SO_AllCodeCache,
|
||||
GenCollectedHeap::StrongAndWeakRoots,
|
||||
&adjust_pointer_closure,
|
||||
&adjust_pointer_closure,
|
||||
&adjust_cld_closure);
|
||||
gch->full_process_roots(&srs,
|
||||
true, // this is the adjust phase
|
||||
GenCollectedHeap::SO_AllCodeCache,
|
||||
false, // all roots
|
||||
&adjust_pointer_closure,
|
||||
&adjust_cld_closure);
|
||||
}
|
||||
|
||||
gch->gen_process_weak_roots(&adjust_pointer_closure);
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "prims/jni_md.h"
|
||||
#include "utilities/ticks.hpp"
|
||||
|
||||
#define LOG_STOP_TIME_FORMAT "(%.3fs, %.3fs) %.3fms"
|
||||
#define LOG_STOP_HEAP_FORMAT SIZE_FORMAT "M->" SIZE_FORMAT "M(" SIZE_FORMAT "M)"
|
||||
|
||||
inline void GCTraceTimeImpl::log_start(jlong start_counter) {
|
||||
@ -46,7 +45,7 @@ inline void GCTraceTimeImpl::log_start(jlong start_counter) {
|
||||
if (_gc_cause != GCCause::_no_gc) {
|
||||
out.print(" (%s)", GCCause::to_string(_gc_cause));
|
||||
}
|
||||
out.print_cr(" (%.3fs)", TimeHelper::counter_to_seconds(start_counter));
|
||||
out.cr();
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +70,7 @@ inline void GCTraceTimeImpl::log_stop(jlong start_counter, jlong stop_counter) {
|
||||
out.print(" " LOG_STOP_HEAP_FORMAT, used_before_m, used_m, capacity_m);
|
||||
}
|
||||
|
||||
out.print_cr(" " LOG_STOP_TIME_FORMAT, start_time_in_secs, stop_time_in_secs, duration_in_ms);
|
||||
out.print_cr(" %.3fms", duration_in_ms);
|
||||
}
|
||||
|
||||
inline void GCTraceTimeImpl::time_stamp(Ticks& ticks) {
|
||||
@ -117,7 +116,7 @@ template <LogLevelType Level, LogTagType T0, LogTagType T1, LogTagType T2, LogTa
|
||||
GCTraceConcTimeImpl<Level, T0, T1, T2, T3, T4, GuardTag>::GCTraceConcTimeImpl(const char* title) :
|
||||
_enabled(LogImpl<T0, T1, T2, T3, T4, GuardTag>::is_level(Level)), _start_time(os::elapsed_counter()), _title(title) {
|
||||
if (_enabled) {
|
||||
LogImpl<T0, T1, T2, T3, T4>::template write<Level>("%s (%.3fs)", _title, TimeHelper::counter_to_seconds(_start_time));
|
||||
LogImpl<T0, T1, T2, T3, T4>::template write<Level>("%s", _title);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,11 +124,8 @@ template <LogLevelType Level, LogTagType T0, LogTagType T1, LogTagType T2, LogTa
|
||||
GCTraceConcTimeImpl<Level, T0, T1, T2, T3, T4, GuardTag>::~GCTraceConcTimeImpl() {
|
||||
if (_enabled) {
|
||||
jlong stop_time = os::elapsed_counter();
|
||||
LogImpl<T0, T1, T2, T3, T4>::template write<Level>("%s " LOG_STOP_TIME_FORMAT,
|
||||
_title,
|
||||
TimeHelper::counter_to_seconds(_start_time),
|
||||
TimeHelper::counter_to_seconds(stop_time),
|
||||
TimeHelper::counter_to_millis(stop_time - _start_time));
|
||||
LogImpl<T0, T1, T2, T3, T4>::template write<Level>("%s %0.3fms", _title,
|
||||
TimeHelper::counter_to_millis(stop_time - _start_time));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,16 +613,6 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
|
||||
SystemDictionary::roots_oops_do(strong_roots, weak_roots);
|
||||
}
|
||||
|
||||
// All threads execute the following. A specific chunk of buckets
|
||||
// from the StringTable are the individual tasks.
|
||||
if (weak_roots != NULL) {
|
||||
if (is_par) {
|
||||
StringTable::possibly_parallel_oops_do(weak_roots);
|
||||
} else {
|
||||
StringTable::oops_do(weak_roots);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) {
|
||||
if (so & SO_ScavengeCodeCache) {
|
||||
assert(code_roots != NULL, "must supply closure for code cache");
|
||||
@ -644,46 +634,82 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
|
||||
}
|
||||
}
|
||||
|
||||
void GenCollectedHeap::gen_process_roots(StrongRootsScope* scope,
|
||||
GenerationType type,
|
||||
void GenCollectedHeap::process_string_table_roots(StrongRootsScope* scope,
|
||||
OopClosure* root_closure) {
|
||||
assert(root_closure != NULL, "Must be set");
|
||||
// All threads execute the following. A specific chunk of buckets
|
||||
// from the StringTable are the individual tasks.
|
||||
if (scope->n_threads() > 1) {
|
||||
StringTable::possibly_parallel_oops_do(root_closure);
|
||||
} else {
|
||||
StringTable::oops_do(root_closure);
|
||||
}
|
||||
}
|
||||
|
||||
void GenCollectedHeap::young_process_roots(StrongRootsScope* scope,
|
||||
OopsInGenClosure* root_closure,
|
||||
OopsInGenClosure* old_gen_closure,
|
||||
CLDClosure* cld_closure) {
|
||||
MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);
|
||||
|
||||
process_roots(scope, SO_ScavengeCodeCache, root_closure, root_closure,
|
||||
cld_closure, cld_closure, &mark_code_closure);
|
||||
process_string_table_roots(scope, root_closure);
|
||||
|
||||
if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
|
||||
root_closure->reset_generation();
|
||||
}
|
||||
|
||||
// When collection is parallel, all threads get to cooperate to do
|
||||
// old generation scanning.
|
||||
old_gen_closure->set_generation(_old_gen);
|
||||
rem_set()->younger_refs_iterate(_old_gen, old_gen_closure, scope->n_threads());
|
||||
old_gen_closure->reset_generation();
|
||||
|
||||
_process_strong_tasks->all_tasks_completed(scope->n_threads());
|
||||
}
|
||||
|
||||
void GenCollectedHeap::cms_process_roots(StrongRootsScope* scope,
|
||||
bool young_gen_as_roots,
|
||||
ScanningOption so,
|
||||
bool only_strong_roots,
|
||||
OopsInGenClosure* not_older_gens,
|
||||
OopsInGenClosure* older_gens,
|
||||
OopsInGenClosure* root_closure,
|
||||
CLDClosure* cld_closure) {
|
||||
const bool is_adjust_phase = !only_strong_roots && !young_gen_as_roots;
|
||||
|
||||
bool is_moving_collection = false;
|
||||
if (type == YoungGen || is_adjust_phase) {
|
||||
// young collections are always moving
|
||||
is_moving_collection = true;
|
||||
}
|
||||
|
||||
MarkingCodeBlobClosure mark_code_closure(not_older_gens, is_moving_collection);
|
||||
OopsInGenClosure* weak_roots = only_strong_roots ? NULL : not_older_gens;
|
||||
MarkingCodeBlobClosure mark_code_closure(root_closure, !CodeBlobToOopClosure::FixRelocations);
|
||||
OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
|
||||
CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
|
||||
|
||||
process_roots(scope, so,
|
||||
not_older_gens, weak_roots,
|
||||
cld_closure, weak_cld_closure,
|
||||
&mark_code_closure);
|
||||
|
||||
if (young_gen_as_roots) {
|
||||
if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
|
||||
if (type == OldGen) {
|
||||
not_older_gens->set_generation(_young_gen);
|
||||
_young_gen->oop_iterate(not_older_gens);
|
||||
}
|
||||
not_older_gens->reset_generation();
|
||||
}
|
||||
process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
|
||||
if (!only_strong_roots) {
|
||||
process_string_table_roots(scope, root_closure);
|
||||
}
|
||||
// When collection is parallel, all threads get to cooperate to do
|
||||
// old generation scanning.
|
||||
if (type == YoungGen) {
|
||||
older_gens->set_generation(_old_gen);
|
||||
rem_set()->younger_refs_iterate(_old_gen, older_gens, scope->n_threads());
|
||||
older_gens->reset_generation();
|
||||
|
||||
if (young_gen_as_roots &&
|
||||
!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
|
||||
root_closure->set_generation(_young_gen);
|
||||
_young_gen->oop_iterate(root_closure);
|
||||
root_closure->reset_generation();
|
||||
}
|
||||
|
||||
_process_strong_tasks->all_tasks_completed(scope->n_threads());
|
||||
}
|
||||
|
||||
void GenCollectedHeap::full_process_roots(StrongRootsScope* scope,
|
||||
bool is_adjust_phase,
|
||||
ScanningOption so,
|
||||
bool only_strong_roots,
|
||||
OopsInGenClosure* root_closure,
|
||||
CLDClosure* cld_closure) {
|
||||
MarkingCodeBlobClosure mark_code_closure(root_closure, is_adjust_phase);
|
||||
OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
|
||||
CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
|
||||
|
||||
process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
|
||||
if (is_adjust_phase) {
|
||||
// We never treat the string table as roots during marking
|
||||
// for the full gc, so we only need to process it during
|
||||
// the adjust phase.
|
||||
process_string_table_roots(scope, root_closure);
|
||||
}
|
||||
|
||||
_process_strong_tasks->all_tasks_completed(scope->n_threads());
|
||||
|
@ -374,16 +374,7 @@ public:
|
||||
// asserted to be this type.
|
||||
static GenCollectedHeap* heap();
|
||||
|
||||
// Invoke the "do_oop" method of one of the closures "not_older_gens"
|
||||
// or "older_gens" on root locations for the generations depending on
|
||||
// the type. (The "older_gens" closure is used for scanning references
|
||||
// from older generations; "not_older_gens" is used everywhere else.)
|
||||
// If "younger_gens_as_roots" is false, younger generations are
|
||||
// not scanned as roots; in this case, the caller must be arranging to
|
||||
// scan the younger generations itself. (For example, a generation might
|
||||
// explicitly mark reachable objects in younger generations, to avoid
|
||||
// excess storage retention.)
|
||||
// The "so" argument determines which of the roots
|
||||
// The ScanningOption determines which of the roots
|
||||
// the closure is applied to:
|
||||
// "SO_None" does none;
|
||||
enum ScanningOption {
|
||||
@ -401,19 +392,34 @@ public:
|
||||
CLDClosure* weak_cld_closure,
|
||||
CodeBlobToOopClosure* code_roots);
|
||||
|
||||
public:
|
||||
static const bool StrongAndWeakRoots = false;
|
||||
static const bool StrongRootsOnly = true;
|
||||
void process_string_table_roots(StrongRootsScope* scope,
|
||||
OopClosure* root_closure);
|
||||
|
||||
void gen_process_roots(StrongRootsScope* scope,
|
||||
GenerationType type,
|
||||
public:
|
||||
void young_process_roots(StrongRootsScope* scope,
|
||||
OopsInGenClosure* root_closure,
|
||||
OopsInGenClosure* old_gen_closure,
|
||||
CLDClosure* cld_closure);
|
||||
|
||||
// If "young_gen_as_roots" is false, younger generations are
|
||||
// not scanned as roots; in this case, the caller must be arranging to
|
||||
// scan the younger generations itself. (For example, a generation might
|
||||
// explicitly mark reachable objects in younger generations, to avoid
|
||||
// excess storage retention.)
|
||||
void cms_process_roots(StrongRootsScope* scope,
|
||||
bool young_gen_as_roots,
|
||||
ScanningOption so,
|
||||
bool only_strong_roots,
|
||||
OopsInGenClosure* not_older_gens,
|
||||
OopsInGenClosure* older_gens,
|
||||
OopsInGenClosure* root_closure,
|
||||
CLDClosure* cld_closure);
|
||||
|
||||
void full_process_roots(StrongRootsScope* scope,
|
||||
bool is_adjust_phase,
|
||||
ScanningOption so,
|
||||
bool only_strong_roots,
|
||||
OopsInGenClosure* root_closure,
|
||||
CLDClosure* cld_closure);
|
||||
|
||||
// Apply "root_closure" to all the weak roots of the system.
|
||||
// These include JNI weak roots, string table,
|
||||
// and referents of reachable weak refs.
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
class InvocationCounter VALUE_OBJ_CLASS_SPEC {
|
||||
friend class VMStructs;
|
||||
friend class JVMCIVMStructs;
|
||||
friend class ciReplay;
|
||||
private: // bit no: |31 3| 2 | 1 0 |
|
||||
unsigned int _counter; // format: [count|carry|state]
|
||||
|
@ -858,8 +858,10 @@ methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info, B
|
||||
}
|
||||
|
||||
if (log_develop_is_enabled(Trace, itables)) {
|
||||
trace_method_resolution("invokeinterface resolved method: caller-class",
|
||||
link_info.current_klass(), resolved_klass,
|
||||
char buf[200];
|
||||
jio_snprintf(buf, sizeof(buf), "%s resolved interface method: caller-class:",
|
||||
Bytecodes::name(code));
|
||||
trace_method_resolution(buf, link_info.current_klass(), resolved_klass,
|
||||
resolved_method, true);
|
||||
}
|
||||
|
||||
@ -1424,7 +1426,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result,
|
||||
}
|
||||
|
||||
if (log_develop_is_enabled(Trace, itables)) {
|
||||
trace_method_resolution("invokeinterface selected method: receiver-class",
|
||||
trace_method_resolution("invokeinterface selected method: receiver-class:",
|
||||
recv_klass, resolved_klass, sel_method, true);
|
||||
}
|
||||
// setup result
|
||||
|
@ -172,7 +172,7 @@ OopMap* CodeInstaller::create_oop_map(Handle debug_info, TRAPS) {
|
||||
return map;
|
||||
}
|
||||
|
||||
void* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) {
|
||||
void* CodeInstaller::record_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS) {
|
||||
/*
|
||||
* This method needs to return a raw (untyped) pointer, since the value of a pointer to the base
|
||||
* class is in general not equal to the pointer of the subclass. When patching metaspace pointers,
|
||||
@ -184,12 +184,14 @@ void* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) {
|
||||
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
|
||||
assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass));
|
||||
int index = _oop_recorder->find_index(klass);
|
||||
section->relocate(dest, metadata_Relocation::spec(index));
|
||||
TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
|
||||
return klass;
|
||||
} else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
|
||||
Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj);
|
||||
assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method));
|
||||
int index = _oop_recorder->find_index(method);
|
||||
section->relocate(dest, metadata_Relocation::spec(index));
|
||||
TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string());
|
||||
return method;
|
||||
} else {
|
||||
@ -198,7 +200,7 @@ void* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) {
|
||||
}
|
||||
|
||||
#ifdef _LP64
|
||||
narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle constant, TRAPS) {
|
||||
narrowKlass CodeInstaller::record_narrow_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS) {
|
||||
oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
|
||||
assert(HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected uncompressed pointer");
|
||||
|
||||
@ -208,6 +210,7 @@ narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle constant, TRA
|
||||
|
||||
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
|
||||
int index = _oop_recorder->find_index(klass);
|
||||
section->relocate(dest, metadata_Relocation::spec(index));
|
||||
TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
|
||||
return Klass::encode_klass(klass);
|
||||
}
|
||||
@ -701,12 +704,12 @@ JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer,
|
||||
if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
|
||||
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
|
||||
#ifdef _LP64
|
||||
*((narrowKlass*) dest) = record_narrow_metadata_reference(constant, CHECK_OK);
|
||||
*((narrowKlass*) dest) = record_narrow_metadata_reference(_constants, dest, constant, CHECK_OK);
|
||||
#else
|
||||
JVMCI_ERROR_OK("unexpected compressed Klass* in 32-bit mode");
|
||||
#endif
|
||||
} else {
|
||||
*((void**) dest) = record_metadata_reference(constant, CHECK_OK);
|
||||
*((void**) dest) = record_metadata_reference(_constants, dest, constant, CHECK_OK);
|
||||
}
|
||||
} else if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
|
||||
Handle obj = HotSpotObjectConstantImpl::object(constant);
|
||||
|
@ -189,9 +189,9 @@ protected:
|
||||
ScopeValue* get_scope_value(Handle value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second, TRAPS);
|
||||
MonitorValue* get_monitor_value(Handle value, GrowableArray<ScopeValue*>* objects, TRAPS);
|
||||
|
||||
void* record_metadata_reference(Handle constant, TRAPS);
|
||||
void* record_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS);
|
||||
#ifdef _LP64
|
||||
narrowKlass record_narrow_metadata_reference(Handle constant, TRAPS);
|
||||
narrowKlass record_narrow_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS);
|
||||
#endif
|
||||
|
||||
// extract the fields of the HotSpotCompiledCode
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user