--- a/.hgtags Sun Jan 14 21:46:14 2018 -0800
+++ b/.hgtags Tue Jan 16 22:24:20 2018 +0000
@@ -460,7 +460,8 @@
bbd692ad4fa300ecca7939ffbe3b1d5e52a28cc6 jdk-10+33
89deac44e51517841491ba86ff44aa82a5ca96b3 jdk-10+34
d8c634b016c628622c9abbdc6bf50509e5dedbec jdk-10+35
-cb54a299aa91419cb7caef3992592e7b22488163 jdk-10+36
+0ee20aad71c4f33c426372b4c8bcc1235ce2ec08 jdk-11+0
+959f2f7cbaa6d2ee45d50029744efb219721576c jdk-10+36
4f830b447edf04fb4a52151a5ad44d9bb60723cd jdk-10+37
e569e83139fdfbecfeb3cd9014d560917787f158 jdk-10+38
5b834ec962366e00d4445352a999a3ac14e26f64 jdk-10+39
--- a/make/Main.gmk Sun Jan 14 21:46:14 2018 -0800
+++ b/make/Main.gmk Tue Jan 16 22:24:20 2018 +0000
@@ -637,7 +637,7 @@
# Declare dependencies between hotspot-<variant>* targets
$(foreach v, $(JVM_VARIANTS), \
$(eval hotspot-$v: hotspot-$v-gensrc hotspot-$v-libs) \
- $(eval hotspot-$v-libs: hotspot-$v-gensrc) \
+ $(eval hotspot-$v-libs: hotspot-$v-gensrc java.base-copy) \
)
hotspot-ide-project: hotspot exploded-image
@@ -691,8 +691,9 @@
jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
# The swing beans need to have java base properly generated to avoid errors
- # in javadoc.
- java.desktop-gensrc-src: java.base-gensrc
+ # in javadoc. The X11 wrappers need the java.base include files to have been
+ # copied and processed.
+ java.desktop-gensrc-src: java.base-gensrc java.base-copy
# The annotation processing for jdk.internal.vm.ci and jdk.internal.vm.compiler
# needs classes from the current JDK.
--- a/make/autoconf/buildjdk-spec.gmk.in Sun Jan 14 21:46:14 2018 -0800
+++ b/make/autoconf/buildjdk-spec.gmk.in Tue Jan 16 22:24:20 2018 +0000
@@ -55,6 +55,7 @@
OPENJDK_TARGET_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
+OPENJDK_TARGET_OS_INCLUDE_SUBDIR := @OPENJDK_BUILD_OS_INCLUDE_SUBDIR@
HOTSPOT_TARGET_OS := @HOTSPOT_BUILD_OS@
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_BUILD_OS_TYPE@
--- a/make/autoconf/flags.m4 Sun Jan 14 21:46:14 2018 -0800
+++ b/make/autoconf/flags.m4 Tue Jan 16 22:24:20 2018 +0000
@@ -1162,9 +1162,7 @@
# Setup some hard coded includes
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
- -I${TOPDIR}/src/java.base/share/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
--- a/make/autoconf/generated-configure.sh Sun Jan 14 21:46:14 2018 -0800
+++ b/make/autoconf/generated-configure.sh Tue Jan 16 22:24:20 2018 +0000
@@ -886,6 +886,8 @@
BOOT_JDK
JAVA_CHECK
JAVAC_CHECK
+VERSION_CLASSFILE_MINOR
+VERSION_CLASSFILE_MAJOR
VENDOR_VERSION_STRING
VERSION_DATE
VERSION_IS_GA
@@ -967,6 +969,7 @@
USERNAME
TOPDIR
PATH_SEP
+OPENJDK_BUILD_OS_INCLUDE_SUBDIR
HOTSPOT_BUILD_CPU_DEFINE
HOTSPOT_BUILD_CPU_ARCH
HOTSPOT_BUILD_CPU
@@ -977,6 +980,7 @@
OPENJDK_BUILD_CPU_ISADIR
OPENJDK_BUILD_CPU_LEGACY_LIB
OPENJDK_BUILD_CPU_LEGACY
+OPENJDK_TARGET_OS_INCLUDE_SUBDIR
HOTSPOT_TARGET_CPU_DEFINE
HOTSPOT_TARGET_CPU_ARCH
HOTSPOT_TARGET_CPU
@@ -16303,6 +16307,14 @@
fi
+ # For historical reasons, the OS include directories have odd names.
+ OPENJDK_TARGET_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+ if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+ OPENJDK_TARGET_OS_INCLUDE_SUBDIR="win32"
+ elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+ OPENJDK_TARGET_OS_INCLUDE_SUBDIR="darwin"
+ fi
+
# Also store the legacy naming of the cpu.
@@ -16454,6 +16466,14 @@
fi
+ # For historical reasons, the OS include directories have odd names.
+ OPENJDK_BUILD_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+ if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+ OPENJDK_BUILD_OS_INCLUDE_SUBDIR="win32"
+ elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+ OPENJDK_BUILD_OS_INCLUDE_SUBDIR="darwin"
+ fi
+
@@ -25459,6 +25479,10 @@
VENDOR_VERSION_STRING="$with_vendor_version_string"
fi
+ # We could define --with flags for these, if really needed
+ VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
+ VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for version string" >&5
$as_echo_n "checking for version string... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VERSION_STRING" >&5
@@ -25480,6 +25504,9 @@
+
+
+
###############################################################################
#
# Setup BootJDK, used to bootstrap the build.
@@ -52752,9 +52779,7 @@
# Setup some hard coded includes
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
- -I${TOPDIR}/src/java.base/share/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
@@ -53635,9 +53660,7 @@
# Setup some hard coded includes
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK \
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
- -I${TOPDIR}/src/java.base/share/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS/native/include \
- -I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/include \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
--- a/make/autoconf/jdk-version.m4 Sun Jan 14 21:46:14 2018 -0800
+++ b/make/autoconf/jdk-version.m4 Tue Jan 16 22:24:20 2018 +0000
@@ -342,6 +342,10 @@
VENDOR_VERSION_STRING="$with_vendor_version_string"
fi
+ # We could define --with flags for these, if really needed
+ VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
+ VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
+
AC_MSG_CHECKING([for version string])
AC_MSG_RESULT([$VERSION_STRING])
@@ -359,4 +363,7 @@
AC_SUBST(VERSION_IS_GA)
AC_SUBST(VERSION_DATE)
AC_SUBST(VENDOR_VERSION_STRING)
+ AC_SUBST(VERSION_CLASSFILE_MAJOR)
+ AC_SUBST(VERSION_CLASSFILE_MINOR)
+
])
--- a/make/autoconf/platform.m4 Sun Jan 14 21:46:14 2018 -0800
+++ b/make/autoconf/platform.m4 Tue Jan 16 22:24:20 2018 +0000
@@ -478,6 +478,14 @@
fi
AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
+ # For historical reasons, the OS include directories have odd names.
+ OPENJDK_$1_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
+ if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
+ OPENJDK_$1_OS_INCLUDE_SUBDIR="win32"
+ elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+ OPENJDK_$1_OS_INCLUDE_SUBDIR="darwin"
+ fi
+ AC_SUBST(OPENJDK_$1_OS_INCLUDE_SUBDIR)
])
AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
--- a/make/autoconf/spec.gmk.in Sun Jan 14 21:46:14 2018 -0800
+++ b/make/autoconf/spec.gmk.in Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2018, 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
@@ -78,6 +78,7 @@
OPENJDK_TARGET_CPU_LEGACY:=@OPENJDK_TARGET_CPU_LEGACY@
OPENJDK_TARGET_CPU_LEGACY_LIB:=@OPENJDK_TARGET_CPU_LEGACY_LIB@
OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@
+OPENJDK_TARGET_OS_INCLUDE_SUBIDR:=@OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
HOTSPOT_TARGET_OS := @HOTSPOT_TARGET_OS@
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_TARGET_OS_TYPE@
@@ -100,6 +101,8 @@
OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@
OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@
+OPENJDK_BUILD_OS_INCLUDE_SUBIDR:=@OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
+
# Target platform value in ModuleTarget class file attribute.
OPENJDK_MODULE_TARGET_PLATFORM:=@OPENJDK_MODULE_TARGET_PLATFORM@
@@ -175,6 +178,10 @@
# Vendor version string
VENDOR_VERSION_STRING := @VENDOR_VERSION_STRING@
+# Class-file version
+VERSION_CLASSFILE_MAJOR := @VERSION_CLASSFILE_MAJOR@
+VERSION_CLASSFILE_MINOR := @VERSION_CLASSFILE_MINOR@
+
# Convenience CFLAGS settings for passing version information into native programs.
VERSION_CFLAGS := \
-DVERSION_FEATURE=$(VERSION_FEATURE) \
@@ -190,6 +197,8 @@
-DVERSION_SPECIFICATION='"$(VERSION_SPECIFICATION)"' \
-DVERSION_DATE='"$(VERSION_DATE)"' \
-DVENDOR_VERSION_STRING='"$(VENDOR_VERSION_STRING)"' \
+ -DVERSION_CLASSFILE_MAJOR=$(VERSION_CLASSFILE_MAJOR) \
+ -DVERSION_CLASSFILE_MINOR=$(VERSION_CLASSFILE_MINOR) \
#
# Platform naming variables
@@ -576,6 +585,8 @@
INTERIM_LANGTOOLS_MODULES := $(addsuffix .interim, $(INTERIM_LANGTOOLS_BASE_MODULES))
INTERIM_LANGTOOLS_ADD_EXPORTS := \
--add-exports java.base/sun.reflect.annotation=jdk.compiler.interim \
+ --add-exports java.base/jdk.internal.jmod=jdk.compiler.interim \
+ --add-exports java.base/jdk.internal.misc=jdk.compiler.interim \
#
INTERIM_LANGTOOLS_MODULES_COMMA := $(strip $(subst $(SPACE),$(COMMA),$(strip \
$(INTERIM_LANGTOOLS_MODULES))))
--- a/make/autoconf/version-numbers Sun Jan 14 21:46:14 2018 -0800
+++ b/make/autoconf/version-numbers Tue Jan 16 22:24:20 2018 +0000
@@ -30,6 +30,8 @@
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_DATE=2018-03-20
+DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
+DEFAULT_VERSION_CLASSFILE_MINOR=0
LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
--- a/make/common/SetupJavaCompilers.gmk Sun Jan 14 21:46:14 2018 -0800
+++ b/make/common/SetupJavaCompilers.gmk Tue Jan 16 22:24:20 2018 +0000
@@ -69,7 +69,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -source 10 -target 10 --doclint-format html5 \
+ FLAGS := -source 11 -target 11 --doclint-format html5 \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -79,7 +79,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -source 10 -target 10 \
+ FLAGS := -source 11 -target 11 \
-encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/conf/jib-profiles.js Sun Jan 14 21:46:14 2018 -0800
+++ b/make/conf/jib-profiles.js Tue Jan 16 22:24:20 2018 +0000
@@ -829,7 +829,7 @@
jtreg: {
server: "javare",
revision: "4.2",
- build_number: "b10",
+ build_number: "b11",
checksum_file: "MD5_VALUES",
file: "jtreg_bin-4.2.zip",
environment_name: "JT_HOME",
--- a/make/copy/Copy-java.base.gmk Sun Jan 14 21:46:14 2018 -0800
+++ b/make/copy/Copy-java.base.gmk Tue Jan 16 22:24:20 2018 +0000
@@ -24,6 +24,7 @@
#
include CopyCommon.gmk
+include TextFileProcessing.gmk
$(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk))
@@ -244,3 +245,16 @@
endif
################################################################################
+# Generate classfile_constants.h
+
+$(eval $(call SetupTextFileProcessing, CREATE_CLASSFILE_CONSTANTS_H, \
+ SOURCE_FILES := $(TOPDIR)/src/java.base/share/native/include/classfile_constants.h.template, \
+ OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/modules_include/java.base/classfile_constants.h, \
+ REPLACEMENTS := \
+ @@VERSION_CLASSFILE_MAJOR@@ => $(VERSION_CLASSFILE_MAJOR) ; \
+ @@VERSION_CLASSFILE_MINOR@@ => $(VERSION_CLASSFILE_MINOR) ; , \
+))
+
+TARGETS += $(CREATE_CLASSFILE_CONSTANTS_H)
+
+################################################################################
--- a/make/copy/CopyCommon.gmk Sun Jan 14 21:46:14 2018 -0800
+++ b/make/copy/CopyCommon.gmk Tue Jan 16 22:24:20 2018 +0000
@@ -39,20 +39,12 @@
$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE, \
SRC := $(INCLUDE_SOURCE_DIR), \
DEST := $(INCLUDE_TARGET_DIR), \
- FILES := $(shell $(FIND) $(INCLUDE_SOURCE_DIR) -type f), \
+ FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_DIR))), \
))
TARGETS += $(COPY_EXPORTED_INCLUDE)
endif
-# For historical reasons, the OS include directories have odd names.
-INCLUDE_TARGET_OS_SUBDIR := $(OPENJDK_TARGET_OS)
-ifeq ($(OPENJDK_TARGET_OS), windows)
- INCLUDE_TARGET_OS_SUBDIR := win32
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
- INCLUDE_TARGET_OS_SUBDIR := darwin
-endif
-
# Use the most specific of OS and OS_TYPE.
INCLUDE_SOURCE_OS_DIR := $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS)/native/include
ifeq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
@@ -62,8 +54,8 @@
ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
$(eval $(call SetupCopyFiles, COPY_EXPORTED_INCLUDE_OS, \
SRC := $(INCLUDE_SOURCE_OS_DIR), \
- DEST := $(INCLUDE_TARGET_DIR)/$(INCLUDE_TARGET_OS_SUBDIR), \
- FILES := $(shell $(FIND) $(INCLUDE_SOURCE_OS_DIR) -type f), \
+ DEST := $(INCLUDE_TARGET_DIR)/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR), \
+ FILES := $(filter %.h, $(call CacheFind, $(INCLUDE_SOURCE_OS_DIR))), \
))
TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
--- a/make/gensrc/GensrcX11Wrappers.gmk Sun Jan 14 21:46:14 2018 -0800
+++ b/make/gensrc/GensrcX11Wrappers.gmk Tue Jan 16 22:24:20 2018 +0000
@@ -92,10 +92,10 @@
endif
SIZER_CFLAGS := \
- -I${TOPDIR}/src/hotspot/share/include \
- -I${TOPDIR}/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
- -I$(TOPDIR)/src/java.base/share/native/include \
- -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
+ -I$(TOPDIR)/src/hotspot/share/include \
+ -I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
+ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
+ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I$(TOPDIR)/src/java.base/share/native/libjava \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
--- a/make/hotspot/lib/CompileJvm.gmk Sun Jan 14 21:46:14 2018 -0800
+++ b/make/hotspot/lib/CompileJvm.gmk Tue Jan 16 22:24:20 2018 +0000
@@ -59,8 +59,8 @@
-I$(TOPDIR)/src/hotspot/share/precompiled \
-I$(TOPDIR)/src/hotspot/share/include \
-I$(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include \
- -I$(TOPDIR)/src/java.base/share/native/include \
- -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include \
+ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
+ -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I$(TOPDIR)/src/java.base/share/native/libjimage \
#
--- a/make/mapfiles/libjava/mapfile-vers Sun Jan 14 21:46:14 2018 -0800
+++ b/make/mapfiles/libjava/mapfile-vers Tue Jan 16 22:24:20 2018 +0000
@@ -258,7 +258,6 @@
Java_jdk_internal_reflect_NativeConstructorAccessorImpl_newInstance0;
Java_jdk_internal_reflect_NativeMethodAccessorImpl_invoke0;
Java_jdk_internal_reflect_Reflection_getCallerClass__;
- Java_jdk_internal_reflect_Reflection_getCallerClass__I;
Java_jdk_internal_reflect_Reflection_getClassAccessFlags;
Java_jdk_internal_misc_VM_latestUserDefinedLoader0;
Java_jdk_internal_misc_VM_getuid;
--- a/make/mapfiles/libjava/reorder-sparc Sun Jan 14 21:46:14 2018 -0800
+++ b/make/mapfiles/libjava/reorder-sparc Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,6 @@
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
-text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_Object_getClass;
text: .text%Java_sun_reflect_Reflection_getClassAccessFlags;
--- a/make/mapfiles/libjava/reorder-sparcv9 Sun Jan 14 21:46:14 2018 -0800
+++ b/make/mapfiles/libjava/reorder-sparcv9 Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,6 @@
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
-text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
text: .text%Java_java_lang_StringUTF16_isBigEndian;
--- a/make/mapfiles/libjava/reorder-x86 Sun Jan 14 21:46:14 2018 -0800
+++ b/make/mapfiles/libjava/reorder-x86 Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,6 @@
text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass__;
-text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern;
text: .text%Java_java_lang_StringUTF16_isBigEndian;
--- a/src/hotspot/cpu/aarch64/aarch64.ad Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/aarch64.ad Tue Jan 16 22:24:20 2018 +0000
@@ -5844,8 +5844,8 @@
operand immByteMapBase()
%{
// Get base of card map
- predicate((jbyte*)n->get_ptr() ==
- ((CardTableModRefBS*)(Universe::heap()->barrier_set()))->byte_map_base);
+ predicate(Universe::heap()->barrier_set()->is_a(BarrierSet::CardTableModRef) &&
+ (jbyte*)n->get_ptr() == ((CardTableModRefBS*)(Universe::heap()->barrier_set()))->byte_map_base);
match(ConP);
op_cost(0);
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -848,7 +848,7 @@
// architecture. In debug mode we shrink it in order to test
// trampolines, but not so small that branches in the interpreter
// are out of range.
- static const unsigned long branch_range = INCLUDE_JVMCI ? 128 * M : NOT_DEBUG(128 * M) DEBUG_ONLY(2 * M);
+ static const unsigned long branch_range = NOT_DEBUG(128 * M) DEBUG_ONLY(2 * M);
static bool reachable_from_branch_at(address branch, address target) {
return uabs(target - branch) < branch_range;
--- a/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/compiledIC_aarch64.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -71,6 +71,13 @@
return 7 * NativeInstruction::instruction_size;
}
+int CompiledStaticCall::to_trampoline_stub_size() {
+ // Somewhat pessimistically, we count 3 instructions here (although
+ // there are only two) because we sometimes emit an alignment nop.
+ // Trampoline stubs are always word aligned.
+ return 3 * NativeInstruction::instruction_size + wordSize;
+}
+
// Relocation entries for call stub, compiled java to interpreter.
int CompiledStaticCall::reloc_to_interp_stub() {
return 4; // 3 in emit_to_interp_stub + 1 in emit_call
--- a/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -109,7 +109,7 @@
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
}
-void CodeInstaller::pd_relocate_JavaMethod(Handle hotspot_method, jint pc_offset, TRAPS) {
+void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, Handle hotspot_method, jint pc_offset, TRAPS) {
#ifdef ASSERT
Method* method = NULL;
// we need to check, this might also be an unresolved method
@@ -124,22 +124,22 @@
case INVOKEINTERFACE: {
assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
- call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
_instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc));
+ call->trampoline_jump(cbuf, SharedRuntime::get_resolve_virtual_call_stub());
break;
}
case INVOKESTATIC: {
assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
- call->set_destination(SharedRuntime::get_resolve_static_call_stub());
_instructions->relocate(call->instruction_address(), relocInfo::static_call_type);
+ call->trampoline_jump(cbuf, SharedRuntime::get_resolve_static_call_stub());
break;
}
case INVOKESPECIAL: {
assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
- call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
_instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type);
+ call->trampoline_jump(cbuf, SharedRuntime::get_resolve_opt_virtual_call_stub());
break;
}
default:
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -801,7 +801,7 @@
assert(is_NativeCallTrampolineStub_at(stub_start_addr), "doesn't look like a trampoline");
end_a_stub();
- return stub;
+ return stub_start_addr;
}
address MacroAssembler::ic_call(address entry, jint method_index) {
--- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -367,3 +367,24 @@
set_ptr_at(data_offset, new_destination);
OrderAccess::release();
}
+
+// Generate a trampoline for a branch to dest. If there's no need for a
+// trampoline, simply patch the call directly to dest.
+address NativeCall::trampoline_jump(CodeBuffer &cbuf, address dest) {
+ MacroAssembler a(&cbuf);
+ address stub = NULL;
+
+ if (a.far_branches()
+ && ! is_NativeCallTrampolineStub_at(instruction_address() + displacement())) {
+ stub = a.emit_trampoline_stub(instruction_address() - cbuf.insts()->start(), dest);
+ }
+
+ if (stub == NULL) {
+ // If we generated no stub, patch this call directly to dest.
+ // This will happen if we don't need far branches or if there
+ // already was a trampoline.
+ set_destination(dest);
+ }
+
+ return stub;
+}
--- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -61,7 +61,7 @@
return uint_at(0);
}
- bool is_blr() const { return (encoding() & 0xfffffc1f) == 0xd63f0000; }
+ bool is_blr() const { return (encoding() & 0xff9ffc1f) == 0xd61f0000; } // blr(register) or br(register)
bool is_adr_aligned() const { return (encoding() & 0xff000000) == 0x10000000; } // adr Xn, <label>, where label is aligned to 4 bytes (address of instruction).
inline bool is_nop();
@@ -143,8 +143,9 @@
}
inline NativeCall* nativeCall_at(address address);
-// The NativeCall is an abstraction for accessing/manipulating native call imm32/rel32off
-// instructions (used to manipulate inline caches, primitive & dll calls, etc.).
+// The NativeCall is an abstraction for accessing/manipulating native
+// call instructions (used to manipulate inline caches, primitive &
+// DSO calls, etc.).
class NativeCall: public NativeInstruction {
public:
@@ -155,7 +156,6 @@
return_address_offset = 4
};
- enum { cache_line_size = BytesPerWord }; // conservative estimate!
address instruction_address() const { return addr_at(instruction_offset); }
address next_instruction_address() const { return addr_at(return_address_offset); }
int displacement() const { return (int_at(displacement_offset) << 6) >> 4; }
@@ -206,6 +206,7 @@
void set_destination_mt_safe(address dest, bool assert_lock = true);
address get_trampoline();
+ address trampoline_jump(CodeBuffer &cbuf, address dest);
};
inline NativeCall* nativeCall_at(address address) {
--- a/src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/relocInfo_aarch64.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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.
*
@@ -35,4 +35,10 @@
format_width = 0
};
+ public:
+
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
+
#endif // CPU_AARCH64_VM_RELOCINFO_AARCH64_HPP
--- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -3404,7 +3404,6 @@
Label done;
Label initialize_header;
Label initialize_object; // including clearing the fields
- Label allocate_shared;
__ get_cpool_and_tags(r4, r0);
// Make sure the class we're about to instantiate has been resolved.
@@ -3433,18 +3432,24 @@
// test to see if it has a finalizer or is malformed in some way
__ tbnz(r3, exact_log2(Klass::_lh_instance_slow_path_bit), slow_case);
- // Allocate the instance
- // 1) Try to allocate in the TLAB
- // 2) if fail and the object is large allocate in the shared Eden
- // 3) if the above fails (or is not applicable), go to a slow case
- // (creates a new TLAB, etc.)
-
+ // Allocate the instance:
+ // If TLAB is enabled:
+ // Try to allocate in the TLAB.
+ // If fails, go to the slow path.
+ // Else If inline contiguous allocations are enabled:
+ // Try to allocate in eden.
+ // If fails due to heap end, go to slow path.
+ //
+ // If TLAB is enabled OR inline contiguous is enabled:
+ // Initialize the allocation.
+ // Exit.
+ //
+ // Go to slow path.
const bool allow_shared_alloc =
Universe::heap()->supports_inline_contig_alloc();
if (UseTLAB) {
- __ tlab_allocate(r0, r3, 0, noreg, r1,
- allow_shared_alloc ? allocate_shared : slow_case);
+ __ tlab_allocate(r0, r3, 0, noreg, r1, slow_case);
if (ZeroTLAB) {
// the fields have been already cleared
@@ -3453,19 +3458,19 @@
// initialize both the header and fields
__ b(initialize_object);
}
+ } else {
+ // Allocation in the shared Eden, if allowed.
+ //
+ // r3: instance size in bytes
+ if (allow_shared_alloc) {
+ __ eden_allocate(r0, r3, 0, r10, slow_case);
+ __ incr_allocated_bytes(rthread, r3, 0, rscratch1);
+ }
}
- // Allocation in the shared Eden, if allowed.
- //
- // r3: instance size in bytes
- if (allow_shared_alloc) {
- __ bind(allocate_shared);
-
- __ eden_allocate(r0, r3, 0, r10, slow_case);
- __ incr_allocated_bytes(rthread, r3, 0, rscratch1);
- }
-
- if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
+ // If UseTLAB or allow_shared_alloc are true, the object is created above and
+ // there is an initialize need. Otherwise, skip and go to the slow path.
+ if (UseTLAB || allow_shared_alloc) {
// The object is initialized before the header. If the object size is
// zero, go directly to the header initialization.
__ bind(initialize_object);
--- a/src/hotspot/cpu/arm/relocInfo_arm.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/arm/relocInfo_arm.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,4 +32,10 @@
format_width = 0
};
+ public:
+
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
+
#endif // CPU_ARM_VM_RELOCINFO_ARM_HPP
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -5601,12 +5601,17 @@
#endif // !PRODUCT
-SkipIfEqualZero::SkipIfEqualZero(MacroAssembler* masm, Register temp, const bool* flag_addr) : _masm(masm), _label() {
+void SkipIfEqualZero::skip_to_label_if_equal_zero(MacroAssembler* masm, Register temp,
+ const bool* flag_addr, Label& label) {
int simm16_offset = masm->load_const_optimized(temp, (address)flag_addr, R0, true);
assert(sizeof(bool) == 1, "PowerPC ABI");
masm->lbz(temp, simm16_offset, temp);
masm->cmpwi(CCR0, temp, 0);
- masm->beq(CCR0, _label);
+ masm->beq(CCR0, label);
+}
+
+SkipIfEqualZero::SkipIfEqualZero(MacroAssembler* masm, Register temp, const bool* flag_addr) : _masm(masm), _label() {
+ skip_to_label_if_equal_zero(masm, temp, flag_addr, _label);
}
SkipIfEqualZero::~SkipIfEqualZero() {
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -979,6 +979,8 @@
public:
// 'Temp' is a temp register that this object can use (and trash).
explicit SkipIfEqualZero(MacroAssembler*, Register temp, const bool* flag_addr);
+ static void skip_to_label_if_equal_zero(MacroAssembler*, Register temp,
+ const bool* flag_addr, Label& label);
~SkipIfEqualZero();
};
--- a/src/hotspot/cpu/ppc/relocInfo_ppc.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/ppc/relocInfo_ppc.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,4 +43,10 @@
#endif
};
+ public:
+
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
+
#endif // CPU_PPC_VM_RELOCINFO_PPC_HPP
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -3634,10 +3634,7 @@
transition(vtos, atos);
Label Lslow_case,
- Ldone,
- Linitialize_header,
- Lallocate_shared,
- Linitialize_object; // Including clearing the fields.
+ Ldone;
const Register RallocatedObject = R17_tos,
RinstanceKlass = R9_ARG7,
@@ -3648,8 +3645,6 @@
Rtags = R3_ARG1,
Rindex = R5_ARG3;
- const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc();
-
// --------------------------------------------------------------------------
// Check if fast case is possible.
@@ -3658,6 +3653,8 @@
// Load index of constant pool entry.
__ get_2_byte_integer_at_bcp(1, Rindex, InterpreterMacroAssembler::Unsigned);
+ // Note: compared to other architectures, PPC's implementation always goes
+ // to the slow path if TLAB is used and fails.
if (UseTLAB) {
// Make sure the class we're about to instantiate has been resolved
// This is done before loading instanceKlass to be consistent with the order
@@ -3687,8 +3684,7 @@
// Fast case:
// Allocate the instance.
// 1) Try to allocate in the TLAB.
- // 2) If fail, and the TLAB is not full enough to discard, allocate in the shared Eden.
- // 3) If the above fails (or is not applicable), go to a slow case (creates a new TLAB, etc.).
+ // 2) If the above fails (or is not applicable), go to a slow case (creates a new TLAB, etc.).
Register RoldTopValue = RallocatedObject; // Object will be allocated here if it fits.
Register RnewTopValue = R6_ARG4;
@@ -3702,53 +3698,13 @@
// If there is enough space, we do not CAS and do not clear.
__ cmpld(CCR0, RnewTopValue, RendValue);
- __ bgt(CCR0, allow_shared_alloc ? Lallocate_shared : Lslow_case);
+ __ bgt(CCR0, Lslow_case);
__ std(RnewTopValue, in_bytes(JavaThread::tlab_top_offset()), R16_thread);
- if (ZeroTLAB) {
- // The fields have already been cleared.
- __ b(Linitialize_header);
- } else {
- // Initialize both the header and fields.
- __ b(Linitialize_object);
- }
-
- // Fall through: TLAB was too small.
- if (allow_shared_alloc) {
- Register RtlabWasteLimitValue = R10_ARG8;
- Register RfreeValue = RnewTopValue;
-
- __ bind(Lallocate_shared);
- // Check if tlab should be discarded (refill_waste_limit >= free).
- __ ld(RtlabWasteLimitValue, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), R16_thread);
- __ subf(RfreeValue, RoldTopValue, RendValue);
- __ srdi(RfreeValue, RfreeValue, LogHeapWordSize); // in dwords
- __ cmpld(CCR0, RtlabWasteLimitValue, RfreeValue);
- __ bge(CCR0, Lslow_case);
-
- // Increment waste limit to prevent getting stuck on this slow path.
- __ add_const_optimized(RtlabWasteLimitValue, RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment());
- __ std(RtlabWasteLimitValue, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), R16_thread);
- }
- // else: No allocation in the shared eden. // fallthru: __ b(Lslow_case);
- }
- // else: Always go the slow path.
-
- // --------------------------------------------------------------------------
- // slow case
- __ bind(Lslow_case);
- call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), Rcpool, Rindex);
-
- if (UseTLAB) {
- __ b(Ldone);
- // --------------------------------------------------------------------------
- // Init1: Zero out newly allocated memory.
-
- if (!ZeroTLAB || allow_shared_alloc) {
- // Clear object fields.
- __ bind(Linitialize_object);
-
+ if (!ZeroTLAB) {
+ // --------------------------------------------------------------------------
+ // Init1: Zero out newly allocated memory.
// Initialize remaining object fields.
Register Rbase = Rtags;
__ addi(Rinstance_size, Rinstance_size, 7 - (int)sizeof(oopDesc));
@@ -3757,13 +3713,10 @@
// Clear out object skipping header. Takes also care of the zero length case.
__ clear_memory_doubleword(Rbase, Rinstance_size);
- // fallthru: __ b(Linitialize_header);
}
// --------------------------------------------------------------------------
// Init2: Initialize the header: mark, klass
- __ bind(Linitialize_header);
-
// Init mark.
if (UseBiasedLocking) {
__ ld(Rscratch, in_bytes(Klass::prototype_header_offset()), RinstanceKlass);
@@ -3777,14 +3730,19 @@
__ store_klass(RallocatedObject, RinstanceKlass, Rscratch); // klass (last for cms)
// Check and trigger dtrace event.
- {
- SkipIfEqualZero skip_if(_masm, Rscratch, &DTraceAllocProbes);
- __ push(atos);
- __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc));
- __ pop(atos);
- }
+ SkipIfEqualZero::skip_to_label_if_equal_zero(_masm, Rscratch, &DTraceAllocProbes, Ldone);
+ __ push(atos);
+ __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc));
+ __ pop(atos);
+
+ __ b(Ldone);
}
+ // --------------------------------------------------------------------------
+ // slow case
+ __ bind(Lslow_case);
+ call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), Rcpool, Rindex);
+
// continue
__ bind(Ldone);
--- a/src/hotspot/cpu/s390/relocInfo_s390.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/s390/relocInfo_s390.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016 SAP SE. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018 SAP SE. 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
@@ -110,6 +110,10 @@
pcrel_data_format = 3 // Relocation is for the target data of a pc-relative instruction.
};
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
+
// Store the new target address into an oop_Relocation cell, if any.
// Return indication if update happened.
static bool update_oop_pool(address begin, address end, address newTarget, CodeBlob* cb);
--- a/src/hotspot/cpu/sparc/compiledIC_sparc.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/sparc/compiledIC_sparc.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -73,6 +73,11 @@
}
#undef __
+int CompiledStaticCall::to_trampoline_stub_size() {
+ // SPARC doesn't use trampolines.
+ return 0;
+}
+
int CompiledStaticCall::to_interp_stub_size() {
// This doesn't need to be accurate but it must be larger or equal to
// the real size of the stub.
--- a/src/hotspot/cpu/sparc/jvmciCodeInstaller_sparc.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/sparc/jvmciCodeInstaller_sparc.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -115,7 +115,7 @@
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
}
-void CodeInstaller::pd_relocate_JavaMethod(Handle hotspot_method, jint pc_offset, TRAPS) {
+void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, Handle hotspot_method, jint pc_offset, TRAPS) {
#ifdef ASSERT
Method* method = NULL;
// we need to check, this might also be an unresolved method
--- a/src/hotspot/cpu/sparc/relocInfo_sparc.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/sparc/relocInfo_sparc.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,11 @@
format_width = 1
};
+ public:
+
+ // This platform has no oops in the code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return false; }
//Reconciliation History
// 1.3 97/10/15 15:38:36 relocInfo_i486.hpp
--- a/src/hotspot/cpu/sparc/templateTable_sparc.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/sparc/templateTable_sparc.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -3270,11 +3270,19 @@
__ br(Assembler::notZero, false, Assembler::pn, slow_case);
__ delayed()->nop();
- // allocate the instance
- // 1) Try to allocate in the TLAB
- // 2) if fail, and the TLAB is not full enough to discard, allocate in the shared Eden
- // 3) if the above fails (or is not applicable), go to a slow case
- // (creates a new TLAB, etc.)
+ // Allocate the instance:
+ // If TLAB is enabled:
+ // Try to allocate in the TLAB.
+ // If fails, go to the slow path.
+ // Else If inline contiguous allocations are enabled:
+ // Try to allocate in eden.
+ // If fails due to heap end, go to slow path.
+ //
+ // If TLAB is enabled OR inline contiguous is enabled:
+ // Initialize the allocation.
+ // Exit.
+ //
+ // Go to slow path.
const bool allow_shared_alloc =
Universe::heap()->supports_inline_contig_alloc();
@@ -3302,61 +3310,43 @@
}
__ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset()));
+ // Allocation does not fit in the TLAB.
+ __ ba_short(slow_case);
+ } else {
+ // Allocation in the shared Eden
if (allow_shared_alloc) {
- // Check if tlab should be discarded (refill_waste_limit >= free)
- __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
- __ sub(RendValue, RoldTopValue, RfreeValue);
- __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
- __ cmp_and_brx_short(RtlabWasteLimitValue, RfreeValue, Assembler::greaterEqualUnsigned, Assembler::pt, slow_case); // tlab waste is small
-
- // increment waste limit to prevent getting stuck on this slow path
- if (Assembler::is_simm13(ThreadLocalAllocBuffer::refill_waste_limit_increment())) {
- __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
- } else {
- // set64 does not use the temp register if the given constant is 32 bit. So
- // we can just use any register; using G0 results in ignoring of the upper 32 bit
- // of that value.
- __ set64(ThreadLocalAllocBuffer::refill_waste_limit_increment(), G4_scratch, G0);
- __ add(RtlabWasteLimitValue, G4_scratch, RtlabWasteLimitValue);
- }
- __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
- } else {
- // No allocation in the shared eden.
- __ ba_short(slow_case);
+ Register RoldTopValue = G1_scratch;
+ Register RtopAddr = G3_scratch;
+ Register RnewTopValue = RallocatedObject;
+ Register RendValue = Rscratch;
+
+ __ set((intptr_t)Universe::heap()->top_addr(), RtopAddr);
+
+ Label retry;
+ __ bind(retry);
+ __ set((intptr_t)Universe::heap()->end_addr(), RendValue);
+ __ ld_ptr(RendValue, 0, RendValue);
+ __ ld_ptr(RtopAddr, 0, RoldTopValue);
+ __ add(RoldTopValue, Roffset, RnewTopValue);
+
+ // RnewTopValue contains the top address after the new object
+ // has been allocated.
+ __ cmp_and_brx_short(RnewTopValue, RendValue, Assembler::greaterUnsigned, Assembler::pn, slow_case);
+
+ __ cas_ptr(RtopAddr, RoldTopValue, RnewTopValue);
+
+ // if someone beat us on the allocation, try again, otherwise continue
+ __ cmp_and_brx_short(RoldTopValue, RnewTopValue, Assembler::notEqual, Assembler::pn, retry);
+
+ // bump total bytes allocated by this thread
+ // RoldTopValue and RtopAddr are dead, so can use G1 and G3
+ __ incr_allocated_bytes(Roffset, G1_scratch, G3_scratch);
}
}
- // Allocation in the shared Eden
- if (allow_shared_alloc) {
- Register RoldTopValue = G1_scratch;
- Register RtopAddr = G3_scratch;
- Register RnewTopValue = RallocatedObject;
- Register RendValue = Rscratch;
-
- __ set((intptr_t)Universe::heap()->top_addr(), RtopAddr);
-
- Label retry;
- __ bind(retry);
- __ set((intptr_t)Universe::heap()->end_addr(), RendValue);
- __ ld_ptr(RendValue, 0, RendValue);
- __ ld_ptr(RtopAddr, 0, RoldTopValue);
- __ add(RoldTopValue, Roffset, RnewTopValue);
-
- // RnewTopValue contains the top address after the new object
- // has been allocated.
- __ cmp_and_brx_short(RnewTopValue, RendValue, Assembler::greaterUnsigned, Assembler::pn, slow_case);
-
- __ cas_ptr(RtopAddr, RoldTopValue, RnewTopValue);
-
- // if someone beat us on the allocation, try again, otherwise continue
- __ cmp_and_brx_short(RoldTopValue, RnewTopValue, Assembler::notEqual, Assembler::pn, retry);
-
- // bump total bytes allocated by this thread
- // RoldTopValue and RtopAddr are dead, so can use G1 and G3
- __ incr_allocated_bytes(Roffset, G1_scratch, G3_scratch);
- }
-
- if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
+ // If UseTLAB or allow_shared_alloc are true, the object is created above and
+ // there is an initialize need. Otherwise, skip and go to the slow path.
+ if (UseTLAB || allow_shared_alloc) {
// clear object fields
__ bind(initialize_object);
__ deccc(Roffset, sizeof(oopDesc));
--- a/src/hotspot/cpu/x86/assembler_x86.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/assembler_x86.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -3167,6 +3167,89 @@
return;
}
+ if (UseAddressNop && VM_Version::is_zx()) {
+ //
+ // Using multi-bytes nops "0x0F 0x1F [address]" for ZX
+ // 1: 0x90
+ // 2: 0x66 0x90
+ // 3: 0x66 0x66 0x90 (don't use "0x0F 0x1F 0x00" - need patching safe padding)
+ // 4: 0x0F 0x1F 0x40 0x00
+ // 5: 0x0F 0x1F 0x44 0x00 0x00
+ // 6: 0x66 0x0F 0x1F 0x44 0x00 0x00
+ // 7: 0x0F 0x1F 0x80 0x00 0x00 0x00 0x00
+ // 8: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
+ // 9: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
+ // 10: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
+ // 11: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00
+
+ // The rest coding is ZX specific - don't use consecutive address nops
+
+ // 12: 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
+ // 13: 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
+ // 14: 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
+ // 15: 0x66 0x66 0x66 0x0F 0x1F 0x84 0x00 0x00 0x00 0x00 0x00 0x66 0x66 0x66 0x90
+
+ while (i >= 15) {
+ // For ZX don't generate consecutive addess nops (mix with regular nops)
+ i -= 15;
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ addr_nop_8();
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8((unsigned char)0x90);
+ // nop
+ }
+ switch (i) {
+ case 14:
+ emit_int8(0x66); // size prefix
+ case 13:
+ emit_int8(0x66); // size prefix
+ case 12:
+ addr_nop_8();
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8(0x66); // size prefix
+ emit_int8((unsigned char)0x90);
+ // nop
+ break;
+ case 11:
+ emit_int8(0x66); // size prefix
+ case 10:
+ emit_int8(0x66); // size prefix
+ case 9:
+ emit_int8(0x66); // size prefix
+ case 8:
+ addr_nop_8();
+ break;
+ case 7:
+ addr_nop_7();
+ break;
+ case 6:
+ emit_int8(0x66); // size prefix
+ case 5:
+ addr_nop_5();
+ break;
+ case 4:
+ addr_nop_4();
+ break;
+ case 3:
+ // Don't use "0x0F 0x1F 0x00" - need patching safe padding
+ emit_int8(0x66); // size prefix
+ case 2:
+ emit_int8(0x66); // size prefix
+ case 1:
+ emit_int8((unsigned char)0x90);
+ // nop
+ break;
+ default:
+ assert(i == 0, " ");
+ }
+ return;
+ }
+
// Using nops with size prefixes "0x66 0x90".
// From AMD Optimization Guide:
// 1: 0x90
--- a/src/hotspot/cpu/x86/compiledIC_x86.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/compiledIC_x86.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -73,6 +73,11 @@
LP64_ONLY(15); // movq (1+1+8); jmp (1+4)
}
+int CompiledStaticCall::to_trampoline_stub_size() {
+ // x86 doesn't use trampolines.
+ return 0;
+}
+
// Relocation entries for call stub, compiled java to interpreter.
int CompiledStaticCall::reloc_to_interp_stub() {
return 4; // 3 in emit_to_interp_stub + 1 in emit_call
--- a/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -144,7 +144,7 @@
TRACE_jvmci_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
}
-void CodeInstaller::pd_relocate_JavaMethod(Handle hotspot_method, jint pc_offset, TRAPS) {
+void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, Handle hotspot_method, jint pc_offset, TRAPS) {
#ifdef ASSERT
Method* method = NULL;
// we need to check, this might also be an unresolved method
--- a/src/hotspot/cpu/x86/relocInfo_x86.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/relocInfo_x86.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -40,4 +40,10 @@
#endif
};
+ public:
+
+ // Instruct loadConP of x86_64.ad places oops in code that are not also
+ // listed in the oop section.
+ static bool mustIterateImmediateOopsInCode() { return true; }
+
#endif // CPU_X86_VM_RELOCINFO_X86_HPP
--- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -433,7 +433,7 @@
//----------------------------------------------------------------------------------------------------
- // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest)
+ // Support for int32_t Atomic::xchg(int32_t exchange_value, volatile int32_t* dest)
//
// xchg exists as far back as 8086, lock needed for MP only
// Stack layout immediately after call:
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -611,8 +611,8 @@
return start;
}
- // Support for jbyte atomic::atomic_cmpxchg(jbyte exchange_value, volatile jbyte* dest,
- // jbyte compare_value)
+ // Support for int8_t atomic::atomic_cmpxchg(int8_t exchange_value, volatile int8_t* dest,
+ // int8_t compare_value)
//
// Arguments :
// c_rarg0: exchange_value
@@ -637,9 +637,9 @@
return start;
}
- // Support for jlong atomic::atomic_cmpxchg(jlong exchange_value,
- // volatile jlong* dest,
- // jlong compare_value)
+ // Support for int64_t atomic::atomic_cmpxchg(int64_t exchange_value,
+ // volatile int64_t* dest,
+ // int64_t compare_value)
// Arguments :
// c_rarg0: exchange_value
// c_rarg1: dest
@@ -694,8 +694,8 @@
// Result:
// *dest += add_value
// return *dest;
- address generate_atomic_add_ptr() {
- StubCodeMark mark(this, "StubRoutines", "atomic_add_ptr");
+ address generate_atomic_add_long() {
+ StubCodeMark mark(this, "StubRoutines", "atomic_add_long");
address start = __ pc();
__ movptr(rax, c_rarg0); // Copy to eax we need a return value anyhow
@@ -5015,14 +5015,14 @@
StubRoutines::_catch_exception_entry = generate_catch_exception();
// atomic calls
- StubRoutines::_atomic_xchg_entry = generate_atomic_xchg();
- StubRoutines::_atomic_xchg_long_entry = generate_atomic_xchg_long();
- StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg();
- StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte();
- StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
- StubRoutines::_atomic_add_entry = generate_atomic_add();
- StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr();
- StubRoutines::_fence_entry = generate_orderaccess_fence();
+ StubRoutines::_atomic_xchg_entry = generate_atomic_xchg();
+ StubRoutines::_atomic_xchg_long_entry = generate_atomic_xchg_long();
+ StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg();
+ StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte();
+ StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
+ StubRoutines::_atomic_add_entry = generate_atomic_add();
+ StubRoutines::_atomic_add_long_entry = generate_atomic_add_long();
+ StubRoutines::_fence_entry = generate_orderaccess_fence();
// platform dependent
StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp();
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -3851,7 +3851,6 @@
Label done;
Label initialize_header;
Label initialize_object; // including clearing the fields
- Label allocate_shared;
__ get_cpool_and_tags(rcx, rax);
@@ -3877,12 +3876,19 @@
__ testl(rdx, Klass::_lh_instance_slow_path_bit);
__ jcc(Assembler::notZero, slow_case);
+ // Allocate the instance:
+ // If TLAB is enabled:
+ // Try to allocate in the TLAB.
+ // If fails, go to the slow path.
+ // Else If inline contiguous allocations are enabled:
+ // Try to allocate in eden.
+ // If fails due to heap end, go to slow path.
//
- // Allocate the instance
- // 1) Try to allocate in the TLAB
- // 2) if fail and the object is large allocate in the shared Eden
- // 3) if the above fails (or is not applicable), go to a slow case
- // (creates a new TLAB, etc.)
+ // If TLAB is enabled OR inline contiguous is enabled:
+ // Initialize the allocation.
+ // Exit.
+ //
+ // Go to slow path.
const bool allow_shared_alloc =
Universe::heap()->supports_inline_contig_alloc();
@@ -3898,7 +3904,7 @@
__ movptr(rax, Address(thread, in_bytes(JavaThread::tlab_top_offset())));
__ lea(rbx, Address(rax, rdx, Address::times_1));
__ cmpptr(rbx, Address(thread, in_bytes(JavaThread::tlab_end_offset())));
- __ jcc(Assembler::above, allow_shared_alloc ? allocate_shared : slow_case);
+ __ jcc(Assembler::above, slow_case);
__ movptr(Address(thread, in_bytes(JavaThread::tlab_top_offset())), rbx);
if (ZeroTLAB) {
// the fields have been already cleared
@@ -3907,40 +3913,40 @@
// initialize both the header and fields
__ jmp(initialize_object);
}
+ } else {
+ // Allocation in the shared Eden, if allowed.
+ //
+ // rdx: instance size in bytes
+ if (allow_shared_alloc) {
+ ExternalAddress heap_top((address)Universe::heap()->top_addr());
+ ExternalAddress heap_end((address)Universe::heap()->end_addr());
+
+ Label retry;
+ __ bind(retry);
+ __ movptr(rax, heap_top);
+ __ lea(rbx, Address(rax, rdx, Address::times_1));
+ __ cmpptr(rbx, heap_end);
+ __ jcc(Assembler::above, slow_case);
+
+ // Compare rax, with the top addr, and if still equal, store the new
+ // top addr in rbx, at the address of the top addr pointer. Sets ZF if was
+ // equal, and clears it otherwise. Use lock prefix for atomicity on MPs.
+ //
+ // rax,: object begin
+ // rbx,: object end
+ // rdx: instance size in bytes
+ __ locked_cmpxchgptr(rbx, heap_top);
+
+ // if someone beat us on the allocation, try again, otherwise continue
+ __ jcc(Assembler::notEqual, retry);
+
+ __ incr_allocated_bytes(thread, rdx, 0);
+ }
}
- // Allocation in the shared Eden, if allowed.
- //
- // rdx: instance size in bytes
- if (allow_shared_alloc) {
- __ bind(allocate_shared);
-
- ExternalAddress heap_top((address)Universe::heap()->top_addr());
- ExternalAddress heap_end((address)Universe::heap()->end_addr());
-
- Label retry;
- __ bind(retry);
- __ movptr(rax, heap_top);
- __ lea(rbx, Address(rax, rdx, Address::times_1));
- __ cmpptr(rbx, heap_end);
- __ jcc(Assembler::above, slow_case);
-
- // Compare rax, with the top addr, and if still equal, store the new
- // top addr in rbx, at the address of the top addr pointer. Sets ZF if was
- // equal, and clears it otherwise. Use lock prefix for atomicity on MPs.
- //
- // rax,: object begin
- // rbx,: object end
- // rdx: instance size in bytes
- __ locked_cmpxchgptr(rbx, heap_top);
-
- // if someone beat us on the allocation, try again, otherwise continue
- __ jcc(Assembler::notEqual, retry);
-
- __ incr_allocated_bytes(thread, rdx, 0);
- }
-
- if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
+ // If UseTLAB or allow_shared_alloc are true, the object is created above and
+ // there is an initialize need. Otherwise, skip and go to the slow path.
+ if (UseTLAB || allow_shared_alloc) {
// The object is initialized before the header. If the object size is
// zero, go directly to the header initialization.
__ bind(initialize_object);
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -628,6 +628,11 @@
if (UseSSE < 1)
_features &= ~CPU_SSE;
+ //since AVX instructions is slower than SSE in some ZX cpus, force USEAVX=0.
+ if (is_zx() && ((cpu_family() == 6) || (cpu_family() == 7))) {
+ UseAVX = 0;
+ }
+
// first try initial setting and detect what we can support
int use_avx_limit = 0;
if (UseAVX > 0) {
@@ -1078,6 +1083,66 @@
// UseXmmRegToRegMoveAll == true --> movaps(xmm, xmm), movapd(xmm, xmm).
// UseXmmRegToRegMoveAll == false --> movss(xmm, xmm), movsd(xmm, xmm).
+
+ if (is_zx()) { // ZX cpus specific settings
+ if (FLAG_IS_DEFAULT(UseStoreImmI16)) {
+ UseStoreImmI16 = false; // don't use it on ZX cpus
+ }
+ if ((cpu_family() == 6) || (cpu_family() == 7)) {
+ if (FLAG_IS_DEFAULT(UseAddressNop)) {
+ // Use it on all ZX cpus
+ UseAddressNop = true;
+ }
+ }
+ if (FLAG_IS_DEFAULT(UseXmmLoadAndClearUpper)) {
+ UseXmmLoadAndClearUpper = true; // use movsd on all ZX cpus
+ }
+ if (FLAG_IS_DEFAULT(UseXmmRegToRegMoveAll)) {
+ if (supports_sse3()) {
+ UseXmmRegToRegMoveAll = true; // use movaps, movapd on new ZX cpus
+ } else {
+ UseXmmRegToRegMoveAll = false;
+ }
+ }
+ if (((cpu_family() == 6) || (cpu_family() == 7)) && supports_sse3()) { // new ZX cpus
+#ifdef COMPILER2
+ if (FLAG_IS_DEFAULT(MaxLoopPad)) {
+ // For new ZX cpus do the next optimization:
+ // don't align the beginning of a loop if there are enough instructions
+ // left (NumberOfLoopInstrToAlign defined in c2_globals.hpp)
+ // in current fetch line (OptoLoopAlignment) or the padding
+ // is big (> MaxLoopPad).
+ // Set MaxLoopPad to 11 for new ZX cpus to reduce number of
+ // generated NOP instructions. 11 is the largest size of one
+ // address NOP instruction '0F 1F' (see Assembler::nop(i)).
+ MaxLoopPad = 11;
+ }
+#endif // COMPILER2
+ if (FLAG_IS_DEFAULT(UseXMMForArrayCopy)) {
+ UseXMMForArrayCopy = true; // use SSE2 movq on new ZX cpus
+ }
+ if (supports_sse4_2()) { // new ZX cpus
+ if (FLAG_IS_DEFAULT(UseUnalignedLoadStores)) {
+ UseUnalignedLoadStores = true; // use movdqu on newest ZX cpus
+ }
+ }
+ if (supports_sse4_2()) {
+ if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) {
+ FLAG_SET_DEFAULT(UseSSE42Intrinsics, true);
+ }
+ } else {
+ if (UseSSE42Intrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
+ warning("SSE4.2 intrinsics require SSE4.2 instructions or higher. Intrinsics will be disabled.");
+ }
+ FLAG_SET_DEFAULT(UseSSE42Intrinsics, false);
+ }
+ }
+
+ if (FLAG_IS_DEFAULT(AllocatePrefetchInstr) && supports_3dnow_prefetch()) {
+ FLAG_SET_DEFAULT(AllocatePrefetchInstr, 3);
+ }
+ }
+
if( is_amd() ) { // AMD cpus specific settings
if( supports_sse2() && FLAG_IS_DEFAULT(UseAddressNop) ) {
// Use it on new AMD cpus starting from Opteron.
@@ -1374,6 +1439,14 @@
#endif
}
+ if (is_zx() && ((cpu_family() == 6) || (cpu_family() == 7)) && supports_sse4_2()) {
+#ifdef COMPILER2
+ if (FLAG_IS_DEFAULT(UseFPUForSpilling)) {
+ FLAG_SET_DEFAULT(UseFPUForSpilling, true);
+ }
+#endif
+ }
+
#ifdef _LP64
// Prefetch settings
--- a/src/hotspot/cpu/x86/vm_version_x86.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/x86/vm_version_x86.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -305,6 +305,9 @@
enum Extended_Family {
// AMD
CPU_FAMILY_AMD_11H = 0x11,
+ // ZX
+ CPU_FAMILY_ZX_CORE_F6 = 6,
+ CPU_FAMILY_ZX_CORE_F7 = 7,
// Intel
CPU_FAMILY_INTEL_CORE = 6,
CPU_MODEL_NEHALEM = 0x1e,
@@ -549,6 +552,16 @@
}
}
+ // ZX features.
+ if (is_zx()) {
+ if (_cpuid_info.ext_cpuid1_ecx.bits.lzcnt_intel != 0)
+ result |= CPU_LZCNT;
+ // for ZX, ecx.bits.misalignsse bit (bit 8) indicates support for prefetchw
+ if (_cpuid_info.ext_cpuid1_ecx.bits.misalignsse != 0) {
+ result |= CPU_3DNOW_PREFETCH;
+ }
+ }
+
return result;
}
@@ -657,6 +670,7 @@
static bool is_P6() { return cpu_family() >= 6; }
static bool is_amd() { assert_is_initialized(); return _cpuid_info.std_vendor_name_0 == 0x68747541; } // 'htuA'
static bool is_intel() { assert_is_initialized(); return _cpuid_info.std_vendor_name_0 == 0x756e6547; } // 'uneG'
+ static bool is_zx() { assert_is_initialized(); return (_cpuid_info.std_vendor_name_0 == 0x746e6543) || (_cpuid_info.std_vendor_name_0 == 0x68532020); } // 'tneC'||'hS '
static bool is_atom_family() { return ((cpu_family() == 0x06) && ((extended_cpu_model() == 0x36) || (extended_cpu_model() == 0x37) || (extended_cpu_model() == 0x4D))); } //Silvermont and Centerton
static bool is_knights_family() { return ((cpu_family() == 0x06) && ((extended_cpu_model() == 0x57) || (extended_cpu_model() == 0x85))); } // Xeon Phi 3200/5200/7200 and Future Xeon Phi
@@ -680,6 +694,15 @@
}
} else if (is_amd()) {
result = (_cpuid_info.ext_cpuid8_ecx.bits.cores_per_cpu + 1);
+ } else if (is_zx()) {
+ bool supports_topology = supports_processor_topology();
+ if (supports_topology) {
+ result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
+ _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
+ }
+ if (!supports_topology || result == 0) {
+ result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
+ }
}
return result;
}
@@ -688,6 +711,8 @@
uint result = 1;
if (is_intel() && supports_processor_topology()) {
result = _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
+ } else if (is_zx() && supports_processor_topology()) {
+ result = _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
} else if (_cpuid_info.std_cpuid1_edx.bits.ht != 0) {
if (cpu_family() >= 0x17) {
result = _cpuid_info.ext_cpuid1E_ebx.bits.threads_per_core + 1;
@@ -705,6 +730,8 @@
result = (_cpuid_info.dcp_cpuid4_ebx.bits.L1_line_size + 1);
} else if (is_amd()) {
result = _cpuid_info.ext_cpuid5_ecx.bits.L1_line_size;
+ } else if (is_zx()) {
+ result = (_cpuid_info.dcp_cpuid4_ebx.bits.L1_line_size + 1);
}
if (result < 32) // not defined ?
result = 32; // 32 bytes by default on x86 and other x64
--- a/src/hotspot/cpu/zero/relocInfo_zero.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/zero/relocInfo_zero.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -34,4 +34,8 @@
format_width = 1
};
+ public:
+
+ static bool mustIterateImmediateOopsInCode() { return true; }
+
#endif // CPU_ZERO_VM_RELOCINFO_ZERO_HPP
--- a/src/hotspot/cpu/zero/stubGenerator_zero.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/cpu/zero/stubGenerator_zero.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -258,7 +258,7 @@
StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_add_entry = ShouldNotCallThisStub();
- StubRoutines::_atomic_add_ptr_entry = ShouldNotCallThisStub();
+ StubRoutines::_atomic_add_long_entry = ShouldNotCallThisStub();
StubRoutines::_fence_entry = ShouldNotCallThisStub();
}
--- a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -132,8 +132,8 @@
extern "C" {
// defined in bsd_x86.s
- jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
- void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst);
+ int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t, bool);
+ void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst);
}
template<>
@@ -143,15 +143,15 @@
T compare_value,
cmpxchg_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
- return cmpxchg_using_helper<jlong>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
+ return cmpxchg_using_helper<int64_t>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
}
template<>
template<typename T>
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
- volatile jlong dest;
- _Atomic_move_long(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+ volatile int64_t dest;
+ _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
return PrimitiveConversions::cast<T>(dest);
}
@@ -160,7 +160,7 @@
inline void Atomic::PlatformStore<8>::operator()(T store_value,
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
- _Atomic_move_long(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+ _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif // AMD64
--- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s Tue Jan 16 22:24:20 2018 +0000
@@ -633,10 +633,10 @@
ret
- # Support for jlong Atomic::cmpxchg(jlong exchange_value,
- # volatile jlong* dest,
- # jlong compare_value,
- # bool is_MP)
+ # Support for int64_t Atomic::cmpxchg(int64_t exchange_value,
+ # volatile int64_t* dest,
+ # int64_t compare_value,
+ # bool is_MP)
#
.p2align 4,,15
ELF_TYPE(_Atomic_cmpxchg_long,@function)
@@ -658,8 +658,8 @@
ret
- # Support for jlong Atomic::load and Atomic::store.
- # void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst)
+ # Support for int64_t Atomic::load and Atomic::store.
+ # void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst)
.p2align 4,,15
ELF_TYPE(_Atomic_move_long,@function)
SYMBOL(_Atomic_move_long):
--- a/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -265,8 +265,8 @@
template<typename T>
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
- volatile jlong dest;
- os::atomic_copy64(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+ volatile int64_t dest;
+ os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
return PrimitiveConversions::cast<T>(dest);
}
@@ -275,7 +275,7 @@
inline void Atomic::PlatformStore<8>::operator()(T store_value,
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
- os::atomic_copy64(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+ os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP
--- a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -50,7 +50,7 @@
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
return PrimitiveConversions::cast<T>(
- (*os::atomic_load_long_func)(reinterpret_cast<const volatile jlong*>(src)));
+ (*os::atomic_load_long_func)(reinterpret_cast<const volatile int64_t*>(src)));
}
template<>
@@ -59,7 +59,7 @@
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
(*os::atomic_store_long_func)(
- PrimitiveConversions::cast<jlong>(store_value), reinterpret_cast<volatile jlong*>(dest));
+ PrimitiveConversions::cast<int64_t>(store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif
@@ -103,7 +103,7 @@
: "memory");
return val;
#else
- return add_using_helper<jint>(os::atomic_add_func, add_value, dest);
+ return add_using_helper<int32_t>(os::atomic_add_func, add_value, dest);
#endif
}
@@ -146,7 +146,7 @@
: "memory");
return old_val;
#else
- return xchg_using_helper<jint>(os::atomic_xchg_func, exchange_value, dest);
+ return xchg_using_helper<int32_t>(os::atomic_xchg_func, exchange_value, dest);
#endif
}
@@ -178,17 +178,17 @@
#ifndef AARCH64
-inline jint reorder_cmpxchg_func(jint exchange_value,
- jint volatile* dest,
- jint compare_value) {
+inline int32_t reorder_cmpxchg_func(int32_t exchange_value,
+ int32_t volatile* dest,
+ int32_t compare_value) {
// Warning: Arguments are swapped to avoid moving them for kernel call
return (*os::atomic_cmpxchg_func)(compare_value, exchange_value, dest);
}
-inline jlong reorder_cmpxchg_long_func(jlong exchange_value,
- jlong volatile* dest,
- jlong compare_value) {
- assert(VM_Version::supports_cx8(), "Atomic compare and exchange jlong not supported on this architecture!");
+inline int64_t reorder_cmpxchg_long_func(int64_t exchange_value,
+ int64_t volatile* dest,
+ int64_t compare_value) {
+ assert(VM_Version::supports_cx8(), "Atomic compare and exchange int64_t not supported on this architecture!");
// Warning: Arguments are swapped to avoid moving them for kernel call
return (*os::atomic_cmpxchg_long_func)(compare_value, exchange_value, dest);
}
@@ -221,7 +221,7 @@
: "memory");
return rv;
#else
- return cmpxchg_using_helper<jint>(reorder_cmpxchg_func, exchange_value, dest, compare_value);
+ return cmpxchg_using_helper<int32_t>(reorder_cmpxchg_func, exchange_value, dest, compare_value);
#endif
}
@@ -251,7 +251,7 @@
: "memory");
return rv;
#else
- return cmpxchg_using_helper<jlong>(reorder_cmpxchg_long_func, exchange_value, dest, compare_value);
+ return cmpxchg_using_helper<int64_t>(reorder_cmpxchg_long_func, exchange_value, dest, compare_value);
#endif
}
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -598,11 +598,11 @@
#ifndef AARCH64
-typedef jlong cmpxchg_long_func_t(jlong, jlong, volatile jlong*);
+typedef int64_t cmpxchg_long_func_t(int64_t, int64_t, volatile int64_t*);
cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap;
-jlong os::atomic_cmpxchg_long_bootstrap(jlong compare_value, jlong exchange_value, volatile jlong* dest) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t compare_value, int64_t exchange_value, volatile int64_t* dest) {
// try to use the stub:
cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
@@ -612,16 +612,16 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jlong old_value = *dest;
+ int64_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
}
-typedef jlong load_long_func_t(const volatile jlong*);
+typedef int64_t load_long_func_t(const volatile int64_t*);
load_long_func_t* os::atomic_load_long_func = os::atomic_load_long_bootstrap;
-jlong os::atomic_load_long_bootstrap(const volatile jlong* src) {
+int64_t os::atomic_load_long_bootstrap(const volatile int64_t* src) {
// try to use the stub:
load_long_func_t* func = CAST_TO_FN_PTR(load_long_func_t*, StubRoutines::atomic_load_long_entry());
@@ -631,15 +631,15 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jlong old_value = *src;
+ int64_t old_value = *src;
return old_value;
}
-typedef void store_long_func_t(jlong, volatile jlong*);
+typedef void store_long_func_t(int64_t, volatile int64_t*);
store_long_func_t* os::atomic_store_long_func = os::atomic_store_long_bootstrap;
-void os::atomic_store_long_bootstrap(jlong val, volatile jlong* dest) {
+void os::atomic_store_long_bootstrap(int64_t val, volatile int64_t* dest) {
// try to use the stub:
store_long_func_t* func = CAST_TO_FN_PTR(store_long_func_t*, StubRoutines::atomic_store_long_entry());
@@ -652,11 +652,11 @@
*dest = val;
}
-typedef jint atomic_add_func_t(jint add_value, volatile jint *dest);
+typedef int32_t atomic_add_func_t(int32_t add_value, volatile int32_t *dest);
atomic_add_func_t * os::atomic_add_func = os::atomic_add_bootstrap;
-jint os::atomic_add_bootstrap(jint add_value, volatile jint *dest) {
+int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest) {
atomic_add_func_t * func = CAST_TO_FN_PTR(atomic_add_func_t*,
StubRoutines::atomic_add_entry());
if (func != NULL) {
@@ -664,16 +664,16 @@
return (*func)(add_value, dest);
}
- jint old_value = *dest;
+ int32_t old_value = *dest;
*dest = old_value + add_value;
return (old_value + add_value);
}
-typedef jint atomic_xchg_func_t(jint exchange_value, volatile jint *dest);
+typedef int32_t atomic_xchg_func_t(int32_t exchange_value, volatile int32_t *dest);
atomic_xchg_func_t * os::atomic_xchg_func = os::atomic_xchg_bootstrap;
-jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest) {
+int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest) {
atomic_xchg_func_t * func = CAST_TO_FN_PTR(atomic_xchg_func_t*,
StubRoutines::atomic_xchg_entry());
if (func != NULL) {
@@ -681,16 +681,16 @@
return (*func)(exchange_value, dest);
}
- jint old_value = *dest;
+ int32_t old_value = *dest;
*dest = exchange_value;
return (old_value);
}
-typedef jint cmpxchg_func_t(jint, jint, volatile jint*);
+typedef int32_t cmpxchg_func_t(int32_t, int32_t, volatile int32_t*);
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
-jint os::atomic_cmpxchg_bootstrap(jint compare_value, jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t compare_value, int32_t exchange_value, volatile int32_t* dest) {
// try to use the stub:
cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
@@ -700,7 +700,7 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -45,35 +45,35 @@
static bool register_code_area(char *low, char *high) { return true; }
#ifndef AARCH64
- static jlong (*atomic_cmpxchg_long_func)(jlong compare_value,
- jlong exchange_value,
- volatile jlong *dest);
+ static int64_t (*atomic_cmpxchg_long_func)(int64_t compare_value,
+ int64_t exchange_value,
+ volatile int64_t *dest);
- static jlong (*atomic_load_long_func)(const volatile jlong*);
+ static int64_t (*atomic_load_long_func)(const volatile int64_t*);
- static void (*atomic_store_long_func)(jlong, volatile jlong*);
+ static void (*atomic_store_long_func)(int64_t, volatile int64_t*);
- static jint (*atomic_add_func)(jint add_value, volatile jint *dest);
+ static int32_t (*atomic_add_func)(int32_t add_value, volatile int32_t *dest);
- static jint (*atomic_xchg_func)(jint exchange_value, volatile jint *dest);
+ static int32_t (*atomic_xchg_func)(int32_t exchange_value, volatile int32_t *dest);
- static jint (*atomic_cmpxchg_func)(jint compare_value,
- jint exchange_value,
- volatile jint *dest);
+ static int32_t (*atomic_cmpxchg_func)(int32_t compare_value,
+ int32_t exchange_value,
+ volatile int32_t *dest);
- static jlong atomic_cmpxchg_long_bootstrap(jlong, jlong, volatile jlong*);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, int64_t, volatile int64_t*);
- static jlong atomic_load_long_bootstrap(const volatile jlong*);
+ static int64_t atomic_load_long_bootstrap(const volatile int64_t*);
- static void atomic_store_long_bootstrap(jlong, volatile jlong*);
+ static void atomic_store_long_bootstrap(int64_t, volatile int64_t*);
- static jint atomic_add_bootstrap(jint add_value, volatile jint *dest);
+ static int32_t atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest);
- static jint atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest);
+ static int32_t atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest);
- static jint atomic_cmpxchg_bootstrap(jint compare_value,
- jint exchange_value,
- volatile jint *dest);
+ static int32_t atomic_cmpxchg_bootstrap(int32_t compare_value,
+ int32_t exchange_value,
+ volatile int32_t *dest);
#endif // !AARCH64
#endif // OS_CPU_LINUX_ARM_VM_OS_LINUX_ARM_HPP
--- a/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -28,15 +28,15 @@
//
// NOTE: we are back in class os here, not Linux
//
- static jint (*atomic_xchg_func) (jint, volatile jint*);
- static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
- static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
- static jint (*atomic_add_func) (jint, volatile jint*);
+ static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
+ static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
+ static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t);
+ static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
- static jint atomic_xchg_bootstrap (jint, volatile jint*);
- static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
- static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
- static jint atomic_add_bootstrap (jint, volatile jint*);
+ static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
+ static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
+ static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
static void setup_fpu() {}
--- a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -133,8 +133,8 @@
extern "C" {
// defined in linux_x86.s
- jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong);
- void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst);
+ int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t);
+ void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst);
}
template<>
@@ -144,15 +144,15 @@
T compare_value,
cmpxchg_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
- return cmpxchg_using_helper<jlong>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
+ return cmpxchg_using_helper<int64_t>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
}
template<>
template<typename T>
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
- volatile jlong dest;
- _Atomic_move_long(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+ volatile int64_t dest;
+ _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
return PrimitiveConversions::cast<T>(dest);
}
@@ -161,7 +161,7 @@
inline void Atomic::PlatformStore<8>::operator()(T store_value,
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
- _Atomic_move_long(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+ _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif // AMD64
--- a/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -30,67 +30,6 @@
// Implementation of class atomic
-#ifdef ARM
-
-/*
- * __kernel_cmpxchg
- *
- * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
- * Return zero if *ptr was changed or non-zero if no exchange happened.
- * The C flag is also set if *ptr was changed to allow for assembly
- * optimization in the calling code.
- *
- */
-
-typedef int (__kernel_cmpxchg_t)(int oldval, int newval, volatile int *ptr);
-#define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0)
-
-
-
-/* Perform an atomic compare and swap: if the current value of `*PTR'
- is OLDVAL, then write NEWVAL into `*PTR'. Return the contents of
- `*PTR' before the operation.*/
-static inline int arm_compare_and_swap(int newval,
- volatile int *ptr,
- int oldval) {
- for (;;) {
- int prev = *ptr;
- if (prev != oldval)
- return prev;
-
- if (__kernel_cmpxchg (prev, newval, ptr) == 0)
- // Success.
- return prev;
-
- // We failed even though prev == oldval. Try again.
- }
-}
-
-/* Atomically add an int to memory. */
-static inline int arm_add_and_fetch(int add_value, volatile int *ptr) {
- for (;;) {
- // Loop until a __kernel_cmpxchg succeeds.
-
- int prev = *ptr;
-
- if (__kernel_cmpxchg (prev, prev + add_value, ptr) == 0)
- return prev + add_value;
- }
-}
-
-/* Atomically write VALUE into `*PTR' and returns the previous
- contents of `*PTR'. */
-static inline int arm_lock_test_and_set(int newval, volatile int *ptr) {
- for (;;) {
- // Loop until a __kernel_cmpxchg succeeds.
- int prev = *ptr;
-
- if (__kernel_cmpxchg (prev, newval, ptr) == 0)
- return prev;
- }
-}
-#endif // ARM
-
template<size_t byte_size>
struct Atomic::PlatformAdd
: Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> >
@@ -105,11 +44,7 @@
STATIC_ASSERT(4 == sizeof(I));
STATIC_ASSERT(4 == sizeof(D));
-#ifdef ARM
- return add_using_helper<int>(arm_add_and_fetch, add_value, dest);
-#else
return __sync_add_and_fetch(dest, add_value);
-#endif // ARM
}
template<>
@@ -117,7 +52,6 @@
inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
STATIC_ASSERT(8 == sizeof(I));
STATIC_ASSERT(8 == sizeof(D));
-
return __sync_add_and_fetch(dest, add_value);
}
@@ -126,9 +60,6 @@
inline T Atomic::PlatformXchg<4>::operator()(T exchange_value,
T volatile* dest) const {
STATIC_ASSERT(4 == sizeof(T));
-#ifdef ARM
- return xchg_using_helper<int>(arm_lock_test_and_set, exchange_value, dest);
-#else
// __sync_lock_test_and_set is a bizarrely named atomic exchange
// operation. Note that some platforms only support this with the
// limitation that the only valid value to store is the immediate
@@ -140,7 +71,6 @@
// barrier.
__sync_synchronize();
return result;
-#endif // ARM
}
template<>
@@ -164,11 +94,7 @@
T compare_value,
cmpxchg_memory_order order) const {
STATIC_ASSERT(4 == sizeof(T));
-#ifdef ARM
- return cmpxchg_using_helper<int>(arm_compare_and_swap, exchange_value, dest, compare_value);
-#else
return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
-#endif // ARM
}
template<>
@@ -185,8 +111,8 @@
template<typename T>
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
STATIC_ASSERT(8 == sizeof(T));
- volatile jlong dest;
- os::atomic_copy64(reinterpret_cast<const volatile jlong*>(src), reinterpret_cast<volatile jlong*>(&dest));
+ volatile int64_t dest;
+ os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
return PrimitiveConversions::cast<T>(dest);
}
@@ -195,7 +121,7 @@
inline void Atomic::PlatformStore<8>::operator()(T store_value,
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
- os::atomic_copy64(reinterpret_cast<const volatile jlong*>(&store_value), reinterpret_cast<volatile jlong*>(dest));
+ os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
}
#endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP
--- a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -28,15 +28,15 @@
//
// NOTE: we are back in class os here, not Solaris
//
- static jint (*atomic_xchg_func) (jint, volatile jint*);
- static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
- static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
- static jint (*atomic_add_func) (jint, volatile jint*);
+ static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
+ static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
+ static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t);
+ static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
- static jint atomic_xchg_bootstrap (jint, volatile jint*);
- static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
- static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
- static jint atomic_add_bootstrap (jint, volatile jint*);
+ static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
+ static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
+ static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
static void setup_fpu() {}
--- a/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -28,16 +28,16 @@
// For Sun Studio - implementation is in solaris_x86_64.il.
extern "C" {
- jint _Atomic_add(jint add_value, volatile jint* dest);
- jlong _Atomic_add_long(jlong add_value, volatile jlong* dest);
+ int32_t _Atomic_add(int32_t add_value, volatile int32_t* dest);
+ int64_t _Atomic_add_long(int64_t add_value, volatile int64_t* dest);
- jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
- jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
- jbyte compare_value);
- jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
- jint compare_value);
- jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
- jlong compare_value);
+ int32_t _Atomic_xchg(int32_t exchange_value, volatile int32_t* dest);
+ int8_t _Atomic_cmpxchg_byte(int8_t exchange_value, volatile int8_t* dest,
+ int8_t compare_value);
+ int32_t _Atomic_cmpxchg(int32_t exchange_value, volatile int32_t* dest,
+ int32_t compare_value);
+ int64_t _Atomic_cmpxchg_long(int64_t exchange_value, volatile int64_t* dest,
+ int64_t compare_value);
}
template<size_t byte_size>
@@ -55,8 +55,8 @@
STATIC_ASSERT(4 == sizeof(I));
STATIC_ASSERT(4 == sizeof(D));
return PrimitiveConversions::cast<D>(
- _Atomic_add(PrimitiveConversions::cast<jint>(add_value),
- reinterpret_cast<jint volatile*>(dest)));
+ _Atomic_add(PrimitiveConversions::cast<int32_t>(add_value),
+ reinterpret_cast<int32_t volatile*>(dest)));
}
// Not using add_using_helper; see comment for cmpxchg.
@@ -66,8 +66,8 @@
STATIC_ASSERT(8 == sizeof(I));
STATIC_ASSERT(8 == sizeof(D));
return PrimitiveConversions::cast<D>(
- _Atomic_add_long(PrimitiveConversions::cast<jlong>(add_value),
- reinterpret_cast<jlong volatile*>(dest)));
+ _Atomic_add_long(PrimitiveConversions::cast<int64_t>(add_value),
+ reinterpret_cast<int64_t volatile*>(dest)));
}
template<>
@@ -76,11 +76,11 @@
T volatile* dest) const {
STATIC_ASSERT(4 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_xchg(PrimitiveConversions::cast<jint>(exchange_value),
- reinterpret_cast<jint volatile*>(dest)));
+ _Atomic_xchg(PrimitiveConversions::cast<int32_t>(exchange_value),
+ reinterpret_cast<int32_t volatile*>(dest)));
}
-extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest);
+extern "C" int64_t _Atomic_xchg_long(int64_t exchange_value, volatile int64_t* dest);
template<>
template<typename T>
@@ -88,8 +88,8 @@
T volatile* dest) const {
STATIC_ASSERT(8 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_xchg_long(PrimitiveConversions::cast<jlong>(exchange_value),
- reinterpret_cast<jlong volatile*>(dest)));
+ _Atomic_xchg_long(PrimitiveConversions::cast<int64_t>(exchange_value),
+ reinterpret_cast<int64_t volatile*>(dest)));
}
// Not using cmpxchg_using_helper here, because some configurations of
@@ -106,9 +106,9 @@
cmpxchg_memory_order order) const {
STATIC_ASSERT(1 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_cmpxchg_byte(PrimitiveConversions::cast<jbyte>(exchange_value),
- reinterpret_cast<jbyte volatile*>(dest),
- PrimitiveConversions::cast<jbyte>(compare_value)));
+ _Atomic_cmpxchg_byte(PrimitiveConversions::cast<int8_t>(exchange_value),
+ reinterpret_cast<int8_t volatile*>(dest),
+ PrimitiveConversions::cast<int8_t>(compare_value)));
}
template<>
@@ -119,9 +119,9 @@
cmpxchg_memory_order order) const {
STATIC_ASSERT(4 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_cmpxchg(PrimitiveConversions::cast<jint>(exchange_value),
- reinterpret_cast<jint volatile*>(dest),
- PrimitiveConversions::cast<jint>(compare_value)));
+ _Atomic_cmpxchg(PrimitiveConversions::cast<int32_t>(exchange_value),
+ reinterpret_cast<int32_t volatile*>(dest),
+ PrimitiveConversions::cast<int32_t>(compare_value)));
}
template<>
@@ -132,9 +132,9 @@
cmpxchg_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
return PrimitiveConversions::cast<T>(
- _Atomic_cmpxchg_long(PrimitiveConversions::cast<jlong>(exchange_value),
- reinterpret_cast<jlong volatile*>(dest),
- PrimitiveConversions::cast<jlong>(compare_value)));
+ _Atomic_cmpxchg_long(PrimitiveConversions::cast<int64_t>(exchange_value),
+ reinterpret_cast<int64_t volatile*>(dest),
+ PrimitiveConversions::cast<int64_t>(compare_value)));
}
#endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -904,12 +904,12 @@
// until initialization is complete.
// TODO - replace with .il implementation when compiler supports it.
-typedef jint xchg_func_t (jint, volatile jint*);
-typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
-typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong);
-typedef jint add_func_t (jint, volatile jint*);
+typedef int32_t xchg_func_t (int32_t, volatile int32_t*);
+typedef int32_t cmpxchg_func_t (int32_t, volatile int32_t*, int32_t);
+typedef int64_t cmpxchg_long_func_t(int64_t, volatile int64_t*, int64_t);
+typedef int32_t add_func_t (int32_t, volatile int32_t*);
-jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) {
// try to use the stub:
xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
@@ -919,12 +919,12 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
*dest = exchange_value;
return old_value;
}
-jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
// try to use the stub:
cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
@@ -934,13 +934,13 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
}
-jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
// try to use the stub:
cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
@@ -950,13 +950,13 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jlong old_value = *dest;
+ int64_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
}
-jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
+int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) {
// try to use the stub:
add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -31,15 +31,15 @@
#ifdef AMD64
static void setup_fpu() {}
#else
- static jint (*atomic_xchg_func) (jint, volatile jint*);
- static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
- static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong);
- static jint (*atomic_add_func) (jint, volatile jint*);
+ static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
+ static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
+ static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t);
+ static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
- static jint atomic_xchg_bootstrap (jint, volatile jint*);
- static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
- static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
- static jint atomic_add_bootstrap (jint, volatile jint*);
+ static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
+ static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
+ static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
static void setup_fpu();
#endif // AMD64
--- a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -54,13 +54,13 @@
template<>
template<typename I, typename D>
inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
- return add_using_helper<jint>(os::atomic_add_func, add_value, dest);
+ return add_using_helper<int32_t>(os::atomic_add_func, add_value, dest);
}
template<>
template<typename I, typename D>
inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
- return add_using_helper<intptr_t>(os::atomic_add_ptr_func, add_value, dest);
+ return add_using_helper<int64_t>(os::atomic_add_long_func, add_value, dest);
}
#define DEFINE_STUB_XCHG(ByteSize, StubType, StubName) \
@@ -72,8 +72,8 @@
return xchg_using_helper<StubType>(StubName, exchange_value, dest); \
}
-DEFINE_STUB_XCHG(4, jint, os::atomic_xchg_func)
-DEFINE_STUB_XCHG(8, jlong, os::atomic_xchg_long_func)
+DEFINE_STUB_XCHG(4, int32_t, os::atomic_xchg_func)
+DEFINE_STUB_XCHG(8, int64_t, os::atomic_xchg_long_func)
#undef DEFINE_STUB_XCHG
@@ -88,9 +88,9 @@
return cmpxchg_using_helper<StubType>(StubName, exchange_value, dest, compare_value); \
}
-DEFINE_STUB_CMPXCHG(1, jbyte, os::atomic_cmpxchg_byte_func)
-DEFINE_STUB_CMPXCHG(4, jint, os::atomic_cmpxchg_func)
-DEFINE_STUB_CMPXCHG(8, jlong, os::atomic_cmpxchg_long_func)
+DEFINE_STUB_CMPXCHG(1, int8_t, os::atomic_cmpxchg_byte_func)
+DEFINE_STUB_CMPXCHG(4, int32_t, os::atomic_cmpxchg_func)
+DEFINE_STUB_CMPXCHG(8, int64_t, os::atomic_cmpxchg_long_func)
#undef DEFINE_STUB_CMPXCHG
@@ -162,10 +162,10 @@
T compare_value,
cmpxchg_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
- jint ex_lo = (jint)exchange_value;
- jint ex_hi = *( ((jint*)&exchange_value) + 1 );
- jint cmp_lo = (jint)compare_value;
- jint cmp_hi = *( ((jint*)&compare_value) + 1 );
+ int32_t ex_lo = (int32_t)exchange_value;
+ int32_t ex_hi = *( ((int32_t*)&exchange_value) + 1 );
+ int32_t cmp_lo = (int32_t)compare_value;
+ int32_t cmp_hi = *( ((int32_t*)&compare_value) + 1 );
__asm {
push ebx
push edi
--- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -218,17 +218,17 @@
// Atomics and Stub Functions
-typedef jint xchg_func_t (jint, volatile jint*);
-typedef intptr_t xchg_long_func_t (jlong, volatile jlong*);
-typedef jint cmpxchg_func_t (jint, volatile jint*, jint);
-typedef jbyte cmpxchg_byte_func_t (jbyte, volatile jbyte*, jbyte);
-typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong);
-typedef jint add_func_t (jint, volatile jint*);
-typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*);
+typedef int32_t xchg_func_t (int32_t, volatile int32_t*);
+typedef int64_t xchg_long_func_t (int64_t, volatile int64_t*);
+typedef int32_t cmpxchg_func_t (int32_t, volatile int32_t*, int32_t);
+typedef int8_t cmpxchg_byte_func_t (int8_t, volatile int8_t*, int8_t);
+typedef int64_t cmpxchg_long_func_t (int64_t, volatile int64_t*, int64_t);
+typedef int32_t add_func_t (int32_t, volatile int32_t*);
+typedef int64_t add_long_func_t (int64_t, volatile int64_t*);
#ifdef AMD64
-jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) {
+int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) {
// try to use the stub:
xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry());
@@ -238,12 +238,12 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
*dest = exchange_value;
return old_value;
}
-intptr_t os::atomic_xchg_long_bootstrap(jlong exchange_value, volatile jlong* dest) {
+int64_t os::atomic_xchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest) {
// try to use the stub:
xchg_long_func_t* func = CAST_TO_FN_PTR(xchg_long_func_t*, StubRoutines::atomic_xchg_long_entry());
@@ -253,13 +253,13 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- intptr_t old_value = *dest;
+ int64_t old_value = *dest;
*dest = exchange_value;
return old_value;
}
-jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) {
+int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) {
// try to use the stub:
cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry());
@@ -269,13 +269,13 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jint old_value = *dest;
+ int32_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
}
-jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+int8_t os::atomic_cmpxchg_byte_bootstrap(int8_t exchange_value, volatile int8_t* dest, int8_t compare_value) {
// try to use the stub:
cmpxchg_byte_func_t* func = CAST_TO_FN_PTR(cmpxchg_byte_func_t*, StubRoutines::atomic_cmpxchg_byte_entry());
@@ -285,7 +285,7 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jbyte old_value = *dest;
+ int8_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
@@ -293,7 +293,7 @@
#endif // AMD64
-jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) {
// try to use the stub:
cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry());
@@ -303,7 +303,7 @@
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
- jlong old_value = *dest;
+ int64_t old_value = *dest;
if (old_value == compare_value)
*dest = exchange_value;
return old_value;
@@ -311,7 +311,7 @@
#ifdef AMD64
-jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) {
+int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) {
// try to use the stub:
add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry());
@@ -324,12 +324,12 @@
return (*dest) += add_value;
}
-intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* dest) {
+int64_t os::atomic_add_long_bootstrap(int64_t add_value, volatile int64_t* dest) {
// try to use the stub:
- add_ptr_func_t* func = CAST_TO_FN_PTR(add_ptr_func_t*, StubRoutines::atomic_add_ptr_entry());
+ add_long_func_t* func = CAST_TO_FN_PTR(add_long_func_t*, StubRoutines::atomic_add_long_entry());
if (func != NULL) {
- os::atomic_add_ptr_func = func;
+ os::atomic_add_long_func = func;
return (*func)(add_value, dest);
}
assert(Threads::number_of_threads() == 0, "for bootstrap only");
@@ -342,7 +342,7 @@
cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap;
cmpxchg_byte_func_t* os::atomic_cmpxchg_byte_func = os::atomic_cmpxchg_byte_bootstrap;
add_func_t* os::atomic_add_func = os::atomic_add_bootstrap;
-add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap;
+add_long_func_t* os::atomic_add_long_func = os::atomic_add_long_bootstrap;
#endif // AMD64
--- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -29,32 +29,32 @@
// NOTE: we are back in class os here, not win32
//
#ifdef AMD64
- static jint (*atomic_xchg_func) (jint, volatile jint*);
- static intptr_t (*atomic_xchg_long_func) (jlong, volatile jlong*);
+ static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*);
+ static int64_t (*atomic_xchg_long_func) (int64_t, volatile int64_t*);
- static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint);
- static jbyte (*atomic_cmpxchg_byte_func) (jbyte, volatile jbyte*, jbyte);
- static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong);
+ static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t);
+ static int8_t (*atomic_cmpxchg_byte_func) (int8_t, volatile int8_t*, int8_t);
+ static int64_t (*atomic_cmpxchg_long_func) (int64_t, volatile int64_t*, int64_t);
- static jint (*atomic_add_func) (jint, volatile jint*);
- static intptr_t (*atomic_add_ptr_func) (intptr_t, volatile intptr_t*);
+ static int32_t (*atomic_add_func) (int32_t, volatile int32_t*);
+ static int64_t (*atomic_add_long_func) (int64_t, volatile int64_t*);
- static jint atomic_xchg_bootstrap (jint, volatile jint*);
- static intptr_t atomic_xchg_long_bootstrap (jlong, volatile jlong*);
+ static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*);
+ static int64_t atomic_xchg_long_bootstrap (int64_t, volatile int64_t*);
- static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint);
- static jbyte atomic_cmpxchg_byte_bootstrap(jbyte, volatile jbyte*, jbyte);
+ static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t);
+ static int8_t atomic_cmpxchg_byte_bootstrap(int8_t, volatile int8_t*, int8_t);
#else
- static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong);
+ static int64_t (*atomic_cmpxchg_long_func) (int64_t, volatile int64_t*, int64_t);
#endif // AMD64
- static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong);
+ static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t);
#ifdef AMD64
- static jint atomic_add_bootstrap (jint, volatile jint*);
- static intptr_t atomic_add_ptr_bootstrap (intptr_t, volatile intptr_t*);
+ static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*);
+ static int64_t atomic_add_long_bootstrap (int64_t, volatile int64_t*);
#endif // AMD64
static void setup_fpu();
--- a/src/hotspot/share/classfile/classFileParser.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/classfile/classFileParser.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -86,8 +86,6 @@
#define JAVA_CLASSFILE_MAGIC 0xCAFEBABE
#define JAVA_MIN_SUPPORTED_VERSION 45
-#define JAVA_MAX_SUPPORTED_VERSION 54
-#define JAVA_MAX_SUPPORTED_MINOR_VERSION 0
// Used for two backward compatibility reasons:
// - to check for new additions to the class file format in JDK1.5
@@ -110,6 +108,8 @@
#define JAVA_10_VERSION 54
+#define JAVA_11_VERSION 55
+
void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
assert((bad_constant == 19 || bad_constant == 20) && _major_version >= JAVA_9_VERSION,
"Unexpected bad constant pool entry");
@@ -4642,11 +4642,11 @@
}
static bool is_supported_version(u2 major, u2 minor){
- const u2 max_version = JAVA_MAX_SUPPORTED_VERSION;
+ const u2 max_version = JVM_CLASSFILE_MAJOR_VERSION;
return (major >= JAVA_MIN_SUPPORTED_VERSION) &&
(major <= max_version) &&
((major != max_version) ||
- (minor <= JAVA_MAX_SUPPORTED_MINOR_VERSION));
+ (minor <= JVM_CLASSFILE_MINOR_VERSION));
}
void ClassFileParser::verify_legal_field_modifiers(jint flags,
@@ -5808,8 +5808,8 @@
_class_name->as_C_string(),
_major_version,
_minor_version,
- JAVA_MAX_SUPPORTED_VERSION,
- JAVA_MAX_SUPPORTED_MINOR_VERSION);
+ JVM_CLASSFILE_MAJOR_VERSION,
+ JVM_CLASSFILE_MINOR_VERSION);
return;
}
--- a/src/hotspot/share/classfile/classLoader.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/classfile/classLoader.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -802,6 +802,14 @@
int end = 0;
bool set_base_piece = true;
+#if INCLUDE_CDS
+ if (DumpSharedSpaces) {
+ if (!Arguments::has_jimage()) {
+ vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL);
+ }
+ }
+#endif
+
// Iterate over class path entries
for (int start = 0; start < len; start = end) {
while (class_path[end] && class_path[end] != os::path_separator()[0]) {
--- a/src/hotspot/share/classfile/defaultMethods.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/classfile/defaultMethods.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -26,6 +26,7 @@
#include "classfile/bytecodeAssembler.hpp"
#include "classfile/defaultMethods.hpp"
#include "classfile/symbolTable.hpp"
+#include "classfile/systemDictionary.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/allocation.hpp"
@@ -683,10 +684,11 @@
Symbol* _method_name;
Symbol* _method_signature;
StatefulMethodFamily* _family;
+ bool _cur_class_is_interface;
public:
- FindMethodsByErasedSig(Symbol* name, Symbol* signature) :
- _method_name(name), _method_signature(signature),
+ FindMethodsByErasedSig(Symbol* name, Symbol* signature, bool is_interf) :
+ _method_name(name), _method_signature(signature), _cur_class_is_interface(is_interf),
_family(NULL) {}
void get_discovered_family(MethodFamily** family) {
@@ -709,14 +711,17 @@
InstanceKlass* iklass = current_class();
Method* m = iklass->find_method(_method_name, _method_signature);
- // private interface methods are not candidates for default methods
- // invokespecial to private interface methods doesn't use default method logic
- // private class methods are not candidates for default methods,
- // private methods do not override default methods, so need to perform
- // default method inheritance without including private methods
- // The overpasses are your supertypes' errors, we do not include them
- // future: take access controls into account for superclass methods
- if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private()) {
+ // Private interface methods are not candidates for default methods.
+ // invokespecial to private interface methods doesn't use default method logic.
+ // Private class methods are not candidates for default methods.
+ // Private methods do not override default methods, so need to perform
+ // default method inheritance without including private methods.
+ // The overpasses are your supertypes' errors, we do not include them.
+ // Non-public methods in java.lang.Object are not candidates for default
+ // methods.
+ // Future: take access controls into account for superclass methods
+ if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private() &&
+ (!_cur_class_is_interface || !SystemDictionary::is_nonpublic_Object_method(m))) {
if (_family == NULL) {
_family = new StatefulMethodFamily();
}
@@ -726,8 +731,8 @@
scope->add_mark(restorer);
} else {
// This is the rule that methods in classes "win" (bad word) over
- // methods in interfaces. This works because of single inheritance
- // private methods in classes do not "win", they will be found
+ // methods in interfaces. This works because of single inheritance.
+ // Private methods in classes do not "win", they will be found
// first on searching, but overriding for invokevirtual needs
// to find default method candidates for the same signature
_family->set_target_if_empty(m);
@@ -745,10 +750,10 @@
static void generate_erased_defaults(
InstanceKlass* klass, GrowableArray<EmptyVtableSlot*>* empty_slots,
- EmptyVtableSlot* slot, TRAPS) {
+ EmptyVtableSlot* slot, bool is_intf, TRAPS) {
// sets up a set of methods with the same exact erased signature
- FindMethodsByErasedSig visitor(slot->name(), slot->signature());
+ FindMethodsByErasedSig visitor(slot->name(), slot->signature(), is_intf);
visitor.run(klass);
MethodFamily* family;
@@ -817,7 +822,7 @@
slot->print_on(&ls);
ls.cr();
}
- generate_erased_defaults(klass, empty_slots, slot, CHECK);
+ generate_erased_defaults(klass, empty_slots, slot, klass->is_interface(), CHECK);
}
log_debug(defaultmethods)("Creating defaults and overpasses...");
create_defaults_and_exceptions(empty_slots, klass, CHECK);
--- a/src/hotspot/share/classfile/systemDictionary.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/classfile/systemDictionary.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -654,6 +654,12 @@
static bool is_platform_class_loader(oop class_loader);
static void clear_invoke_method_table();
+ // Returns TRUE if the method is a non-public member of class java.lang.Object.
+ static bool is_nonpublic_Object_method(Method* m) {
+ assert(m != NULL, "Unexpected NULL Method*");
+ return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass();
+ }
+
protected:
static InstanceKlass* find_shared_class(Symbol* class_name);
--- a/src/hotspot/share/classfile/vmSymbols.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/classfile/vmSymbols.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -996,8 +996,8 @@
do_name( montgomerySquare_name, "implMontgomerySquare") \
do_signature(montgomerySquare_signature, "([I[IIJ[I)[I") \
\
- do_class(java_util_ArraysSupport, "java/util/ArraysSupport") \
- do_intrinsic(_vectorizedMismatch, java_util_ArraysSupport, vectorizedMismatch_name, vectorizedMismatch_signature, F_S)\
+ do_class(jdk_internal_util_ArraysSupport, "jdk/internal/util/ArraysSupport") \
+ do_intrinsic(_vectorizedMismatch, jdk_internal_util_ArraysSupport, vectorizedMismatch_name, vectorizedMismatch_signature, F_S)\
do_name(vectorizedMismatch_name, "vectorizedMismatch") \
do_signature(vectorizedMismatch_signature, "(Ljava/lang/Object;JLjava/lang/Object;JII)I") \
\
--- a/src/hotspot/share/code/compiledIC.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/code/compiledIC.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -344,6 +344,7 @@
// Code
static address emit_to_interp_stub(CodeBuffer &cbuf, address mark = NULL);
static int to_interp_stub_size();
+ static int to_trampoline_stub_size();
static int reloc_to_interp_stub();
static void emit_to_aot_stub(CodeBuffer &cbuf, address mark = NULL);
static int to_aot_stub_size();
--- a/src/hotspot/share/code/nmethod.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/code/nmethod.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -1485,16 +1485,18 @@
bool nmethod::do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred) {
// Compiled code
- {
- RelocIterator iter(this, low_boundary);
- while (iter.next()) {
- if (iter.type() == relocInfo::oop_type) {
- if (unload_if_dead_at(&iter, is_alive, unloading_occurred)) {
- return true;
+
+ // Prevent extra code cache walk for platforms that don't have immediate oops.
+ if (relocInfo::mustIterateImmediateOopsInCode()) {
+ RelocIterator iter(this, low_boundary);
+ while (iter.next()) {
+ if (iter.type() == relocInfo::oop_type) {
+ if (unload_if_dead_at(&iter, is_alive, unloading_occurred)) {
+ return true;
+ }
}
}
}
- }
return do_unloading_scopes(is_alive, unloading_occurred);
}
@@ -1584,18 +1586,21 @@
// (See comment above.)
}
- RelocIterator iter(this, low_boundary);
+ // Prevent extra code cache walk for platforms that don't have immediate oops.
+ if (relocInfo::mustIterateImmediateOopsInCode()) {
+ RelocIterator iter(this, low_boundary);
- while (iter.next()) {
- if (iter.type() == relocInfo::oop_type ) {
- oop_Relocation* r = iter.oop_reloc();
- // In this loop, we must only follow those oops directly embedded in
- // the code. Other oops (oop_index>0) are seen as part of scopes_oops.
- assert(1 == (r->oop_is_immediate()) +
- (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()),
- "oop must be found in exactly one place");
- if (r->oop_is_immediate() && r->oop_value() != NULL) {
- f->do_oop(r->oop_addr());
+ while (iter.next()) {
+ if (iter.type() == relocInfo::oop_type ) {
+ oop_Relocation* r = iter.oop_reloc();
+ // In this loop, we must only follow those oops directly embedded in
+ // the code. Other oops (oop_index>0) are seen as part of scopes_oops.
+ assert(1 == (r->oop_is_immediate()) +
+ (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()),
+ "oop must be found in exactly one place");
+ if (r->oop_is_immediate() && r->oop_value() != NULL) {
+ f->do_oop(r->oop_addr());
+ }
}
}
}
@@ -1620,7 +1625,7 @@
assert(nmethod::oops_do_marking_is_active(), "oops_do_marking_prologue must be called");
if (_oops_do_mark_link == NULL) {
// Claim this nmethod for this thread to mark.
- if (Atomic::cmpxchg(NMETHOD_SENTINEL, &_oops_do_mark_link, (nmethod*)NULL) == NULL) {
+ if (Atomic::replace_if_null(NMETHOD_SENTINEL, &_oops_do_mark_link)) {
// Atomically append this nmethod (now claimed) to the head of the list:
nmethod* observed_mark_nmethods = _oops_do_mark_nmethods;
for (;;) {
--- a/src/hotspot/share/code/relocInfo.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/code/relocInfo.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -910,6 +910,10 @@
}
// an oop in the instruction stream
static RelocationHolder spec_for_immediate() {
+ // If no immediate oops are generated, we can skip some walks over nmethods.
+ // Assert that they don't get generated accidently!
+ assert(relocInfo::mustIterateImmediateOopsInCode(),
+ "Must return true so we will search for oops as roots etc. in the code.");
const int oop_index = 0;
const int offset = 0; // if you want an offset, use the oop pool
RelocationHolder rh = newHolder();
--- a/src/hotspot/share/gc/parallel/gcTaskThread.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/gc/parallel/gcTaskThread.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -77,7 +77,7 @@
if (_time_stamps == NULL) {
// We allocate the _time_stamps array lazily since logging can be enabled dynamically
GCTaskTimeStamp* time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
- if (Atomic::cmpxchg(time_stamps, &_time_stamps, (GCTaskTimeStamp*)NULL) != NULL) {
+ if (!Atomic::replace_if_null(time_stamps, &_time_stamps)) {
// Someone already setup the time stamps
FREE_C_HEAP_ARRAY(GCTaskTimeStamp, time_stamps);
}
--- a/src/hotspot/share/include/jvm.h Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/include/jvm.h Tue Jan 16 22:24:20 2018 +0000
@@ -317,23 +317,18 @@
JNIEXPORT jobject JNICALL
JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim);
-/*
- * java.lang.Class and java.lang.ClassLoader
- */
-
-#define JVM_CALLER_DEPTH -1
/*
* Returns the immediate caller class of the native method invoking
* JVM_GetCallerClass. The Method.invoke and other frames due to
* reflection machinery are skipped.
*
- * The depth parameter must be -1 (JVM_DEPTH). The caller is expected
- * to be marked with sun.reflect.CallerSensitive. The JVM will throw
- * an error if it is not marked propertly.
+ * The caller is expected to be marked with
+ * jdk.internal.reflect.CallerSensitive. The JVM will throw an
+ * error if it is not marked properly.
*/
JNIEXPORT jclass JNICALL
-JVM_GetCallerClass(JNIEnv *env, int depth);
+JVM_GetCallerClass(JNIEnv *env);
/*
--- a/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -699,6 +699,7 @@
// Estimate the number of static and aot call stubs that might be emitted.
int static_call_stubs = 0;
int aot_call_stubs = 0;
+ int trampoline_stubs = 0;
objArrayOop sites = this->sites();
for (int i = 0; i < sites->length(); i++) {
oop site = sites->obj_at(i);
@@ -710,8 +711,18 @@
JVMCI_ERROR_0("expected Integer id, got %s", id_obj->klass()->signature_name());
}
jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
- if (id == INVOKESTATIC || id == INVOKESPECIAL) {
+ switch (id) {
+ case INVOKEINTERFACE:
+ case INVOKEVIRTUAL:
+ trampoline_stubs++;
+ break;
+ case INVOKESTATIC:
+ case INVOKESPECIAL:
static_call_stubs++;
+ trampoline_stubs++;
+ break;
+ default:
+ break;
}
}
}
@@ -726,6 +737,7 @@
}
}
int size = static_call_stubs * CompiledStaticCall::to_interp_stub_size();
+ size += trampoline_stubs * CompiledStaticCall::to_trampoline_stub_size();
#if INCLUDE_AOT
size += aot_call_stubs * CompiledStaticCall::to_aot_stub_size();
#endif
@@ -1171,7 +1183,7 @@
}
TRACE_jvmci_3("method call");
- CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset, CHECK);
+ CodeInstaller::pd_relocate_JavaMethod(buffer, hotspot_method, pc_offset, CHECK);
if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
// Need a static call stub for transitions from compiled to interpreted.
CompiledStaticCall::emit_to_interp_stub(buffer, _instructions->start() + pc_offset);
@@ -1282,4 +1294,3 @@
}
}
}
-
--- a/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCodeInstaller.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -185,7 +185,7 @@
void pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS);
void pd_patch_DataSectionReference(int pc_offset, int data_offset, TRAPS);
void pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, TRAPS);
- void pd_relocate_JavaMethod(Handle method, jint pc_offset, TRAPS);
+ void pd_relocate_JavaMethod(CodeBuffer &cbuf, Handle method, jint pc_offset, TRAPS);
void pd_relocate_poll(address pc, jint mark, TRAPS);
objArrayOop sites() { return (objArrayOop) JNIHandles::resolve(_sites_handle); }
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -749,8 +749,13 @@
C2V_END
C2V_VMENTRY(jobject, getImplementor, (JNIEnv *, jobject, jobject jvmci_type))
- InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type);
- oop implementor = CompilerToVM::get_jvmci_type(klass->implementor(), CHECK_NULL);
+ Klass* klass = CompilerToVM::asKlass(jvmci_type);
+ if (!klass->is_interface()) {
+ THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+ err_msg("Expected interface type, got %s", klass->external_name()));
+ }
+ InstanceKlass* iklass = InstanceKlass::cast(klass);
+ oop implementor = CompilerToVM::get_jvmci_type(iklass->implementor(), CHECK_NULL);
return JNIHandles::make_local(THREAD, implementor);
C2V_END
@@ -989,8 +994,12 @@
C2V_END
C2V_VMENTRY(jobject, getClassInitializer, (JNIEnv *, jobject, jobject jvmci_type))
- InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type);
- oop result = CompilerToVM::get_jvmci_method(klass->class_initializer(), CHECK_NULL);
+ Klass* klass = CompilerToVM::asKlass(jvmci_type);
+ if (!klass->is_instance_klass()) {
+ return NULL;
+ }
+ InstanceKlass* iklass = InstanceKlass::cast(klass);
+ oop result = CompilerToVM::get_jvmci_method(iklass->class_initializer(), CHECK_NULL);
return JNIHandles::make_local(THREAD, result);
C2V_END
--- a/src/hotspot/share/oops/cpCache.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/oops/cpCache.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -177,6 +177,7 @@
// instruction somehow links to a non-interface method (in Object).
// In that case, the method has no itable index and must be invoked as a virtual.
// Set a flag to keep track of this corner case.
+ assert(method->is_public(), "Calling non-public method in Object with invokeinterface");
change_to_virtual = true;
// ...and fall through as if we were handling invokevirtual:
--- a/src/hotspot/share/oops/klassVtable.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/oops/klassVtable.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -86,13 +86,14 @@
GrowableArray<Method*> new_mirandas(20);
// compute the number of mirandas methods that must be added to the end
- get_mirandas(&new_mirandas, all_mirandas, super, methods, NULL, local_interfaces);
+ get_mirandas(&new_mirandas, all_mirandas, super, methods, NULL, local_interfaces,
+ class_flags.is_interface());
*num_new_mirandas = new_mirandas.length();
// Interfaces do not need interface methods in their vtables
// This includes miranda methods and during later processing, default methods
if (!class_flags.is_interface()) {
- vtable_length += *num_new_mirandas * vtableEntry::size();
+ vtable_length += *num_new_mirandas * vtableEntry::size();
}
if (Universe::is_bootstrapping() && vtable_length == 0) {
@@ -454,8 +455,13 @@
} else {
super_method = method_at(i);
}
- // Check if method name matches
- if (super_method->name() == name && super_method->signature() == signature) {
+ // Check if method name matches. Ignore match if klass is an interface and the
+ // matching method is a non-public java.lang.Object method. (See JVMS 5.4.3.4)
+ // This is safe because the method at this slot should never get invoked.
+ // (TBD: put in a method to throw NoSuchMethodError if this slot is ever used.)
+ if (super_method->name() == name && super_method->signature() == signature &&
+ (!_klass->is_interface() ||
+ !SystemDictionary::is_nonpublic_Object_method(super_method))) {
// get super_klass for method_holder for the found method
InstanceKlass* super_klass = super_method->method_holder();
@@ -713,7 +719,7 @@
if (mhk->is_interface()) {
assert(m->is_public(), "should be public");
assert(ik()->implements_interface(method_holder) , "this class should implement the interface");
- if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super())) {
+ if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super(), klass()->is_interface())) {
return true;
}
}
@@ -738,7 +744,10 @@
// During the first run, the current instanceKlass has not yet been
// created, the superclasses and superinterfaces do have instanceKlasses
// but may not have vtables, the default_methods list is empty, no overpasses.
-// This is seen by default method creation.
+// Default method generation uses the all_mirandas array as the starter set for
+// maximally-specific default method calculation. So, for both classes and
+// interfaces, it is necessary that the first pass will find all non-private
+// interface instance methods, whether or not they are concrete.
//
// Pass 2: recalculated during vtable initialization: only include abstract methods.
// The goal of pass 2 is to walk through the superinterfaces to see if any of
@@ -772,7 +781,8 @@
// Part of the Miranda Rights in the US mean that if you do not have
// an attorney one will be appointed for you.
bool klassVtable::is_miranda(Method* m, Array<Method*>* class_methods,
- Array<Method*>* default_methods, const Klass* super) {
+ Array<Method*>* default_methods, const Klass* super,
+ bool is_interface) {
if (m->is_static() || m->is_private() || m->is_overpass()) {
return false;
}
@@ -800,8 +810,11 @@
for (const Klass* cursuper = super; cursuper != NULL; cursuper = cursuper->super())
{
- if (InstanceKlass::cast(cursuper)->find_local_method(name, signature,
- Klass::find_overpass, Klass::skip_static, Klass::skip_private) != NULL) {
+ Method* found_mth = InstanceKlass::cast(cursuper)->find_local_method(name, signature,
+ Klass::find_overpass, Klass::skip_static, Klass::skip_private);
+ // Ignore non-public methods in java.lang.Object if klass is an interface.
+ if (found_mth != NULL && (!is_interface ||
+ !SystemDictionary::is_nonpublic_Object_method(found_mth))) {
return false;
}
}
@@ -820,7 +833,7 @@
void klassVtable::add_new_mirandas_to_lists(
GrowableArray<Method*>* new_mirandas, GrowableArray<Method*>* all_mirandas,
Array<Method*>* current_interface_methods, Array<Method*>* class_methods,
- Array<Method*>* default_methods, const Klass* super) {
+ Array<Method*>* default_methods, const Klass* super, bool is_interface) {
// iterate thru the current interface's method to see if it a miranda
int num_methods = current_interface_methods->length();
@@ -839,7 +852,7 @@
}
if (!is_duplicate) { // we don't want duplicate miranda entries in the vtable
- if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all?
+ if (is_miranda(im, class_methods, default_methods, super, is_interface)) { // is it a miranda at all?
const InstanceKlass *sk = InstanceKlass::cast(super);
// check if it is a duplicate of a super's miranda
if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::find_defaults) == NULL) {
@@ -858,7 +871,8 @@
const Klass* super,
Array<Method*>* class_methods,
Array<Method*>* default_methods,
- Array<Klass*>* local_interfaces) {
+ Array<Klass*>* local_interfaces,
+ bool is_interface) {
assert((new_mirandas->length() == 0) , "current mirandas must be 0");
// iterate thru the local interfaces looking for a miranda
@@ -867,7 +881,7 @@
InstanceKlass *ik = InstanceKlass::cast(local_interfaces->at(i));
add_new_mirandas_to_lists(new_mirandas, all_mirandas,
ik->methods(), class_methods,
- default_methods, super);
+ default_methods, super, is_interface);
// iterate thru each local's super interfaces
Array<Klass*>* super_ifs = ik->transitive_interfaces();
int num_super_ifs = super_ifs->length();
@@ -875,7 +889,7 @@
InstanceKlass *sik = InstanceKlass::cast(super_ifs->at(j));
add_new_mirandas_to_lists(new_mirandas, all_mirandas,
sik->methods(), class_methods,
- default_methods, super);
+ default_methods, super, is_interface);
}
}
}
@@ -888,7 +902,8 @@
int klassVtable::fill_in_mirandas(int initialized) {
GrowableArray<Method*> mirandas(20);
get_mirandas(&mirandas, NULL, ik()->super(), ik()->methods(),
- ik()->default_methods(), ik()->local_interfaces());
+ ik()->default_methods(), ik()->local_interfaces(),
+ klass()->is_interface());
for (int i = 0; i < mirandas.length(); i++) {
if (log_develop_is_enabled(Trace, vtables)) {
Method* meth = mirandas.at(i);
--- a/src/hotspot/share/oops/klassVtable.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/oops/klassVtable.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -144,21 +144,24 @@
bool is_miranda_entry_at(int i);
int fill_in_mirandas(int initialized);
static bool is_miranda(Method* m, Array<Method*>* class_methods,
- Array<Method*>* default_methods, const Klass* super);
+ Array<Method*>* default_methods, const Klass* super,
+ bool is_interface);
static void add_new_mirandas_to_lists(
GrowableArray<Method*>* new_mirandas,
GrowableArray<Method*>* all_mirandas,
Array<Method*>* current_interface_methods,
Array<Method*>* class_methods,
Array<Method*>* default_methods,
- const Klass* super);
+ const Klass* super,
+ bool is_interface);
static void get_mirandas(
GrowableArray<Method*>* new_mirandas,
GrowableArray<Method*>* all_mirandas,
const Klass* super,
Array<Method*>* class_methods,
Array<Method*>* default_methods,
- Array<Klass*>* local_interfaces);
+ Array<Klass*>* local_interfaces,
+ bool is_interface);
void verify_against(outputStream* st, klassVtable* vt, int index);
inline InstanceKlass* ik() const;
// When loading a class from CDS archive at run time, and no class redefintion
--- a/src/hotspot/share/oops/method.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/oops/method.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -446,7 +446,7 @@
bool Method::init_method_counters(MethodCounters* counters) {
// Try to install a pointer to MethodCounters, return true on success.
- return Atomic::cmpxchg(counters, &_method_counters, (MethodCounters*)NULL) == NULL;
+ return Atomic::replace_if_null(counters, &_method_counters);
}
void Method::cleanup_inline_caches() {
--- a/src/hotspot/share/prims/jvm.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/prims/jvm.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -678,17 +678,9 @@
// Misc. class handling ///////////////////////////////////////////////////////////
-JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth))
+JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env))
JVMWrapper("JVM_GetCallerClass");
- // Pre-JDK 8 and early builds of JDK 8 don't have a CallerSensitive annotation; or
- // sun.reflect.Reflection.getCallerClass with a depth parameter is provided
- // temporarily for existing code to use until a replacement API is defined.
- if (SystemDictionary::reflect_CallerSensitive_klass() == NULL || depth != JVM_CALLER_DEPTH) {
- Klass* k = thread->security_get_caller_class(depth);
- return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror());
- }
-
// Getting the class of the caller frame.
//
// The call stack at this point looks something like this:
--- a/src/hotspot/share/prims/jvmtiRawMonitor.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/prims/jvmtiRawMonitor.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -127,7 +127,7 @@
int JvmtiRawMonitor::SimpleEnter (Thread * Self) {
for (;;) {
- if (Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
+ if (Atomic::replace_if_null(Self, &_owner)) {
return OS_OK ;
}
@@ -139,7 +139,7 @@
Node._next = _EntryList ;
_EntryList = &Node ;
OrderAccess::fence() ;
- if (_owner == NULL && Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
+ if (_owner == NULL && Atomic::replace_if_null(Self, &_owner)) {
_EntryList = Node._next ;
RawMonitor_lock->unlock() ;
return OS_OK ;
--- a/src/hotspot/share/prims/whitebox.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/prims/whitebox.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -1727,10 +1727,16 @@
WB_ENTRY(jboolean, WB_IsCDSIncludedInVmBuild(JNIEnv* env))
#if INCLUDE_CDS
+# ifdef _LP64
+ if (!UseCompressedOops || !UseCompressedClassPointers) {
+ // On 64-bit VMs, CDS is supported only with compressed oops/pointers
+ return false;
+ }
+# endif // _LP64
return true;
#else
return false;
-#endif
+#endif // INCLUDE_CDS
WB_END
--- a/src/hotspot/share/runtime/arguments.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/arguments.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -200,7 +200,9 @@
_writeable = writeable;
}
-AgentLibrary::AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) {
+AgentLibrary::AgentLibrary(const char* name, const char* options,
+ bool is_absolute_path, void* os_lib,
+ bool instrument_lib) {
_name = AllocateHeap(strlen(name)+1, mtArguments);
strcpy(_name, name);
if (options == NULL) {
@@ -214,6 +216,7 @@
_next = NULL;
_state = agent_invalid;
_is_static_lib = false;
+ _is_instrument_lib = instrument_lib;
}
// Check if head of 'option' matches 'name', and sets 'tail' to the remaining
@@ -290,6 +293,10 @@
_agentList.add(new AgentLibrary(name, options, absolute_path, NULL));
}
+void Arguments::add_instrument_agent(const char* name, char* options, bool absolute_path) {
+ _agentList.add(new AgentLibrary(name, options, absolute_path, NULL, true));
+}
+
// Late-binding agents not started via arguments
void Arguments::add_loaded_agent(AgentLibrary *agentLib) {
_agentList.add(agentLib);
@@ -497,7 +504,7 @@
{ "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
- { "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+ { "UseMembar", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "FastTLABRefill", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "SafepointSpinBeforeYield", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "DeferThrSuspendLoopCount", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) },
@@ -674,6 +681,14 @@
return false;
}
+// Verifies the correctness of the entries in the special_jvm_flags table.
+// If there is a semantic error (i.e. a bug in the table) such as the obsoletion
+// version being earlier than the deprecation version, then a warning is issued
+// and verification fails - by returning false. If it is detected that the table
+// is out of date, with respect to the current version, then a warning is issued
+// but verification does not fail. This allows the VM to operate when the version
+// is first updated, without needing to update all the impacted flags at the
+// same time.
static bool verify_special_jvm_flags() {
bool success = true;
for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
@@ -710,7 +725,6 @@
if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) {
if (Flag::find_flag(flag.name) != NULL) {
warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name);
- success = false;
}
}
}
@@ -720,7 +734,6 @@
if (!version_less_than(JDK_Version::current(), flag.expired_in)) {
if (Flag::find_flag(flag.name) != NULL) {
warning("Global variable for expired flag entry \"%s\" should be removed", flag.name);
- success = false;
}
}
}
@@ -2791,7 +2804,7 @@
size_t length = strlen(tail) + 1;
char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments);
jio_snprintf(options, length, "%s", tail);
- add_init_agent("instrument", options, false);
+ add_instrument_agent("instrument", options, false);
// java agents need module java.instrument
if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) {
return JNI_ENOMEM;
--- a/src/hotspot/share/runtime/arguments.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/arguments.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -142,6 +142,7 @@
void* _os_lib;
bool _is_absolute_path;
bool _is_static_lib;
+ bool _is_instrument_lib;
AgentState _state;
AgentLibrary* _next;
@@ -154,13 +155,15 @@
void set_os_lib(void* os_lib) { _os_lib = os_lib; }
AgentLibrary* next() const { return _next; }
bool is_static_lib() const { return _is_static_lib; }
+ bool is_instrument_lib() const { return _is_instrument_lib; }
void set_static_lib(bool is_static_lib) { _is_static_lib = is_static_lib; }
bool valid() { return (_state == agent_valid); }
void set_valid() { _state = agent_valid; }
void set_invalid() { _state = agent_invalid; }
// Constructor
- AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib);
+ AgentLibrary(const char* name, const char* options, bool is_absolute_path,
+ void* os_lib, bool instrument_lib=false);
};
// maintain an order of entry list of AgentLibrary
@@ -337,6 +340,7 @@
// -agentlib and -agentpath arguments
static AgentLibraryList _agentList;
static void add_init_agent(const char* name, char* options, bool absolute_path);
+ static void add_instrument_agent(const char* name, char* options, bool absolute_path);
// Late-binding agents not started via arguments
static void add_loaded_agent(AgentLibrary *agentLib);
--- a/src/hotspot/share/runtime/atomic.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/atomic.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -45,8 +45,8 @@
class Atomic : AllStatic {
public:
- // Atomic operations on jlong types are not available on all 32-bit
- // platforms. If atomic ops on jlongs are defined here they must only
+ // Atomic operations on int64 types are not available on all 32-bit
+ // platforms. If atomic ops on int64 are defined here they must only
// be used from code that verifies they are available at runtime and
// can provide an alternative action if not - see supports_cx8() for
// a means to test availability.
@@ -639,16 +639,16 @@
//
// Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment.
template<>
-struct Atomic::AddImpl<jshort, jshort> VALUE_OBJ_CLASS_SPEC {
- jshort operator()(jshort add_value, jshort volatile* dest) const {
+struct Atomic::AddImpl<short, short> VALUE_OBJ_CLASS_SPEC {
+ short operator()(short add_value, short volatile* dest) const {
#ifdef VM_LITTLE_ENDIAN
assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
- jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest-1));
+ int new_value = Atomic::add(add_value << 16, (volatile int*)(dest-1));
#else
assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
- jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest));
+ int new_value = Atomic::add(add_value << 16, (volatile int*)(dest));
#endif
- return (jshort)(new_value >> 16); // preserves sign
+ return (short)(new_value >> 16); // preserves sign
}
};
@@ -807,7 +807,7 @@
do {
// value to swap in matches current value ...
uint32_t new_value = cur;
- // ... except for the one jbyte we want to update
+ // ... except for the one byte we want to update
reinterpret_cast<uint8_t*>(&new_value)[offset] = canon_exchange_value;
uint32_t res = cmpxchg(new_value, aligned_dest, cur, order);
--- a/src/hotspot/share/runtime/jniHandles.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/jniHandles.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -47,6 +47,7 @@
} else {
Thread* thread = Thread::current();
assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+ assert(!current_thread_in_native(), "must not be in native");
return thread->active_handles()->allocate_handle(obj);
}
}
@@ -59,6 +60,8 @@
return NULL; // ignore null handles
} else {
assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+ assert(thread->is_Java_thread(), "not a Java thread");
+ assert(!current_thread_in_native(), "must not be in native");
return thread->active_handles()->allocate_handle(obj);
}
}
@@ -70,6 +73,7 @@
} else {
JavaThread* thread = JavaThread::thread_from_jni_environment(env);
assert(Universe::heap()->is_in_reserved(obj), "sanity check");
+ assert(!current_thread_in_native(), "must not be in native");
return thread->active_handles()->allocate_handle(obj);
}
}
@@ -77,6 +81,7 @@
jobject JNIHandles::make_global(Handle obj) {
assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC");
+ assert(!current_thread_in_native(), "must not be in native");
jobject res = NULL;
if (!obj.is_null()) {
// ignore null handles
@@ -93,6 +98,7 @@
jobject JNIHandles::make_weak_global(Handle obj) {
assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC");
+ assert(!current_thread_in_native(), "must not be in native");
jobject res = NULL;
if (!obj.is_null()) {
// ignore null handles
@@ -265,6 +271,13 @@
weak_oops_do(&verify_handle);
}
+// This method is implemented here to avoid circular includes between
+// jniHandles.hpp and thread.hpp.
+bool JNIHandles::current_thread_in_native() {
+ Thread* thread = Thread::current();
+ return (thread->is_Java_thread() &&
+ JavaThread::current()->thread_state() == _thread_in_native);
+}
void jni_handles_init() {
--- a/src/hotspot/share/runtime/jniHandles.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/jniHandles.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -48,6 +48,10 @@
template<bool external_guard> inline static oop resolve_impl(jobject handle);
template<bool external_guard> static oop resolve_jweak(jweak handle);
+ // This method is not inlined in order to avoid circular includes between
+ // this header file and thread.hpp.
+ static bool current_thread_in_native();
+
public:
// Low tag bit in jobject used to distinguish a jweak. jweak is
// type equivalent to jobject, but there are places where we need to
@@ -230,6 +234,7 @@
template<bool external_guard>
inline oop JNIHandles::resolve_impl(jobject handle) {
assert(handle != NULL, "precondition");
+ assert(!current_thread_in_native(), "must not be in native");
oop result;
if (is_jweak(handle)) { // Unlikely
result = resolve_jweak<external_guard>(handle);
--- a/src/hotspot/share/runtime/mutex.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/mutex.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -467,7 +467,7 @@
OrderAccess::fence();
// Optional optimization ... try barging on the inner lock
- if ((NativeMonitorFlags & 32) && Atomic::cmpxchg(ESelf, &_OnDeck, (ParkEvent*)NULL) == NULL) {
+ if ((NativeMonitorFlags & 32) && Atomic::replace_if_null(ESelf, &_OnDeck)) {
goto OnDeck_LOOP;
}
@@ -574,7 +574,7 @@
// Unlike a normal lock, however, the exiting thread "locks" OnDeck,
// picks a successor and marks that thread as OnDeck. That successor
// thread will then clear OnDeck once it eventually acquires the outer lock.
- if (Atomic::cmpxchg((ParkEvent*)_LBIT, &_OnDeck, (ParkEvent*)NULL) != NULL) {
+ if (!Atomic::replace_if_null((ParkEvent*)_LBIT, &_OnDeck)) {
return;
}
--- a/src/hotspot/share/runtime/objectMonitor.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/objectMonitor.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -421,7 +421,7 @@
int ObjectMonitor::TryLock(Thread * Self) {
void * own = _owner;
if (own != NULL) return 0;
- if (Atomic::cmpxchg(Self, &_owner, (void*)NULL) == NULL) {
+ if (Atomic::replace_if_null(Self, &_owner)) {
// Either guarantee _recursions == 0 or set _recursions = 0.
assert(_recursions == 0, "invariant");
assert(_owner == Self, "invariant");
@@ -529,7 +529,7 @@
if ((SyncFlags & 16) == 0 && nxt == NULL && _EntryList == NULL) {
// Try to assume the role of responsible thread for the monitor.
// CONSIDER: ST vs CAS vs { if (Responsible==null) Responsible=Self }
- Atomic::cmpxchg(Self, &_Responsible, (Thread*)NULL);
+ Atomic::replace_if_null(Self, &_Responsible);
}
// The lock might have been released while this thread was occupied queueing
@@ -553,7 +553,7 @@
assert(_owner != Self, "invariant");
if ((SyncFlags & 2) && _Responsible == NULL) {
- Atomic::cmpxchg(Self, &_Responsible, (Thread*)NULL);
+ Atomic::replace_if_null(Self, &_Responsible);
}
// park self
@@ -1007,7 +1007,7 @@
// to reacquire the lock the responsibility for ensuring succession
// falls to the new owner.
//
- if (Atomic::cmpxchg(THREAD, &_owner, (void*)NULL) != NULL) {
+ if (!Atomic::replace_if_null(THREAD, &_owner)) {
return;
}
TEVENT(Exit - Reacquired);
@@ -1032,7 +1032,7 @@
// B. If the elements forming the EntryList|cxq are TSM
// we could simply unpark() the lead thread and return
// without having set _succ.
- if (Atomic::cmpxchg(THREAD, &_owner, (void*)NULL) != NULL) {
+ if (!Atomic::replace_if_null(THREAD, &_owner)) {
TEVENT(Inflated exit - reacquired succeeded);
return;
}
@@ -1714,7 +1714,7 @@
ObjectWaiter * tail = _cxq;
if (tail == NULL) {
iterator->_next = NULL;
- if (Atomic::cmpxchg(iterator, &_cxq, (ObjectWaiter*)NULL) == NULL) {
+ if (Atomic::replace_if_null(iterator, &_cxq)) {
break;
}
} else {
--- a/src/hotspot/share/runtime/safepoint.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/safepoint.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -103,7 +103,7 @@
int nof_threads = Threads::number_of_threads();
- log_debug(safepoint)("Safepoint synchronization initiated. (%d)", nof_threads);
+ log_debug(safepoint)("Safepoint synchronization initiated. (%d threads)", nof_threads);
RuntimeService::record_safepoint_begin();
@@ -407,9 +407,7 @@
// Update the count of active JNI critical regions
GCLocker::set_jni_lock_count(_current_jni_active_count);
- if (log_is_enabled(Debug, safepoint)) {
- log_debug(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description());
- }
+ log_info(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description());
RuntimeService::record_safepoint_synchronized();
if (PrintSafepointStatistics) {
@@ -496,14 +494,14 @@
cur_state->restart(); // TSS _running
SafepointMechanism::disarm_local_poll(current); // release store, local state -> polling page
}
- log_debug(safepoint)("Leaving safepoint region");
+ log_info(safepoint)("Leaving safepoint region");
} else {
// Set to not synchronized, so the threads will not go into the signal_thread_blocked method
// when they get restarted.
_state = _not_synchronized;
OrderAccess::fence();
- log_debug(safepoint)("Leaving safepoint region");
+ log_info(safepoint)("Leaving safepoint region");
// Start suspended threads
jtiwh.rewind();
--- a/src/hotspot/share/runtime/stubRoutines.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/stubRoutines.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -62,12 +62,11 @@
address StubRoutines::_atomic_xchg_entry = NULL;
address StubRoutines::_atomic_xchg_long_entry = NULL;
address StubRoutines::_atomic_store_entry = NULL;
-address StubRoutines::_atomic_store_ptr_entry = NULL;
address StubRoutines::_atomic_cmpxchg_entry = NULL;
address StubRoutines::_atomic_cmpxchg_byte_entry = NULL;
address StubRoutines::_atomic_cmpxchg_long_entry = NULL;
address StubRoutines::_atomic_add_entry = NULL;
-address StubRoutines::_atomic_add_ptr_entry = NULL;
+address StubRoutines::_atomic_add_long_entry = NULL;
address StubRoutines::_fence_entry = NULL;
address StubRoutines::_d2i_wrapper = NULL;
address StubRoutines::_d2l_wrapper = NULL;
--- a/src/hotspot/share/runtime/stubRoutines.hpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/stubRoutines.hpp Tue Jan 16 22:24:20 2018 +0000
@@ -103,12 +103,11 @@
static address _atomic_xchg_entry;
static address _atomic_xchg_long_entry;
static address _atomic_store_entry;
- static address _atomic_store_ptr_entry;
static address _atomic_cmpxchg_entry;
static address _atomic_cmpxchg_byte_entry;
static address _atomic_cmpxchg_long_entry;
static address _atomic_add_entry;
- static address _atomic_add_ptr_entry;
+ static address _atomic_add_long_entry;
static address _fence_entry;
static address _d2i_wrapper;
static address _d2l_wrapper;
@@ -277,12 +276,11 @@
static address atomic_xchg_entry() { return _atomic_xchg_entry; }
static address atomic_xchg_long_entry() { return _atomic_xchg_long_entry; }
static address atomic_store_entry() { return _atomic_store_entry; }
- static address atomic_store_ptr_entry() { return _atomic_store_ptr_entry; }
static address atomic_cmpxchg_entry() { return _atomic_cmpxchg_entry; }
static address atomic_cmpxchg_byte_entry() { return _atomic_cmpxchg_byte_entry; }
static address atomic_cmpxchg_long_entry() { return _atomic_cmpxchg_long_entry; }
static address atomic_add_entry() { return _atomic_add_entry; }
- static address atomic_add_ptr_entry() { return _atomic_add_ptr_entry; }
+ static address atomic_add_long_entry() { return _atomic_add_long_entry; }
static address fence_entry() { return _fence_entry; }
static address d2i_wrapper() { return _d2i_wrapper; }
--- a/src/hotspot/share/runtime/synchronizer.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/synchronizer.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -238,8 +238,7 @@
// and last are the inflated Java Monitor (ObjectMonitor) checks.
lock->set_displaced_header(markOopDesc::unused_mark());
- if (owner == NULL &&
- Atomic::cmpxchg(Self, &(m->_owner), (void*)NULL) == NULL) {
+ if (owner == NULL && Atomic::replace_if_null(Self, &(m->_owner))) {
assert(m->_recursions == 0, "invariant");
assert(m->_owner == Self, "invariant");
return true;
--- a/src/hotspot/share/runtime/thread.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/runtime/thread.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -4039,9 +4039,16 @@
}
if (library == NULL) {
const char *sub_msg = " on the library path, with error: ";
- size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1;
+ const char *sub_msg2 = "\nModule java.instrument may be missing from runtime image.";
+
+ size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) +
+ strlen(ebuf) + strlen(sub_msg2) + 1;
char *buf = NEW_C_HEAP_ARRAY(char, len, mtThread);
- jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
+ if (!agent->is_instrument_lib()) {
+ jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
+ } else {
+ jio_snprintf(buf, len, "%s%s%s%s%s", msg, name, sub_msg, ebuf, sub_msg2);
+ }
// If we can't find the agent, exit.
vm_exit_during_initialization(buf, NULL);
FREE_C_HEAP_ARRAY(char, buf);
--- a/src/hotspot/share/services/mallocSiteTable.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/services/mallocSiteTable.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -147,7 +147,7 @@
if (entry == NULL) return NULL;
// swap in the head
- if (Atomic::cmpxchg(entry, &_table[index], (MallocSiteHashtableEntry*)NULL) == NULL) {
+ if (Atomic::replace_if_null(entry, &_table[index])) {
return entry->data();
}
@@ -259,5 +259,5 @@
}
bool MallocSiteHashtableEntry::atomic_insert(MallocSiteHashtableEntry* entry) {
- return Atomic::cmpxchg(entry, &_next, (MallocSiteHashtableEntry*)NULL) == NULL;
+ return Atomic::replace_if_null(entry, &_next);
}
--- a/src/hotspot/share/utilities/bitMap.cpp Sun Jan 14 21:46:14 2018 -0800
+++ b/src/hotspot/share/utilities/bitMap.cpp Tue Jan 16 22:24:20 2018 +0000
@@ -628,7 +628,7 @@
table[i] = num_set_bits(i);
}
- if (Atomic::cmpxchg(table, &_pop_count_table, (BitMap::idx_t*)NULL) != NULL) {
+ if (!Atomic::replace_if_null(table, &_pop_count_table)) {
guarantee(_pop_count_table != NULL, "invariant");
FREE_C_HEAP_ARRAY(idx_t, table);
}
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,8 @@
}
// step 2: find mount point
+ List<UnixMountEntry> procMountsEntries =
+ fs.getMountEntries("/proc/mounts");
UnixPath parent = path.getParent();
while (parent != null) {
UnixFileAttributes attrs = null;
@@ -74,16 +76,23 @@
} catch (UnixException x) {
x.rethrowAsIOException(parent);
}
- if (attrs.dev() != dev())
- break;
+ if (attrs.dev() != dev()) {
+ // step 3: lookup mounted file systems (use /proc/mounts to
+ // ensure we find the file system even when not in /etc/mtab)
+ byte[] dir = path.asByteArray();
+ for (UnixMountEntry entry : procMountsEntries) {
+ if (Arrays.equals(dir, entry.dir()))
+ return entry;
+ }
+ }
path = parent;
parent = parent.getParent();
}
- // step 3: lookup mounted file systems (use /proc/mounts to ensure we
- // find the file system even when not in /etc/mtab)
+ // step 3: lookup mounted file systems (use /proc/mounts to
+ // ensure we find the file system even when not in /etc/mtab)
byte[] dir = path.asByteArray();
- for (UnixMountEntry entry: fs.getMountEntries("/proc/mounts")) {
+ for (UnixMountEntry entry : procMountsEntries) {
if (Arrays.equals(dir, entry.dir()))
return entry;
}
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
/**
* Returns object to iterate over the mount entries in the given fstab file.
*/
- Iterable<UnixMountEntry> getMountEntries(String fstab) {
+ List<UnixMountEntry> getMountEntries(String fstab) {
ArrayList<UnixMountEntry> entries = new ArrayList<>();
try {
long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r"));
@@ -101,7 +101,7 @@
* Returns object to iterate over the mount entries in /etc/mtab
*/
@Override
- Iterable<UnixMountEntry> getMountEntries() {
+ List<UnixMountEntry> getMountEntries() {
return getMountEntries("/etc/mtab");
}
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Tue Jan 16 22:24:20 2018 +0000
@@ -48,6 +48,7 @@
1.8 to 1.8.X 52,0
1.9 to 1.9.X 53,0
1.10 to 1.10.X 54,0
+ 1.11 to 1.11.X 55,0
*/
public static final Package.Version JAVA_MIN_CLASS_VERSION =
@@ -71,6 +72,9 @@
public static final Package.Version JAVA10_MAX_CLASS_VERSION =
Package.Version.of(54, 00);
+ public static final Package.Version JAVA11_MAX_CLASS_VERSION =
+ Package.Version.of(55, 00);
+
public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D;
public static final Package.Version JAVA5_PACKAGE_VERSION =
@@ -87,7 +91,7 @@
// upper limit, should point to the latest class version
public static final Package.Version JAVA_MAX_CLASS_VERSION =
- JAVA10_MAX_CLASS_VERSION;
+ JAVA11_MAX_CLASS_VERSION;
// upper limit should point to the latest package version, for version info!.
public static final Package.Version MAX_PACKAGE_VERSION =
--- a/src/java.base/share/classes/java/io/ByteArrayOutputStream.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/io/ByteArrayOutputStream.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,6 +27,7 @@
import java.nio.charset.Charset;
import java.util.Arrays;
+import java.util.Objects;
/**
* This class implements an output stream in which the data is
@@ -147,10 +148,7 @@
* @param len the number of bytes to write.
*/
public synchronized void write(byte b[], int off, int len) {
- if ((off < 0) || (off > b.length) || (len < 0) ||
- ((off + len) - b.length > 0)) {
- throw new IndexOutOfBoundsException();
- }
+ Objects.checkFromIndexSize(off, len, b.length);
ensureCapacity(count + len);
System.arraycopy(b, off, buf, count, len);
count += len;
--- a/src/java.base/share/classes/java/io/File.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/io/File.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, 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
@@ -2256,7 +2256,7 @@
private transient volatile Path filePath;
/**
- * Returns a {@link Path java.nio.file.Path} object constructed from the
+ * Returns a {@link Path java.nio.file.Path} object constructed from
* this abstract path. The resulting {@code Path} is associated with the
* {@link java.nio.file.FileSystems#getDefault default-filesystem}.
*
--- a/src/java.base/share/classes/java/io/InputStream.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/io/InputStream.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, 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,7 +25,9 @@
package java.io;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import java.util.Objects;
/**
@@ -54,6 +56,93 @@
private static final int DEFAULT_BUFFER_SIZE = 8192;
/**
+ * Returns a new {@code InputStream} that reads no bytes. The returned
+ * stream is initially open. The stream is closed by calling the
+ * {@code close()} method. Subsequent calls to {@code close()} have no
+ * effect.
+ *
+ * <p> While the stream is open, the {@code available()}, {@code read()},
+ * {@code read(byte[])}, {@code read(byte[], int, int)},
+ * {@code readAllBytes()}, {@code readNBytes()}, {@code skip()}, and
+ * {@code transferTo()} methods all behave as if end of stream has been
+ * reached. After the stream has been closed, these methods all throw
+ * {@code IOException}.
+ *
+ * <p> The {@code markSupported()} method returns {@code false}. The
+ * {@code mark()} method does nothing, and the {@code reset()} method
+ * throws {@code IOException}.
+ *
+ * @return an {@code InputStream} which contains no bytes
+ *
+ * @since 11
+ */
+ public static InputStream nullInputStream() {
+ return new InputStream() {
+ private volatile boolean closed;
+
+ private void ensureOpen() throws IOException {
+ if (closed) {
+ throw new IOException("Stream closed");
+ }
+ }
+
+ @Override
+ public int available () throws IOException {
+ ensureOpen();
+ return 0;
+ }
+
+ @Override
+ public int read() throws IOException {
+ ensureOpen();
+ return -1;
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ Objects.checkFromIndexSize(off, len, b.length);
+ if (len == 0) {
+ return 0;
+ }
+ ensureOpen();
+ return -1;
+ }
+
+ @Override
+ public byte[] readAllBytes() throws IOException {
+ ensureOpen();
+ return new byte[0];
+ }
+
+ @Override
+ public int readNBytes(byte[] b, int off, int len)
+ throws IOException {
+ Objects.checkFromIndexSize(off, len, b.length);
+ ensureOpen();
+ return 0;
+ }
+
+ @Override
+ public long skip(long n) throws IOException {
+ ensureOpen();
+ return 0L;
+ }
+
+ @Override
+ public long transferTo(OutputStream out) throws IOException {
+ Objects.requireNonNull(out);
+ ensureOpen();
+ return 0L;
+ }
+
+ @Override
+ public void close() throws IOException {
+ closed = true;
+ }
+ };
+ }
+
+ /**
* Reads the next byte of data from the input stream. The value byte is
* returned as an <code>int</code> in the range <code>0</code> to
* <code>255</code>. If no byte is available because the end of the stream
@@ -164,7 +253,6 @@
* @see java.io.InputStream#read()
*/
public int read(byte b[], int off, int len) throws IOException {
- Objects.requireNonNull(b);
Objects.checkFromIndexSize(off, len, b.length);
if (len == 0) {
return 0;
@@ -229,30 +317,55 @@
* @since 9
*/
public byte[] readAllBytes() throws IOException {
- byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
- int capacity = buf.length;
- int nread = 0;
+ List<byte[]> bufs = null;
+ byte[] result = null;
+ int total = 0;
int n;
- for (;;) {
- // read to EOF which may read more or less than initial buffer size
- while ((n = read(buf, nread, capacity - nread)) > 0)
+ do {
+ byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
+ int nread = 0;
+
+ // read to EOF which may read more or less than buffer size
+ while ((n = read(buf, nread, buf.length - nread)) > 0) {
nread += n;
+ }
- // if the last call to read returned -1, then we're done
- if (n < 0)
- break;
+ if (nread > 0) {
+ if (MAX_BUFFER_SIZE - total < nread) {
+ throw new OutOfMemoryError("Required array size too large");
+ }
+ total += nread;
+ if (result == null) {
+ result = buf;
+ } else {
+ if (bufs == null) {
+ bufs = new ArrayList<>();
+ bufs.add(result);
+ }
+ bufs.add(buf);
+ }
+ }
+ } while (n >= 0); // if the last call to read returned -1, then break
- // need to allocate a larger buffer
- if (capacity <= MAX_BUFFER_SIZE - capacity) {
- capacity = capacity << 1;
- } else {
- if (capacity == MAX_BUFFER_SIZE)
- throw new OutOfMemoryError("Required array size too large");
- capacity = MAX_BUFFER_SIZE;
+ if (bufs == null) {
+ if (result == null) {
+ return new byte[0];
}
- buf = Arrays.copyOf(buf, capacity);
+ return result.length == total ?
+ result : Arrays.copyOf(result, total);
}
- return (capacity == nread) ? buf : Arrays.copyOf(buf, nread);
+
+ result = new byte[total];
+ int offset = 0;
+ int remaining = total;
+ for (byte[] b : bufs) {
+ int len = Math.min(b.length, remaining);
+ System.arraycopy(b, 0, result, offset, len);
+ offset += len;
+ remaining -= len;
+ }
+
+ return result;
}
/**
@@ -299,7 +412,6 @@
* @since 9
*/
public int readNBytes(byte[] b, int off, int len) throws IOException {
- Objects.requireNonNull(b);
Objects.checkFromIndexSize(off, len, b.length);
int n = 0;
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java Tue Jan 16 22:24:20 2018 +0000
@@ -1296,7 +1296,6 @@
* @throws InvalidClassException if the filter rejects creation
*/
private void checkArray(Class<?> arrayType, int arrayLength) throws InvalidClassException {
- Objects.requireNonNull(arrayType);
if (! arrayType.isArray()) {
throw new IllegalArgumentException("not an array type");
}
--- a/src/java.base/share/classes/java/io/OutputStream.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/io/OutputStream.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, 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
@@ -47,6 +47,51 @@
*/
public abstract class OutputStream implements Closeable, Flushable {
/**
+ * Returns a new {@code OutputStream} which discards all bytes. The
+ * returned stream is initially open. The stream is closed by calling
+ * the {@code close()} method. Subsequent calls to {@code close()} have
+ * no effect.
+ *
+ * <p> While the stream is open, the {@code write(int)}, {@code
+ * write(byte[])}, and {@code write(byte[], int, int)} methods do nothing.
+ * After the stream has been closed, these methods all throw {@code
+ * IOException}.
+ *
+ * <p> The {@code flush()} method does nothing.
+ *
+ * @return an {@code OutputStream} which discards all bytes
+ *
+ * @since 11
+ */
+ public static OutputStream nullOutputStream() {
+ return new OutputStream() {
+ private volatile boolean closed;
+
+ private void ensureOpen() throws IOException {
+ if (closed) {
+ throw new IOException("Stream closed");
+ }
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ ensureOpen();
+ }
+
+ @Override
+ public void write(byte b[], int off, int len) throws IOException {
+ Objects.checkFromIndexSize(off, len, b.length);
+ ensureOpen();
+ }
+
+ @Override
+ public void close() {
+ closed = true;
+ }
+ };
+ }
+
+ /**
* Writes the specified byte to this output stream. The general
* contract for <code>write</code> is that one byte is written
* to the output stream. The byte to be written is the eight
@@ -106,7 +151,6 @@
* stream is closed.
*/
public void write(byte b[], int off, int len) throws IOException {
- Objects.requireNonNull(b);
Objects.checkFromIndexSize(off, len, b.length);
// len == 0 condition implicitly handled by loop bounds
for (int i = 0 ; i < len ; i++) {
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Tue Jan 16 22:24:20 2018 +0000
@@ -1667,6 +1667,7 @@
/** Craft a LambdaForm customized for this particular MethodHandle */
/*non-public*/
void customize() {
+ final LambdaForm form = this.form;
if (form.customized == null) {
LambdaForm newForm = form.customize(this);
updateForm(newForm);
--- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java Tue Jan 16 22:24:20 2018 +0000
@@ -2521,7 +2521,7 @@
* the {@code packageFinder} throws an {@link UncheckedIOException} then
* {@link IOException} cause will be re-thrown. </p>
*
- * <p> The module descriptor is read from the buffer stating at index
+ * <p> The module descriptor is read from the buffer starting at index
* {@code p}, where {@code p} is the buffer's {@link ByteBuffer#position()
* position} when this method is invoked. Upon return the buffer's position
* will be equal to {@code p + n} where {@code n} is the number of bytes
--- a/src/java.base/share/classes/java/lang/ref/Reference.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/lang/ref/Reference.java Tue Jan 16 22:24:20 2018 +0000
@@ -141,14 +141,6 @@
}
/*
- * system property to disable clearing before enqueuing.
- */
- private static final class ClearBeforeEnqueue {
- static final boolean DISABLE =
- Boolean.getBoolean("jdk.lang.ref.disableClearBeforeEnqueue");
- }
-
- /*
* Atomically get and clear (set to null) the VM's pending list.
*/
private static native Reference<Object> getAndClearReferencePendingList();
@@ -299,8 +291,7 @@
* it was not registered with a queue when it was created
*/
public boolean enqueue() {
- if (!ClearBeforeEnqueue.DISABLE)
- this.referent = null;
+ this.referent = null;
return this.queue.enqueue(this);
}
--- a/src/java.base/share/classes/java/net/InetSocketAddress.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/net/InetSocketAddress.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -317,10 +317,9 @@
}
/**
- *
* Gets the {@code InetAddress}.
*
- * @return the InetAdress or {@code null} if it is unresolved.
+ * @return the InetAddress or {@code null} if it is unresolved.
*/
public final InetAddress getAddress() {
return holder.getAddress();
--- a/src/java.base/share/classes/java/nio/Bits.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Bits.java Tue Jan 16 22:24:20 2018 +0000
@@ -63,38 +63,38 @@
// -- Unsafe access --
- private static final Unsafe unsafe = Unsafe.getUnsafe();
+ private static final Unsafe UNSAFE = Unsafe.getUnsafe();
static Unsafe unsafe() {
- return unsafe;
+ return UNSAFE;
}
// -- Processor and memory-system properties --
- private static final ByteOrder byteOrder
- = unsafe.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
+ private static final ByteOrder BYTE_ORDER
+ = UNSAFE.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
static ByteOrder byteOrder() {
- return byteOrder;
+ return BYTE_ORDER;
}
- private static int pageSize = -1;
+ private static int PAGE_SIZE = -1;
static int pageSize() {
- if (pageSize == -1)
- pageSize = unsafe().pageSize();
- return pageSize;
+ if (PAGE_SIZE == -1)
+ PAGE_SIZE = unsafe().pageSize();
+ return PAGE_SIZE;
}
static int pageCount(long size) {
return (int)(size + (long)pageSize() - 1L) / pageSize();
}
- private static boolean unaligned = unsafe.unalignedAccess();
+ private static boolean UNALIGNED = UNSAFE.unalignedAccess();
static boolean unaligned() {
- return unaligned;
+ return UNALIGNED;
}
@@ -103,11 +103,11 @@
// A user-settable upper limit on the maximum amount of allocatable
// direct buffer memory. This value may be changed during VM
// initialization if it is launched with "-XX:MaxDirectMemorySize=<size>".
- private static volatile long maxMemory = VM.maxDirectMemory();
- private static final AtomicLong reservedMemory = new AtomicLong();
- private static final AtomicLong totalCapacity = new AtomicLong();
- private static final AtomicLong count = new AtomicLong();
- private static volatile boolean memoryLimitSet;
+ private static volatile long MAX_MEMORY = VM.maxDirectMemory();
+ private static final AtomicLong RESERVED_MEMORY = new AtomicLong();
+ private static final AtomicLong TOTAL_CAPACITY = new AtomicLong();
+ private static final AtomicLong COUNT = new AtomicLong();
+ private static volatile boolean MEMORY_LIMIT_SET;
// max. number of sleeps during try-reserving with exponentially
// increasing delay before throwing OutOfMemoryError:
@@ -120,9 +120,9 @@
// which a process may access. All sizes are specified in bytes.
static void reserveMemory(long size, int cap) {
- if (!memoryLimitSet && VM.initLevel() >= 1) {
- maxMemory = VM.maxDirectMemory();
- memoryLimitSet = true;
+ if (!MEMORY_LIMIT_SET && VM.initLevel() >= 1) {
+ MAX_MEMORY = VM.maxDirectMemory();
+ MEMORY_LIMIT_SET = true;
}
// optimist!
@@ -200,10 +200,10 @@
// actual memory usage, which will differ when buffers are page
// aligned.
long totalCap;
- while (cap <= maxMemory - (totalCap = totalCapacity.get())) {
- if (totalCapacity.compareAndSet(totalCap, totalCap + cap)) {
- reservedMemory.addAndGet(size);
- count.incrementAndGet();
+ while (cap <= MAX_MEMORY - (totalCap = TOTAL_CAPACITY.get())) {
+ if (TOTAL_CAPACITY.compareAndSet(totalCap, totalCap + cap)) {
+ RESERVED_MEMORY.addAndGet(size);
+ COUNT.incrementAndGet();
return true;
}
}
@@ -213,9 +213,9 @@
static void unreserveMemory(long size, int cap) {
- long cnt = count.decrementAndGet();
- long reservedMem = reservedMemory.addAndGet(-size);
- long totalCap = totalCapacity.addAndGet(-cap);
+ long cnt = COUNT.decrementAndGet();
+ long reservedMem = RESERVED_MEMORY.addAndGet(-size);
+ long totalCap = TOTAL_CAPACITY.addAndGet(-cap);
assert cnt >= 0 && reservedMem >= 0 && totalCap >= 0;
}
@@ -234,15 +234,15 @@
}
@Override
public long getCount() {
- return Bits.count.get();
+ return Bits.COUNT.get();
}
@Override
public long getTotalCapacity() {
- return Bits.totalCapacity.get();
+ return Bits.TOTAL_CAPACITY.get();
}
@Override
public long getMemoryUsed() {
- return Bits.reservedMemory.get();
+ return Bits.RESERVED_MEMORY.get();
}
};
}
--- a/src/java.base/share/classes/java/nio/Buffer.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Buffer.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,6 +26,7 @@
package java.nio;
import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
import java.util.Spliterator;
@@ -181,6 +182,8 @@
*/
public abstract class Buffer {
+ // Cached unsafe-access object
+ static final Unsafe UNSAFE = Bits.unsafe();
/**
* The characteristics of Spliterators that traverse and split elements
@@ -617,6 +620,14 @@
// -- Package-private methods for bounds checking, etc. --
/**
+ *
+ * @return the base reference, paired with the address
+ * field, which in combination can be used for unsafe access into a heap
+ * buffer or direct byte buffer (and views of).
+ */
+ abstract Object base();
+
+ /**
* Checks the current position against the limit, throwing a {@link
* BufferUnderflowException} if it is not smaller than the limit, and then
* increments the position.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/nio/BufferMismatch.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.nio;
+
+import jdk.internal.util.ArraysSupport;
+
+/**
+ * Mismatch methods for buffers
+ */
+final class BufferMismatch {
+
+ static int mismatch(ByteBuffer a, int aOff, ByteBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 7) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + aOff,
+ b.base(), b.address + bOff,
+ length,
+ ArraysSupport.LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0) return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(CharBuffer a, int aOff, CharBuffer b, int bOff, int length) {
+ int i = 0;
+ // Ensure only heap or off-heap buffer instances use the
+ // vectorized mismatch. If either buffer is a StringCharBuffer
+ // (order is null) then the slow path is taken
+ if (length > 3 && a.charRegionOrder() == b.charRegionOrder()
+ && a.charRegionOrder() != null && b.charRegionOrder() != null) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0) return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(ShortBuffer a, int aOff, ShortBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 3 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0) return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(IntBuffer a, int aOff, IntBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 1 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0) return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(FloatBuffer a, int aOff, FloatBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 1 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ // Mismatched
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values; and
+ // is not associated with +0 and -0
+ float av = a.get(aOff + i);
+ float bv = b.get(bOff + i);
+ if (av != bv && (!Float.isNaN(av) || !Float.isNaN(bv)))
+ return i;
+
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ }
+ // Matched
+ else {
+ i = length - ~i;
+ }
+ }
+ for (; i < length; i++) {
+ float av = a.get(aOff + i);
+ float bv = b.get(bOff + i);
+ if (av != bv && (!Float.isNaN(av) || !Float.isNaN(bv)))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(LongBuffer a, int aOff, LongBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 0 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+ for (; i < length; i++) {
+ if (a.get(aOff + i) != b.get(bOff + i))
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(DoubleBuffer a, int aOff, DoubleBuffer b, int bOff, int length) {
+ int i = 0;
+ if (length > 0 && a.order() == b.order()) {
+ i = ArraysSupport.vectorizedMismatch(
+ a.base(), a.address + (aOff << ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE),
+ b.base(), b.address + (bOff << ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE),
+ length,
+ ArraysSupport.LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ // Mismatched
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values; and
+ // is not associated with +0 and -0
+ double av = a.get(aOff + i);
+ double bv = b.get(bOff + i);
+ if (av != bv && (!Double.isNaN(av) || !Double.isNaN(bv)))
+ return i;
+
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ }
+ // Matched
+ else {
+ return -1;
+ }
+ }
+ for (; i < length; i++) {
+ double av = a.get(aOff + i);
+ double bv = b.get(bOff + i);
+ if (av != bv && (!Double.isNaN(av) || !Double.isNaN(bv)))
+ return i;
+ }
+ return -1;
+ }
+}
--- a/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template Tue Jan 16 22:24:20 2018 +0000
@@ -36,9 +36,6 @@
#if[rw]
- // Cached unsafe-access object
- private static final Unsafe unsafe = Bits.unsafe();
-
protected final ByteBuffer bb;
#end[rw]
@@ -74,6 +71,11 @@
#end[rw]
}
+ @Override
+ Object base() {
+ return bb.hb;
+ }
+
public $Type$Buffer slice() {
int pos = this.position();
int lim = this.limit();
@@ -117,20 +119,20 @@
}
public $type$ get() {
- $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
{#if[boB]?true:false});
return $fromBits$(x);
}
public $type$ get(int i) {
- $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
{#if[boB]?true:false});
return $fromBits$(x);
}
#if[streamableType]
$type$ getUnchecked(int i) {
- $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(i),
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(i),
{#if[boB]?true:false});
return $fromBits$(x);
}
@@ -141,7 +143,7 @@
public $Type$Buffer put($type$ x) {
#if[rw]
$memtype$ y = $toBits$(x);
- unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
+ UNSAFE.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
{#if[boB]?true:false});
return this;
#else[rw]
@@ -152,7 +154,7 @@
public $Type$Buffer put(int i, $type$ x) {
#if[rw]
$memtype$ y = $toBits$(x);
- unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
+ UNSAFE.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
{#if[boB]?true:false});
return this;
#else[rw]
@@ -241,4 +243,9 @@
#end[boL]
}
+#if[char]
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
}
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template Tue Jan 16 22:24:20 2018 +0000
@@ -32,7 +32,7 @@
#if[rw]
private $type$ get$Type$(long a) {
- $memtype$ x = unsafe.get$Memtype$Unaligned(null, a, bigEndian);
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
return $fromBits$(x);
}
@@ -49,7 +49,7 @@
private ByteBuffer put$Type$(long a, $type$ x) {
#if[rw]
$memtype$ y = $toBits$(x);
- unsafe.put$Memtype$Unaligned(null, a, y, bigEndian);
+ UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -81,7 +81,7 @@
int rem = (off <= lim ? lim - off : 0);
int size = rem >> $LG_BYTES_PER_VALUE$;
- if (!unaligned && ((address + off) % $BYTES_PER_VALUE$ != 0)) {
+ if (!UNALIGNED && ((address + off) % $BYTES_PER_VALUE$ != 0)) {
return (bigEndian
? ($Type$Buffer)(new ByteBufferAs$Type$Buffer$RW$B(this,
-1,
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,6 @@
package java.nio;
import java.io.FileDescriptor;
-import jdk.internal.misc.Unsafe;
import jdk.internal.misc.VM;
import jdk.internal.ref.Cleaner;
import sun.nio.ch.DirectBuffer;
@@ -45,14 +44,11 @@
#if[rw]
- // Cached unsafe-access object
- protected static final Unsafe unsafe = Bits.unsafe();
-
// Cached array base offset
- private static final long arrayBaseOffset = (long)unsafe.arrayBaseOffset($type$[].class);
+ private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
// Cached unaligned-access capability
- protected static final boolean unaligned = Bits.unaligned();
+ protected static final boolean UNALIGNED = Bits.unaligned();
// Base address, used in all indexing calculations
// NOTE: moved up to Buffer.java for speed in JNI GetDirectBufferAddress
@@ -73,8 +69,6 @@
implements Runnable
{
- private static Unsafe unsafe = Unsafe.getUnsafe();
-
private long address;
private long size;
private int capacity;
@@ -91,7 +85,7 @@
// Paranoia
return;
}
- unsafe.freeMemory(address);
+ UNSAFE.freeMemory(address);
address = 0;
Bits.unreserveMemory(size, capacity);
}
@@ -124,12 +118,12 @@
long base = 0;
try {
- base = unsafe.allocateMemory(size);
+ base = UNSAFE.allocateMemory(size);
} catch (OutOfMemoryError x) {
Bits.unreserveMemory(size, cap);
throw x;
}
- unsafe.setMemory(base, size, (byte) 0);
+ UNSAFE.setMemory(base, size, (byte) 0);
if (pa && (base % ps != 0)) {
// Round up to page boundary
address = base + ps - (base & (ps - 1));
@@ -206,6 +200,11 @@
#end[rw]
}
+ @Override
+ Object base() {
+ return null;
+ }
+
public $Type$Buffer slice() {
int pos = this.position();
int lim = this.limit();
@@ -258,16 +257,16 @@
}
public $type$ get() {
- return $fromBits$($swap$(unsafe.get$Swaptype$(ix(nextGetIndex()))));
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(nextGetIndex()))));
}
public $type$ get(int i) {
- return $fromBits$($swap$(unsafe.get$Swaptype$(ix(checkIndex(i)))));
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(checkIndex(i)))));
}
#if[streamableType]
$type$ getUnchecked(int i) {
- return $fromBits$($swap$(unsafe.get$Swaptype$(ix(i))));
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(i))));
}
#end[streamableType]
@@ -282,10 +281,10 @@
if (length > rem)
throw new BufferUnderflowException();
- long dstOffset = arrayBaseOffset + ((long)offset << $LG_BYTES_PER_VALUE$);
+ long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
#if[!byte]
if (order() != ByteOrder.nativeOrder())
- unsafe.copySwapMemory(null,
+ UNSAFE.copySwapMemory(null,
ix(pos),
dst,
dstOffset,
@@ -293,7 +292,7 @@
(long)1 << $LG_BYTES_PER_VALUE$);
else
#end[!byte]
- unsafe.copyMemory(null,
+ UNSAFE.copyMemory(null,
ix(pos),
dst,
dstOffset,
@@ -312,7 +311,7 @@
public $Type$Buffer put($type$ x) {
#if[rw]
- unsafe.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
+ UNSAFE.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -321,7 +320,7 @@
public $Type$Buffer put(int i, $type$ x) {
#if[rw]
- unsafe.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
+ UNSAFE.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -347,7 +346,7 @@
if (srem > rem)
throw new BufferOverflowException();
- unsafe.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
+ UNSAFE.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
sb.position(spos + srem);
position(pos + srem);
} else if (src.hb != null) {
@@ -380,10 +379,10 @@
if (length > rem)
throw new BufferOverflowException();
- long srcOffset = arrayBaseOffset + ((long)offset << $LG_BYTES_PER_VALUE$);
+ long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
#if[!byte]
if (order() != ByteOrder.nativeOrder())
- unsafe.copySwapMemory(src,
+ UNSAFE.copySwapMemory(src,
srcOffset,
null,
ix(pos),
@@ -391,7 +390,7 @@
(long)1 << $LG_BYTES_PER_VALUE$);
else
#end[!byte]
- unsafe.copyMemory(src,
+ UNSAFE.copyMemory(src,
srcOffset,
null,
ix(pos),
@@ -413,7 +412,7 @@
assert (pos <= lim);
int rem = (pos <= lim ? lim - pos : 0);
- unsafe.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
+ UNSAFE.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
position(rem);
limit(capacity());
discardMark();
@@ -490,17 +489,22 @@
#end[!byte]
+#if[char]
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
#if[byte]
byte _get(int i) { // package-private
- return unsafe.getByte(address + i);
+ return UNSAFE.getByte(address + i);
}
void _put(int i, byte b) { // package-private
#if[rw]
- unsafe.putByte(address + i, b);
+ UNSAFE.putByte(address + i, b);
#else[rw]
throw new ReadOnlyBufferException();
#end[rw]
--- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Tue Jan 16 22:24:20 2018 +0000
@@ -27,8 +27,6 @@
package java.nio;
-import jdk.internal.misc.Unsafe;
-
/**
#if[rw]
* A read/write Heap$Type$Buffer.
@@ -43,6 +41,11 @@
class Heap$Type$Buffer$RW$
extends {#if[ro]?Heap}$Type$Buffer
{
+ // Cached array base offset
+ private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
+
+ // Cached array base offset
+ private static final long ARRAY_INDEX_SCALE = UNSAFE.arrayIndexScale($type$[].class);
// For speed these fields are actually declared in X-Buffer;
// these declarations are here as documentation
@@ -53,16 +56,6 @@
#end[rw]
*/
-#if[byte]
-
- // Cached unsafe-access object
- private static final Unsafe unsafe = Bits.unsafe();
-
- // Cached array base offset
- private static final long arrayBaseOffset = unsafe.arrayBaseOffset($type$[].class);
-
-#end[byte]
-
Heap$Type$Buffer$RW$(int cap, int lim) { // package-private
#if[rw]
super(-1, 0, lim, cap, new $type$[cap], 0);
@@ -70,13 +63,11 @@
hb = new $type$[cap];
offset = 0;
*/
+ this.address = ARRAY_BASE_OFFSET;
#else[rw]
super(cap, lim);
this.isReadOnly = true;
#end[rw]
-#if[byte]
- this.address = arrayBaseOffset;
-#end[byte]
}
Heap$Type$Buffer$RW$($type$[] buf, int off, int len) { // package-private
@@ -86,13 +77,11 @@
hb = buf;
offset = 0;
*/
+ this.address = ARRAY_BASE_OFFSET;
#else[rw]
super(buf, off, len);
this.isReadOnly = true;
#end[rw]
-#if[byte]
- this.address = arrayBaseOffset;
-#end[byte]
}
protected Heap$Type$Buffer$RW$($type$[] buf,
@@ -105,13 +94,11 @@
hb = buf;
offset = off;
*/
+ this.address = ARRAY_BASE_OFFSET + off * ARRAY_INDEX_SCALE;
#else[rw]
super(buf, mark, pos, lim, cap, off);
this.isReadOnly = true;
#end[rw]
-#if[byte]
- this.address = arrayBaseOffset + off;
-#end[byte]
}
public $Type$Buffer slice() {
@@ -296,18 +283,18 @@
#if[rw]
public char getChar() {
- return unsafe.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
+ return UNSAFE.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
}
public char getChar(int i) {
- return unsafe.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
+ return UNSAFE.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
}
#end[rw]
public $Type$Buffer putChar(char x) {
#if[rw]
- unsafe.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
+ UNSAFE.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -316,7 +303,7 @@
public $Type$Buffer putChar(int i, char x) {
#if[rw]
- unsafe.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
+ UNSAFE.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -347,18 +334,18 @@
#if[rw]
public short getShort() {
- return unsafe.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
+ return UNSAFE.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
}
public short getShort(int i) {
- return unsafe.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
+ return UNSAFE.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
}
#end[rw]
public $Type$Buffer putShort(short x) {
#if[rw]
- unsafe.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
+ UNSAFE.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -367,7 +354,7 @@
public $Type$Buffer putShort(int i, short x) {
#if[rw]
- unsafe.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
+ UNSAFE.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -398,18 +385,18 @@
#if[rw]
public int getInt() {
- return unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
+ return UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
}
public int getInt(int i) {
- return unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+ return UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
}
#end[rw]
public $Type$Buffer putInt(int x) {
#if[rw]
- unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian);
+ UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -418,7 +405,7 @@
public $Type$Buffer putInt(int i, int x) {
#if[rw]
- unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian);
+ UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -449,18 +436,18 @@
#if[rw]
public long getLong() {
- return unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+ return UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
}
public long getLong(int i) {
- return unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+ return UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
}
#end[rw]
public $Type$Buffer putLong(long x) {
#if[rw]
- unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian);
+ UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -469,7 +456,7 @@
public $Type$Buffer putLong(int i, long x) {
#if[rw]
- unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian);
+ UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -500,12 +487,12 @@
#if[rw]
public float getFloat() {
- int x = unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
+ int x = UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
return Float.intBitsToFloat(x);
}
public float getFloat(int i) {
- int x = unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+ int x = UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
return Float.intBitsToFloat(x);
}
@@ -514,7 +501,7 @@
public $Type$Buffer putFloat(float x) {
#if[rw]
int y = Float.floatToRawIntBits(x);
- unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
+ UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -524,7 +511,7 @@
public $Type$Buffer putFloat(int i, float x) {
#if[rw]
int y = Float.floatToRawIntBits(x);
- unsafe.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian);
+ UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -555,12 +542,12 @@
#if[rw]
public double getDouble() {
- long x = unsafe.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+ long x = UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
return Double.longBitsToDouble(x);
}
public double getDouble(int i) {
- long x = unsafe.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+ long x = UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
return Double.longBitsToDouble(x);
}
@@ -569,7 +556,7 @@
public $Type$Buffer putDouble(double x) {
#if[rw]
long y = Double.doubleToRawLongBits(x);
- unsafe.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian);
+ UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -579,7 +566,7 @@
public $Type$Buffer putDouble(int i, double x) {
#if[rw]
long y = Double.doubleToRawLongBits(x);
- unsafe.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian);
+ UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -643,7 +630,11 @@
public ByteOrder order() {
return ByteOrder.nativeOrder();
}
+#end[!byte]
+#if[char]
-#end[!byte]
-
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
}
--- a/src/java.base/share/classes/java/nio/StringCharBuffer.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/StringCharBuffer.java Tue Jan 16 22:24:20 2018 +0000
@@ -127,4 +127,30 @@
return ByteOrder.nativeOrder();
}
+ ByteOrder charRegionOrder() {
+ return null;
+ }
+
+ public boolean equals(Object ob) {
+ if (this == ob)
+ return true;
+ if (!(ob instanceof CharBuffer))
+ return false;
+ CharBuffer that = (CharBuffer)ob;
+ if (this.remaining() != that.remaining())
+ return false;
+ return BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ this.remaining()) < 0;
+ }
+
+ public int compareTo(CharBuffer that) {
+ int i = BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ Math.min(this.remaining(), that.remaining()));
+ if (i >= 0) {
+ return Character.compare(this.get(this.position() + i), that.get(this.position() + i));
+ }
+ return this.remaining() - that.remaining();
+ }
}
--- a/src/java.base/share/classes/java/nio/X-Buffer.java.template Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template Tue Jan 16 22:24:20 2018 +0000
@@ -36,6 +36,8 @@
import java.util.stream.$Streamtype$Stream;
#end[streamableType]
+import jdk.internal.util.ArraysSupport;
+
/**
* $A$ $type$ buffer.
*
@@ -287,6 +289,11 @@
this(mark, pos, lim, cap, null, 0);
}
+ @Override
+ Object base() {
+ return hb;
+ }
+
#if[byte]
/**
@@ -1297,19 +1304,9 @@
$Type$Buffer that = ($Type$Buffer)ob;
if (this.remaining() != that.remaining())
return false;
- int p = this.position();
- for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--)
- if (!equals(this.get(i), that.get(j)))
- return false;
- return true;
- }
-
- private static boolean equals($type$ x, $type$ y) {
-#if[floatingPointType]
- return (x == y) || ($Fulltype$.isNaN(x) && $Fulltype$.isNaN(y));
-#else[floatingPointType]
- return x == y;
-#end[floatingPointType]
+ return BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ this.remaining()) < 0;
}
/**
@@ -1336,11 +1333,11 @@
* is less than, equal to, or greater than the given buffer
*/
public int compareTo($Type$Buffer that) {
- int n = this.position() + Math.min(this.remaining(), that.remaining());
- for (int i = this.position(), j = that.position(); i < n; i++, j++) {
- int cmp = compare(this.get(i), that.get(j));
- if (cmp != 0)
- return cmp;
+ int i = BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ Math.min(this.remaining(), that.remaining()));
+ if (i >= 0) {
+ return compare(this.get(this.position() + i), that.get(this.position() + i));
}
return this.remaining() - that.remaining();
}
@@ -1571,6 +1568,12 @@
#end[!byte]
+#if[char]
+ // The order or null if the buffer does not cover a memory region,
+ // such as StringCharBuffer
+ abstract ByteOrder charRegionOrder();
+#end[char]
+
#if[byte]
boolean bigEndian // package-private
--- a/src/java.base/share/classes/java/nio/file/Files.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/nio/file/Files.java Tue Jan 16 22:24:20 2018 +0000
@@ -2955,22 +2955,6 @@
}
/**
- * Reads all bytes from an input stream and writes them to an output stream.
- */
- private static long copy(InputStream source, OutputStream sink)
- throws IOException
- {
- long nread = 0L;
- byte[] buf = new byte[BUFFER_SIZE];
- int n;
- while ((n = source.read(buf)) > 0) {
- sink.write(buf, 0, n);
- nread += n;
- }
- return nread;
- }
-
- /**
* Copies all bytes from an input stream to a file. On return, the input
* stream will be at end of stream.
*
@@ -3082,7 +3066,7 @@
// do the copy
try (OutputStream out = ostream) {
- return copy(in, out);
+ return in.transferTo(out);
}
}
@@ -3124,7 +3108,7 @@
Objects.requireNonNull(out);
try (InputStream in = newInputStream(source)) {
- return copy(in, out);
+ return in.transferTo(out);
}
}
--- a/src/java.base/share/classes/java/util/Arrays.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/util/Arrays.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,6 +26,7 @@
package java.util;
import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.util.ArraysSupport;
import java.lang.reflect.Array;
import java.util.concurrent.ForkJoinPool;
--- a/src/java.base/share/classes/java/util/ArraysSupport.java Sun Jan 14 21:46:14 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,545 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package java.util;
-
-import jdk.internal.HotSpotIntrinsicCandidate;
-import jdk.internal.misc.Unsafe;
-
-/**
- * Utility methods to find a mismatch between two primitive arrays.
- *
- * <p>Array equality and lexicographical comparison can be built on top of
- * array mismatch functionality.
- *
- * <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages
- * vector-based techniques to access and compare the contents of two arrays.
- * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
- * content of an array, thus access is supported on platforms that do not
- * support unaligned access. For a byte[] array, 8 bytes (64 bits) can be
- * accessed and compared as a unit rather than individually, which increases
- * the performance when the method is compiled by the HotSpot VM. On supported
- * platforms the mismatch implementation is intrinsified to leverage SIMD
- * instructions. So for a byte[] array, 16 bytes (128 bits), 32 bytes
- * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
- * permitting, can be accessed and compared as a unit, which further increases
- * the performance over the Java implementation.
- *
- * <p>None of the mismatch methods perform array bounds checks. It is the
- * responsibility of the caller (direct or otherwise) to perform such checks
- * before calling this method.
- */
-class ArraysSupport {
- static final Unsafe U = Unsafe.getUnsafe();
-
- private static final boolean BIG_ENDIAN = U.isBigEndian();
-
- private static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
- private static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
- private static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
- private static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
- private static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
- private static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
- private static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
- private static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
-
- private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
-
- private static int exactLog2(int scale) {
- if ((scale & (scale - 1)) != 0)
- throw new Error("data type scale not a power of two");
- return Integer.numberOfTrailingZeros(scale);
- }
-
- private ArraysSupport() {}
-
- /**
- * Find the relative index of the first mismatching pair of elements in two
- * primitive arrays of the same component type. Pairs of elements will be
- * tested in order relative to given offsets into both arrays.
- *
- * <p>This method does not perform type checks or bounds checks. It is the
- * responsibility of the caller to perform such checks before calling this
- * method.
- *
- * <p>The given offsets, in bytes, need not be aligned according to the
- * given log<sub>2</sub> size the array elements. More specifically, an
- * offset modulus the size need not be zero.
- *
- * @param a the first array to be tested for mismatch, or {@code null} for
- * direct memory access
- * @param aOffset the relative offset, in bytes, from the base address of
- * the first array to test from, otherwise if the first array is
- * {@code null}, an absolute address pointing to the first element to test.
- * @param b the second array to be tested for mismatch, or {@code null} for
- * direct memory access
- * @param bOffset the relative offset, in bytes, from the base address of
- * the second array to test from, otherwise if the second array is
- * {@code null}, an absolute address pointing to the first element to test.
- * @param length the number of array elements to test
- * @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that
- * corresponds to the size, in bytes, of an array element.
- * @return if a mismatch is found a relative index, between 0 (inclusive)
- * and {@code length} (exclusive), of the first mismatching pair of elements
- * in the two arrays. Otherwise, if a mismatch is not found the bitwise
- * compliment of the number of remaining pairs of elements to be checked in
- * the tail of the two arrays.
- */
- @HotSpotIntrinsicCandidate
- static int vectorizedMismatch(Object a, long aOffset,
- Object b, long bOffset,
- int length,
- int log2ArrayIndexScale) {
- // assert a.getClass().isArray();
- // assert b.getClass().isArray();
- // assert 0 <= length <= sizeOf(a)
- // assert 0 <= length <= sizeOf(b)
- // assert 0 <= log2ArrayIndexScale <= 3
-
- int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
- int wi = 0;
- for (; wi < length >> log2ValuesPerWidth; wi++) {
- long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
- long av = U.getLongUnaligned(a, aOffset + bi);
- long bv = U.getLongUnaligned(b, bOffset + bi);
- if (av != bv) {
- long x = av ^ bv;
- int o = BIG_ENDIAN
- ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
- : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
- return (wi << log2ValuesPerWidth) + o;
- }
- }
-
- // Calculate the tail of remaining elements to check
- int tail = length - (wi << log2ValuesPerWidth);
-
- if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
- int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
- // Handle 4 bytes or 2 chars in the tail using int width
- if (tail >= wordTail) {
- long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
- int av = U.getIntUnaligned(a, aOffset + bi);
- int bv = U.getIntUnaligned(b, bOffset + bi);
- if (av != bv) {
- int x = av ^ bv;
- int o = BIG_ENDIAN
- ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
- : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
- return (wi << log2ValuesPerWidth) + o;
- }
- tail -= wordTail;
- }
- return ~tail;
- }
- else {
- return ~tail;
- }
- }
-
- // Booleans
- // Each boolean element takes up one byte
-
- static int mismatch(boolean[] a,
- boolean[] b,
- int length) {
- int i = 0;
- if (length > 7) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
- b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
- length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- static int mismatch(boolean[] a, int aFromIndex,
- boolean[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 7) {
- int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
- int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Bytes
-
- /**
- * Find the index of a mismatch between two arrays.
- *
- * <p>This method does not perform bounds checks. It is the responsibility
- * of the caller to perform such bounds checks before calling this method.
- *
- * @param a the first array to be tested for a mismatch
- * @param b the second array to be tested for a mismatch
- * @param length the number of bytes from each array to check
- * @return the index of a mismatch between the two arrays, otherwise -1 if
- * no mismatch. The index will be within the range of (inclusive) 0 to
- * (exclusive) the smaller of the two array lengths.
- */
- static int mismatch(byte[] a,
- byte[] b,
- int length) {
- // ISSUE: defer to index receiving methods if performance is good
- // assert length <= a.length
- // assert length <= b.length
-
- int i = 0;
- if (length > 7) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
- b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
- length, LOG2_ARRAY_BYTE_INDEX_SCALE);
- if (i >= 0)
- return i;
- // Align to tail
- i = length - ~i;
-// assert i >= 0 && i <= 7;
- }
- // Tail < 8 bytes
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- /**
- * Find the relative index of a mismatch between two arrays starting from
- * given indexes.
- *
- * <p>This method does not perform bounds checks. It is the responsibility
- * of the caller to perform such bounds checks before calling this method.
- *
- * @param a the first array to be tested for a mismatch
- * @param aFromIndex the index of the first element (inclusive) in the first
- * array to be compared
- * @param b the second array to be tested for a mismatch
- * @param bFromIndex the index of the first element (inclusive) in the
- * second array to be compared
- * @param length the number of bytes from each array to check
- * @return the relative index of a mismatch between the two arrays,
- * otherwise -1 if no mismatch. The index will be within the range of
- * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
- */
- static int mismatch(byte[] a, int aFromIndex,
- byte[] b, int bFromIndex,
- int length) {
- // assert 0 <= aFromIndex < a.length
- // assert 0 <= aFromIndex + length <= a.length
- // assert 0 <= bFromIndex < b.length
- // assert 0 <= bFromIndex + length <= b.length
- // assert length >= 0
-
- int i = 0;
- if (length > 7) {
- int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
- int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_BYTE_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Chars
-
- static int mismatch(char[] a,
- char[] b,
- int length) {
- int i = 0;
- if (length > 3) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
- b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
- length, LOG2_ARRAY_CHAR_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- static int mismatch(char[] a, int aFromIndex,
- char[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 3) {
- int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_CHAR_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Shorts
-
- static int mismatch(short[] a,
- short[] b,
- int length) {
- int i = 0;
- if (length > 3) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
- b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
- length, LOG2_ARRAY_SHORT_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- static int mismatch(short[] a, int aFromIndex,
- short[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 3) {
- int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_SHORT_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Ints
-
- static int mismatch(int[] a,
- int[] b,
- int length) {
- int i = 0;
- if (length > 1) {
- i = vectorizedMismatch(
- a, Unsafe.ARRAY_INT_BASE_OFFSET,
- b, Unsafe.ARRAY_INT_BASE_OFFSET,
- length, LOG2_ARRAY_INT_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[i] != b[i])
- return i;
- }
- return -1;
- }
-
- static int mismatch(int[] a, int aFromIndex,
- int[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 1) {
- int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_INT_INDEX_SCALE);
- if (i >= 0)
- return i;
- i = length - ~i;
- }
- for (; i < length; i++) {
- if (a[aFromIndex + i] != b[bFromIndex + i])
- return i;
- }
- return -1;
- }
-
-
- // Floats
-
- static int mismatch(float[] a,
- float[] b,
- int length) {
- return mismatch(a, 0, b, 0, length);
- }
-
- static int mismatch(float[] a, int aFromIndex,
- float[] b, int bFromIndex,
- int length) {
- int i = 0;
- if (length > 1) {
- int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
- i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
- // Mismatched
- if (i >= 0) {
- // Check if mismatch is not associated with two NaN values
- if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
- return i;
-
- // Mismatch on two different NaN values that are normalized to match
- // Fall back to slow mechanism
- // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
- // However, requires that returned value be relative to input ranges
- i++;
- }
- // Matched
- else {
- i = length - ~i;
- }
- }
- for (; i < length; i++) {
- if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
- return i;
- }
- return -1;
- }
-
- // 64 bit sizes
-
- // Long
-
- static int mismatch(long[] a,
- long[] b,
- int length) {
- if (length == 0) {
- return -1;
- }
- int i = vectorizedMismatch(
- a, Unsafe.ARRAY_LONG_BASE_OFFSET,
- b, Unsafe.ARRAY_LONG_BASE_OFFSET,
- length, LOG2_ARRAY_LONG_INDEX_SCALE);
- return i >= 0 ? i : -1;
- }
-
- static int mismatch(long[] a, int aFromIndex,
- long[] b, int bFromIndex,
- int length) {
- if (length == 0) {
- return -1;
- }
- int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
- int i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_LONG_INDEX_SCALE);
- return i >= 0 ? i : -1;
- }
-
-
- // Double
-
- static int mismatch(double[] a,
- double[] b,
- int length) {
- return mismatch(a, 0, b, 0, length);
- }
-
- static int mismatch(double[] a, int aFromIndex,
- double[] b, int bFromIndex,
- int length) {
- if (length == 0) {
- return -1;
- }
- int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
- int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
- int i = vectorizedMismatch(
- a, aOffset,
- b, bOffset,
- length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
- if (i >= 0) {
- // Check if mismatch is not associated with two NaN values
- if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
- return i;
-
- // Mismatch on two different NaN values that are normalized to match
- // Fall back to slow mechanism
- // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
- // However, requires that returned value be relative to input ranges
- i++;
- for (; i < length; i++) {
- if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
- return i;
- }
- }
-
- return -1;
- }
-}
--- a/src/java.base/share/classes/java/util/regex/Pattern.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -954,6 +954,12 @@
private int flags;
/**
+ * The temporary pattern flags used during compiling. The flags might be turn
+ * on and off by embedded flag.
+ */
+ private transient int flags0;
+
+ /**
* Boolean indicating this Pattern is compiled; this is necessary in order
* to lazily compile deserialized Patterns.
*/
@@ -1137,7 +1143,7 @@
* @return The match flags specified when this pattern was compiled
*/
public int flags() {
- return flags;
+ return flags0;
}
/**
@@ -1369,6 +1375,9 @@
// Read in all fields
s.defaultReadObject();
+ // reset the flags
+ flags0 = flags;
+
// Initialize counts
capturingGroupCount = 1;
localCount = 0;
@@ -1400,6 +1409,9 @@
if ((flags & UNICODE_CHARACTER_CLASS) != 0)
flags |= UNICODE_CASE;
+ // 'flags' for compiling
+ flags0 = flags;
+
// Reset group index count
capturingGroupCount = 1;
localCount = 0;
@@ -1841,7 +1853,7 @@
* Indicates whether a particular flag is set or not.
*/
private boolean has(int f) {
- return (flags & f) != 0;
+ return (flags0 & f) != 0;
}
/**
@@ -2718,7 +2730,7 @@
ch == 0x53 || ch == 0x73 || //S and s
ch == 0x4b || ch == 0x6b || //K and k
ch == 0xc5 || ch == 0xe5))) { //A+ring
- bits.add(ch, flags());
+ bits.add(ch, flags0);
return null;
}
return single(ch);
@@ -2931,7 +2943,7 @@
boolean capturingGroup = false;
Node head = null;
Node tail = null;
- int save = flags;
+ int save = flags0;
int saveTCNCount = topClosureNodes.size();
root = null;
int ch = next();
@@ -3032,7 +3044,7 @@
}
accept(')', "Unclosed group");
- flags = save;
+ flags0 = save;
// Check for quantifiers
Node node = closure(head);
@@ -3135,28 +3147,28 @@
for (;;) {
switch (ch) {
case 'i':
- flags |= CASE_INSENSITIVE;
+ flags0 |= CASE_INSENSITIVE;
break;
case 'm':
- flags |= MULTILINE;
+ flags0 |= MULTILINE;
break;
case 's':
- flags |= DOTALL;
+ flags0 |= DOTALL;
break;
case 'd':
- flags |= UNIX_LINES;
+ flags0 |= UNIX_LINES;
break;
case 'u':
- flags |= UNICODE_CASE;
+ flags0 |= UNICODE_CASE;
break;
case 'c':
- flags |= CANON_EQ;
+ flags0 |= CANON_EQ;
break;
case 'x':
- flags |= COMMENTS;
+ flags0 |= COMMENTS;
break;
case 'U':
- flags |= (UNICODE_CHARACTER_CLASS | UNICODE_CASE);
+ flags0 |= (UNICODE_CHARACTER_CLASS | UNICODE_CASE);
break;
case '-': // subFlag then fall through
ch = next();
@@ -3178,28 +3190,28 @@
for (;;) {
switch (ch) {
case 'i':
- flags &= ~CASE_INSENSITIVE;
+ flags0 &= ~CASE_INSENSITIVE;
break;
case 'm':
- flags &= ~MULTILINE;
+ flags0 &= ~MULTILINE;
break;
case 's':
- flags &= ~DOTALL;
+ flags0 &= ~DOTALL;
break;
case 'd':
- flags &= ~UNIX_LINES;
+ flags0 &= ~UNIX_LINES;
break;
case 'u':
- flags &= ~UNICODE_CASE;
+ flags0 &= ~UNICODE_CASE;
break;
case 'c':
- flags &= ~CANON_EQ;
+ flags0 &= ~CANON_EQ;
break;
case 'x':
- flags &= ~COMMENTS;
+ flags0 &= ~COMMENTS;
break;
case 'U':
- flags &= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE);
+ flags0 &= ~(UNICODE_CHARACTER_CLASS | UNICODE_CASE);
break;
default:
return;
--- a/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/jdk/internal/module/ModuleInfo.java Tue Jan 16 22:24:20 2018 +0000
@@ -64,7 +64,7 @@
public final class ModuleInfo {
private final int JAVA_MIN_SUPPORTED_VERSION = 53;
- private final int JAVA_MAX_SUPPORTED_VERSION = 54;
+ private final int JAVA_MAX_SUPPORTED_VERSION = 55;
private static final JavaLangModuleAccess JLMA
= SharedSecrets.getJavaLangModuleAccess();
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java Tue Jan 16 22:24:20 2018 +0000
@@ -185,7 +185,7 @@
public ClassReader(final byte[] b, final int off, final int len) {
this.b = b;
// checks the class version
- if (readShort(off + 6) > Opcodes.V10) {
+ if (readShort(off + 6) > Opcodes.V11) {
throw new IllegalArgumentException();
}
// parses the constant pool
--- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/Opcodes.java Tue Jan 16 22:24:20 2018 +0000
@@ -90,6 +90,7 @@
int V1_8 = 0 << 16 | 52;
int V9 = 0 << 16 | 53;
int V10 = 0 << 16 | 54;
+ int V11 = 0 << 16 | 55;
// access flags
--- a/src/java.base/share/classes/jdk/internal/reflect/Reflection.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/jdk/internal/reflect/Reflection.java Tue Jan 16 22:24:20 2018 +0000
@@ -64,14 +64,6 @@
@HotSpotIntrinsicCandidate
public static native Class<?> getCallerClass();
- /**
- * @deprecated This method will be removed.
- * This method is a private JDK API and retained temporarily to
- * simplify the implementation of sun.misc.Reflection.getCallerClass.
- */
- @Deprecated(forRemoval=true)
- public static native Class<?> getCallerClass(int depth);
-
/** Retrieves the access flags written to the class file. For
inner classes these flags may differ from those returned by
Class.getModifiers(), which searches the InnerClasses
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/util/ArraysSupport.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.util;
+
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
+
+/**
+ * Utility methods to find a mismatch between two primitive arrays.
+ *
+ * <p>Array equality and lexicographical comparison can be built on top of
+ * array mismatch functionality.
+ *
+ * <p>The mismatch method implementation, {@link #vectorizedMismatch}, leverages
+ * vector-based techniques to access and compare the contents of two arrays.
+ * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
+ * content of an array, thus access is supported on platforms that do not
+ * support unaligned access. For a byte[] array, 8 bytes (64 bits) can be
+ * accessed and compared as a unit rather than individually, which increases
+ * the performance when the method is compiled by the HotSpot VM. On supported
+ * platforms the mismatch implementation is intrinsified to leverage SIMD
+ * instructions. So for a byte[] array, 16 bytes (128 bits), 32 bytes
+ * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
+ * permitting, can be accessed and compared as a unit, which further increases
+ * the performance over the Java implementation.
+ *
+ * <p>None of the mismatch methods perform array bounds checks. It is the
+ * responsibility of the caller (direct or otherwise) to perform such checks
+ * before calling this method.
+ */
+public class ArraysSupport {
+ static final Unsafe U = Unsafe.getUnsafe();
+
+ private static final boolean BIG_ENDIAN = U.isBigEndian();
+
+ public static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
+ public static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
+ public static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
+ public static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
+ public static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
+ public static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
+ public static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
+ public static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
+
+ private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
+
+ private static int exactLog2(int scale) {
+ if ((scale & (scale - 1)) != 0)
+ throw new Error("data type scale not a power of two");
+ return Integer.numberOfTrailingZeros(scale);
+ }
+
+ private ArraysSupport() {}
+
+ /**
+ * Find the relative index of the first mismatching pair of elements in two
+ * primitive arrays of the same component type. Pairs of elements will be
+ * tested in order relative to given offsets into both arrays.
+ *
+ * <p>This method does not perform type checks or bounds checks. It is the
+ * responsibility of the caller to perform such checks before calling this
+ * method.
+ *
+ * <p>The given offsets, in bytes, need not be aligned according to the
+ * given log<sub>2</sub> size the array elements. More specifically, an
+ * offset modulus the size need not be zero.
+ *
+ * @param a the first array to be tested for mismatch, or {@code null} for
+ * direct memory access
+ * @param aOffset the relative offset, in bytes, from the base address of
+ * the first array to test from, otherwise if the first array is
+ * {@code null}, an absolute address pointing to the first element to test.
+ * @param b the second array to be tested for mismatch, or {@code null} for
+ * direct memory access
+ * @param bOffset the relative offset, in bytes, from the base address of
+ * the second array to test from, otherwise if the second array is
+ * {@code null}, an absolute address pointing to the first element to test.
+ * @param length the number of array elements to test
+ * @param log2ArrayIndexScale log<sub>2</sub> of the array index scale, that
+ * corresponds to the size, in bytes, of an array element.
+ * @return if a mismatch is found a relative index, between 0 (inclusive)
+ * and {@code length} (exclusive), of the first mismatching pair of elements
+ * in the two arrays. Otherwise, if a mismatch is not found the bitwise
+ * compliment of the number of remaining pairs of elements to be checked in
+ * the tail of the two arrays.
+ */
+ @HotSpotIntrinsicCandidate
+ public static int vectorizedMismatch(Object a, long aOffset,
+ Object b, long bOffset,
+ int length,
+ int log2ArrayIndexScale) {
+ // assert a.getClass().isArray();
+ // assert b.getClass().isArray();
+ // assert 0 <= length <= sizeOf(a)
+ // assert 0 <= length <= sizeOf(b)
+ // assert 0 <= log2ArrayIndexScale <= 3
+
+ int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
+ int wi = 0;
+ for (; wi < length >> log2ValuesPerWidth; wi++) {
+ long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+ long av = U.getLongUnaligned(a, aOffset + bi);
+ long bv = U.getLongUnaligned(b, bOffset + bi);
+ if (av != bv) {
+ long x = av ^ bv;
+ int o = BIG_ENDIAN
+ ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+ : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+ return (wi << log2ValuesPerWidth) + o;
+ }
+ }
+
+ // Calculate the tail of remaining elements to check
+ int tail = length - (wi << log2ValuesPerWidth);
+
+ if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
+ int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
+ // Handle 4 bytes or 2 chars in the tail using int width
+ if (tail >= wordTail) {
+ long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+ int av = U.getIntUnaligned(a, aOffset + bi);
+ int bv = U.getIntUnaligned(b, bOffset + bi);
+ if (av != bv) {
+ int x = av ^ bv;
+ int o = BIG_ENDIAN
+ ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+ : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+ return (wi << log2ValuesPerWidth) + o;
+ }
+ tail -= wordTail;
+ }
+ return ~tail;
+ }
+ else {
+ return ~tail;
+ }
+ }
+
+ // Booleans
+ // Each boolean element takes up one byte
+
+ public static int mismatch(boolean[] a,
+ boolean[] b,
+ int length) {
+ int i = 0;
+ if (length > 7) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+ b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+ length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ public static int mismatch(boolean[] a, int aFromIndex,
+ boolean[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 7) {
+ int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
+ int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Bytes
+
+ /**
+ * Find the index of a mismatch between two arrays.
+ *
+ * <p>This method does not perform bounds checks. It is the responsibility
+ * of the caller to perform such bounds checks before calling this method.
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @param length the number of bytes from each array to check
+ * @return the index of a mismatch between the two arrays, otherwise -1 if
+ * no mismatch. The index will be within the range of (inclusive) 0 to
+ * (exclusive) the smaller of the two array lengths.
+ */
+ public static int mismatch(byte[] a,
+ byte[] b,
+ int length) {
+ // ISSUE: defer to index receiving methods if performance is good
+ // assert length <= a.length
+ // assert length <= b.length
+
+ int i = 0;
+ if (length > 7) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+ b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+ length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ // Align to tail
+ i = length - ~i;
+// assert i >= 0 && i <= 7;
+ }
+ // Tail < 8 bytes
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Find the relative index of a mismatch between two arrays starting from
+ * given indexes.
+ *
+ * <p>This method does not perform bounds checks. It is the responsibility
+ * of the caller to perform such bounds checks before calling this method.
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index of the first element (inclusive) in the first
+ * array to be compared
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index of the first element (inclusive) in the
+ * second array to be compared
+ * @param length the number of bytes from each array to check
+ * @return the relative index of a mismatch between the two arrays,
+ * otherwise -1 if no mismatch. The index will be within the range of
+ * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
+ */
+ public static int mismatch(byte[] a, int aFromIndex,
+ byte[] b, int bFromIndex,
+ int length) {
+ // assert 0 <= aFromIndex < a.length
+ // assert 0 <= aFromIndex + length <= a.length
+ // assert 0 <= bFromIndex < b.length
+ // assert 0 <= bFromIndex + length <= b.length
+ // assert length >= 0
+
+ int i = 0;
+ if (length > 7) {
+ int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
+ int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Chars
+
+ public static int mismatch(char[] a,
+ char[] b,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+ b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+ length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ public static int mismatch(char[] a, int aFromIndex,
+ char[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Shorts
+
+ public static int mismatch(short[] a,
+ short[] b,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+ b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+ length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ public static int mismatch(short[] a, int aFromIndex,
+ short[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Ints
+
+ public static int mismatch(int[] a,
+ int[] b,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_INT_BASE_OFFSET,
+ b, Unsafe.ARRAY_INT_BASE_OFFSET,
+ length, LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ public static int mismatch(int[] a, int aFromIndex,
+ int[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Floats
+
+ public static int mismatch(float[] a,
+ float[] b,
+ int length) {
+ return mismatch(a, 0, b, 0, length);
+ }
+
+ public static int mismatch(float[] a, int aFromIndex,
+ float[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ // Mismatched
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values
+ if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
+ return i;
+
+ // Mismatch on two different NaN values that are normalized to match
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ }
+ // Matched
+ else {
+ i = length - ~i;
+ }
+ }
+ for (; i < length; i++) {
+ if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
+ return i;
+ }
+ return -1;
+ }
+
+ // 64 bit sizes
+
+ // Long
+
+ public static int mismatch(long[] a,
+ long[] b,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int i = vectorizedMismatch(
+ a, Unsafe.ARRAY_LONG_BASE_OFFSET,
+ b, Unsafe.ARRAY_LONG_BASE_OFFSET,
+ length, LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+
+ public static int mismatch(long[] a, int aFromIndex,
+ long[] b, int bFromIndex,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+ int i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+
+
+ // Double
+
+ public static int mismatch(double[] a,
+ double[] b,
+ int length) {
+ return mismatch(a, 0, b, 0, length);
+ }
+
+ public static int mismatch(double[] a, int aFromIndex,
+ double[] b, int bFromIndex,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ int i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values
+ if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
+ return i;
+
+ // Mismatch on two different NaN values that are normalized to match
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ for (; i < length; i++) {
+ if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
+ return i;
+ }
+ }
+
+ return -1;
+ }
+}
--- a/src/java.base/share/classes/module-info.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/module-info.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -142,7 +142,7 @@
java.instrument,
java.logging;
exports jdk.internal.jmod to
- jdk.compiler, // reflective dependency
+ jdk.compiler,
jdk.jlink;
exports jdk.internal.logger to
java.logging;
@@ -172,7 +172,7 @@
java.xml,
jdk.attach,
jdk.charsets,
- jdk.compiler, // reflective dependency
+ jdk.compiler,
jdk.incubator.httpclient,
jdk.jdeps,
jdk.jlink,
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeHash.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeHash.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -108,7 +108,29 @@
* a hash for the certificate verify message is required.
*/
HandshakeHash(boolean needCertificateVerify) {
- clonesNeeded = needCertificateVerify ? 4 : 3;
+ // We may rework the code later, but for now we use hard-coded number
+ // of clones if the underlying MessageDigests are not cloneable.
+ //
+ // The number used here is based on the current handshake protocols and
+ // implementation. It may be changed if the handshake processe gets
+ // changed in the future, for example adding a new extension that
+ // requires handshake hash. Please be careful about the number of
+ // clones if additional handshak hash is required in the future.
+ //
+ // For the current implementation, the handshake hash is required for
+ // the following items:
+ // . CertificateVerify handshake message (optional)
+ // . client Finished handshake message
+ // . server Finished Handshake message
+ // . the extended Master Secret extension [RFC 7627]
+ //
+ // Note that a late call to server setNeedClientAuth dose not update
+ // the number of clones. We may address the issue later.
+ //
+ // Note for safety, we allocate one more clone for the current
+ // implementation. We may consider it more carefully in the future
+ // for the exact number or rework the code in a different way.
+ clonesNeeded = needCertificateVerify ? 5 : 4;
}
void reserve(ByteBuffer input) {
@@ -335,7 +357,8 @@
if (finMD != null) return;
try {
- finMD = CloneableDigest.getDigest(normalizeAlgName(s), 2);
+ // See comment in the contructor.
+ finMD = CloneableDigest.getDigest(normalizeAlgName(s), 4);
} catch (NoSuchAlgorithmException e) {
throw new Error(e);
}
--- a/src/java.base/share/native/include/classfile_constants.h Sun Jan 14 21:46:14 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,581 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef CLASSFILE_CONSTANTS_H
-#define CLASSFILE_CONSTANTS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Classfile version number for this information */
-#define JVM_CLASSFILE_MAJOR_VERSION 54
-#define JVM_CLASSFILE_MINOR_VERSION 0
-
-/* Flags */
-
-enum {
- JVM_ACC_PUBLIC = 0x0001,
- JVM_ACC_PRIVATE = 0x0002,
- JVM_ACC_PROTECTED = 0x0004,
- JVM_ACC_STATIC = 0x0008,
- JVM_ACC_FINAL = 0x0010,
- JVM_ACC_SYNCHRONIZED = 0x0020,
- JVM_ACC_SUPER = 0x0020,
- JVM_ACC_VOLATILE = 0x0040,
- JVM_ACC_BRIDGE = 0x0040,
- JVM_ACC_TRANSIENT = 0x0080,
- JVM_ACC_VARARGS = 0x0080,
- JVM_ACC_NATIVE = 0x0100,
- JVM_ACC_INTERFACE = 0x0200,
- JVM_ACC_ABSTRACT = 0x0400,
- JVM_ACC_STRICT = 0x0800,
- JVM_ACC_SYNTHETIC = 0x1000,
- JVM_ACC_ANNOTATION = 0x2000,
- JVM_ACC_ENUM = 0x4000,
- JVM_ACC_MODULE = 0x8000
-};
-
-#define JVM_ACC_PUBLIC_BIT 0
-#define JVM_ACC_PRIVATE_BIT 1
-#define JVM_ACC_PROTECTED_BIT 2
-#define JVM_ACC_STATIC_BIT 3
-#define JVM_ACC_FINAL_BIT 4
-#define JVM_ACC_SYNCHRONIZED_BIT 5
-#define JVM_ACC_SUPER_BIT 5
-#define JVM_ACC_VOLATILE_BIT 6
-#define JVM_ACC_BRIDGE_BIT 6
-#define JVM_ACC_TRANSIENT_BIT 7
-#define JVM_ACC_VARARGS_BIT 7
-#define JVM_ACC_NATIVE_BIT 8
-#define JVM_ACC_INTERFACE_BIT 9
-#define JVM_ACC_ABSTRACT_BIT 10
-#define JVM_ACC_STRICT_BIT 11
-#define JVM_ACC_SYNTHETIC_BIT 12
-#define JVM_ACC_ANNOTATION_BIT 13
-#define JVM_ACC_ENUM_BIT 14
-
-/* Used in newarray instruction. */
-
-enum {
- JVM_T_BOOLEAN = 4,
- JVM_T_CHAR = 5,
- JVM_T_FLOAT = 6,
- JVM_T_DOUBLE = 7,
- JVM_T_BYTE = 8,
- JVM_T_SHORT = 9,
- JVM_T_INT = 10,
- JVM_T_LONG = 11
-};
-
-/* Constant Pool Entries */
-
-enum {
- JVM_CONSTANT_Utf8 = 1,
- JVM_CONSTANT_Unicode = 2, /* unused */
- JVM_CONSTANT_Integer = 3,
- JVM_CONSTANT_Float = 4,
- JVM_CONSTANT_Long = 5,
- JVM_CONSTANT_Double = 6,
- JVM_CONSTANT_Class = 7,
- JVM_CONSTANT_String = 8,
- JVM_CONSTANT_Fieldref = 9,
- JVM_CONSTANT_Methodref = 10,
- JVM_CONSTANT_InterfaceMethodref = 11,
- JVM_CONSTANT_NameAndType = 12,
- JVM_CONSTANT_MethodHandle = 15, // JSR 292
- JVM_CONSTANT_MethodType = 16, // JSR 292
- JVM_CONSTANT_InvokeDynamic = 18,
- JVM_CONSTANT_ExternalMax = 18
-};
-
-/* JVM_CONSTANT_MethodHandle subtypes */
-enum {
- JVM_REF_getField = 1,
- JVM_REF_getStatic = 2,
- JVM_REF_putField = 3,
- JVM_REF_putStatic = 4,
- JVM_REF_invokeVirtual = 5,
- JVM_REF_invokeStatic = 6,
- JVM_REF_invokeSpecial = 7,
- JVM_REF_newInvokeSpecial = 8,
- JVM_REF_invokeInterface = 9
-};
-
-/* StackMapTable type item numbers */
-
-enum {
- JVM_ITEM_Top = 0,
- JVM_ITEM_Integer = 1,
- JVM_ITEM_Float = 2,
- JVM_ITEM_Double = 3,
- JVM_ITEM_Long = 4,
- JVM_ITEM_Null = 5,
- JVM_ITEM_UninitializedThis = 6,
- JVM_ITEM_Object = 7,
- JVM_ITEM_Uninitialized = 8
-};
-
-/* Type signatures */
-
-enum {
- JVM_SIGNATURE_ARRAY = '[',
- JVM_SIGNATURE_BYTE = 'B',
- JVM_SIGNATURE_CHAR = 'C',
- JVM_SIGNATURE_CLASS = 'L',
- JVM_SIGNATURE_ENDCLASS = ';',
- JVM_SIGNATURE_ENUM = 'E',
- JVM_SIGNATURE_FLOAT = 'F',
- JVM_SIGNATURE_DOUBLE = 'D',
- JVM_SIGNATURE_FUNC = '(',
- JVM_SIGNATURE_ENDFUNC = ')',
- JVM_SIGNATURE_INT = 'I',
- JVM_SIGNATURE_LONG = 'J',
- JVM_SIGNATURE_SHORT = 'S',
- JVM_SIGNATURE_VOID = 'V',
- JVM_SIGNATURE_BOOLEAN = 'Z'
-};
-
-/* Opcodes */
-
-enum {
- JVM_OPC_nop = 0,
- JVM_OPC_aconst_null = 1,
- JVM_OPC_iconst_m1 = 2,
- JVM_OPC_iconst_0 = 3,
- JVM_OPC_iconst_1 = 4,
- JVM_OPC_iconst_2 = 5,
- JVM_OPC_iconst_3 = 6,
- JVM_OPC_iconst_4 = 7,
- JVM_OPC_iconst_5 = 8,
- JVM_OPC_lconst_0 = 9,
- JVM_OPC_lconst_1 = 10,
- JVM_OPC_fconst_0 = 11,
- JVM_OPC_fconst_1 = 12,
- JVM_OPC_fconst_2 = 13,
- JVM_OPC_dconst_0 = 14,
- JVM_OPC_dconst_1 = 15,
- JVM_OPC_bipush = 16,
- JVM_OPC_sipush = 17,
- JVM_OPC_ldc = 18,
- JVM_OPC_ldc_w = 19,
- JVM_OPC_ldc2_w = 20,
- JVM_OPC_iload = 21,
- JVM_OPC_lload = 22,
- JVM_OPC_fload = 23,
- JVM_OPC_dload = 24,
- JVM_OPC_aload = 25,
- JVM_OPC_iload_0 = 26,
- JVM_OPC_iload_1 = 27,
- JVM_OPC_iload_2 = 28,
- JVM_OPC_iload_3 = 29,
- JVM_OPC_lload_0 = 30,
- JVM_OPC_lload_1 = 31,
- JVM_OPC_lload_2 = 32,
- JVM_OPC_lload_3 = 33,
- JVM_OPC_fload_0 = 34,
- JVM_OPC_fload_1 = 35,
- JVM_OPC_fload_2 = 36,
- JVM_OPC_fload_3 = 37,
- JVM_OPC_dload_0 = 38,
- JVM_OPC_dload_1 = 39,
- JVM_OPC_dload_2 = 40,
- JVM_OPC_dload_3 = 41,
- JVM_OPC_aload_0 = 42,
- JVM_OPC_aload_1 = 43,
- JVM_OPC_aload_2 = 44,
- JVM_OPC_aload_3 = 45,
- JVM_OPC_iaload = 46,
- JVM_OPC_laload = 47,
- JVM_OPC_faload = 48,
- JVM_OPC_daload = 49,
- JVM_OPC_aaload = 50,
- JVM_OPC_baload = 51,
- JVM_OPC_caload = 52,
- JVM_OPC_saload = 53,
- JVM_OPC_istore = 54,
- JVM_OPC_lstore = 55,
- JVM_OPC_fstore = 56,
- JVM_OPC_dstore = 57,
- JVM_OPC_astore = 58,
- JVM_OPC_istore_0 = 59,
- JVM_OPC_istore_1 = 60,
- JVM_OPC_istore_2 = 61,
- JVM_OPC_istore_3 = 62,
- JVM_OPC_lstore_0 = 63,
- JVM_OPC_lstore_1 = 64,
- JVM_OPC_lstore_2 = 65,
- JVM_OPC_lstore_3 = 66,
- JVM_OPC_fstore_0 = 67,
- JVM_OPC_fstore_1 = 68,
- JVM_OPC_fstore_2 = 69,
- JVM_OPC_fstore_3 = 70,
- JVM_OPC_dstore_0 = 71,
- JVM_OPC_dstore_1 = 72,
- JVM_OPC_dstore_2 = 73,
- JVM_OPC_dstore_3 = 74,
- JVM_OPC_astore_0 = 75,
- JVM_OPC_astore_1 = 76,
- JVM_OPC_astore_2 = 77,
- JVM_OPC_astore_3 = 78,
- JVM_OPC_iastore = 79,
- JVM_OPC_lastore = 80,
- JVM_OPC_fastore = 81,
- JVM_OPC_dastore = 82,
- JVM_OPC_aastore = 83,
- JVM_OPC_bastore = 84,
- JVM_OPC_castore = 85,
- JVM_OPC_sastore = 86,
- JVM_OPC_pop = 87,
- JVM_OPC_pop2 = 88,
- JVM_OPC_dup = 89,
- JVM_OPC_dup_x1 = 90,
- JVM_OPC_dup_x2 = 91,
- JVM_OPC_dup2 = 92,
- JVM_OPC_dup2_x1 = 93,
- JVM_OPC_dup2_x2 = 94,
- JVM_OPC_swap = 95,
- JVM_OPC_iadd = 96,
- JVM_OPC_ladd = 97,
- JVM_OPC_fadd = 98,
- JVM_OPC_dadd = 99,
- JVM_OPC_isub = 100,
- JVM_OPC_lsub = 101,
- JVM_OPC_fsub = 102,
- JVM_OPC_dsub = 103,
- JVM_OPC_imul = 104,
- JVM_OPC_lmul = 105,
- JVM_OPC_fmul = 106,
- JVM_OPC_dmul = 107,
- JVM_OPC_idiv = 108,
- JVM_OPC_ldiv = 109,
- JVM_OPC_fdiv = 110,
- JVM_OPC_ddiv = 111,
- JVM_OPC_irem = 112,
- JVM_OPC_lrem = 113,
- JVM_OPC_frem = 114,
- JVM_OPC_drem = 115,
- JVM_OPC_ineg = 116,
- JVM_OPC_lneg = 117,
- JVM_OPC_fneg = 118,
- JVM_OPC_dneg = 119,
- JVM_OPC_ishl = 120,
- JVM_OPC_lshl = 121,
- JVM_OPC_ishr = 122,
- JVM_OPC_lshr = 123,
- JVM_OPC_iushr = 124,
- JVM_OPC_lushr = 125,
- JVM_OPC_iand = 126,
- JVM_OPC_land = 127,
- JVM_OPC_ior = 128,
- JVM_OPC_lor = 129,
- JVM_OPC_ixor = 130,
- JVM_OPC_lxor = 131,
- JVM_OPC_iinc = 132,
- JVM_OPC_i2l = 133,
- JVM_OPC_i2f = 134,
- JVM_OPC_i2d = 135,
- JVM_OPC_l2i = 136,
- JVM_OPC_l2f = 137,
- JVM_OPC_l2d = 138,
- JVM_OPC_f2i = 139,
- JVM_OPC_f2l = 140,
- JVM_OPC_f2d = 141,
- JVM_OPC_d2i = 142,
- JVM_OPC_d2l = 143,
- JVM_OPC_d2f = 144,
- JVM_OPC_i2b = 145,
- JVM_OPC_i2c = 146,
- JVM_OPC_i2s = 147,
- JVM_OPC_lcmp = 148,
- JVM_OPC_fcmpl = 149,
- JVM_OPC_fcmpg = 150,
- JVM_OPC_dcmpl = 151,
- JVM_OPC_dcmpg = 152,
- JVM_OPC_ifeq = 153,
- JVM_OPC_ifne = 154,
- JVM_OPC_iflt = 155,
- JVM_OPC_ifge = 156,
- JVM_OPC_ifgt = 157,
- JVM_OPC_ifle = 158,
- JVM_OPC_if_icmpeq = 159,
- JVM_OPC_if_icmpne = 160,
- JVM_OPC_if_icmplt = 161,
- JVM_OPC_if_icmpge = 162,
- JVM_OPC_if_icmpgt = 163,
- JVM_OPC_if_icmple = 164,
- JVM_OPC_if_acmpeq = 165,
- JVM_OPC_if_acmpne = 166,
- JVM_OPC_goto = 167,
- JVM_OPC_jsr = 168,
- JVM_OPC_ret = 169,
- JVM_OPC_tableswitch = 170,
- JVM_OPC_lookupswitch = 171,
- JVM_OPC_ireturn = 172,
- JVM_OPC_lreturn = 173,
- JVM_OPC_freturn = 174,
- JVM_OPC_dreturn = 175,
- JVM_OPC_areturn = 176,
- JVM_OPC_return = 177,
- JVM_OPC_getstatic = 178,
- JVM_OPC_putstatic = 179,
- JVM_OPC_getfield = 180,
- JVM_OPC_putfield = 181,
- JVM_OPC_invokevirtual = 182,
- JVM_OPC_invokespecial = 183,
- JVM_OPC_invokestatic = 184,
- JVM_OPC_invokeinterface = 185,
- JVM_OPC_invokedynamic = 186,
- JVM_OPC_new = 187,
- JVM_OPC_newarray = 188,
- JVM_OPC_anewarray = 189,
- JVM_OPC_arraylength = 190,
- JVM_OPC_athrow = 191,
- JVM_OPC_checkcast = 192,
- JVM_OPC_instanceof = 193,
- JVM_OPC_monitorenter = 194,
- JVM_OPC_monitorexit = 195,
- JVM_OPC_wide = 196,
- JVM_OPC_multianewarray = 197,
- JVM_OPC_ifnull = 198,
- JVM_OPC_ifnonnull = 199,
- JVM_OPC_goto_w = 200,
- JVM_OPC_jsr_w = 201,
- JVM_OPC_MAX = 201
-};
-
-/* Opcode length initializer, use with something like:
- * unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
- */
-#define JVM_OPCODE_LENGTH_INITIALIZER { \
- 1, /* nop */ \
- 1, /* aconst_null */ \
- 1, /* iconst_m1 */ \
- 1, /* iconst_0 */ \
- 1, /* iconst_1 */ \
- 1, /* iconst_2 */ \
- 1, /* iconst_3 */ \
- 1, /* iconst_4 */ \
- 1, /* iconst_5 */ \
- 1, /* lconst_0 */ \
- 1, /* lconst_1 */ \
- 1, /* fconst_0 */ \
- 1, /* fconst_1 */ \
- 1, /* fconst_2 */ \
- 1, /* dconst_0 */ \
- 1, /* dconst_1 */ \
- 2, /* bipush */ \
- 3, /* sipush */ \
- 2, /* ldc */ \
- 3, /* ldc_w */ \
- 3, /* ldc2_w */ \
- 2, /* iload */ \
- 2, /* lload */ \
- 2, /* fload */ \
- 2, /* dload */ \
- 2, /* aload */ \
- 1, /* iload_0 */ \
- 1, /* iload_1 */ \
- 1, /* iload_2 */ \
- 1, /* iload_3 */ \
- 1, /* lload_0 */ \
- 1, /* lload_1 */ \
- 1, /* lload_2 */ \
- 1, /* lload_3 */ \
- 1, /* fload_0 */ \
- 1, /* fload_1 */ \
- 1, /* fload_2 */ \
- 1, /* fload_3 */ \
- 1, /* dload_0 */ \
- 1, /* dload_1 */ \
- 1, /* dload_2 */ \
- 1, /* dload_3 */ \
- 1, /* aload_0 */ \
- 1, /* aload_1 */ \
- 1, /* aload_2 */ \
- 1, /* aload_3 */ \
- 1, /* iaload */ \
- 1, /* laload */ \
- 1, /* faload */ \
- 1, /* daload */ \
- 1, /* aaload */ \
- 1, /* baload */ \
- 1, /* caload */ \
- 1, /* saload */ \
- 2, /* istore */ \
- 2, /* lstore */ \
- 2, /* fstore */ \
- 2, /* dstore */ \
- 2, /* astore */ \
- 1, /* istore_0 */ \
- 1, /* istore_1 */ \
- 1, /* istore_2 */ \
- 1, /* istore_3 */ \
- 1, /* lstore_0 */ \
- 1, /* lstore_1 */ \
- 1, /* lstore_2 */ \
- 1, /* lstore_3 */ \
- 1, /* fstore_0 */ \
- 1, /* fstore_1 */ \
- 1, /* fstore_2 */ \
- 1, /* fstore_3 */ \
- 1, /* dstore_0 */ \
- 1, /* dstore_1 */ \
- 1, /* dstore_2 */ \
- 1, /* dstore_3 */ \
- 1, /* astore_0 */ \
- 1, /* astore_1 */ \
- 1, /* astore_2 */ \
- 1, /* astore_3 */ \
- 1, /* iastore */ \
- 1, /* lastore */ \
- 1, /* fastore */ \
- 1, /* dastore */ \
- 1, /* aastore */ \
- 1, /* bastore */ \
- 1, /* castore */ \
- 1, /* sastore */ \
- 1, /* pop */ \
- 1, /* pop2 */ \
- 1, /* dup */ \
- 1, /* dup_x1 */ \
- 1, /* dup_x2 */ \
- 1, /* dup2 */ \
- 1, /* dup2_x1 */ \
- 1, /* dup2_x2 */ \
- 1, /* swap */ \
- 1, /* iadd */ \
- 1, /* ladd */ \
- 1, /* fadd */ \
- 1, /* dadd */ \
- 1, /* isub */ \
- 1, /* lsub */ \
- 1, /* fsub */ \
- 1, /* dsub */ \
- 1, /* imul */ \
- 1, /* lmul */ \
- 1, /* fmul */ \
- 1, /* dmul */ \
- 1, /* idiv */ \
- 1, /* ldiv */ \
- 1, /* fdiv */ \
- 1, /* ddiv */ \
- 1, /* irem */ \
- 1, /* lrem */ \
- 1, /* frem */ \
- 1, /* drem */ \
- 1, /* ineg */ \
- 1, /* lneg */ \
- 1, /* fneg */ \
- 1, /* dneg */ \
- 1, /* ishl */ \
- 1, /* lshl */ \
- 1, /* ishr */ \
- 1, /* lshr */ \
- 1, /* iushr */ \
- 1, /* lushr */ \
- 1, /* iand */ \
- 1, /* land */ \
- 1, /* ior */ \
- 1, /* lor */ \
- 1, /* ixor */ \
- 1, /* lxor */ \
- 3, /* iinc */ \
- 1, /* i2l */ \
- 1, /* i2f */ \
- 1, /* i2d */ \
- 1, /* l2i */ \
- 1, /* l2f */ \
- 1, /* l2d */ \
- 1, /* f2i */ \
- 1, /* f2l */ \
- 1, /* f2d */ \
- 1, /* d2i */ \
- 1, /* d2l */ \
- 1, /* d2f */ \
- 1, /* i2b */ \
- 1, /* i2c */ \
- 1, /* i2s */ \
- 1, /* lcmp */ \
- 1, /* fcmpl */ \
- 1, /* fcmpg */ \
- 1, /* dcmpl */ \
- 1, /* dcmpg */ \
- 3, /* ifeq */ \
- 3, /* ifne */ \
- 3, /* iflt */ \
- 3, /* ifge */ \
- 3, /* ifgt */ \
- 3, /* ifle */ \
- 3, /* if_icmpeq */ \
- 3, /* if_icmpne */ \
- 3, /* if_icmplt */ \
- 3, /* if_icmpge */ \
- 3, /* if_icmpgt */ \
- 3, /* if_icmple */ \
- 3, /* if_acmpeq */ \
- 3, /* if_acmpne */ \
- 3, /* goto */ \
- 3, /* jsr */ \
- 2, /* ret */ \
- 99, /* tableswitch */ \
- 99, /* lookupswitch */ \
- 1, /* ireturn */ \
- 1, /* lreturn */ \
- 1, /* freturn */ \
- 1, /* dreturn */ \
- 1, /* areturn */ \
- 1, /* return */ \
- 3, /* getstatic */ \
- 3, /* putstatic */ \
- 3, /* getfield */ \
- 3, /* putfield */ \
- 3, /* invokevirtual */ \
- 3, /* invokespecial */ \
- 3, /* invokestatic */ \
- 5, /* invokeinterface */ \
- 5, /* invokedynamic */ \
- 3, /* new */ \
- 2, /* newarray */ \
- 3, /* anewarray */ \
- 1, /* arraylength */ \
- 1, /* athrow */ \
- 3, /* checkcast */ \
- 3, /* instanceof */ \
- 1, /* monitorenter */ \
- 1, /* monitorexit */ \
- 0, /* wide */ \
- 4, /* multianewarray */ \
- 3, /* ifnull */ \
- 3, /* ifnonnull */ \
- 5, /* goto_w */ \
- 5 /* jsr_w */ \
-}
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif /* CLASSFILE_CONSTANTS */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/native/include/classfile_constants.h.template Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,581 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef CLASSFILE_CONSTANTS_H
+#define CLASSFILE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Classfile version number for this information */
+#define JVM_CLASSFILE_MAJOR_VERSION @@VERSION_CLASSFILE_MAJOR@@
+#define JVM_CLASSFILE_MINOR_VERSION @@VERSION_CLASSFILE_MINOR@@
+
+/* Flags */
+
+enum {
+ JVM_ACC_PUBLIC = 0x0001,
+ JVM_ACC_PRIVATE = 0x0002,
+ JVM_ACC_PROTECTED = 0x0004,
+ JVM_ACC_STATIC = 0x0008,
+ JVM_ACC_FINAL = 0x0010,
+ JVM_ACC_SYNCHRONIZED = 0x0020,
+ JVM_ACC_SUPER = 0x0020,
+ JVM_ACC_VOLATILE = 0x0040,
+ JVM_ACC_BRIDGE = 0x0040,
+ JVM_ACC_TRANSIENT = 0x0080,
+ JVM_ACC_VARARGS = 0x0080,
+ JVM_ACC_NATIVE = 0x0100,
+ JVM_ACC_INTERFACE = 0x0200,
+ JVM_ACC_ABSTRACT = 0x0400,
+ JVM_ACC_STRICT = 0x0800,
+ JVM_ACC_SYNTHETIC = 0x1000,
+ JVM_ACC_ANNOTATION = 0x2000,
+ JVM_ACC_ENUM = 0x4000,
+ JVM_ACC_MODULE = 0x8000
+};
+
+#define JVM_ACC_PUBLIC_BIT 0
+#define JVM_ACC_PRIVATE_BIT 1
+#define JVM_ACC_PROTECTED_BIT 2
+#define JVM_ACC_STATIC_BIT 3
+#define JVM_ACC_FINAL_BIT 4
+#define JVM_ACC_SYNCHRONIZED_BIT 5
+#define JVM_ACC_SUPER_BIT 5
+#define JVM_ACC_VOLATILE_BIT 6
+#define JVM_ACC_BRIDGE_BIT 6
+#define JVM_ACC_TRANSIENT_BIT 7
+#define JVM_ACC_VARARGS_BIT 7
+#define JVM_ACC_NATIVE_BIT 8
+#define JVM_ACC_INTERFACE_BIT 9
+#define JVM_ACC_ABSTRACT_BIT 10
+#define JVM_ACC_STRICT_BIT 11
+#define JVM_ACC_SYNTHETIC_BIT 12
+#define JVM_ACC_ANNOTATION_BIT 13
+#define JVM_ACC_ENUM_BIT 14
+
+/* Used in newarray instruction. */
+
+enum {
+ JVM_T_BOOLEAN = 4,
+ JVM_T_CHAR = 5,
+ JVM_T_FLOAT = 6,
+ JVM_T_DOUBLE = 7,
+ JVM_T_BYTE = 8,
+ JVM_T_SHORT = 9,
+ JVM_T_INT = 10,
+ JVM_T_LONG = 11
+};
+
+/* Constant Pool Entries */
+
+enum {
+ JVM_CONSTANT_Utf8 = 1,
+ JVM_CONSTANT_Unicode = 2, /* unused */
+ JVM_CONSTANT_Integer = 3,
+ JVM_CONSTANT_Float = 4,
+ JVM_CONSTANT_Long = 5,
+ JVM_CONSTANT_Double = 6,
+ JVM_CONSTANT_Class = 7,
+ JVM_CONSTANT_String = 8,
+ JVM_CONSTANT_Fieldref = 9,
+ JVM_CONSTANT_Methodref = 10,
+ JVM_CONSTANT_InterfaceMethodref = 11,
+ JVM_CONSTANT_NameAndType = 12,
+ JVM_CONSTANT_MethodHandle = 15, // JSR 292
+ JVM_CONSTANT_MethodType = 16, // JSR 292
+ JVM_CONSTANT_InvokeDynamic = 18,
+ JVM_CONSTANT_ExternalMax = 18
+};
+
+/* JVM_CONSTANT_MethodHandle subtypes */
+enum {
+ JVM_REF_getField = 1,
+ JVM_REF_getStatic = 2,
+ JVM_REF_putField = 3,
+ JVM_REF_putStatic = 4,
+ JVM_REF_invokeVirtual = 5,
+ JVM_REF_invokeStatic = 6,
+ JVM_REF_invokeSpecial = 7,
+ JVM_REF_newInvokeSpecial = 8,
+ JVM_REF_invokeInterface = 9
+};
+
+/* StackMapTable type item numbers */
+
+enum {
+ JVM_ITEM_Top = 0,
+ JVM_ITEM_Integer = 1,
+ JVM_ITEM_Float = 2,
+ JVM_ITEM_Double = 3,
+ JVM_ITEM_Long = 4,
+ JVM_ITEM_Null = 5,
+ JVM_ITEM_UninitializedThis = 6,
+ JVM_ITEM_Object = 7,
+ JVM_ITEM_Uninitialized = 8
+};
+
+/* Type signatures */
+
+enum {
+ JVM_SIGNATURE_ARRAY = '[',
+ JVM_SIGNATURE_BYTE = 'B',
+ JVM_SIGNATURE_CHAR = 'C',
+ JVM_SIGNATURE_CLASS = 'L',
+ JVM_SIGNATURE_ENDCLASS = ';',
+ JVM_SIGNATURE_ENUM = 'E',
+ JVM_SIGNATURE_FLOAT = 'F',
+ JVM_SIGNATURE_DOUBLE = 'D',
+ JVM_SIGNATURE_FUNC = '(',
+ JVM_SIGNATURE_ENDFUNC = ')',
+ JVM_SIGNATURE_INT = 'I',
+ JVM_SIGNATURE_LONG = 'J',
+ JVM_SIGNATURE_SHORT = 'S',
+ JVM_SIGNATURE_VOID = 'V',
+ JVM_SIGNATURE_BOOLEAN = 'Z'
+};
+
+/* Opcodes */
+
+enum {
+ JVM_OPC_nop = 0,
+ JVM_OPC_aconst_null = 1,
+ JVM_OPC_iconst_m1 = 2,
+ JVM_OPC_iconst_0 = 3,
+ JVM_OPC_iconst_1 = 4,
+ JVM_OPC_iconst_2 = 5,
+ JVM_OPC_iconst_3 = 6,
+ JVM_OPC_iconst_4 = 7,
+ JVM_OPC_iconst_5 = 8,
+ JVM_OPC_lconst_0 = 9,
+ JVM_OPC_lconst_1 = 10,
+ JVM_OPC_fconst_0 = 11,
+ JVM_OPC_fconst_1 = 12,
+ JVM_OPC_fconst_2 = 13,
+ JVM_OPC_dconst_0 = 14,
+ JVM_OPC_dconst_1 = 15,
+ JVM_OPC_bipush = 16,
+ JVM_OPC_sipush = 17,
+ JVM_OPC_ldc = 18,
+ JVM_OPC_ldc_w = 19,
+ JVM_OPC_ldc2_w = 20,
+ JVM_OPC_iload = 21,
+ JVM_OPC_lload = 22,
+ JVM_OPC_fload = 23,
+ JVM_OPC_dload = 24,
+ JVM_OPC_aload = 25,
+ JVM_OPC_iload_0 = 26,
+ JVM_OPC_iload_1 = 27,
+ JVM_OPC_iload_2 = 28,
+ JVM_OPC_iload_3 = 29,
+ JVM_OPC_lload_0 = 30,
+ JVM_OPC_lload_1 = 31,
+ JVM_OPC_lload_2 = 32,
+ JVM_OPC_lload_3 = 33,
+ JVM_OPC_fload_0 = 34,
+ JVM_OPC_fload_1 = 35,
+ JVM_OPC_fload_2 = 36,
+ JVM_OPC_fload_3 = 37,
+ JVM_OPC_dload_0 = 38,
+ JVM_OPC_dload_1 = 39,
+ JVM_OPC_dload_2 = 40,
+ JVM_OPC_dload_3 = 41,
+ JVM_OPC_aload_0 = 42,
+ JVM_OPC_aload_1 = 43,
+ JVM_OPC_aload_2 = 44,
+ JVM_OPC_aload_3 = 45,
+ JVM_OPC_iaload = 46,
+ JVM_OPC_laload = 47,
+ JVM_OPC_faload = 48,
+ JVM_OPC_daload = 49,
+ JVM_OPC_aaload = 50,
+ JVM_OPC_baload = 51,
+ JVM_OPC_caload = 52,
+ JVM_OPC_saload = 53,
+ JVM_OPC_istore = 54,
+ JVM_OPC_lstore = 55,
+ JVM_OPC_fstore = 56,
+ JVM_OPC_dstore = 57,
+ JVM_OPC_astore = 58,
+ JVM_OPC_istore_0 = 59,
+ JVM_OPC_istore_1 = 60,
+ JVM_OPC_istore_2 = 61,
+ JVM_OPC_istore_3 = 62,
+ JVM_OPC_lstore_0 = 63,
+ JVM_OPC_lstore_1 = 64,
+ JVM_OPC_lstore_2 = 65,
+ JVM_OPC_lstore_3 = 66,
+ JVM_OPC_fstore_0 = 67,
+ JVM_OPC_fstore_1 = 68,
+ JVM_OPC_fstore_2 = 69,
+ JVM_OPC_fstore_3 = 70,
+ JVM_OPC_dstore_0 = 71,
+ JVM_OPC_dstore_1 = 72,
+ JVM_OPC_dstore_2 = 73,
+ JVM_OPC_dstore_3 = 74,
+ JVM_OPC_astore_0 = 75,
+ JVM_OPC_astore_1 = 76,
+ JVM_OPC_astore_2 = 77,
+ JVM_OPC_astore_3 = 78,
+ JVM_OPC_iastore = 79,
+ JVM_OPC_lastore = 80,
+ JVM_OPC_fastore = 81,
+ JVM_OPC_dastore = 82,
+ JVM_OPC_aastore = 83,
+ JVM_OPC_bastore = 84,
+ JVM_OPC_castore = 85,
+ JVM_OPC_sastore = 86,
+ JVM_OPC_pop = 87,
+ JVM_OPC_pop2 = 88,
+ JVM_OPC_dup = 89,
+ JVM_OPC_dup_x1 = 90,
+ JVM_OPC_dup_x2 = 91,
+ JVM_OPC_dup2 = 92,
+ JVM_OPC_dup2_x1 = 93,
+ JVM_OPC_dup2_x2 = 94,
+ JVM_OPC_swap = 95,
+ JVM_OPC_iadd = 96,
+ JVM_OPC_ladd = 97,
+ JVM_OPC_fadd = 98,
+ JVM_OPC_dadd = 99,
+ JVM_OPC_isub = 100,
+ JVM_OPC_lsub = 101,
+ JVM_OPC_fsub = 102,
+ JVM_OPC_dsub = 103,
+ JVM_OPC_imul = 104,
+ JVM_OPC_lmul = 105,
+ JVM_OPC_fmul = 106,
+ JVM_OPC_dmul = 107,
+ JVM_OPC_idiv = 108,
+ JVM_OPC_ldiv = 109,
+ JVM_OPC_fdiv = 110,
+ JVM_OPC_ddiv = 111,
+ JVM_OPC_irem = 112,
+ JVM_OPC_lrem = 113,
+ JVM_OPC_frem = 114,
+ JVM_OPC_drem = 115,
+ JVM_OPC_ineg = 116,
+ JVM_OPC_lneg = 117,
+ JVM_OPC_fneg = 118,
+ JVM_OPC_dneg = 119,
+ JVM_OPC_ishl = 120,
+ JVM_OPC_lshl = 121,
+ JVM_OPC_ishr = 122,
+ JVM_OPC_lshr = 123,
+ JVM_OPC_iushr = 124,
+ JVM_OPC_lushr = 125,
+ JVM_OPC_iand = 126,
+ JVM_OPC_land = 127,
+ JVM_OPC_ior = 128,
+ JVM_OPC_lor = 129,
+ JVM_OPC_ixor = 130,
+ JVM_OPC_lxor = 131,
+ JVM_OPC_iinc = 132,
+ JVM_OPC_i2l = 133,
+ JVM_OPC_i2f = 134,
+ JVM_OPC_i2d = 135,
+ JVM_OPC_l2i = 136,
+ JVM_OPC_l2f = 137,
+ JVM_OPC_l2d = 138,
+ JVM_OPC_f2i = 139,
+ JVM_OPC_f2l = 140,
+ JVM_OPC_f2d = 141,
+ JVM_OPC_d2i = 142,
+ JVM_OPC_d2l = 143,
+ JVM_OPC_d2f = 144,
+ JVM_OPC_i2b = 145,
+ JVM_OPC_i2c = 146,
+ JVM_OPC_i2s = 147,
+ JVM_OPC_lcmp = 148,
+ JVM_OPC_fcmpl = 149,
+ JVM_OPC_fcmpg = 150,
+ JVM_OPC_dcmpl = 151,
+ JVM_OPC_dcmpg = 152,
+ JVM_OPC_ifeq = 153,
+ JVM_OPC_ifne = 154,
+ JVM_OPC_iflt = 155,
+ JVM_OPC_ifge = 156,
+ JVM_OPC_ifgt = 157,
+ JVM_OPC_ifle = 158,
+ JVM_OPC_if_icmpeq = 159,
+ JVM_OPC_if_icmpne = 160,
+ JVM_OPC_if_icmplt = 161,
+ JVM_OPC_if_icmpge = 162,
+ JVM_OPC_if_icmpgt = 163,
+ JVM_OPC_if_icmple = 164,
+ JVM_OPC_if_acmpeq = 165,
+ JVM_OPC_if_acmpne = 166,
+ JVM_OPC_goto = 167,
+ JVM_OPC_jsr = 168,
+ JVM_OPC_ret = 169,
+ JVM_OPC_tableswitch = 170,
+ JVM_OPC_lookupswitch = 171,
+ JVM_OPC_ireturn = 172,
+ JVM_OPC_lreturn = 173,
+ JVM_OPC_freturn = 174,
+ JVM_OPC_dreturn = 175,
+ JVM_OPC_areturn = 176,
+ JVM_OPC_return = 177,
+ JVM_OPC_getstatic = 178,
+ JVM_OPC_putstatic = 179,
+ JVM_OPC_getfield = 180,
+ JVM_OPC_putfield = 181,
+ JVM_OPC_invokevirtual = 182,
+ JVM_OPC_invokespecial = 183,
+ JVM_OPC_invokestatic = 184,
+ JVM_OPC_invokeinterface = 185,
+ JVM_OPC_invokedynamic = 186,
+ JVM_OPC_new = 187,
+ JVM_OPC_newarray = 188,
+ JVM_OPC_anewarray = 189,
+ JVM_OPC_arraylength = 190,
+ JVM_OPC_athrow = 191,
+ JVM_OPC_checkcast = 192,
+ JVM_OPC_instanceof = 193,
+ JVM_OPC_monitorenter = 194,
+ JVM_OPC_monitorexit = 195,
+ JVM_OPC_wide = 196,
+ JVM_OPC_multianewarray = 197,
+ JVM_OPC_ifnull = 198,
+ JVM_OPC_ifnonnull = 199,
+ JVM_OPC_goto_w = 200,
+ JVM_OPC_jsr_w = 201,
+ JVM_OPC_MAX = 201
+};
+
+/* Opcode length initializer, use with something like:
+ * unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
+ */
+#define JVM_OPCODE_LENGTH_INITIALIZER { \
+ 1, /* nop */ \
+ 1, /* aconst_null */ \
+ 1, /* iconst_m1 */ \
+ 1, /* iconst_0 */ \
+ 1, /* iconst_1 */ \
+ 1, /* iconst_2 */ \
+ 1, /* iconst_3 */ \
+ 1, /* iconst_4 */ \
+ 1, /* iconst_5 */ \
+ 1, /* lconst_0 */ \
+ 1, /* lconst_1 */ \
+ 1, /* fconst_0 */ \
+ 1, /* fconst_1 */ \
+ 1, /* fconst_2 */ \
+ 1, /* dconst_0 */ \
+ 1, /* dconst_1 */ \
+ 2, /* bipush */ \
+ 3, /* sipush */ \
+ 2, /* ldc */ \
+ 3, /* ldc_w */ \
+ 3, /* ldc2_w */ \
+ 2, /* iload */ \
+ 2, /* lload */ \
+ 2, /* fload */ \
+ 2, /* dload */ \
+ 2, /* aload */ \
+ 1, /* iload_0 */ \
+ 1, /* iload_1 */ \
+ 1, /* iload_2 */ \
+ 1, /* iload_3 */ \
+ 1, /* lload_0 */ \
+ 1, /* lload_1 */ \
+ 1, /* lload_2 */ \
+ 1, /* lload_3 */ \
+ 1, /* fload_0 */ \
+ 1, /* fload_1 */ \
+ 1, /* fload_2 */ \
+ 1, /* fload_3 */ \
+ 1, /* dload_0 */ \
+ 1, /* dload_1 */ \
+ 1, /* dload_2 */ \
+ 1, /* dload_3 */ \
+ 1, /* aload_0 */ \
+ 1, /* aload_1 */ \
+ 1, /* aload_2 */ \
+ 1, /* aload_3 */ \
+ 1, /* iaload */ \
+ 1, /* laload */ \
+ 1, /* faload */ \
+ 1, /* daload */ \
+ 1, /* aaload */ \
+ 1, /* baload */ \
+ 1, /* caload */ \
+ 1, /* saload */ \
+ 2, /* istore */ \
+ 2, /* lstore */ \
+ 2, /* fstore */ \
+ 2, /* dstore */ \
+ 2, /* astore */ \
+ 1, /* istore_0 */ \
+ 1, /* istore_1 */ \
+ 1, /* istore_2 */ \
+ 1, /* istore_3 */ \
+ 1, /* lstore_0 */ \
+ 1, /* lstore_1 */ \
+ 1, /* lstore_2 */ \
+ 1, /* lstore_3 */ \
+ 1, /* fstore_0 */ \
+ 1, /* fstore_1 */ \
+ 1, /* fstore_2 */ \
+ 1, /* fstore_3 */ \
+ 1, /* dstore_0 */ \
+ 1, /* dstore_1 */ \
+ 1, /* dstore_2 */ \
+ 1, /* dstore_3 */ \
+ 1, /* astore_0 */ \
+ 1, /* astore_1 */ \
+ 1, /* astore_2 */ \
+ 1, /* astore_3 */ \
+ 1, /* iastore */ \
+ 1, /* lastore */ \
+ 1, /* fastore */ \
+ 1, /* dastore */ \
+ 1, /* aastore */ \
+ 1, /* bastore */ \
+ 1, /* castore */ \
+ 1, /* sastore */ \
+ 1, /* pop */ \
+ 1, /* pop2 */ \
+ 1, /* dup */ \
+ 1, /* dup_x1 */ \
+ 1, /* dup_x2 */ \
+ 1, /* dup2 */ \
+ 1, /* dup2_x1 */ \
+ 1, /* dup2_x2 */ \
+ 1, /* swap */ \
+ 1, /* iadd */ \
+ 1, /* ladd */ \
+ 1, /* fadd */ \
+ 1, /* dadd */ \
+ 1, /* isub */ \
+ 1, /* lsub */ \
+ 1, /* fsub */ \
+ 1, /* dsub */ \
+ 1, /* imul */ \
+ 1, /* lmul */ \
+ 1, /* fmul */ \
+ 1, /* dmul */ \
+ 1, /* idiv */ \
+ 1, /* ldiv */ \
+ 1, /* fdiv */ \
+ 1, /* ddiv */ \
+ 1, /* irem */ \
+ 1, /* lrem */ \
+ 1, /* frem */ \
+ 1, /* drem */ \
+ 1, /* ineg */ \
+ 1, /* lneg */ \
+ 1, /* fneg */ \
+ 1, /* dneg */ \
+ 1, /* ishl */ \
+ 1, /* lshl */ \
+ 1, /* ishr */ \
+ 1, /* lshr */ \
+ 1, /* iushr */ \
+ 1, /* lushr */ \
+ 1, /* iand */ \
+ 1, /* land */ \
+ 1, /* ior */ \
+ 1, /* lor */ \
+ 1, /* ixor */ \
+ 1, /* lxor */ \
+ 3, /* iinc */ \
+ 1, /* i2l */ \
+ 1, /* i2f */ \
+ 1, /* i2d */ \
+ 1, /* l2i */ \
+ 1, /* l2f */ \
+ 1, /* l2d */ \
+ 1, /* f2i */ \
+ 1, /* f2l */ \
+ 1, /* f2d */ \
+ 1, /* d2i */ \
+ 1, /* d2l */ \
+ 1, /* d2f */ \
+ 1, /* i2b */ \
+ 1, /* i2c */ \
+ 1, /* i2s */ \
+ 1, /* lcmp */ \
+ 1, /* fcmpl */ \
+ 1, /* fcmpg */ \
+ 1, /* dcmpl */ \
+ 1, /* dcmpg */ \
+ 3, /* ifeq */ \
+ 3, /* ifne */ \
+ 3, /* iflt */ \
+ 3, /* ifge */ \
+ 3, /* ifgt */ \
+ 3, /* ifle */ \
+ 3, /* if_icmpeq */ \
+ 3, /* if_icmpne */ \
+ 3, /* if_icmplt */ \
+ 3, /* if_icmpge */ \
+ 3, /* if_icmpgt */ \
+ 3, /* if_icmple */ \
+ 3, /* if_acmpeq */ \
+ 3, /* if_acmpne */ \
+ 3, /* goto */ \
+ 3, /* jsr */ \
+ 2, /* ret */ \
+ 99, /* tableswitch */ \
+ 99, /* lookupswitch */ \
+ 1, /* ireturn */ \
+ 1, /* lreturn */ \
+ 1, /* freturn */ \
+ 1, /* dreturn */ \
+ 1, /* areturn */ \
+ 1, /* return */ \
+ 3, /* getstatic */ \
+ 3, /* putstatic */ \
+ 3, /* getfield */ \
+ 3, /* putfield */ \
+ 3, /* invokevirtual */ \
+ 3, /* invokespecial */ \
+ 3, /* invokestatic */ \
+ 5, /* invokeinterface */ \
+ 5, /* invokedynamic */ \
+ 3, /* new */ \
+ 2, /* newarray */ \
+ 3, /* anewarray */ \
+ 1, /* arraylength */ \
+ 1, /* athrow */ \
+ 3, /* checkcast */ \
+ 3, /* instanceof */ \
+ 1, /* monitorenter */ \
+ 1, /* monitorexit */ \
+ 0, /* wide */ \
+ 4, /* multianewarray */ \
+ 3, /* ifnull */ \
+ 3, /* ifnonnull */ \
+ 5, /* goto_w */ \
+ 5 /* jsr_w */ \
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CLASSFILE_CONSTANTS */
--- a/src/java.base/share/native/libjava/Reflection.c Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/native/libjava/Reflection.c Tue Jan 16 22:24:20 2018 +0000
@@ -30,13 +30,7 @@
JNIEXPORT jclass JNICALL
Java_jdk_internal_reflect_Reflection_getCallerClass__(JNIEnv *env, jclass unused)
{
- return JVM_GetCallerClass(env, JVM_CALLER_DEPTH);
-}
-
-JNIEXPORT jclass JNICALL
-Java_jdk_internal_reflect_Reflection_getCallerClass__I(JNIEnv *env, jclass unused, jint depth)
-{
- return JVM_GetCallerClass(env, depth);
+ return JVM_GetCallerClass(env);
}
JNIEXPORT jint JNICALL
--- a/src/java.base/share/native/libjava/System.c Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.base/share/native/libjava/System.c Tue Jan 16 22:24:20 2018 +0000
@@ -114,9 +114,6 @@
#define VENDOR_URL_BUG "http://bugreport.java.com/bugreport/"
#endif
-#define JAVA_MAX_SUPPORTED_VERSION 54
-#define JAVA_MAX_SUPPORTED_MINOR_VERSION 0
-
#ifdef JAVA_SPECIFICATION_VENDOR /* Third party may NOT overwrite this. */
#error "ERROR: No override of JAVA_SPECIFICATION_VENDOR is allowed"
#else
@@ -222,8 +219,8 @@
PUTPROP(props, "java.vendor.url", VENDOR_URL);
PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
- jio_snprintf(buf, sizeof(buf), "%d.%d", JAVA_MAX_SUPPORTED_VERSION,
- JAVA_MAX_SUPPORTED_MINOR_VERSION);
+ jio_snprintf(buf, sizeof(buf), "%d.%d", JVM_CLASSFILE_MAJOR_VERSION,
+ JVM_CLASSFILE_MINOR_VERSION);
PUTPROP(props, "java.class.version", buf);
if (sprops->awt_toolkit) {
--- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java Tue Jan 16 22:24:20 2018 +0000
@@ -57,6 +57,7 @@
* 1.8: lambda expressions and default methods
* 9: modules, small cleanups to 1.7 and 1.8 changes
* 10: local-variable type inference (var)
+ * 11: to be determined changes
*/
/**
@@ -162,7 +163,15 @@
*
* @since 10
*/
- RELEASE_10;
+ RELEASE_10,
+
+ /**
+ * The version recognized by the Java Platform, Standard Edition
+ * 11.
+ *
+ * @since 11
+ */
+ RELEASE_11;
// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
@@ -173,7 +182,7 @@
* @return the latest source version that can be modeled
*/
public static SourceVersion latest() {
- return RELEASE_10;
+ return RELEASE_11;
}
private static final SourceVersion latestSupported = getLatestSupported();
@@ -183,6 +192,8 @@
String specVersion = System.getProperty("java.specification.version");
switch (specVersion) {
+ case "11":
+ return RELEASE_11;
case "10":
return RELEASE_10;
case "9":
--- a/src/java.compiler/share/classes/javax/tools/FileManagerUtils.java Sun Jan 14 21:46:14 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.tools;
-
-import java.io.File;
-import java.nio.file.Path;
-import java.util.Iterator;
-
-/**
- * Package-private utility methods to convert between files and paths.
- *
- * @since 9
- */
-class FileManagerUtils {
- private FileManagerUtils() { }
-
- static Iterable<Path> asPaths(final Iterable<? extends File> files) {
- return () -> new Iterator<Path>() {
- Iterator<? extends File> iter = files.iterator();
-
- @Override
- public boolean hasNext() {
- return iter.hasNext();
- }
-
- @Override
- public Path next() {
- return iter.next().toPath();
- }
- };
- }
-
- static Iterable<File> asFiles(final Iterable<? extends Path> paths) {
- return () -> new Iterator<File>() {
- Iterator<? extends Path> iter = paths.iterator();
-
- @Override
- public boolean hasNext() {
- return iter.hasNext();
- }
-
- @Override
- public File next() {
- Path p = iter.next();
- try {
- return p.toFile();
- } catch (UnsupportedOperationException e) {
- throw new IllegalArgumentException(p.toString(), e);
- }
- }
- };
- }
-}
--- a/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,7 @@
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collection;
-
-import static javax.tools.FileManagerUtils.*;
+import java.util.Iterator;
/**
* File manager based on {@linkplain File java.io.File} and {@linkplain Path java.nio.file.Path}.
@@ -447,4 +446,42 @@
* @since 9
*/
default void setPathFactory(PathFactory f) { }
+
+
+ private static Iterable<Path> asPaths(final Iterable<? extends File> files) {
+ return () -> new Iterator<Path>() {
+ Iterator<? extends File> iter = files.iterator();
+
+ @Override
+ public boolean hasNext() {
+ return iter.hasNext();
+ }
+
+ @Override
+ public Path next() {
+ return iter.next().toPath();
+ }
+ };
+ }
+
+ private static Iterable<File> asFiles(final Iterable<? extends Path> paths) {
+ return () -> new Iterator<File>() {
+ Iterator<? extends Path> iter = paths.iterator();
+
+ @Override
+ public boolean hasNext() {
+ return iter.hasNext();
+ }
+
+ @Override
+ public File next() {
+ Path p = iter.next();
+ try {
+ return p.toFile();
+ } catch (UnsupportedOperationException e) {
+ throw new IllegalArgumentException(p.toString(), e);
+ }
+ }
+ };
+ }
}
--- a/src/java.desktop/share/classes/java/awt/Toolkit.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/java.desktop/share/classes/java/awt/Toolkit.java Tue Jan 16 22:24:20 2018 +0000
@@ -678,6 +678,11 @@
* If the connection to the specified URL requires
* either {@code URLPermission} or {@code SocketPermission},
* then {@code URLPermission} is used for security checks.
+ * For compatibility with pre-1.2 security managers, if the access
+ * is denied with {@code FilePermission} or {@code SocketPermission},
+ * the method throws the {@code SecurityException}
+ * if the corresponding 1.1-style SecurityManager.checkXXX method
+ * also denies permission.
* @param url the URL to use in fetching the pixel data.
* @return an image which gets its pixel data from
* the specified URL.
@@ -719,6 +724,11 @@
* If the connection to the specified URL requires
* either {@code URLPermission} or {@code SocketPermission},
* then {@code URLPermission} is used for security checks.
+ * For compatibility with pre-1.2 security managers, if the access
+ * is denied with {@code FilePermission} or {@code SocketPermission},
+ * the method throws {@code SecurityException}
+ * if the corresponding 1.1-style SecurityManager.checkXXX method
+ * also denies permission.
* @param url the URL to use in fetching the pixel data.
* @return an image which gets its pixel data from
* the specified URL.
--- a/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -46,9 +46,7 @@
// will not be able to find all Hotspot processes.
// Any changes to this needs to be synchronized with HotSpot.
private static final String tmpdir = "/tmp";
-
- // The patch to the socket file created by the target VM
- String path;
+ String socket_path;
/**
* Attaches to the target VM
@@ -69,8 +67,9 @@
// Find the socket file. If not found then we attempt to start the
// attach mechanism in the target VM by sending it a QUIT signal.
// Then we attempt to find the socket file again.
- path = findSocketFile(pid);
- if (path == null) {
+ File socket_file = new File(tmpdir, ".java_pid" + pid);
+ socket_path = socket_file.getPath();
+ if (!socket_file.exists()) {
File f = createAttachFile(pid);
try {
sendQuitTo(pid);
@@ -86,19 +85,19 @@
try {
Thread.sleep(delay);
} catch (InterruptedException x) { }
- path = findSocketFile(pid);
time_spend += delay;
- if (time_spend > timeout/2 && path == null) {
+ if (time_spend > timeout/2 && !socket_file.exists()) {
// Send QUIT again to give target VM the last chance to react
sendQuitTo(pid);
}
- } while (time_spend <= timeout && path == null);
- if (path == null) {
+ } while (time_spend <= timeout && !socket_file.exists());
+ if (!socket_file.exists()) {
throw new AttachNotSupportedException(
String.format("Unable to open socket file %s: " +
"target process %d doesn't respond within %dms " +
- "or HotSpot VM not loaded", f.getPath(), pid, time_spend));
+ "or HotSpot VM not loaded", socket_path, pid,
+ time_spend));
}
} finally {
f.delete();
@@ -107,14 +106,14 @@
// Check that the file owner/permission to avoid attaching to
// bogus process
- checkPermissions(path);
+ checkPermissions(socket_path);
// Check that we can connect to the process
// - this ensures we throw the permission denied error now rather than
// later when we attempt to enqueue a command.
int s = socket();
try {
- connect(s, path);
+ connect(s, socket_path);
} finally {
close(s);
}
@@ -125,8 +124,8 @@
*/
public void detach() throws IOException {
synchronized (this) {
- if (this.path != null) {
- this.path = null;
+ if (socket_path != null) {
+ socket_path = null;
}
}
}
@@ -144,12 +143,10 @@
assert args.length <= 3; // includes null
// did we detach?
- String p;
synchronized (this) {
- if (this.path == null) {
+ if (socket_path == null) {
throw new IOException("Detached from target VM");
}
- p = this.path;
}
// create UNIX socket
@@ -157,7 +154,7 @@
// connect to target VM
try {
- connect(s, p);
+ connect(s, socket_path);
} catch (IOException x) {
close(s);
throw x;
@@ -264,15 +261,6 @@
}
}
- // Return the socket file for the given process.
- private String findSocketFile(int pid) {
- File f = new File(tmpdir, ".java_pid" + pid);
- if (!f.exists()) {
- return null;
- }
- return f.getPath();
- }
-
// On Solaris/Linux/Aix a simple handshake is used to start the attach mechanism
// if not already started. The client creates a .attach_pid<pid> file in the
// target VM's working directory (or temp directory), and the SIGQUIT handler
--- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Tue Jan 16 22:24:20 2018 +0000
@@ -47,10 +47,7 @@
// will not be able to find all Hotspot processes.
// Any changes to this needs to be synchronized with HotSpot.
private static final String tmpdir = "/tmp";
-
- // The patch to the socket file created by the target VM
- String path;
-
+ String socket_path;
/**
* Attaches to the target VM
*/
@@ -73,8 +70,9 @@
// Find the socket file. If not found then we attempt to start the
// attach mechanism in the target VM by sending it a QUIT signal.
// Then we attempt to find the socket file again.
- path = findSocketFile(pid, ns_pid);
- if (path == null) {
+ File socket_file = findSocketFile(pid, ns_pid);
+ socket_path = socket_file.getPath();
+ if (!socket_file.exists()) {
File f = createAttachFile(pid, ns_pid);
try {
sendQuitTo(pid);
@@ -90,19 +88,19 @@
try {
Thread.sleep(delay);
} catch (InterruptedException x) { }
- path = findSocketFile(pid, ns_pid);
time_spend += delay;
- if (time_spend > timeout/2 && path == null) {
+ if (time_spend > timeout/2 && !socket_file.exists()) {
// Send QUIT again to give target VM the last chance to react
sendQuitTo(pid);
}
- } while (time_spend <= timeout && path == null);
- if (path == null) {
+ } while (time_spend <= timeout && !socket_file.exists());
+ if (!socket_file.exists()) {
throw new AttachNotSupportedException(
String.format("Unable to open socket file %s: " +
"target process %d doesn't respond within %dms " +
- "or HotSpot VM not loaded", f.getPath(), pid, time_spend));
+ "or HotSpot VM not loaded", socket_path, pid,
+ time_spend));
}
} finally {
f.delete();
@@ -111,14 +109,14 @@
// Check that the file owner/permission to avoid attaching to
// bogus process
- checkPermissions(path);
+ checkPermissions(socket_path);
// Check that we can connect to the process
// - this ensures we throw the permission denied error now rather than
// later when we attempt to enqueue a command.
int s = socket();
try {
- connect(s, path);
+ connect(s, socket_path);
} finally {
close(s);
}
@@ -129,8 +127,8 @@
*/
public void detach() throws IOException {
synchronized (this) {
- if (this.path != null) {
- this.path = null;
+ if (socket_path != null) {
+ socket_path = null;
}
}
}
@@ -148,12 +146,10 @@
assert args.length <= 3; // includes null
// did we detach?
- String p;
synchronized (this) {
- if (this.path == null) {
+ if (socket_path == null) {
throw new IOException("Detached from target VM");
}
- p = this.path;
}
// create UNIX socket
@@ -161,7 +157,7 @@
// connect to target VM
try {
- connect(s, p);
+ connect(s, socket_path);
} catch (IOException x) {
close(s);
throw x;
@@ -257,8 +253,9 @@
if ((off < 0) || (off > bs.length) || (len < 0) ||
((off + len) > bs.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
- } else if (len == 0)
+ } else if (len == 0) {
return 0;
+ }
return VirtualMachineImpl.read(s, bs, off, len);
}
@@ -269,16 +266,12 @@
}
// Return the socket file for the given process.
- private String findSocketFile(int pid, int ns_pid) {
+ private File findSocketFile(int pid, int ns_pid) {
// A process may not exist in the same mount namespace as the caller.
// Instead, attach relative to the target root filesystem as exposed by
// procfs regardless of namespaces.
String root = "/proc/" + pid + "/root/" + tmpdir;
- File f = new File(root, ".java_pid" + ns_pid);
- if (!f.exists()) {
- return null;
- }
- return f.getPath();
+ return new File(root, ".java_pid" + ns_pid);
}
// On Solaris/Linux a simple handshake is used to start the attach mechanism
--- a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, 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
@@ -45,9 +45,7 @@
// the latter can be changed by the user.
// Any changes to this needs to be synchronized with HotSpot.
private static final String tmpdir;
-
- // The patch to the socket file created by the target VM
- String path;
+ String socket_path;
/**
* Attaches to the target VM
@@ -68,8 +66,9 @@
// Find the socket file. If not found then we attempt to start the
// attach mechanism in the target VM by sending it a QUIT signal.
// Then we attempt to find the socket file again.
- path = findSocketFile(pid);
- if (path == null) {
+ File socket_file = new File(tmpdir, ".java_pid" + pid);
+ socket_path = socket_file.getPath();
+ if (!socket_file.exists()) {
File f = createAttachFile(pid);
try {
sendQuitTo(pid);
@@ -85,19 +84,19 @@
try {
Thread.sleep(delay);
} catch (InterruptedException x) { }
- path = findSocketFile(pid);
time_spend += delay;
- if (time_spend > timeout/2 && path == null) {
+ if (time_spend > timeout/2 && !socket_file.exists()) {
// Send QUIT again to give target VM the last chance to react
sendQuitTo(pid);
}
- } while (time_spend <= timeout && path == null);
- if (path == null) {
+ } while (time_spend <= timeout && !socket_file.exists());
+ if (!socket_file.exists()) {
throw new AttachNotSupportedException(
String.format("Unable to open socket file %s: " +
- "target process %d doesn't respond within %dms " +
- "or HotSpot VM not loaded", f.getPath(), pid, time_spend));
+ "target process %d doesn't respond within %dms " +
+ "or HotSpot VM not loaded", socket_path,
+ pid, time_spend));
}
} finally {
f.delete();
@@ -106,14 +105,14 @@
// Check that the file owner/permission to avoid attaching to
// bogus process
- checkPermissions(path);
+ checkPermissions(socket_path);
// Check that we can connect to the process
// - this ensures we throw the permission denied error now rather than
// later when we attempt to enqueue a command.
int s = socket();
try {
- connect(s, path);
+ connect(s, socket_path);
} finally {
close(s);
}
@@ -124,8 +123,8 @@
*/
public void detach() throws IOException {
synchronized (this) {
- if (this.path != null) {
- this.path = null;
+ if (socket_path != null) {
+ socket_path = null;
}
}
}
@@ -143,12 +142,10 @@
assert args.length <= 3; // includes null
// did we detach?
- String p;
synchronized (this) {
- if (this.path == null) {
+ if (socket_path == null) {
throw new IOException("Detached from target VM");
}
- p = this.path;
}
// create UNIX socket
@@ -156,7 +153,7 @@
// connect to target VM
try {
- connect(s, p);
+ connect(s, socket_path);
} catch (IOException x) {
close(s);
throw x;
@@ -264,14 +261,6 @@
}
}
- // Return the socket file for the given process.
- // Checks temp directory for .java_pid<pid>.
- private String findSocketFile(int pid) {
- String fn = ".java_pid" + pid;
- File f = new File(tmpdir, fn);
- return f.exists() ? f.getPath() : null;
- }
-
/*
* Write/sends the given to the target VM. String is transmitted in
* UTF-8 encoding.
@@ -282,7 +271,7 @@
try {
b = s.getBytes("UTF-8");
} catch (java.io.UnsupportedEncodingException x) {
- throw new InternalError();
+ throw new InternalError(x);
}
VirtualMachineImpl.write(fd, b, 0, b.length);
}
--- a/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, 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
@@ -47,6 +47,7 @@
// door descriptor;
private int fd = -1;
+ String socket_path;
/**
* Attaches to the target VM
@@ -60,7 +61,7 @@
try {
pid = Integer.parseInt(vmid);
} catch (NumberFormatException x) {
- throw new AttachNotSupportedException("invalid process identifier");
+ throw new AttachNotSupportedException("Invalid process identifier");
}
// Opens the door file to the target VM. If the file is not
@@ -100,7 +101,7 @@
throw new AttachNotSupportedException(
String.format("Unable to open door %s: " +
"target process %d doesn't respond within %dms " +
- "or HotSpot VM not loaded", f.getPath(), pid, time_spend));
+ "or HotSpot VM not loaded", socket_path, pid, time_spend));
}
} finally {
f.delete();
@@ -210,13 +211,13 @@
// The door is attached to .java_pid<pid> in the temporary directory.
private int openDoor(int pid) throws IOException {
- String path = tmpdir + "/.java_pid" + pid;;
- fd = open(path);
+ socket_path = tmpdir + "/.java_pid" + pid;
+ fd = open(socket_path);
// Check that the file owner/permission to avoid attaching to
// bogus process
try {
- checkPermissions(path);
+ checkPermissions(socket_path);
} catch (IOException ioe) {
close(fd);
throw ioe;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java Tue Jan 16 22:24:20 2018 +0000
@@ -78,8 +78,11 @@
/** 1.9 modularity. */
JDK9("9"),
- /** 1.10 covers the to be determined language features that will be added in JDK 10. */
- JDK10("10");
+ /** 1.10 local-variable type inference (var). */
+ JDK10("10"),
+
+ /** 1.11 covers the to be determined language features that will be added in JDK 11. */
+ JDK11("11");
private static final Context.Key<Source> sourceKey = new Context.Key<>();
@@ -108,6 +111,7 @@
tab.put("1.8", JDK8); // Make 8 an alias for 1.8
tab.put("1.9", JDK9); // Make 9 an alias for 1.9
tab.put("1.10", JDK10); // Make 10 an alias for 1.10
+ // Decline to make 1.11 an alias for 11.
}
private Source(String name) {
@@ -125,6 +129,7 @@
}
public Target requiredTarget() {
+ if (this.compareTo(JDK11) >= 0) return Target.JDK1_11;
if (this.compareTo(JDK10) >= 0) return Target.JDK1_10;
if (this.compareTo(JDK9) >= 0) return Target.JDK1_9;
if (this.compareTo(JDK8) >= 0) return Target.JDK1_8;
@@ -247,6 +252,8 @@
return RELEASE_9;
case JDK10:
return RELEASE_10;
+ case JDK11:
+ return RELEASE_11;
default:
return null;
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Tue Jan 16 22:24:20 2018 +0000
@@ -1628,9 +1628,6 @@
/** The parameters of the method. */
public List<VarSymbol> params = null;
- /** The names of the parameters */
- public List<Name> savedParameterNames;
-
/** For an annotation type element, its default value if any.
* The value is null if none appeared in the method
* declaration.
@@ -1886,59 +1883,20 @@
public List<VarSymbol> params() {
owner.complete();
if (params == null) {
- // If ClassReader.saveParameterNames has been set true, then
- // savedParameterNames will be set to a list of names that
- // matches the types in type.getParameterTypes(). If any names
- // were not found in the class file, those names in the list will
- // be set to the empty name.
- // If ClassReader.saveParameterNames has been set false, then
- // savedParameterNames will be null.
- List<Name> paramNames = savedParameterNames;
- savedParameterNames = null;
- // discard the provided names if the list of names is the wrong size.
- if (paramNames == null || paramNames.size() != type.getParameterTypes().size()) {
- paramNames = List.nil();
- }
- ListBuffer<VarSymbol> buf = new ListBuffer<>();
- List<Name> remaining = paramNames;
- // assert: remaining and paramNames are both empty or both
- // have same cardinality as type.getParameterTypes()
+ ListBuffer<VarSymbol> newParams = new ListBuffer<>();
int i = 0;
for (Type t : type.getParameterTypes()) {
- Name paramName;
- if (remaining.isEmpty()) {
- // no names for any parameters available
- paramName = createArgName(i, paramNames);
- } else {
- paramName = remaining.head;
- remaining = remaining.tail;
- if (paramName.isEmpty()) {
- // no name for this specific parameter
- paramName = createArgName(i, paramNames);
- }
- }
- buf.append(new VarSymbol(PARAMETER, paramName, t, this));
- i++;
+ Name paramName = name.table.fromString("arg" + i);
+ VarSymbol param = new VarSymbol(PARAMETER, paramName, t, this);
+ newParams.append(param);
+
}
- params = buf.toList();
+ params = newParams.toList();
}
+ Assert.checkNonNull(params);
return params;
}
- // Create a name for the argument at position 'index' that is not in
- // the exclude list. In normal use, either no names will have been
- // provided, in which case the exclude list is empty, or all the names
- // will have been provided, in which case this method will not be called.
- private Name createArgName(int index, List<Name> exclude) {
- String prefix = "arg";
- while (true) {
- Name argName = name.table.fromString(prefix + index);
- if (!exclude.contains(argName))
- return argName;
- prefix += "$";
- }
- }
-
public Symbol asMemberOf(Type site, Types types) {
return new MethodSymbol(flags_field, name, types.memberType(site, this), owner);
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Tue Jan 16 22:24:20 2018 +0000
@@ -1976,8 +1976,8 @@
types.covariantReturnType(rt2, rt1, types.noWarnings)) ||
checkCommonOverriderIn(s1,s2,site);
if (!compat) {
- log.error(pos, Errors.TypesIncompatibleDiffRet(t1, t2, s2.name +
- "(" + types.memberType(t2, s2).getParameterTypes() + ")"));
+ log.error(pos, Errors.TypesIncompatible(t1, t2,
+ Fragments.IncompatibleDiffRet(s2.name, types.memberType(t2, s2).getParameterTypes())));
return s2;
}
} else if (checkNameClash((ClassSymbol)site.tsym, s1, s2) &&
@@ -2563,20 +2563,22 @@
//strong semantics - issue an error if two sibling interfaces
//have two override-equivalent defaults - or if one is abstract
//and the other is default
- String errKey;
+ Fragment diagKey;
Symbol s1 = defaults.first();
Symbol s2;
if (defaults.size() > 1) {
- errKey = "types.incompatible.unrelated.defaults";
s2 = defaults.toList().tail.head;
+ diagKey = Fragments.IncompatibleUnrelatedDefaults(Kinds.kindName(site.tsym), site,
+ m.name, types.memberType(site, m).getParameterTypes(),
+ s1.location(), s2.location());
+
} else {
- errKey = "types.incompatible.abstract.default";
s2 = abstracts.first();
+ diagKey = Fragments.IncompatibleAbstractDefault(Kinds.kindName(site.tsym), site,
+ m.name, types.memberType(site, m).getParameterTypes(),
+ s1.location(), s2.location());
}
- log.error(pos, errKey,
- Kinds.kindName(site.tsym), site,
- m.name, types.memberType(site, m).getParameterTypes(),
- s1.location(), s2.location());
+ log.error(pos, Errors.TypesIncompatible(s1.location().type, s2.location().type, diagKey));
break;
}
}
@@ -3462,6 +3464,7 @@
types.hasSameArgs(sym.type, byName.type) ||
types.hasSameArgs(types.erasure(sym.type), types.erasure(byName.type)))) {
if ((sym.flags() & VARARGS) != (byName.flags() & VARARGS)) {
+ sym.flags_field |= CLASH;
varargsDuplicateError(pos, sym, byName);
return true;
} else if (sym.kind == MTH && !types.hasSameArgs(sym.type, byName.type, false)) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Jan 16 22:24:20 2018 +0000
@@ -1618,19 +1618,30 @@
if ((m1.flags() & BRIDGE) != (m2.flags() & BRIDGE))
return ((m1.flags() & BRIDGE) != 0) ? m2 : m1;
+ if (m1.baseSymbol() == m2.baseSymbol()) {
+ // this is the same imported symbol which has been cloned twice.
+ // Return the first one (either will do).
+ return m1;
+ }
+
// if one overrides or hides the other, use it
TypeSymbol m1Owner = (TypeSymbol)m1.owner;
TypeSymbol m2Owner = (TypeSymbol)m2.owner;
- if (types.asSuper(m1Owner.type, m2Owner) != null &&
- ((m1.owner.flags_field & INTERFACE) == 0 ||
- (m2.owner.flags_field & INTERFACE) != 0) &&
- m1.overrides(m2, m1Owner, types, false))
- return m1;
- if (types.asSuper(m2Owner.type, m1Owner) != null &&
- ((m2.owner.flags_field & INTERFACE) == 0 ||
- (m1.owner.flags_field & INTERFACE) != 0) &&
- m2.overrides(m1, m2Owner, types, false))
- return m2;
+ // the two owners can never be the same if the target methods are compiled from source,
+ // but we need to protect against cases where the methods are defined in some classfile
+ // and make sure we issue an ambiguity error accordingly (by skipping the logic below).
+ if (m1Owner != m2Owner) {
+ if (types.asSuper(m1Owner.type, m2Owner) != null &&
+ ((m1.owner.flags_field & INTERFACE) == 0 ||
+ (m2.owner.flags_field & INTERFACE) != 0) &&
+ m1.overrides(m2, m1Owner, types, false))
+ return m1;
+ if (types.asSuper(m2Owner.type, m1Owner) != null &&
+ ((m2.owner.flags_field & INTERFACE) == 0 ||
+ (m1.owner.flags_field & INTERFACE) != 0) &&
+ m2.overrides(m1, m2Owner, types, false))
+ return m2;
+ }
boolean m1Abstract = (m1.flags() & ABSTRACT) != 0;
boolean m2Abstract = (m2.flags() & ABSTRACT) != 0;
if (m1Abstract && !m2Abstract) return m2;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
import java.io.File;
import java.io.IOException;
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -77,11 +79,6 @@
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.JDK9Wrappers.Configuration;
-import com.sun.tools.javac.util.JDK9Wrappers.Layer;
-import com.sun.tools.javac.util.JDK9Wrappers.ModuleFinder;
-import com.sun.tools.javac.util.JDK9Wrappers.Module;
-import com.sun.tools.javac.util.JDK9Wrappers.ServiceLoaderHelper;
import static java.nio.file.FileVisitOption.FOLLOW_LINKS;
@@ -980,14 +977,14 @@
public <S> ServiceLoader<S> getServiceLoader(Location location, Class<S> service) throws IOException {
nullCheck(location);
nullCheck(service);
- Module.getModule(getClass()).addUses(service);
+ getClass().getModule().addUses(service);
if (location.isModuleOrientedLocation()) {
Collection<Path> paths = locations.getLocation(location);
ModuleFinder finder = ModuleFinder.of(paths.toArray(new Path[paths.size()]));
- Layer bootLayer = Layer.boot();
+ ModuleLayer bootLayer = ModuleLayer.boot();
Configuration cf = bootLayer.configuration().resolveAndBind(ModuleFinder.of(), finder, Collections.emptySet());
- Layer layer = bootLayer.defineModulesWithOneLoader(cf, ClassLoader.getSystemClassLoader());
- return ServiceLoaderHelper.load(layer, service);
+ ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, ClassLoader.getSystemClassLoader());
+ return ServiceLoader.load(layer, service);
} else {
return ServiceLoader.load(service, getClassLoader(location));
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -77,6 +77,8 @@
import javax.tools.StandardJavaFileManager.PathFactory;
import javax.tools.StandardLocation;
+import jdk.internal.jmod.JmodFile;
+
import com.sun.tools.javac.code.Lint;
import com.sun.tools.javac.code.Lint.LintCategory;
import com.sun.tools.javac.main.Option;
@@ -84,7 +86,6 @@
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
import com.sun.tools.javac.util.DefinedBy;
import com.sun.tools.javac.util.DefinedBy.Api;
-import com.sun.tools.javac.util.JDK9Wrappers;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.jvm.ModuleNameReader;
@@ -1451,7 +1452,7 @@
if (p.getFileName().toString().endsWith(".jmod")) {
try {
// check if the JMOD file is valid
- JDK9Wrappers.JmodFile.checkMagic(p);
+ JmodFile.checkMagic(p);
// No JMOD file system. Use JarFileSystem to
// workaround for now
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java Tue Jan 16 22:24:20 2018 +0000
@@ -111,7 +111,8 @@
V51(51, 0), // JDK 1.7
V52(52, 0), // JDK 1.8: lambda, type annos, param names
V53(53, 0), // JDK 1.9: modules, indy string concat
- V54(54, 0); // JDK 10
+ V54(54, 0), // JDK 10
+ V55(55, 0); // JDK 11: constant dynamic
Version(int major, int minor) {
this.major = major;
this.minor = minor;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Tue Jan 16 22:24:20 2018 +0000
@@ -193,6 +193,26 @@
int[] parameterNameIndices;
/**
+ * A table to hold annotations for method parameters.
+ */
+ ParameterAnnotations[] parameterAnnotations;
+
+ /**
+ * A holder for parameter annotations.
+ */
+ static class ParameterAnnotations {
+ List<CompoundAnnotationProxy> proxies;
+
+ void add(List<CompoundAnnotationProxy> newAnnotations) {
+ if (proxies == null) {
+ proxies = newAnnotations;
+ } else {
+ proxies = proxies.prependList(newAnnotations);
+ }
+ }
+ }
+
+ /**
* Whether or not any parameter names have been found.
*/
boolean haveParameterNameIndices;
@@ -1218,7 +1238,7 @@
new AttributeReader(names.RuntimeInvisibleParameterAnnotations, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
- attachParameterAnnotations(sym);
+ readParameterAnnotations(sym);
}
},
@@ -1230,7 +1250,7 @@
new AttributeReader(names.RuntimeVisibleParameterAnnotations, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
protected void read(Symbol sym, int attrLen) {
- attachParameterAnnotations(sym);
+ readParameterAnnotations(sym);
}
},
@@ -1288,10 +1308,14 @@
int numEntries = nextByte();
parameterNameIndices = new int[numEntries];
haveParameterNameIndices = true;
+ int index = 0;
for (int i = 0; i < numEntries; i++) {
int nameIndex = nextChar();
int flags = nextChar();
- parameterNameIndices[i] = nameIndex;
+ if ((flags & (Flags.MANDATED | Flags.SYNTHETIC)) != 0) {
+ continue;
+ }
+ parameterNameIndices[index++] = nameIndex;
}
}
bp = newbp;
@@ -1580,65 +1604,82 @@
* Reading Java-language annotations
***********************************************************************/
+ /**
+ * Save annotations.
+ */
+ List<CompoundAnnotationProxy> readAnnotations() {
+ int numAttributes = nextChar();
+ ListBuffer<CompoundAnnotationProxy> annotations = new ListBuffer<>();
+ for (int i = 0; i < numAttributes; i++) {
+ annotations.append(readCompoundAnnotation());
+ }
+ return annotations.toList();
+ }
+
/** Attach annotations.
*/
void attachAnnotations(final Symbol sym) {
- int numAttributes = nextChar();
- if (numAttributes != 0) {
- ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
- for (int i = 0; i<numAttributes; i++) {
- CompoundAnnotationProxy proxy = readCompoundAnnotation();
- if (proxy.type.tsym == syms.proprietaryType.tsym)
- sym.flags_field |= PROPRIETARY;
- else if (proxy.type.tsym == syms.profileType.tsym) {
- if (profile != Profile.DEFAULT) {
- for (Pair<Name,Attribute> v: proxy.values) {
- if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
- Attribute.Constant c = (Attribute.Constant) v.snd;
- if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
- sym.flags_field |= NOT_IN_PROFILE;
- }
+ attachAnnotations(sym, readAnnotations());
+ }
+
+ /**
+ * Attach annotations.
+ */
+ void attachAnnotations(final Symbol sym, List<CompoundAnnotationProxy> annotations) {
+ if (annotations.isEmpty()) {
+ return;
+ }
+ ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
+ for (CompoundAnnotationProxy proxy : annotations) {
+ if (proxy.type.tsym == syms.proprietaryType.tsym)
+ sym.flags_field |= PROPRIETARY;
+ else if (proxy.type.tsym == syms.profileType.tsym) {
+ if (profile != Profile.DEFAULT) {
+ for (Pair<Name, Attribute> v : proxy.values) {
+ if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
+ Attribute.Constant c = (Attribute.Constant)v.snd;
+ if (c.type == syms.intType && ((Integer)c.value) > profile.value) {
+ sym.flags_field |= NOT_IN_PROFILE;
}
}
}
- } else {
- if (proxy.type.tsym == syms.annotationTargetType.tsym) {
- target = proxy;
- } else if (proxy.type.tsym == syms.repeatableType.tsym) {
- repeatable = proxy;
- } else if (proxy.type.tsym == syms.deprecatedType.tsym) {
- sym.flags_field |= (DEPRECATED | DEPRECATED_ANNOTATION);
- for (Pair<Name, Attribute> v : proxy.values) {
- if (v.fst == names.forRemoval && v.snd instanceof Attribute.Constant) {
- Attribute.Constant c = (Attribute.Constant) v.snd;
- if (c.type == syms.booleanType && ((Integer) c.value) != 0) {
- sym.flags_field |= DEPRECATED_REMOVAL;
- }
+ }
+ } else {
+ if (proxy.type.tsym == syms.annotationTargetType.tsym) {
+ target = proxy;
+ } else if (proxy.type.tsym == syms.repeatableType.tsym) {
+ repeatable = proxy;
+ } else if (proxy.type.tsym == syms.deprecatedType.tsym) {
+ sym.flags_field |= (DEPRECATED | DEPRECATED_ANNOTATION);
+ for (Pair<Name, Attribute> v : proxy.values) {
+ if (v.fst == names.forRemoval && v.snd instanceof Attribute.Constant) {
+ Attribute.Constant c = (Attribute.Constant)v.snd;
+ if (c.type == syms.booleanType && ((Integer)c.value) != 0) {
+ sym.flags_field |= DEPRECATED_REMOVAL;
}
}
}
-
- proxies.append(proxy);
}
+ proxies.append(proxy);
}
- annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
}
+ annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
}
- /** Attach parameter annotations.
+ /** Read parameter annotations.
*/
- void attachParameterAnnotations(final Symbol method) {
- final MethodSymbol meth = (MethodSymbol)method;
+ void readParameterAnnotations(Symbol meth) {
int numParameters = buf[bp++] & 0xFF;
- List<VarSymbol> parameters = meth.params();
- int pnum = 0;
- while (parameters.tail != null) {
- attachAnnotations(parameters.head);
- parameters = parameters.tail;
- pnum++;
+ if (parameterAnnotations == null) {
+ parameterAnnotations = new ParameterAnnotations[numParameters];
+ } else if (parameterAnnotations.length != numParameters) {
+ throw badClassFile("bad.runtime.invisible.param.annotations", meth);
}
- if (pnum != numParameters) {
- throw badClassFile("bad.runtime.invisible.param.annotations", meth);
+ for (int pnum = 0; pnum < numParameters; pnum++) {
+ if (parameterAnnotations[pnum] == null) {
+ parameterAnnotations[pnum] = new ParameterAnnotations();
+ }
+ parameterAnnotations[pnum].add(readAnnotations());
}
}
@@ -2403,8 +2444,7 @@
} finally {
currentOwner = prevOwner;
}
- if (saveParameterNames)
- setParameterNames(m, type);
+ setParameters(m, type);
if ((flags & VARARGS) != 0) {
final Type last = type.getParameterTypes().last();
@@ -2457,22 +2497,17 @@
}
/**
- * Set the parameter names for a symbol from the name index in the
- * parameterNameIndicies array. The type of the symbol may have changed
- * while reading the method attributes (see the Signature attribute).
- * This may be because of generic information or because anonymous
- * synthetic parameters were added. The original type (as read from
- * the method descriptor) is used to help guess the existence of
+ * Set the parameters for a method symbol, including any names and
+ * annotations that were read.
+ *
+ * <p>The type of the symbol may have changed while reading the
+ * method attributes (see the Signature attribute). This may be
+ * because of generic information or because anonymous synthetic
+ * parameters were added. The original type (as read from the
+ * method descriptor) is used to help guess the existence of
* anonymous synthetic parameters.
- * On completion, sym.savedParameter names will either be null (if
- * no parameter names were found in the class file) or will be set to a
- * list of names, one per entry in sym.type.getParameterTypes, with
- * any missing names represented by the empty name.
*/
- void setParameterNames(MethodSymbol sym, Type jvmType) {
- // if no names were found in the class file, there's nothing more to do
- if (!haveParameterNameIndices)
- return;
+ void setParameters(MethodSymbol sym, Type jvmType) {
// If we get parameter names from MethodParameters, then we
// don't need to skip.
int firstParam = 0;
@@ -2483,16 +2518,16 @@
// make a corresponding allowance here for the position of
// the first parameter. Note that this assumes the
// skipped parameter has a width of 1 -- i.e. it is not
- // a double width type (long or double.)
- if (sym.name == names.init && currentOwner.hasOuterInstance()) {
- // Sometimes anonymous classes don't have an outer
- // instance, however, there is no reliable way to tell so
- // we never strip this$n
- if (!currentOwner.name.isEmpty())
- firstParam += 1;
- }
+ // a double width type (long or double.)
+ if (sym.name == names.init && currentOwner.hasOuterInstance()) {
+ // Sometimes anonymous classes don't have an outer
+ // instance, however, there is no reliable way to tell so
+ // we never strip this$n
+ if (!currentOwner.name.isEmpty())
+ firstParam += 1;
+ }
- if (sym.type != jvmType) {
+ if (sym.type != jvmType) {
// reading the method attributes has caused the
// symbol's type to be changed. (i.e. the Signature
// attribute.) This may happen if there are hidden
@@ -2502,21 +2537,55 @@
// at the beginning, and so skip over them. The
// primary case for this is two hidden parameters
// passed into Enum constructors.
- int skip = Code.width(jvmType.getParameterTypes())
- - Code.width(sym.type.getParameterTypes());
- firstParam += skip;
- }
+ int skip = Code.width(jvmType.getParameterTypes())
+ - Code.width(sym.type.getParameterTypes());
+ firstParam += skip;
+ }
}
List<Name> paramNames = List.nil();
- int index = firstParam;
+ ListBuffer<VarSymbol> params = new ListBuffer<>();
+ int nameIndex = firstParam;
+ int annotationIndex = 0;
for (Type t: sym.type.getParameterTypes()) {
- int nameIdx = (index < parameterNameIndices.length
- ? parameterNameIndices[index] : 0);
- Name name = nameIdx == 0 ? names.empty : readName(nameIdx);
+ Name name = parameterName(nameIndex, paramNames);
paramNames = paramNames.prepend(name);
- index += sawMethodParameters ? 1 : Code.width(t);
+ VarSymbol param = new VarSymbol(PARAMETER, name, t, sym);
+ params.append(param);
+ if (parameterAnnotations != null) {
+ ParameterAnnotations annotations = parameterAnnotations[annotationIndex];
+ if (annotations != null && annotations.proxies != null
+ && !annotations.proxies.isEmpty()) {
+ annotate.normal(new AnnotationCompleter(param, annotations.proxies));
+ }
+ }
+ nameIndex += sawMethodParameters ? 1 : Code.width(t);
+ annotationIndex++;
+ }
+ if (parameterAnnotations != null && parameterAnnotations.length != annotationIndex) {
+ throw badClassFile("bad.runtime.invisible.param.annotations", sym);
}
- sym.savedParameterNames = paramNames.reverse();
+ Assert.checkNull(sym.params);
+ sym.params = params.toList();
+ parameterAnnotations = null;
+ parameterNameIndices = null;
+ }
+
+
+ // Returns the name for the parameter at position 'index', either using
+ // names read from the MethodParameters, or by synthesizing a name that
+ // is not on the 'exclude' list.
+ private Name parameterName(int index, List<Name> exclude) {
+ if (parameterNameIndices != null && index < parameterNameIndices.length
+ && parameterNameIndices[index] != 0) {
+ return readName(parameterNameIndices[index]);
+ }
+ String prefix = "arg";
+ while (true) {
+ Name argName = names.fromString(prefix + exclude.size());
+ if (!exclude.contains(argName))
+ return argName;
+ prefix += "$";
+ }
}
/**
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -1678,7 +1678,7 @@
try {
writeClassFile(out, c);
if (verbose)
- log.printVerbose("wrote.file", outFile);
+ log.printVerbose("wrote.file", outFile.getName());
out.close();
out = null;
} finally {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Profile.java Tue Jan 16 22:24:20 2018 +0000
@@ -40,9 +40,9 @@
* deletion without notice.</b>
*/
public enum Profile {
- COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
- COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
- COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
+ COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
+ COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
+ COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11),
DEFAULT {
@Override
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java Tue Jan 16 22:24:20 2018 +0000
@@ -64,7 +64,10 @@
JDK1_9("1.9", 53, 0),
/** JDK 10. */
- JDK1_10("1.10", 54, 0);
+ JDK1_10("1.10", 54, 0),
+
+ /** JDK 11. */
+ JDK1_11("11", 55, 0);
private static final Context.Key<Target> targetKey = new Context.Key<>();
@@ -95,6 +98,7 @@
tab.put("8", JDK1_8);
tab.put("9", JDK1_9);
tab.put("10", JDK1_10);
+ tab.put("11", JDK1_11);
}
public final String name;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.lang.module.ModuleDescriptor;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -47,6 +48,8 @@
import javax.lang.model.SourceVersion;
+import jdk.internal.misc.VM;
+
import com.sun.tools.doclint.DocLint;
import com.sun.tools.javac.code.Lint;
import com.sun.tools.javac.code.Lint.LintCategory;
@@ -57,7 +60,6 @@
import com.sun.tools.javac.platform.PlatformProvider;
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
import com.sun.tools.javac.util.Assert;
-import com.sun.tools.javac.util.JDK9Wrappers;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Log.PrefixKind;
import com.sun.tools.javac.util.Log.WriterKind;
@@ -650,21 +652,11 @@
if (arg.isEmpty()) {
throw helper.newInvalidValueException("err.no.value.for.option", option);
} else {
+ // use official parser if available
try {
- Class.forName(JDK9Wrappers.ModuleDescriptor.Version.CLASSNAME);
- // use official parser if available
- try {
- JDK9Wrappers.ModuleDescriptor.Version.parse(arg);
- } catch (IllegalArgumentException e) {
- throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
- }
- } catch (ClassNotFoundException ex) {
- // fall-back to simplistic rules when running on older platform
- if (!(arg.charAt(0) >= '0' && arg.charAt(0) <= '9') ||
- arg.endsWith("-") ||
- arg.endsWith("+")) {
- throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
- }
+ ModuleDescriptor.Version.parse(arg);
+ } catch (IllegalArgumentException e) {
+ throw helper.newInvalidValueException("err.bad.value.for.option", option, arg);
}
}
super.process(helper, option, arg);
@@ -717,41 +709,36 @@
HIDDEN, BASIC) {
@Override
public void process(OptionHelper helper, String option) throws InvalidValueException {
- try {
- Class.forName(JDK9Wrappers.VMHelper.CLASSNAME);
- String[] runtimeArgs = JDK9Wrappers.VMHelper.getRuntimeArguments();
- for (String arg : runtimeArgs) {
- // Handle any supported runtime options; ignore all others.
- // The runtime arguments always use the single token form, e.g. "--name=value".
- for (Option o : getSupportedRuntimeOptions()) {
- if (o.matches(arg)) {
- switch (o) {
- case ADD_MODULES:
- int eq = arg.indexOf('=');
- Assert.check(eq > 0, () -> ("invalid runtime option:" + arg));
- // --add-modules=ALL-DEFAULT is not supported at compile-time
- // so remove it from list, and only process the rest
- // if the set is non-empty.
- // Note that --add-modules=ALL-DEFAULT is automatically added
- // by the standard javac launcher.
- String mods = Arrays.stream(arg.substring(eq + 1).split(","))
- .filter(s -> !s.isEmpty() && !s.equals("ALL-DEFAULT"))
- .collect(Collectors.joining(","));
- if (!mods.isEmpty()) {
- String updatedArg = arg.substring(0, eq + 1) + mods;
- o.handleOption(helper, updatedArg, Collections.emptyIterator());
- }
- break;
- default:
- o.handleOption(helper, arg, Collections.emptyIterator());
- break;
- }
- break;
+ String[] runtimeArgs = VM.getRuntimeArguments();
+ for (String arg : runtimeArgs) {
+ // Handle any supported runtime options; ignore all others.
+ // The runtime arguments always use the single token form, e.g. "--name=value".
+ for (Option o : getSupportedRuntimeOptions()) {
+ if (o.matches(arg)) {
+ switch (o) {
+ case ADD_MODULES:
+ int eq = arg.indexOf('=');
+ Assert.check(eq > 0, () -> ("invalid runtime option:" + arg));
+ // --add-modules=ALL-DEFAULT is not supported at compile-time
+ // so remove it from list, and only process the rest
+ // if the set is non-empty.
+ // Note that --add-modules=ALL-DEFAULT is automatically added
+ // by the standard javac launcher.
+ String mods = Arrays.stream(arg.substring(eq + 1).split(","))
+ .filter(s -> !s.isEmpty() && !s.equals("ALL-DEFAULT"))
+ .collect(Collectors.joining(","));
+ if (!mods.isEmpty()) {
+ String updatedArg = arg.substring(0, eq + 1) + mods;
+ o.handleOption(helper, updatedArg, Collections.emptyIterator());
+ }
+ break;
+ default:
+ o.handleOption(helper, arg, Collections.emptyIterator());
+ break;
}
+ break;
}
}
- } catch (ClassNotFoundException | SecurityException e) {
- throw helper.newInvalidValueException("err.cannot.access.runtime.env");
}
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java Tue Jan 16 22:24:20 2018 +0000
@@ -712,20 +712,20 @@
}
private void checkNameAndExistence(ModuleSymbol mod, String typename, boolean allowUnnamedPackageInfo) throws FilerException {
- // TODO: Check if type already exists on source or class path?
- // If so, use warning message key proc.type.already.exists
checkName(typename, allowUnnamedPackageInfo);
- ClassSymbol existing;
+ ClassSymbol existing = elementUtils.getTypeElement(typename);
boolean alreadySeen = aggregateGeneratedSourceNames.contains(Pair.of(mod, typename)) ||
aggregateGeneratedClassNames.contains(Pair.of(mod, typename)) ||
initialClassNames.contains(typename) ||
- ((existing = elementUtils.getTypeElement(typename)) != null &&
- initialInputs.contains(existing.sourcefile));
+ (existing != null && initialInputs.contains(existing.sourcefile));
if (alreadySeen) {
if (lint)
log.warning(Warnings.ProcTypeRecreate(typename));
throw new FilerException("Attempt to recreate a file for type " + typename);
}
+ if (lint && existing != null) {
+ log.warning("proc.type.already.exists", typename);
+ }
if (!mod.isUnnamed() && !typename.contains(".")) {
throw new FilerException("Attempt to create a type in unnamed package of a named module: " + typename);
}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -82,7 +82,6 @@
import com.sun.tools.javac.util.DefinedBy.Api;
import com.sun.tools.javac.util.Iterators;
import com.sun.tools.javac.util.JCDiagnostic;
-import com.sun.tools.javac.util.JDK9Wrappers.Module;
import com.sun.tools.javac.util.JavacMessages;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Log;
@@ -267,7 +266,7 @@
: fileManager.getClassLoader(CLASS_PATH);
if (options.isSet("accessInternalAPI"))
- ModuleHelper.addExports(Module.getModule(getClass()), Module.getUnnamedModule(processorClassLoader));
+ ModuleHelper.addExports(getClass().getModule(), processorClassLoader.getUnnamedModule());
if (processorClassLoader != null && processorClassLoader instanceof Closeable) {
compiler.closeables = compiler.closeables.prepend((Closeable) processorClassLoader);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java Tue Jan 16 22:24:20 2018 +0000
@@ -55,7 +55,7 @@
* deletion without notice.</b>
*/
@SupportedAnnotationTypes("*")
-@SupportedSourceVersion(SourceVersion.RELEASE_10)
+@SupportedSourceVersion(SourceVersion.RELEASE_11)
public class PrintingProcessor extends AbstractProcessor {
PrintWriter writer;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Jan 16 22:24:20 2018 +0000
@@ -1144,16 +1144,21 @@
compiler.err.type.var.more.than.once.in.result=\
type variable {0} occurs more than once in type of {1}; cannot be left uninstantiated
-# 0: type, 1: type, 2: string
-compiler.err.types.incompatible.diff.ret=\
- types {0} and {1} are incompatible; both define {2}, but with unrelated return types
+# 0: type, 1: type, 2: fragment
+compiler.err.types.incompatible=\
+ types {0} and {1} are incompatible;\n\
+ {2}
+
+# 0: name, 1: list of type
+compiler.misc.incompatible.diff.ret=\
+ both define {0}({1}), but with unrelated return types
# 0: kind name, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
-compiler.err.types.incompatible.unrelated.defaults=\
+compiler.misc.incompatible.unrelated.defaults=\
{0} {1} inherits unrelated defaults for {2}({3}) from types {4} and {5}
# 0: kind name, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
-compiler.err.types.incompatible.abstract.default=\
+compiler.misc.incompatible.abstract.default=\
{0} {1} inherits abstract and default for {2}({3}) from types {4} and {5}
# 0: name, 1: kind name, 2: symbol
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2018, 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
@@ -374,8 +374,6 @@
not a directory: {0}
javac.err.file.not.file=\
not a file: {0}
-javac.err.cannot.access.runtime.env=\
- cannot access runtime environment
javac.err.two.class.loaders.1=\
javac is split between multiple class loaders: check your configuration
javac.err.two.class.loaders.2=\
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java Sun Jan 14 21:46:14 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,460 +0,0 @@
-/*
- * Copyright (c) 2015, 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.util;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.ServiceLoader;
-
-/**
- * This class provides wrappers for classes and methods that are new in JDK 9, and which are not
- * available on older versions of the platform on which javac may be compiled and run.
- * In future releases, when javac is always compiled on JDK 9 or later, the use of these wrappers
- * can be replaced by use of the real underlying classes.
- *
- * <p>Wrapper classes provide a subset of the API of the wrapped classes, as needed for use
- * in javac. Wrapper objects contain an {@code Object} reference to the underlying runtime object,
- * and {@code Class} and {@code Method} objects for obtaining or using such instances via
- * runtime reflection. The {@code Class} and {@code Method} objects are set up on a per-class
- * basis, by an {@code init} method, which is called from static methods on the wrapper class,
- * or in the constructor, when instances are created.
- * <p>
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class JDK9Wrappers {
-
- /**
- * Helper class for new method in java.util.ServiceLoader.
- */
- public static final class ServiceLoaderHelper {
- @SuppressWarnings("unchecked")
- public static <S> ServiceLoader<S> load(Layer layer, Class<S> service) {
- try {
- init();
- Object result = loadMethod.invoke(null, layer.theRealLayer, service);
- return (ServiceLoader<S>)result;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Method loadMethod = null;
-
- private static void init() {
- if (loadMethod == null) {
- try {
- Class<?> layerClass = Layer.layerClass;
- loadMethod = ServiceLoader.class.getDeclaredMethod("load", layerClass, Class.class);
- } catch (NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.module.ModuleDescriptor and ModuleDescriptor.Version.
- */
- public static class ModuleDescriptor {
- public static class Version {
- public static final String CLASSNAME = "java.lang.module.ModuleDescriptor$Version";
- private final Object theRealVersion;
-
- private Version(Object version) {
- this.theRealVersion = version;
- }
-
- public static Version parse(String v) {
- try {
- init();
- Object result = parseMethod.invoke(null, v);
- Version version = new Version(result);
- return version;
- } catch (InvocationTargetException ex) {
- if (ex.getCause() instanceof IllegalArgumentException) {
- throw (IllegalArgumentException) ex.getCause();
- } else {
- throw new Abort(ex);
- }
- } catch (IllegalAccessException | IllegalArgumentException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- @Override
- public String toString() {
- return theRealVersion.toString();
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> versionClass = null;
- private static Method parseMethod = null;
-
- private static void init() {
- if (versionClass == null) {
- try {
- versionClass = Class.forName(CLASSNAME, false, null);
- parseMethod = versionClass.getDeclaredMethod("parse", String.class);
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.module.ModuleFinder.
- */
- public static class ModuleFinder {
- private final Object theRealModuleFinder;
-
- private ModuleFinder(Object moduleFinder) {
- this.theRealModuleFinder = moduleFinder;
- init();
- }
-
- public static ModuleFinder of(Path... dirs) {
- try {
- init();
- Object result = ofMethod.invoke(null, (Object)dirs);
- ModuleFinder mFinder = new ModuleFinder(result);
- return mFinder;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> moduleFinderClass = null;
- private static Method ofMethod;
-
- static final Class<?> getModuleFinderClass() {
- init();
- return moduleFinderClass;
- }
-
- private static void init() {
- if (moduleFinderClass == null) {
- try {
- moduleFinderClass = Class.forName("java.lang.module.ModuleFinder", false, null);
- ofMethod = moduleFinderClass.getDeclaredMethod("of", Path[].class);
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.Module. To materialize a handle use the static factory
- * methods Module#getModule(Class<?>) or Module#getUnnamedModule(ClassLoader).
- */
- public static class Module {
-
- private final Object theRealModule;
-
- private Module(Object module) {
- this.theRealModule = module;
- init();
- }
-
- public static Module getModule(Class<?> clazz) {
- try {
- init();
- Object result = getModuleMethod.invoke(clazz, new Object[0]);
- return new Module(result);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- public static Module getUnnamedModule(ClassLoader classLoader) {
- try {
- init();
- Object result = getUnnamedModuleMethod.invoke(classLoader, new Object[0]);
- return new Module(result);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- public Module addExports(String pn, Module other) {
- try {
- addExportsMethod.invoke(theRealModule, new Object[] { pn, other.theRealModule});
- } catch (IllegalAccessException | InvocationTargetException ex) {
- throw new Abort(ex);
- }
- return this;
- }
-
- public Module addUses(Class<?> st) {
- try {
- addUsesMethod.invoke(theRealModule, new Object[] { st });
- } catch (IllegalAccessException | InvocationTargetException ex) {
- throw new Abort(ex);
- }
- return this;
- }
-
- // -----------------------------------------------------------------------------------------
- // on java.lang.Module
- private static Method addExportsMethod = null;
- // on java.lang.Module
- private static Method addUsesMethod = null;
- // on java.lang.Class
- private static Method getModuleMethod;
- // on java.lang.ClassLoader
- private static Method getUnnamedModuleMethod;
-
- private static void init() {
- if (addExportsMethod == null) {
- try {
- Class<?> moduleClass = Class.forName("java.lang.Module", false, null);
- addUsesMethod = moduleClass.getDeclaredMethod("addUses", new Class<?>[] { Class.class });
- addExportsMethod = moduleClass.getDeclaredMethod("addExports",
- new Class<?>[] { String.class, moduleClass });
- getModuleMethod = Class.class.getDeclaredMethod("getModule", new Class<?>[0]);
- getUnnamedModuleMethod = ClassLoader.class.getDeclaredMethod("getUnnamedModule", new Class<?>[0]);
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.module.Configuration.
- */
- public static final class Configuration {
- private final Object theRealConfiguration;
-
- private Configuration(Object configuration) {
- this.theRealConfiguration = configuration;
- init();
- }
-
- public Configuration resolveAndBind(
- ModuleFinder beforeFinder,
- ModuleFinder afterFinder,
- Collection<String> roots) {
- try {
- Object result = resolveAndBindMethod.invoke(theRealConfiguration,
- beforeFinder.theRealModuleFinder,
- afterFinder.theRealModuleFinder,
- roots
- );
- Configuration configuration = new Configuration(result);
- return configuration;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> configurationClass = null;
- private static Method resolveAndBindMethod;
-
- static final Class<?> getConfigurationClass() {
- init();
- return configurationClass;
- }
-
- private static void init() {
- if (configurationClass == null) {
- try {
- configurationClass = Class.forName("java.lang.module.Configuration", false, null);
- Class<?> moduleFinderInterface = ModuleFinder.getModuleFinderClass();
- resolveAndBindMethod = configurationClass.getDeclaredMethod("resolveAndBind",
- moduleFinderInterface,
- moduleFinderInterface,
- Collection.class
- );
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Wrapper class for java.lang.ModuleLayer.
- */
- public static final class Layer {
- private final Object theRealLayer;
-
- private Layer(Object layer) {
- this.theRealLayer = layer;
- }
-
- public static Layer boot() {
- try {
- init();
- Object result = bootMethod.invoke(null);
- Layer layer = new Layer(result);
- return layer;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- public Configuration configuration() {
- try {
- Object result = configurationMethod.invoke(theRealLayer);
- Configuration configuration = new Configuration(result);
- return configuration;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- public Layer defineModulesWithOneLoader(Configuration configuration, ClassLoader parentClassLoader) {
- try {
- Object result = defineModulesWithOneLoaderMethod.invoke(
- theRealLayer, configuration.theRealConfiguration, parentClassLoader);
- Layer layer = new Layer(result);
- return layer;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> layerClass = null;
- private static Method bootMethod;
- private static Method defineModulesWithOneLoaderMethod;
- private static Method configurationMethod;
-
- private static void init() {
- if (layerClass == null) {
- try {
- layerClass = Class.forName("java.lang.ModuleLayer", false, null);
- bootMethod = layerClass.getDeclaredMethod("boot");
- defineModulesWithOneLoaderMethod = layerClass.getDeclaredMethod("defineModulesWithOneLoader",
- Configuration.getConfigurationClass(),
- ClassLoader.class);
- configurationMethod = layerClass.getDeclaredMethod("configuration");
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
-
- /**
- * Helper class for new method in jdk.internal.misc.VM.
- */
- public static final class VMHelper {
- public static final String CLASSNAME = "jdk.internal.misc.VM";
-
- @SuppressWarnings("unchecked")
- public static String[] getRuntimeArguments() {
- try {
- init();
- Object result = getRuntimeArgumentsMethod.invoke(null);
- return (String[])result;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
- | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> vmClass = null;
- private static Method getRuntimeArgumentsMethod = null;
-
- private static void init() {
- if (vmClass == null) {
- try {
- vmClass = Class.forName(CLASSNAME, false, null);
- getRuntimeArgumentsMethod = vmClass.getDeclaredMethod("getRuntimeArguments");
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-
- /**
- * Helper class for new method in jdk.internal.jmod.JmodFile
- */
- public static final class JmodFile {
- public static final String JMOD_FILE_CLASSNAME = "jdk.internal.jmod.JmodFile";
-
- public static void checkMagic(Path file) throws IOException {
- try {
- init();
- checkMagicMethod.invoke(null, file);
- } catch (InvocationTargetException ex) {
- if (ex.getCause() instanceof IOException) {
- throw IOException.class.cast(ex.getCause());
- }
- throw new Abort(ex);
- } catch (IllegalAccessException | IllegalArgumentException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
-
- // -----------------------------------------------------------------------------------------
-
- private static Class<?> jmodFileClass = null;
- private static Method checkMagicMethod = null;
-
- private static void init() {
- if (jmodFileClass == null) {
- try {
- jmodFileClass = Class.forName(JMOD_FILE_CLASSNAME, false, null);
- checkMagicMethod = jmodFileClass.getDeclaredMethod("checkMagic", Path.class);
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) {
- throw new Abort(ex);
- }
- }
- }
- }
-}
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ModuleHelper.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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,8 +25,6 @@
package com.sun.tools.javac.util;
-import com.sun.tools.javac.util.JDK9Wrappers.Module;
-
public class ModuleHelper {
private static final String[] javacInternalPackages = new String[] {
--- a/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeanLinker.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.dynalink/share/classes/jdk/dynalink/beans/BeanLinker.java Tue Jan 16 22:24:20 2018 +0000
@@ -116,7 +116,7 @@
if(clazz.isArray()) {
// Some languages won't have a notion of manipulating collections. Exposing "length" on arrays as an
// explicit property is beneficial for them.
- setPropertyGetter("length", MethodHandles.arrayLength(clazz), ValidationType.EXACT_CLASS);
+ setPropertyGetter("length", GET_ARRAY_LENGTH, ValidationType.IS_ARRAY);
} else if(Collection.class.isAssignableFrom(clazz)) {
setPropertyGetter("length", GET_COLLECTION_LENGTH, ValidationType.INSTANCE_OF);
} else if(Map.class.isAssignableFrom(clazz)) {
@@ -546,6 +546,9 @@
private static final MethodHandle GET_MAP_LENGTH = Lookup.PUBLIC.findVirtual(Map.class, "size",
MethodType.methodType(int.class));
+ private static final MethodHandle GET_ARRAY_LENGTH = Lookup.PUBLIC.findStatic(Array.class, "getLength",
+ MethodType.methodType(int.class, Object.class));
+
private static void assertParameterCount(final CallSiteDescriptor descriptor, final int paramCount) {
if(descriptor.getMethodType().parameterCount() != paramCount) {
throw new BootstrapMethodError(descriptor.getOperation() + " must have exactly " + paramCount + " parameters.");
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Tue Jan 16 22:24:20 2018 +0000
@@ -135,8 +135,9 @@
/**
* Gets the implementor for the interface class {@code type}.
*
- * @return the implementor if there is a single implementor, 0 if there is no implementor, or
- * {@code type} itself if there is more than one implementor
+ * @return the implementor if there is a single implementor, {@code null} if there is no
+ * implementor, or {@code type} itself if there is more than one implementor
+ * @throws IllegalArgumentException if type is not an interface type
*/
native HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type);
@@ -256,14 +257,13 @@
native void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
/**
- * If {@code cpi} denotes an entry representing a resolved dynamic adapter
- * (see {@code resolveInvokeDynamicInPool} and {@code resolveInvokeHandleInPool}),
- * return the opcode of the instruction for which the resolution was performed
- * ({@code invokedynamic} or {@code invokevirtual}}, or {@code -1} otherwise.
+ * If {@code cpi} denotes an entry representing a resolved dynamic adapter (see
+ * {@code resolveInvokeDynamicInPool} and {@code resolveInvokeHandleInPool}), return the opcode
+ * of the instruction for which the resolution was performed ({@code invokedynamic} or
+ * {@code invokevirtual}}, or {@code -1} otherwise.
*/
native int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
-
/**
* Gets the list of type names (in the format of {@link JavaType#getName()}) denoting the
* classes that define signature polymorphic methods.
@@ -388,7 +388,7 @@
/**
* Gets the static initializer of {@code type}.
*
- * @return 0 if {@code type} has no static initializer
+ * @return {@code null} if {@code type} has no static initializer
*/
native HotSpotResolvedJavaMethodImpl getClassInitializer(HotSpotResolvedObjectTypeImpl type);
@@ -468,7 +468,8 @@
native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method);
/**
- * Sets flags on {@code method} indicating that it should never be inlined or compiled by the VM.
+ * Sets flags on {@code method} indicating that it should never be inlined or compiled by the
+ * VM.
*/
native void setNotInlinableOrCompilable(HotSpotResolvedJavaMethodImpl method);
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Tue Jan 16 22:24:20 2018 +0000
@@ -922,7 +922,10 @@
}
public ResolvedJavaMethod getClassInitializer() {
- return compilerToVM().getClassInitializer(this);
+ if (!isArray()) {
+ return compilerToVM().getClassInitializer(this);
+ }
+ return null;
}
@Override
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,8 +46,8 @@
private final ResolvedJavaType type;
private final List<ClassfileBytecode> codeAttributes;
- private static final int MAJOR_VERSION_JAVA7 = 51;
- private static final int MAJOR_VERSION_JAVA10 = 54;
+ private static final int MAJOR_VERSION_JAVA_MIN = 51;
+ private static final int MAJOR_VERSION_JAVA_MAX = 55;
private static final int MAGIC = 0xCAFEBABE;
/**
@@ -65,7 +65,7 @@
int minor = stream.readUnsignedShort();
int major = stream.readUnsignedShort();
- if (major < MAJOR_VERSION_JAVA7 || major > MAJOR_VERSION_JAVA10) {
+ if (major < MAJOR_VERSION_JAVA_MIN || major > MAJOR_VERSION_JAVA_MAX) {
throw new UnsupportedClassVersionError("Unsupported class file version: " + major + "." + minor);
}
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/LoadProc.java Tue Jan 16 22:24:20 2018 +0000
@@ -50,7 +50,7 @@
import javax.tools.Diagnostic;
-import static javax.lang.model.SourceVersion.RELEASE_10;
+import static javax.lang.model.SourceVersion.RELEASE_11;
/**
* Annotation processor for the Deprecation Scanner tool.
@@ -58,7 +58,7 @@
*
*/
@SupportedAnnotationTypes("java.lang.Deprecated")
-@SupportedSourceVersion(RELEASE_10)
+@SupportedSourceVersion(RELEASE_11)
public class LoadProc extends AbstractProcessor {
Elements elements;
Messager messager;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java Tue Jan 16 22:24:20 2018 +0000
@@ -106,7 +106,7 @@
// Keep these updated manually until there's a compiler API
// that allows querying of supported releases.
final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
- final Set<String> releasesWithForRemoval = Set.of("9", "10");
+ final Set<String> releasesWithForRemoval = Set.of("9", "10", "11");
final Set<String> validReleases;
{
@@ -358,14 +358,15 @@
* Process classes from a particular JDK release, using only information
* in this JDK.
*
- * @param release "6", "7", "8", "9", or "10"
+ * @param release "6", "7", "8", "9", "10", or "11"
* @param classes collection of classes to process, may be empty
* @return success value
*/
boolean processRelease(String release, Collection<String> classes) throws IOException {
options.addAll(List.of("--release", release));
- if (release.equals("9") || release.equals("10")) {
+ if (release.equals("9") || release.equals("10") ||
+ release.equals("11")) {
List<String> rootMods = List.of("java.se", "java.se.ee");
TraverseProc proc = new TraverseProc(rootMods);
JavaCompiler.CompilationTask task =
@@ -481,7 +482,7 @@
String dir = null;
String jar = null;
String jdkHome = null;
- String release = "10";
+ String release = "11";
List<String> loadClasses = new ArrayList<>();
String csvFile = null;
--- a/src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.rmic/share/classes/sun/tools/java/RuntimeConstants.java Tue Jan 16 22:24:20 2018 +0000
@@ -67,7 +67,7 @@
/* Class File Constants */
int JAVA_MAGIC = 0xcafebabe;
int JAVA_MIN_SUPPORTED_VERSION = 45;
- int JAVA_MAX_SUPPORTED_VERSION = 54;
+ int JAVA_MAX_SUPPORTED_VERSION = 55;
int JAVA_MAX_SUPPORTED_MINOR_VERSION = 0;
/* Generate class file version for 1.1 by default */
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Sun Jan 14 21:46:14 2018 -0800
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Tue Jan 16 22:24:20 2018 +0000
@@ -1083,7 +1083,7 @@
// Simply invoke super.finalize()
mv.visitVarInsn(ALOAD, 0);
- mv.checkcast(Type.getType(generatedClassName));
+ mv.checkcast(Type.getType('L' + generatedClassName + ';'));
mv.invokespecial(superClassName, "finalize", VOID_METHOD_DESCRIPTOR, false);
mv.visitInsn(RETURN);
--- a/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java Sun Jan 14 21:46:14 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.reflect;
-
-public class Reflection {
-
- private Reflection() { }
-
- /**
- * @deprecated This method is an internal API and will be removed.
- * Use {@link StackWalker} to walk the stack and obtain the caller class
- * with {@link StackWalker.StackFrame#getDeclaringClass} instead.
- */
- @Deprecated(forRemoval=true)
- @SuppressWarnings("removal") // Reflection.getCallerClass
- public static Class<?> getCallerClass(int depth) {
- if (depth < 0)
- throw new InternalError("depth must be positive");
-
- // increase depth to account for delegation to the internal impl
- return jdk.internal.reflect.Reflection.getCallerClass(depth + 1);
- }
-}
--- a/test/hotspot/jtreg/ProblemList.txt Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/ProblemList.txt Tue Jan 16 22:24:20 2018 +0000
@@ -51,6 +51,7 @@
compiler/tiered/LevelTransitionTest.java 8067651 generic-all
compiler/types/correctness/CorrectnessTest.java 8066173 generic-all
compiler/types/correctness/OffTest.java 8066173 generic-all
+compiler/c2/Test8007294.java 8192992 generic-all
# aot test intermittently failing in jprt 8175791
compiler/aot/DeoptimizationTest.java 8175791 windows-all
--- a/test/hotspot/jtreg/TEST.ROOT Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/TEST.ROOT Tue Jan 16 22:24:20 2018 +0000
@@ -58,7 +58,7 @@
docker.support
# Minimum jtreg version
-requiredVersion=4.2 b08
+requiredVersion=4.2 b11
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../../ notation to reach them
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetImplementorTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/GetImplementorTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -103,6 +103,14 @@
HotSpotResolvedObjectType resolvedIface = CompilerToVMHelper
.lookupTypeHelper(Utils.toJVMTypeSignature(tcase.anInterface),
getClass(), /* resolve = */ true);
+ if (!resolvedIface.isInterface()) {
+ try {
+ CompilerToVMHelper.getImplementor(resolvedIface);
+ Asserts.fail("Expected " + IllegalArgumentException.class.getName());
+ } catch (IllegalArgumentException e) {
+ }
+ return;
+ }
HotSpotResolvedObjectType resolvedImplementer = CompilerToVMHelper
.getImplementor(resolvedIface);
HotSpotResolvedObjectType resolvedExpected = null;
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Tue Jan 16 22:24:20 2018 +0000
@@ -473,6 +473,20 @@
metaAccess.lookupJavaType(ConcreteTransitiveImplementor1.class);
metaAccess.lookupJavaType(ConcreteTransitiveImplementor2.class);
assertEquals(aSai2, iSai2.getSingleImplementor());
+
+ for (Class<?> c : classes) {
+ ResolvedJavaType type = metaAccess.lookupJavaType(c);
+ try {
+ type.getSingleImplementor();
+ if (!c.isInterface()) {
+ throw new AssertionError("Expected exception for calling getSingleImplmentor on " + c.getName());
+ }
+ } catch (JVMCIError e) {
+ if (c.isInterface()) {
+ throw new AssertionError("Unexpected exception", e);
+ }
+ }
+ }
}
@Test(expected = JVMCIError.class)
@@ -830,6 +844,10 @@
assertNull(metaAccess.lookupJavaType(C.class).getClassInitializer());
assertNull(metaAccess.lookupJavaType(int.class).getClassInitializer());
assertNull(metaAccess.lookupJavaType(void.class).getClassInitializer());
+ for (Class<?> c : classes) {
+ ResolvedJavaType type = metaAccess.lookupJavaType(c);
+ type.getClassInitializer();
+ }
}
@Test
--- a/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/CommandLine/VMDeprecatedOptions.java Tue Jan 16 22:24:20 2018 +0000
@@ -47,10 +47,6 @@
{"InitialRAMFraction", "64"},
{"AssumeMP", "false"},
{"UseMembar", "true"},
- {"FastTLABRefill", "false"},
- {"DeferPollingPageLoopCount", "-1"},
- {"SafepointSpinBeforeYield", "2000"},
- {"DeferThrSuspendLoopCount", "4000"},
// deprecated alias flags (see also aliased_jvm_flags):
{"DefaultMaxRAMFraction", "4"},
@@ -110,6 +106,5 @@
testDeprecated(DEPRECATED_OPTIONS); // Make sure that each deprecated option is mentioned in the output.
testDeprecatedDiagnostic("UnsyncloadClass", "false");
testDeprecatedDiagnostic("IgnoreUnverifiableClassesDuringDump", "false");
- testDeprecatedExperimental("UseCGroupMemoryLimitForHeap", "true");
}
}
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,7 @@
* attempting to use CDS archive. JVM should exit gracefully
* when sharing mode is ON, and continue w/o sharing if sharing
* mode is AUTO.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
* @test
* @requires vm.cds & !vm.graal.enabled
* @summary Testing -Xbootclasspath/a support for CDS
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @summary CDS (class data sharing) requires the same -XX:[+-]CompactStrings
* setting between archive creation time and load time.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java Tue Jan 16 22:24:20 2018 +0000
@@ -29,7 +29,7 @@
* This is a negative test; using object alignment for loading that
* is different from object alignment for creating a CDS file
* should fail when loading.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @bug 8025642
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @summary Testing CDS (class data sharing) using varying object alignment.
* Using same object alignment for each dump/load pair
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test DefaultUseWithClient
* @summary Test default behavior of sharing with -client
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,7 @@
* Feature support: compressed oops/kptrs, 64-bit os, not on windows
* @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @run main DumpSharedDictionary
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test NonBootLoaderClasses
* @summary Test to ensure platform and app classes are not being archived
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @bug 8066670
* @summary Testing -XX:+PrintSharedArchiveAndExit option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
* @test SASymbolTableTest
* @requires vm.cds
* @summary Walk symbol table using SA, with and without CDS.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot.oops
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @bug 8014138
* @summary Testing new -XX:SharedArchiveFile=<file-name> option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @summary Test variety of values for SharedBaseAddress, making sure
* VM handles normal values as well as edge values w/o a crash.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,7 @@
* are actually shared
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test -Xshare:auto with shared strings and -XX:+UseStringDeduplication
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test -Xshare:auto with shared strings.
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @requires vm.cds
* @bug 8059510
* @summary Test SharedSymbolTableBucketSize option
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
* @test SpaceUtilizationCheck
* @requires vm.cds
* @summary Check if the space utilization for shared spaces is adequate
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @bug 8169711
* @summary Test interpreter method entries for intrinsics with CDS (class data sharing)
* and different settings of the intrinsic flag during dump/use of the archive.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Exercise initial transformation (ClassFileLoadHook)
* with CDS with Interface/Implementor pair
* @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,7 @@
* @summary Exercise initial transformation (ClassFileLoadHook)
* with CDS with SubClass and SuperClass
* @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,7 @@
* @summary Exercise initial transformation (ClassFileLoadHook)
* with CDS with SubClass and SuperClass, each lives in own separate package
* @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary At run time, it is OK to append new elements to the classpath that was used at dump time.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary bootclasspath mismatch test.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @test
* @summary Test case sensitive aspect of comparing class paths
* between dump time and archive use time
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Initiating and defining classloader test.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Class-Path: attribute in MANIFEST file
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,8 +24,8 @@
/*
* @test CommandLineFlagCombo
- * AppCDS does not support uncompressed oops
- * @requires (vm.gc=="null") & ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true))
+ * @requires vm.cds
+ * @requires (vm.gc=="null")
* @summary Test command line flag combinations that
* could likely affect the behaviour of AppCDS
* @library /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,8 +28,7 @@
* the dump and execute steps, in such way that they cause errors
* E.g. use compressed oops for creating and archive, but then
* execute w/o compressed oops
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of directories in -cp
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @run main DirClasspathTest
*/
--- a/test/hotspot/jtreg/runtime/appcds/DumpClassList.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/DumpClassList.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary DumpLoadedClassList should exclude generated classes, classes in bootclasspath/a and
* --patch-module.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Adding extra symbols into CDS archive using -XX:SharedArchiveConfigFile
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Test for field annotations.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Unused metadata created during dump time should be freed from the CDS archive.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules jdk.jartool/sun.tools.jar
* @compile test-classes/MethodNoReturn.jasm test-classes/Hello.java
--- a/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary a simple test for loading a class using the ext class loader in AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/HelloTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/HelloTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Hello World test for AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
@@ -36,7 +35,6 @@
*/
public class HelloTest {
-
public static void main(String[] args) throws Exception {
TestCommon.test(JarBuilder.getOrCreateHelloJar(),
TestCommon.list("Hello"), "Hello");
--- a/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Test the -XX:+IgnoreEmptyClassPaths flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary JvmtiEnv::AddToBootstrapClassLoaderSearch and JvmtiEnv::AddToSystemClassLoaderSearch should disable AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @bug 8060592
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Try different combination of mismatched UseAppCDS between dump time and run time.
- * (Note: AppCDS does not support uncompressed oops.)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,8 @@
/*
* @test
* @summary When super class is missing during dumping, no crash should happen.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ *
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,8 @@
/*
* @test
* @summary Run multiple processes with the same archive, ensure they share
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ *
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test MultiReleaseJars
* @bug 8170105
* @summary Test multi-release jar with AppCDS.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/OldClassTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/OldClassTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary classes with major version < JDK_1.5 (48) should not be included in CDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/PackageSealing.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/PackageSealing.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Load app classes from CDS archive in parallel threads. Similar to ParallelLoad.java, but each class in its own JAR
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,9 +25,8 @@
/*
* @test
* @summary Load app classes from CDS archive in parallel threads
- * AppCDS does not support uncompressed oops
* @library /test/lib
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @modules java.base/jdk.internal.misc
* java.management
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary test the -XX:+PrintSharedArchiveAndExit flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of prohibited package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of protection domain.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Use ClassLoader.defineClass() to load a class with rewritten bytecode. Make sure
* the archived class with the same name is not loaded.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java Tue Jan 16 22:24:20 2018 +0000
@@ -23,20 +23,19 @@
*/
/*
- * @test
- * @summary SharedArchiveConsistency
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
- * java.compiler
- * java.management
- * jdk.jartool/sun.tools.jar
- * jdk.internal.jvmstat/sun.jvmstat.monitor
- * @build sun.hotspot.WhiteBox
- * @compile test-classes/Hello.java
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SharedArchiveConsistency
+ * @test
+ * @summary SharedArchiveConsistency
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * java.compiler
+ * java.management
+ * jdk.jartool/sun.tools.jar
+ * jdk.internal.jvmstat/sun.jvmstat.monitor
+ * @build sun.hotspot.WhiteBox
+ * @compile test-classes/Hello.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SharedArchiveConsistency
*/
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
--- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,8 +24,7 @@
/*
* @test
* @summary The diagnostic option, -XX:SharedArchiveFile can be unlocked using -XX:+UseAppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,8 +27,7 @@
* @summary Test variety of values for SharedBaseAddress, in AppCDS mode,
* making sure VM handles normal values as well as edge values
* w/o a crash.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SharedPackages.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SharedPackages.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of package.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SignedJar.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SignedJar.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary AppCDS handling of signed JAR.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java Tue Jan 16 22:24:20 2018 +0000
@@ -23,17 +23,16 @@
*/
/*
- * @test
- * @summary If -Djava.system.class.loader=xxx is specified in command-line, disable UseAppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
- * @library /test/lib
- * @modules java.base/jdk.internal.misc
+ * @test
+ * @summary If -Djava.system.class.loader=xxx is specified in command-line, disable UseAppCDS
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
- * @compile test-classes/TestClassLoader.java
- * @compile test-classes/ReportMyLoader.java
- * @compile test-classes/TrySwitchMyLoader.java
- * @run main SpecifySysLoaderProp
+ * @compile test-classes/TestClassLoader.java
+ * @compile test-classes/ReportMyLoader.java
+ * @compile test-classes/TrySwitchMyLoader.java
+ * @run main SpecifySysLoaderProp
*/
import java.io.*;
--- a/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary ensure -XX:+TraceClassPaths showing entire expecting app classpath
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Testing use of UseAppCDS flag
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Unverfiable app classes should not be archived.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/**
* @test
* @summary Test 'iload_w' bytecode in shared class
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary classpath mismatch between dump time and execution time
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Test -Xshare:auto for AppCDS
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Test resolved_references
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary Dump time should not crash if any class with shared strings fails verification due to missing dependencies.
* @bug 8186789
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Test open archive heap regions
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,7 @@
* mapped due to out of range, and -Xshare:on should not fail. Test on
* linux 64-bit only since the HeapBaseMinAddress value is platform specific.
* The value used in the test may cause different behavior on other platforms.
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (os.family == "linux") & (os.arch == "amd64") & (sun.arch.data.model == "64")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary Redefine shared class. GC should not cause crash with cached resolved_references.
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @requires vm.flavor != "minimal"
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of class list format.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Hello World test for AppCDS custom loader support
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Check that during dumping, the classes for BOOT/EXT/APP loaders are segregated from the
* custom loader classes.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Load classes from CDS archive into multiple custom loader using parallel threads
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Load classes from CDS archive into a single custom loader using parallel threads (finger print)
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Make sure prohibited packages cannot be stored into archive for custom loaders.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary AppCDS handling of protection domain in custom loaders.
*
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
*
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Testing the loading of a class with the same name in two different class loaders.
*
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
*
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Make sure classes intended for custom loaders cannot be loaded by BOOT/EXT/APP loaders
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Test the behavior when shared classes loaded by custom loaders are
* unloaded.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.cds.custom.loaders
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/testlibrary
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,6 @@
/*
* @test
* @summary Ensure that support for AppCDS custom class loaders are not enabled on unsupported platforms.
- * (NOTE: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
* @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary test the ability to archive array classes and load them from the archive
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @compile ArrayTestHelper.java
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary ensure no anonymous class is being dumped into the CDS archive
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @compile ../test-classes/Hello.java
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary When dumping the CDS archive, try to cause garbage collection while classes are being loaded.
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,7 @@
* option for testing the interaction with GC and shared strings.
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @requires vm.gc.G1
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Abort dumping if any of the new jigsaw vm options is specified.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib ..
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Test combinations of jigsaw options that affect the use of AppCDS
*
- * AppCDS does not support uncompressed oops
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library /test/lib ..
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary a test to demonstrate that an application class in the -cp
* will be archived although --patch-module is specified. The class in
* the -cp has no dependencies on the class in the --patch-module.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary if a class is defined to a package which is not defined to any
* module in the jimage, the class will not be found during dump
* time but it will be used during run time.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary different settings of --patch-module at dump time and runtime are
* acceptable. The class found in runtime --patch-module entry should
* be used.
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary a simple test to ensure that a directory in the --patch-module
* option does not affect dump process
* @library ../..
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary sharing is disabled if java.base is patch at runtime
* @library ../..
* @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary a simple test to ensure that class is loaded from jar file in --patch-module at runtime
* @library ../..
* @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary the class in the -cp is a subclass of the class in --patch-module. The
* patched class should be used at runtime.
* @library ../..
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/*
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @summary a patched class found in --patch-module should be used at runtime
* @library ../..
* @library /test/hotspot/jtreg/testlibrary
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/**
* @test
* @summary AppCDS tests for testing -Xbootclasspath/a
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/**
* @test
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library ../..
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,8 +25,7 @@
/*
* @test
* @summary Ensure that classes found in jimage takes precedence over classes found in -Xbootclasspath/a.
- * AppCDS does not support uncompressed oops
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.activation
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java Tue Jan 16 22:24:20 2018 +0000
@@ -29,7 +29,7 @@
* 2) app loader will load the class from the jimage by default;
* app loader will load the class from the bootclasspath if the
* "--limit-modules java.base" option is specified
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/**
* @test
- * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled
+ * @requires vm.cds & !vm.graal.enabled
* @library ../..
* @library /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java Tue Jan 16 22:24:20 2018 +0000
@@ -24,7 +24,7 @@
/**
* @test
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @modules java.base/jdk.internal.misc
* @library ../..
* @library /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary Test jvmti class file loader hook interaction with AppCDS
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
* java.management
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Exercise the java.lang.instrument.Instrumentation APIs on classes archived
* using CDS/AppCDSv1/AppCDSv2.
* @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -29,7 +29,7 @@
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti
* /test/hotspot/jtreg/testlibrary/jvmti
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @modules java.base/jdk.internal.misc
* java.management
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java Tue Jan 16 22:24:20 2018 +0000
@@ -32,7 +32,7 @@
* /test/hotspot/jtreg/runtime/SharedArchiveFile /test/hotspot/jtreg/testlibrary/jvmti
* /test/hotspot/jtreg/runtime/appcds/customLoader
* /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java Tue Jan 16 22:24:20 2018 +0000
@@ -32,7 +32,7 @@
* /test/hotspot/jtreg/runtime/SharedArchiveFile /test/hotspot/jtreg/testlibrary/jvmti
* /test/hotspot/jtreg/runtime/appcds/customLoader
* /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.flavor != "minimal"
* @modules java.base/jdk.internal.misc
* jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Run /runtime/RedefineTests/RedefineRunningMethods in AppCDS mode to
* make sure class redefinition works with CDS.
- * (Note: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/RedefineTests /test/hotspot/jtreg/runtime/appcds
* @modules java.compiler
* java.instrument
--- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,8 +26,7 @@
* @test
* @summary Run /runtime/RedefineTests/RedefineRunningMethods in AppCDS mode to
* make sure class redefinition works with CDS.
- * (Note: AppCDS does not support uncompressed oops)
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/RedefineTests /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
* @modules java.compiler
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Exercise GC with shared strings
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,7 @@
/*
* @test
* @summary Test relevant combinations of command line flags with shared strings
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java Tue Jan 16 22:24:20 2018 +0000
@@ -28,7 +28,7 @@
* Also test mismatch in oops encoding between dump time and run time
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test shared strings together with string intern operation
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Check most common errors in file format
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Basic shared string test with large pages
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Test locking on shared strings
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Basic test for shared strings
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Basic plus test for shared strings
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary Write a lots of shared strings.
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/hotspot/jtreg/runtime/appcds /test/lib
* @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,7 +27,7 @@
* @summary White box test for shared strings
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java Tue Jan 16 22:24:20 2018 +0000
@@ -26,7 +26,7 @@
* @test
* @summary Regression test for JDK-8098821
* @bug 8098821
- * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @requires vm.cds
* @requires vm.gc.G1
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/classFileParserBug/Class55.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8173382
+ * @summary Check that the JVM accepts class files with version 55
+ * @run main Class55
+ */
+
+super public class Class55 version 55:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 0 locals 1 {
+ return;
+ }
+
+} // end Class Class55
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/AbstractClone.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokeinterface of clone() works properly where clone() is
+ * an abstract method in a superinterface and also overridden locally.
+ * @run main AbstractClone
+ */
+
+public class AbstractClone {
+
+ interface I1 {
+ Object clone();
+ }
+
+ interface I2 extends I1 { }
+
+ static class C implements I2 {
+ public Object clone() {
+ return "In C's clone()";
+ }
+ }
+
+ static Object test(I2 i) { return i.clone(); }
+
+ public static void main(String[] args) {
+ String s = (String)test(new C());
+ if (!s.equals("In C's clone()")) {
+ throw new RuntimeException("Wrong clone() called");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/AbstractNoClones.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokeinterface of clone() works properly where clone() is
+ * an abstract method in a superinterface and not overridden locally.
+ * @compile AbstractNoClones.jasm
+ * @run main AbstractNoClones
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class AbstractNoClones {
+//
+// interface I1 {
+// Object clone();
+// }
+//
+// interface I2 extends I1 { }
+//
+// static class C implements I2 { }
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// try {
+// String s = (String)test(new C());
+// throw new RuntimeException("Expected IAE not thrown");
+// } catch (java.lang.IllegalAccessError e) {
+// if (!e.toString().contains("C.clone")) {
+// throw new RuntimeException("Wrong IllegalAccessError exception thrown");
+// }
+// }
+// }
+// }
+
+
+interface AbstractNoClones$I1 version 53:0 {
+
+ public abstract Method clone:"()Ljava/lang/Object;";
+
+ static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$I1
+
+
+interface AbstractNoClones$I2 implements AbstractNoClones$I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+ static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$I2
+
+
+super class AbstractNoClones$C implements AbstractNoClones$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static InnerClass C=class AbstractNoClones$C of class AbstractNoClones;
+ static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+
+} // end Class AbstractNoClones$C
+
+
+super public class AbstractNoClones version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LAbstractNoClones$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod AbstractNoClones$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ try t0;
+ new class AbstractNoClones$C;
+ dup;
+ invokespecial Method AbstractNoClones$C."<init>":"()V";
+ invokestatic Method test:"(LAbstractNoClones$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Expected IAE not thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ endtry t0;
+ catch t0 java/lang/IllegalAccessError;
+ stack_frame_type stack1;
+ stack_map class java/lang/IllegalAccessError;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/IllegalAccessError.toString:"()Ljava/lang/String;";
+ ldc String "C.clone";
+ invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+ ifne L47;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong IllegalAccessError exception thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L47: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class AbstractNoClones$C of class AbstractNoClones;
+ static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones;
+ static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones;
+
+} // end Class AbstractNoClones
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultClone.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that a default method named clone() does not get masked by
+ * java.lang.Object.clone() during resolution.
+ * @compile DefaultClone.jasm
+ * @run main DefaultClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultClone {
+//
+// interface I1 {
+// default Object clone() {
+// return "In I1's clone()";
+// }
+// }
+//
+//
+// interface I2 extends I1 { }
+//
+//
+// static class C implements I2 {
+// public Object clone() {
+// return "In C's clone()";
+// }
+// }
+//
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// String s = (String)test(new C());
+// if (!s.equals("In C's clone()")) {
+// throw new RuntimeException("Wrong clone() called");
+// }
+// }
+// }
+
+
+interface DefaultClone$I1 version 53:0 {
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In I1\'s clone()";
+ areturn;
+ }
+
+ static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone$I1
+
+
+
+interface DefaultClone$I2 implements DefaultClone$I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+ static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone$I2
+
+
+super class DefaultClone$C implements DefaultClone$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In C\'s clone()";
+ areturn;
+ }
+
+ static InnerClass C=class DefaultClone$C of class DefaultClone;
+ static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+
+} // end Class DefaultClone$C
+
+
+super public class DefaultClone version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LDefaultClone$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod DefaultClone$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ new class DefaultClone$C;
+ dup;
+ invokespecial Method DefaultClone$C."<init>":"()V";
+ invokestatic Method test:"(LDefaultClone$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ aload_1;
+ ldc String "In C\'s clone()";
+ invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+ ifne L33;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong clone() called";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L33: stack_frame_type append;
+ locals_map class java/lang/String;
+ return;
+ }
+
+ static InnerClass C=class DefaultClone$C of class DefaultClone;
+ static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone;
+ static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone;
+
+} // end Class DefaultClone
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultFinalize.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that a default method named finalize() does not get masked by
+ * java.lang.Object.finalize() during resolution.
+ * @compile DefaultFinalize.jasm
+ * @run main DefaultFinalize
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultFinalize {
+//
+// static String res;
+//
+// interface I1 {
+// default void finalize() {
+// res = "In I1's finalize()";
+// }
+// }
+//
+// interface I2 extends I1 { }
+//
+// static class C implements I2 {
+// public void finalize() {
+// res = "In C's finalize()";
+// }
+// }
+//
+// static void test(I2 i) { i.finalize(); }
+//
+// public static void main(String[] args) {
+// test(new C());
+// if (!res.equals("In C's finalize()")) {
+// throw new RuntimeException("Wrong finalize() method called");
+// }
+// }
+// }
+
+
+interface DefaultFinalize$I1 version 54:0 {
+
+ public Method finalize:"()V" stack 1 locals 1 {
+ ldc String "In I1\'s finalize()";
+ putstatic Field DefaultFinalize.res:"Ljava/lang/String;";
+ return;
+ }
+
+ static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$I1
+
+
+interface DefaultFinalize$I2 implements DefaultFinalize$I1 version 54:0 {
+
+ static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+ static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$I2
+
+
+super class DefaultFinalize$C implements DefaultFinalize$I2 version 54:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public Method finalize:"()V" stack 1 locals 1 {
+ ldc String "In C\'s finalize()";
+ putstatic Field DefaultFinalize.res:"Ljava/lang/String;";
+ return;
+ }
+
+ static InnerClass C=class DefaultFinalize$C of class DefaultFinalize;
+ static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+
+} // end Class DefaultFinalize$C
+
+
+super public class DefaultFinalize version 54:0 {
+
+ static Field res:"Ljava/lang/String;";
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LDefaultFinalize$I2;)V" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod DefaultFinalize$I2.finalize:"()V", 1;
+ return;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 1 {
+ new class DefaultFinalize$C;
+ dup;
+ invokespecial Method DefaultFinalize$C."<init>":"()V";
+ invokestatic Method test:"(LDefaultFinalize$I2;)V";
+ getstatic Field res:"Ljava/lang/String;";
+ ldc String "In C\'s finalize()";
+ invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+ ifne L31;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong finalize() method called";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L31: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class DefaultFinalize$C of class DefaultFinalize;
+ static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize;
+ static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize;
+
+} // end Class DefaultFinalize
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultHashCode.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokeinterface calls the right hashCode() method when
+ * there is both a local method named hashCode() and a default method
+ * named hashCode().
+ * @compile DefaultHashCode.jasm
+ * @run main DefaultHashCode
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultHashCode {
+//
+// interface I2 {
+// default int hashCode() {
+// return 5;
+// }
+// }
+//
+// static class C implements I2 {
+// public int hashCode() {
+// return 4;
+// }
+// }
+//
+// static int test(I2 i) { return i.hashCode(); }
+//
+// public static void main(String[] args) {
+// if (test(new C()) != 4) {
+// throw new RuntimeException("Wrong hashCode() function called");
+// }
+// }
+// }
+
+
+interface DefaultHashCode$I2 version 53:0 {
+
+ public Method hashCode:"()I" stack 1 locals 1 {
+ iconst_5;
+ ireturn;
+ }
+
+ static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode$I2
+
+
+super class DefaultHashCode$C implements DefaultHashCode$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public Method hashCode:"()I" stack 1 locals 1 {
+ iconst_4;
+ ireturn;
+ }
+
+ static InnerClass C=class DefaultHashCode$C of class DefaultHashCode;
+ static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode$C
+
+
+super public class DefaultHashCode version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LDefaultHashCode$I2;)I" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod DefaultHashCode$I2.hashCode:"()I", 1;
+ ireturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 1 {
+ new class DefaultHashCode$C;
+ dup;
+ invokespecial Method DefaultHashCode$C."<init>":"()V";
+ invokestatic Method test:"(LDefaultHashCode$I2;)I";
+ iconst_4;
+ if_icmpeq L24;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong hashCode() function called";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L24: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class DefaultHashCode$C of class DefaultHashCode;
+ static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode;
+
+} // end Class DefaultHashCode
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/DefaultNoCloneInC.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that calling clone() with an invokeinterface opcode throws an IAE
+ * even if there is a default method named clone() in a super interface.
+ * @compile DefaultNoCloneInC.jasm
+ * @run main DefaultNoCloneInC
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class DefaultNoCloneInC {
+//
+// interface I1 {
+// default Object clone() {
+// return "In I1's clone()";
+// }
+// }
+//
+//
+// interface I2 extends I1 { }
+//
+//
+// static class C implements I2 { }
+//
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// try {
+// String s = (String)test(new C());
+// throw new RuntimeException("Expected IAE not thrown");
+// } catch (java.lang.IllegalAccessError e) {
+// if (!e.toString().contains("C.clone")) {
+// throw new RuntimeException("Wrong IllegalAccessError exception thrown");
+// }
+// }
+// }
+// }
+
+
+interface DefaultNoCloneInC$I1 version 53:0 {
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In I1\'s clone()";
+ areturn;
+ }
+
+ static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$I1
+
+
+interface DefaultNoCloneInC$I2 implements DefaultNoCloneInC$I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+ static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$I2
+
+
+super class DefaultNoCloneInC$C implements DefaultNoCloneInC$I2 version 53:0 {
+
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static InnerClass C=class DefaultNoCloneInC$C of class DefaultNoCloneInC;
+ static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC$C
+
+
+super public class DefaultNoCloneInC version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LDefaultNoCloneInC$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod DefaultNoCloneInC$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ try t0;
+ new class DefaultNoCloneInC$C;
+ dup;
+ invokespecial Method DefaultNoCloneInC$C."<init>":"()V";
+ invokestatic Method test:"(LDefaultNoCloneInC$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Expected IAE not thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ endtry t0;
+ catch t0 java/lang/IllegalAccessError;
+ stack_frame_type stack1;
+ stack_map class java/lang/IllegalAccessError;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/IllegalAccessError.toString:"()Ljava/lang/String;";
+ ldc String "C.clone";
+ invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+ ifne L47;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong IllegalAccessError exception thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L47: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class DefaultNoCloneInC$C of class DefaultNoCloneInC;
+ static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC;
+ static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC;
+
+} // end Class DefaultNoCloneInC
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/LocalClone.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that method resolution for invokeinterface of clone() fails
+ * if it cannot find a public method named clone().
+ * @compile LocalClone.jasm
+ * @run main LocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// interface I1 { }
+//
+//
+// public class LocalClone {
+//
+// interface I2 extends I1 { }
+//
+//
+// static class C implements I2 {
+// public Object clone() {
+// return "In C's clone()";
+// }
+// }
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// try {
+// String s = (String)test(new C());
+// throw new RuntimeException("Expected NSME not thrown");
+// } catch (java.lang.NoSuchMethodError e) {
+// if (!e.toString().contains("I2.clone")) {
+// throw new RuntimeException("Wrong NoSuchMethodError exception thrown");
+// }
+// }
+// }
+// }
+
+
+interface I1 version 53:0 { } // end Class I1
+
+
+interface LocalClone$I2 implements I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone$I2
+
+
+super class LocalClone$C implements LocalClone$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In C\'s clone()";
+ areturn;
+ }
+
+ static InnerClass C=class LocalClone$C of class LocalClone;
+ static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone$C
+
+
+super public class LocalClone version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LLocalClone$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod LocalClone$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ try t0;
+ new class LocalClone$C;
+ dup;
+ invokespecial Method LocalClone$C."<init>":"()V";
+ invokestatic Method test:"(LLocalClone$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Expected NSME not thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ endtry t0;
+ catch t0 java/lang/NoSuchMethodError;
+ stack_frame_type stack1;
+ stack_map class java/lang/NoSuchMethodError;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/NoSuchMethodError.toString:"()Ljava/lang/String;";
+ ldc String "I2.clone";
+ invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+ ifne L47;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong NoSuchMethodError exception thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L47: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class LocalClone$C of class LocalClone;
+ static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone;
+
+} // end Class LocalClone
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/NoClones.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that a NoSuchMethodError exception gets thrown if invokeinterface
+ * calls clone() and there is no public implementation of clone().
+ * @compile NoClones.jasm
+ * @run main NoClones
+ */
+
+// The below .jasm code implements the following java code:
+//
+// interface I1 { }
+//
+//
+// public class NoClones {
+//
+// interface I2 extends I1 { }
+//
+// static class C implements I2 { }
+//
+// static Object test(I2 i) { return i.clone(); }
+//
+// public static void main(String[] args) {
+// try {
+// String s = (String)test(new C());
+// throw new RuntimeException("Expected NSME not thrown");
+// } catch (java.lang.NoSuchMethodError e) {
+// if (!e.toString().contains("I2.clone")) {
+// throw new RuntimeException("Wrong NoSuchMethodError exception thrown");
+// }
+// }
+// }
+// }
+
+
+interface I1 version 53:0 { } // end Class I1
+
+
+interface NoClones$I2 implements I1 version 53:0 {
+
+ static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones$I2
+
+
+super class NoClones$C implements NoClones$I2 version 53:0 {
+
+ Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static InnerClass C=class NoClones$C of class NoClones;
+ static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones$C
+
+
+super public class NoClones version 53:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LNoClones$I2;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokeinterface InterfaceMethod NoClones$I2.clone:"()Ljava/lang/Object;", 1;
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ try t0;
+ new class NoClones$C;
+ dup;
+ invokespecial Method NoClones$C."<init>":"()V";
+ invokestatic Method test:"(LNoClones$I2;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Expected NSME not thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ endtry t0;
+ catch t0 java/lang/NoSuchMethodError;
+ stack_frame_type stack1;
+ stack_map class java/lang/NoSuchMethodError;
+ astore_1;
+ aload_1;
+ invokevirtual Method java/lang/NoSuchMethodError.toString:"()Ljava/lang/String;";
+ ldc String "I2.clone";
+ invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z";
+ ifne L47;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong NoSuchMethodError exception thrown";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L47: stack_frame_type same;
+ return;
+ }
+
+ static InnerClass C=class NoClones$C of class NoClones;
+ static abstract interface InnerClass I2=class NoClones$I2 of class NoClones;
+
+} // end Class NoClones
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/DefMethClone.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+interface DefMethClone version 54:0 {
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In DefMethClone\'s clone()";
+ areturn;
+ }
+
+} // end Class DefMethClone
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokevirtual of clone() finds the clone() method that
+ * is local to the calling class.
+ * @compile DefMethClone.jasm SuperClass.jasm I1.java HasLocalClone.jasm
+ * @run main/othervm -noverify HasLocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class HasLocalClone extends SuperClass implements I1 {
+//
+// public Object clone() {
+// return "In HasLocalClone's clone()";
+// }
+//
+// static Object test(SuperClass a) { return a.clone(); }
+//
+// public static void main(String[] args) {
+// String s = (String)test(new HasLocalClone());
+// if (!s.equals("In HasLocalCloneC's clone()")) {
+// throw new RuntimeException("Wrong clone() called: " + s);
+// }
+// }
+// }
+
+
+super public class HasLocalClone extends SuperClass implements I1 version 54:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method SuperClass."<init>":"()V";
+ return;
+ }
+
+ public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 {
+ ldc String "In HasLocalClone\'s clone()";
+ areturn;
+ }
+
+ static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;";
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ new class HasLocalClone;
+ dup;
+ invokespecial Method "<init>":"()V";
+ invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;";
+ checkcast class java/lang/String;
+ astore_1;
+ aload_1;
+ ldc String "In HasLocalClone\'s clone()";
+ invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z";
+ ifne L37;
+ new class java/lang/RuntimeException;
+ dup;
+ aload_1;
+ invokedynamic InvokeDynamic REF_invokeStatic:java/lang/invoke/StringConcatFactory.makeConcatWithConstants:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;":makeConcatWithConstants:"(Ljava/lang/String;)Ljava/lang/String;" String "Wrong clone() called: ";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L37: stack_frame_type append;
+ locals_map class java/lang/String;
+ return;
+ }
+
+ public static final InnerClass Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles;
+
+} // end Class HasLocalClone
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+interface I1 extends DefMethClone { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1Abstr.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+interface I1Abstr extends DefMethClone {
+ Object clone();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
+ * even if a superinterface has a default method named clone().
+ * @compile DefMethClone.jasm SuperClass.jasm I1.java NoLocalClone.jasm
+ * @run main/othervm -noverify NoLocalClone
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class NoLocalClone extends SuperClass implements Cloneable,I1 {
+//
+// static Object test(SuperClass a) { return a.clone(); }
+//
+// public static void main(String[] args) {
+// Object obj = test(new NoLocalClone());
+// if (!(obj instanceof NoLocalClone)) {
+// throw new RuntimeException("Wrong clone() called.");
+// }
+// }
+// }
+
+super public class NoLocalClone extends SuperClass implements java/lang/Cloneable, I1 version 54:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method SuperClass."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;";
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ new class NoLocalClone;
+ dup;
+ invokespecial Method "<init>":"()V";
+ invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;";
+ astore_1;
+ aload_1;
+ instanceof class NoLocalClone;
+ ifne L31;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong clone() called.";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L31: stack_frame_type append;
+ locals_map class java/lang/Object;
+ return;
+ }
+
+} // end Class NoLocalClone
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8154587
+ * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
+ * even if a superinterface has an abstract method named clone().
+ * @compile DefMethClone.jasm SuperClass.jasm I1Abstr.java NoLocalCloneAbstr.jasm
+ * @run main/othervm -noverify NoLocalCloneAbstr
+ */
+
+// The below .jasm code implements the following java code:
+//
+// public class NoLocalCloneAbstr extends SuperClass implements Cloneable,I1Abstr {
+//
+// static Object test(SuperClass a) { return a.clone(); }
+//
+// public static void main(String[] args) {
+// Object obj = test(new NoLocalCloneAbstr());
+// if (!(obj instanceof NoLocalCloneAbstr)) {
+// throw new RuntimeException("Wrong clone() called.");
+// }
+// }
+// }
+
+super public class NoLocalCloneAbstr extends SuperClass implements java/lang/Cloneable, I1Abstr version 54:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method SuperClass."<init>":"()V";
+ return;
+ }
+
+ static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 {
+ aload_0;
+ invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;";
+ areturn;
+ }
+
+ public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 {
+ new class NoLocalCloneAbstr;
+ dup;
+ invokespecial Method "<init>":"()V";
+ invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;";
+ astore_1;
+ aload_1;
+ instanceof class NoLocalCloneAbstr;
+ ifne L31;
+ new class java/lang/RuntimeException;
+ dup;
+ ldc String "Wrong clone() called.";
+ invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+ athrow;
+ L31: stack_frame_type append;
+ locals_map class java/lang/Object;
+ return;
+ }
+
+} // end Class NoLocalCloneAbstr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/SuperClass.jasm Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, 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.
+ *
+ */
+
+super public class SuperClass implements DefMethClone version 54:0 {
+
+ public Method "<init>":"()V" stack 1 locals 1 {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+} // end Class SuperClass
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+/**
+ * @test
+ * @summary If #processors > 1024 os_linux.cpp uses special coding.
+ * Excercise this by forcing usage of this coding. If this fails, this
+ * VM was either compiled on a platform which does not define CPU_ALLOC,
+ * or it is executed on a platform that does not support it.
+ * @requires os.family == "linux"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @run driver TestUseCpuAllocPath
+ */
+public class TestUseCpuAllocPath {
+
+ static final String SUCCESS_STRING = "active_processor_count: using dynamic path (forced)";
+
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb =
+ ProcessTools.createJavaProcessBuilder(false,
+ "-Xlog:os=trace",
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+UseCpuAllocPath",
+ "-version");
+
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain(SUCCESS_STRING);
+ }
+}
--- a/test/jaxp/TEST.ROOT Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jaxp/TEST.ROOT Tue Jan 16 22:24:20 2018 +0000
@@ -23,7 +23,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b08
+requiredVersion=4.2 b11
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
--- a/test/jdk/ProblemList.txt Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/ProblemList.txt Tue Jan 16 22:24:20 2018 +0000
@@ -217,6 +217,8 @@
java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
+java/net/httpclient/SplitResponseSSL.java 8194151 windows-all
+
############################################################################
# jdk_nio
@@ -348,8 +350,6 @@
# svc_tools
-sun/tools/jcmd/TestJcmdSanity.java 8031482 windows-all
-
sun/tools/jstat/jstatClassloadOutput1.sh 8173942 generic-all
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java 8057732 generic-all
--- a/test/jdk/TEST.ROOT Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/TEST.ROOT Tue Jan 16 22:24:20 2018 +0000
@@ -40,7 +40,7 @@
vm.cds
# Minimum jtreg version
-requiredVersion=4.2 b09
+requiredVersion=4.2 b11
# Path to libraries in the topmost test directory. This is needed so @library
# does not need ../../ notation to reach them
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/io/InputStream/NullInputStream.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @bug 4358774
+ * @run testng NullInputStream
+ * @summary Check for expected behavior of InputStream.nullInputStream().
+ */
+public class NullInputStream {
+ private static InputStream openStream;
+ private static InputStream closedStream;
+
+ @BeforeGroups(groups="open")
+ public static void openStream() {
+ openStream = InputStream.nullInputStream();
+ }
+
+ @BeforeGroups(groups="closed")
+ public static void openAndCloseStream() {
+ closedStream = InputStream.nullInputStream();
+ try {
+ closedStream.close();
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @AfterGroups(groups="open")
+ public static void closeStream() {
+ try {
+ openStream.close();
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testOpen() {
+ assertNotNull(openStream, "InputStream.nullInputStream() returned null");
+ }
+
+ @Test(groups = "open")
+ public static void testAvailable() {
+ try {
+ assertEquals(0, openStream.available(), "available() != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testRead() {
+ try {
+ assertEquals(-1, openStream.read(), "read() != -1");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testReadBII() {
+ try {
+ assertEquals(-1, openStream.read(new byte[1], 0, 1),
+ "read(byte[],int,int) != -1");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testReadAllBytes() {
+ try {
+ assertEquals(0, openStream.readAllBytes().length,
+ "readAllBytes().length != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testreadNBytes() {
+ try {
+ assertEquals(0, openStream.readNBytes(new byte[1], 0, 1),
+ "readNBytes(byte[],int,int) != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testSkip() {
+ try {
+ assertEquals(0, openStream.skip(1), "skip() != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "open")
+ public static void testTransferTo() {
+ try {
+ assertEquals(0, openStream.transferTo(new ByteArrayOutputStream(7)),
+ "transferTo() != 0");
+ } catch (IOException ioe) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testAvailableClosed() {
+ try {
+ closedStream.available();
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testReadClosed() {
+ try {
+ closedStream.read();
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testReadBIIClosed() {
+ try {
+ closedStream.read(new byte[1], 0, 1);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testReadAllBytesClosed() {
+ try {
+ closedStream.readAllBytes();
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testReadNBytesClosed() {
+ try {
+ closedStream.readNBytes(new byte[1], 0, 1);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testSkipClosed() {
+ try {
+ closedStream.skip(1);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups = "closed")
+ public static void testTransferToClosed() {
+ try {
+ closedStream.transferTo(new ByteArrayOutputStream(7));
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+}
--- a/test/jdk/java/io/InputStream/ReadAllBytes.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/io/InputStream/ReadAllBytes.java Tue Jan 16 22:24:20 2018 +0000
@@ -31,7 +31,7 @@
/*
* @test
- * @bug 8080835
+ * @bug 8080835 8193832
* @library /test/lib
* @build jdk.test.lib.RandomFactory
* @run main ReadAllBytes
@@ -47,15 +47,11 @@
test(new byte[]{});
test(new byte[]{1, 2, 3});
test(createRandomBytes(1024));
- test(createRandomBytes((1 << 13) - 1));
- test(createRandomBytes((1 << 13)));
- test(createRandomBytes((1 << 13) + 1));
- test(createRandomBytes((1 << 15) - 1));
- test(createRandomBytes((1 << 15)));
- test(createRandomBytes((1 << 15) + 1));
- test(createRandomBytes((1 << 17) - 1));
- test(createRandomBytes((1 << 17)));
- test(createRandomBytes((1 << 17) + 1));
+ for (int shift : new int[] {13, 14, 15, 17}) {
+ for (int offset : new int[] {-1, 0, 1}) {
+ test(createRandomBytes((1 << shift) + offset));
+ }
+ }
}
static void test(byte[] expectedBytes) throws IOException {
--- a/test/jdk/java/io/InputStream/ReadParams.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/io/InputStream/ReadParams.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4008296 4008293 4190090 4193729
+ * @bug 4008296 4008293 4190090 4193729 4358774
* @summary Check for correct handling of parameters to
* XXXXInputStream.read(b, off, len).
*
@@ -197,6 +197,11 @@
doTest1(ifs);
ifs.close();
+ InputStream nis = InputStream.nullInputStream();
+ doTest(nis);
+ doTest1(nis);
+ nis.close();
+
/* cleanup */
fn.delete();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/io/OutputStream/NullOutputStream.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.BeforeGroups;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @bug 4358774
+ * @run testng NullOutputStream
+ * @summary Check for expected behavior of OutputStream.nullOutputStream().
+ */
+public class NullOutputStream {
+ private static OutputStream openStream;
+ private static OutputStream closedStream;
+
+ @BeforeGroups(groups="open")
+ public static void openStream() {
+ openStream = OutputStream.nullOutputStream();
+ }
+
+ @BeforeGroups(groups="closed")
+ public static void openAndCloseStream() {
+ closedStream = OutputStream.nullOutputStream();
+ try {
+ closedStream.close();
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @AfterGroups(groups="open")
+ public static void closeStream() {
+ try {
+ openStream.close();
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups="open")
+ public static void testOpen() {
+ assertNotNull(openStream,
+ "OutputStream.nullOutputStream() returned null");
+ }
+
+ @Test(groups="open")
+ public static void testWrite() {
+ try {
+ openStream.write(62832);
+ } catch (IOException e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups="open")
+ public static void testWriteBII() {
+ try {
+ openStream.write(new byte[] {(byte)6}, 0, 1);
+ } catch (Exception e) {
+ fail("Unexpected IOException");
+ }
+ }
+
+ @Test(groups="closed")
+ public static void testWriteClosed() {
+ try {
+ closedStream.write(62832);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+
+ @Test(groups="closed")
+ public static void testWriteBIIClosed() {
+ try {
+ closedStream.write(new byte[] {(byte)6}, 0, 1);
+ fail("Expected IOException not thrown");
+ } catch (IOException e) {
+ }
+ }
+}
--- a/test/jdk/java/io/OutputStream/WriteParams.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/io/OutputStream/WriteParams.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 1267039 1267043 4193729
+ * @bug 1267039 1267043 4193729 4358774
* @summary Check for correct handling of parameters to
* XXXXOutputStream.write(b, off, len).
*
@@ -152,6 +152,11 @@
doTest1(dfos);
dfos.close();
+ OutputStream nos = OutputStream.nullOutputStream();
+ doTest(nos);
+ doTest1(nos);
+ nos.close();
+
/* cleanup */
fn.delete();
--- a/test/jdk/java/lang/module/ClassFileVersionsTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/lang/module/ClassFileVersionsTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -54,6 +54,8 @@
{ 53, 0, Set.of(STATIC, TRANSITIVE) },
{ 54, 0, Set.of() }, // JDK 10
+
+ { 55, 0, Set.of()}, // JDK 11
};
}
@@ -69,7 +71,11 @@
{ 54, 0, Set.of(TRANSITIVE) },
{ 54, 0, Set.of(STATIC, TRANSITIVE) },
- { 55, 0, Set.of()}, // JDK 11
+ { 55, 0, Set.of(STATIC) }, // JDK 11
+ { 55, 0, Set.of(TRANSITIVE) },
+ { 55, 0, Set.of(STATIC, TRANSITIVE) },
+
+ { 56, 0, Set.of()}, // JDK 12
};
}
--- a/test/jdk/java/lang/ref/ReferenceEnqueue.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/lang/ref/ReferenceEnqueue.java Tue Jan 16 22:24:20 2018 +0000
@@ -25,7 +25,6 @@
* @bug 4268317 8132306 8175797
* @summary Test if Reference.enqueue() works properly with GC
* @run main ReferenceEnqueue
- * @run main/othervm -Djdk.lang.ref.disableClearBeforeEnqueue=true ReferenceEnqueue
*/
import java.lang.ref.*;
@@ -87,8 +86,6 @@
final ReferenceQueue<Object> queue = new ReferenceQueue<>();
final List<Reference<Object>> refs = new ArrayList<>();
final int iterations = 1000;
- final boolean disableClearBeforeEnqueue =
- Boolean.getBoolean("jdk.lang.ref.disableClearBeforeEnqueue");
ExplicitEnqueue() {
this.refs.add(new SoftReference<>(new Object(), queue));
@@ -101,10 +98,7 @@
if (ref.enqueue() == false) {
throw new RuntimeException("Error: enqueue failed");
}
- if (disableClearBeforeEnqueue && ref.get() == null) {
- throw new RuntimeException("Error: clearing should be disabled");
- }
- if (!disableClearBeforeEnqueue && ref.get() != null) {
+ if (ref.get() != null) {
throw new RuntimeException("Error: referent must be cleared");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/nio/Buffer/EqualsCompareTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,686 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.function.LongFunction;
+import java.util.stream.IntStream;
+
+/*
+ * @test
+ * @bug 8193085
+ * @summary tests for buffer equals and compare
+ * @run testng EqualsCompareTest
+ */
+
+public class EqualsCompareTest {
+
+ // Maximum width in bits
+ static final int MAX_WIDTH = 512;
+
+ static final Map<Class, Integer> typeToWidth;
+
+ static {
+ typeToWidth = new HashMap<>();
+ typeToWidth.put(byte.class, Byte.SIZE);
+ typeToWidth.put(short.class, Short.SIZE);
+ typeToWidth.put(char.class, Character.SIZE);
+ typeToWidth.put(int.class, Integer.SIZE);
+ typeToWidth.put(long.class, Long.SIZE);
+ typeToWidth.put(float.class, Float.SIZE);
+ typeToWidth.put(double.class, Double.SIZE);
+ }
+
+ static int arraySizeFor(Class<?> type) {
+ assert type.isPrimitive();
+ return 4 * MAX_WIDTH / typeToWidth.get(type);
+ }
+
+ enum BufferKind {
+ HEAP,
+ HEAP_VIEW,
+ DIRECT;
+ }
+
+ static abstract class BufferType<T extends Buffer, E> {
+ final BufferKind k;
+ final Class<?> bufferType;
+ final Class<?> elementType;
+
+ final MethodHandle eq;
+ final MethodHandle cmp;
+
+ final MethodHandle getter;
+ final MethodHandle setter;
+
+ BufferType(BufferKind k, Class<T> bufferType, Class<?> elementType) {
+ this.k = k;
+ this.bufferType = bufferType;
+ this.elementType = elementType;
+
+ var lookup = MethodHandles.lookup();
+ try {
+ eq = lookup.findVirtual(bufferType, "equals", MethodType.methodType(boolean.class, Object.class));
+ cmp = lookup.findVirtual(bufferType, "compareTo", MethodType.methodType(int.class, bufferType));
+
+ getter = lookup.findVirtual(bufferType, "get", MethodType.methodType(elementType, int.class));
+ setter = lookup.findVirtual(bufferType, "put", MethodType.methodType(bufferType, int.class, elementType));
+ }
+ catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return bufferType.getName() + " " + k;
+ }
+
+ T construct(int length) {
+ return construct(length, ByteOrder.BIG_ENDIAN);
+ }
+
+ abstract T construct(int length, ByteOrder bo);
+
+ @SuppressWarnings("unchecked")
+ T slice(T a, int from, int to) {
+ return (T) a.position(from).limit(to).slice();
+ }
+
+ @SuppressWarnings("unchecked")
+ E get(T a, int i) {
+ try {
+ return (E) getter.invoke(a, i);
+ }
+ catch (RuntimeException | Error e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+ void set(T a, int i, Object v) {
+ try {
+ setter.invoke(a, i, convert(v));
+ }
+ catch (RuntimeException | Error e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+ abstract Object convert(Object o);
+
+ boolean equals(T a, T b) {
+ try {
+ return (boolean) eq.invoke(a, b);
+ }
+ catch (RuntimeException | Error e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+ int compare(T a, T b) {
+ try {
+ return (int) cmp.invoke(a, b);
+ }
+ catch (RuntimeException | Error e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new Error(t);
+ }
+ }
+
+ boolean pairWiseEquals(T a, T b) {
+ if (a.remaining() != b.remaining())
+ return false;
+ int p = a.position();
+ for (int i = a.limit() - 1, j = b.limit() - 1; i >= p; i--, j--)
+ if (!get(a, i).equals(get(b, j)))
+ return false;
+ return true;
+ }
+
+ static class Bytes extends BufferType<ByteBuffer, Byte> {
+ Bytes(BufferKind k) {
+ super(k, ByteBuffer.class, byte.class);
+ }
+
+ @Override
+ ByteBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length).order(bo);
+ default:
+ case HEAP_VIEW:
+ case HEAP:
+ return ByteBuffer.allocate(length).order(bo);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).byteValue()
+ : o;
+ }
+ }
+
+ static class Chars extends BufferType<CharBuffer, Character> {
+ Chars(BufferKind k) {
+ super(k, CharBuffer.class, char.class);
+ }
+
+ @Override
+ CharBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Character.BYTES).
+ order(bo).
+ asCharBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Character.BYTES).
+ order(bo).
+ asCharBuffer();
+ default:
+ case HEAP:
+ return CharBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? (char) ((Integer) o).intValue()
+ : o;
+ }
+
+ CharBuffer transformToStringBuffer(CharBuffer c) {
+ char[] chars = new char[c.remaining()];
+ c.get(chars);
+ return CharBuffer.wrap(new String(chars));
+ }
+ }
+
+ static class Shorts extends BufferType<ShortBuffer, Short> {
+ Shorts(BufferKind k) {
+ super(k, ShortBuffer.class, short.class);
+ }
+
+ @Override
+ ShortBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Short.BYTES).
+ order(bo).
+ asShortBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Short.BYTES).
+ order(bo).
+ asShortBuffer();
+ default:
+ case HEAP:
+ return ShortBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).shortValue()
+ : o;
+ }
+ }
+
+ static class Ints extends BufferType<IntBuffer, Integer> {
+ Ints(BufferKind k) {
+ super(k, IntBuffer.class, int.class);
+ }
+
+ @Override
+ IntBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Integer.BYTES).
+ order(bo).
+ asIntBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Integer.BYTES).
+ order(bo).
+ asIntBuffer();
+ default:
+ case HEAP:
+ return IntBuffer.allocate(length);
+ }
+ }
+
+ Object convert(Object o) {
+ return o;
+ }
+ }
+
+ static class Floats extends BufferType<FloatBuffer, Float> {
+ Floats(BufferKind k) {
+ super(k, FloatBuffer.class, float.class);
+ }
+
+ @Override
+ FloatBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Float.BYTES).
+ order(bo).
+ asFloatBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Float.BYTES).
+ order(bo).
+ asFloatBuffer();
+ default:
+ case HEAP:
+ return FloatBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).floatValue()
+ : o;
+ }
+
+ @Override
+ boolean pairWiseEquals(FloatBuffer a, FloatBuffer b) {
+ if (a.remaining() != b.remaining())
+ return false;
+ int p = a.position();
+ for (int i = a.limit() - 1, j = b.limit() - 1; i >= p; i--, j--) {
+ float av = a.get(i);
+ float bv = b.get(j);
+ if (av != bv && (!Float.isNaN(av) || !Float.isNaN(bv)))
+ return false;
+ }
+ return true;
+ }
+ }
+
+ static class Longs extends BufferType<LongBuffer, Long> {
+ Longs(BufferKind k) {
+ super(k, LongBuffer.class, long.class);
+ }
+
+ @Override
+ LongBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Long.BYTES).
+ order(bo).
+ asLongBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Long.BYTES).
+ order(bo).
+ asLongBuffer();
+ default:
+ case HEAP:
+ return LongBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).longValue()
+ : o;
+ }
+ }
+
+ static class Doubles extends BufferType<DoubleBuffer, Double> {
+ Doubles(BufferKind k) {
+ super(k, DoubleBuffer.class, double.class);
+ }
+
+ @Override
+ DoubleBuffer construct(int length, ByteOrder bo) {
+ switch (k) {
+ case DIRECT:
+ return ByteBuffer.allocateDirect(length * Double.BYTES).
+ order(bo).
+ asDoubleBuffer();
+ case HEAP_VIEW:
+ return ByteBuffer.allocate(length * Double.BYTES).
+ order(bo).
+ asDoubleBuffer();
+ default:
+ case HEAP:
+ return DoubleBuffer.allocate(length);
+ }
+ }
+
+ @Override
+ Object convert(Object o) {
+ return o instanceof Integer
+ ? ((Integer) o).doubleValue()
+ : o;
+ }
+
+ @Override
+ boolean pairWiseEquals(DoubleBuffer a, DoubleBuffer b) {
+ if (a.remaining() != b.remaining())
+ return false;
+ int p = a.position();
+ for (int i = a.limit() - 1, j = b.limit() - 1; i >= p; i--, j--) {
+ double av = a.get(i);
+ double bv = b.get(j);
+ if (av != bv && (!Double.isNaN(av) || !Double.isNaN(bv)))
+ return false;
+ }
+ return true;
+ }
+ }
+ }
+
+
+ static Object[][] bufferTypes;
+
+ @DataProvider
+ public static Object[][] bufferTypesProvider() {
+ if (bufferTypes == null) {
+ bufferTypes = new Object[][]{
+ {new BufferType.Bytes(BufferKind.HEAP)},
+ {new BufferType.Bytes(BufferKind.DIRECT)},
+ {new BufferType.Chars(BufferKind.HEAP)},
+ {new BufferType.Chars(BufferKind.HEAP_VIEW)},
+ {new BufferType.Chars(BufferKind.DIRECT)},
+ {new BufferType.Shorts(BufferKind.HEAP)},
+ {new BufferType.Shorts(BufferKind.HEAP_VIEW)},
+ {new BufferType.Shorts(BufferKind.DIRECT)},
+ {new BufferType.Ints(BufferKind.HEAP)},
+ {new BufferType.Ints(BufferKind.HEAP_VIEW)},
+ {new BufferType.Ints(BufferKind.DIRECT)},
+ {new BufferType.Floats(BufferKind.HEAP)},
+ {new BufferType.Floats(BufferKind.HEAP_VIEW)},
+ {new BufferType.Floats(BufferKind.DIRECT)},
+ {new BufferType.Longs(BufferKind.HEAP)},
+ {new BufferType.Longs(BufferKind.HEAP_VIEW)},
+ {new BufferType.Longs(BufferKind.DIRECT)},
+ {new BufferType.Doubles(BufferKind.HEAP)},
+ {new BufferType.Doubles(BufferKind.HEAP_VIEW)},
+ {new BufferType.Doubles(BufferKind.DIRECT)},
+ };
+ }
+ return bufferTypes;
+ }
+
+
+ static Object[][] floatbufferTypes;
+
+ @DataProvider
+ public static Object[][] floatBufferTypesProvider() {
+ if (floatbufferTypes == null) {
+ LongFunction<Object> bTof = rb -> Float.intBitsToFloat((int) rb);
+ LongFunction<Object> bToD = Double::longBitsToDouble;
+
+ floatbufferTypes = new Object[][]{
+ // canonical and non-canonical NaNs
+ // If conversion is a signalling NaN it may be subject to conversion to a
+ // quiet NaN on some processors, even if a copy is performed
+ // The tests assume that if conversion occurs it does not convert to the
+ // canonical NaN
+ new Object[]{new BufferType.Floats(BufferKind.HEAP), 0x7fc00000L, 0x7f800001L, bTof},
+ new Object[]{new BufferType.Floats(BufferKind.HEAP_VIEW), 0x7fc00000L, 0x7f800001L, bTof},
+ new Object[]{new BufferType.Floats(BufferKind.DIRECT), 0x7fc00000L, 0x7f800001L, bTof},
+ new Object[]{new BufferType.Doubles(BufferKind.HEAP), 0x7ff8000000000000L, 0x7ff0000000000001L, bToD},
+ new Object[]{new BufferType.Doubles(BufferKind.HEAP_VIEW), 0x7ff8000000000000L, 0x7ff0000000000001L, bToD},
+ new Object[]{new BufferType.Doubles(BufferKind.DIRECT), 0x7ff8000000000000L, 0x7ff0000000000001L, bToD},
+
+ // +0.0 and -0.0
+ new Object[]{new BufferType.Floats(BufferKind.HEAP), 0x0L, 0x80000000L, bTof},
+ new Object[]{new BufferType.Floats(BufferKind.HEAP_VIEW), 0x0L, 0x80000000L, bTof},
+ new Object[]{new BufferType.Floats(BufferKind.DIRECT), 0x0L, 0x80000000L, bTof},
+ new Object[]{new BufferType.Doubles(BufferKind.HEAP), 0x0L, 0x8000000000000000L, bToD},
+ new Object[]{new BufferType.Doubles(BufferKind.HEAP_VIEW), 0x0L, 0x8000000000000000L, bToD},
+ new Object[]{new BufferType.Doubles(BufferKind.DIRECT), 0x0L, 0x8000000000000000L, bToD},
+ };
+ }
+ return floatbufferTypes;
+ }
+
+
+ static Object[][] charBufferTypes;
+
+ @DataProvider
+ public static Object[][] charBufferTypesProvider() {
+ if (charBufferTypes == null) {
+ charBufferTypes = new Object[][]{
+ {new BufferType.Chars(BufferKind.HEAP)},
+ {new BufferType.Chars(BufferKind.HEAP_VIEW)},
+ {new BufferType.Chars(BufferKind.DIRECT)},
+ };
+ }
+ return charBufferTypes;
+ }
+
+
+ // Tests all primitive buffers
+ @Test(dataProvider = "bufferTypesProvider")
+ <E>
+ void testBuffers(BufferType<Buffer, E> bufferType) {
+ // Test with buffers of the same byte order (BE)
+ BiFunction<BufferType<Buffer, E>, Integer, Buffer> constructor = (at, s) -> {
+ Buffer a = at.construct(s);
+ for (int x = 0; x < s; x++) {
+ at.set(a, x, x % 8);
+ }
+ return a;
+ };
+
+ testBufferType(bufferType, constructor, constructor);
+
+ // Test with buffers of different byte order
+ if (bufferType.elementType != byte.class &&
+ (bufferType.k == BufferKind.HEAP_VIEW ||
+ bufferType.k == BufferKind.DIRECT)) {
+
+ BiFunction<BufferType<Buffer, E>, Integer, Buffer> leConstructor = (at, s) -> {
+ Buffer a = at.construct(s, ByteOrder.LITTLE_ENDIAN);
+ for (int x = 0; x < s; x++) {
+ at.set(a, x, x % 8);
+ }
+ return a;
+ };
+ testBufferType(bufferType, constructor, leConstructor);
+ }
+ }
+
+ // Tests float and double buffers with edge-case values (NaN, -0.0, +0.0)
+ @Test(dataProvider = "floatBufferTypesProvider")
+ public void testFloatBuffers(
+ BufferType<Buffer, Float> bufferType,
+ long rawBitsA, long rawBitsB,
+ LongFunction<Object> bitsToFloat) {
+ Object av = bitsToFloat.apply(rawBitsA);
+ Object bv = bitsToFloat.apply(rawBitsB);
+
+ BiFunction<BufferType<Buffer, Float>, Integer, Buffer> allAs = (at, s) -> {
+ Buffer b = at.construct(s);
+ for (int x = 0; x < s; x++) {
+ at.set(b, x, av);
+ }
+ return b;
+ };
+
+ BiFunction<BufferType<Buffer, Float>, Integer, Buffer> allBs = (at, s) -> {
+ Buffer b = at.construct(s);
+ for (int x = 0; x < s; x++) {
+ at.set(b, x, bv);
+ }
+ return b;
+ };
+
+ BiFunction<BufferType<Buffer, Float>, Integer, Buffer> halfBs = (at, s) -> {
+ Buffer b = at.construct(s);
+ for (int x = 0; x < s / 2; x++) {
+ at.set(b, x, bv);
+ }
+ for (int x = s / 2; x < s; x++) {
+ at.set(b, x, 1);
+ }
+ return b;
+ };
+
+ // Sanity check
+ int size = arraySizeFor(bufferType.elementType);
+ Assert.assertTrue(bufferType.pairWiseEquals(allAs.apply(bufferType, size),
+ allBs.apply(bufferType, size)));
+ Assert.assertTrue(bufferType.equals(allAs.apply(bufferType, size),
+ allBs.apply(bufferType, size)));
+
+ testBufferType(bufferType, allAs, allBs);
+ testBufferType(bufferType, allAs, halfBs);
+ }
+
+ // Tests CharBuffer for region sources and CharSequence sources
+ @Test(dataProvider = "charBufferTypesProvider")
+ public void testCharBuffers(BufferType.Chars charBufferType) {
+
+ BiFunction<BufferType.Chars, Integer, CharBuffer> constructor = (at, s) -> {
+ CharBuffer a = at.construct(s);
+ for (int x = 0; x < s; x++) {
+ at.set(a, x, x % 8);
+ }
+ return a;
+ };
+
+ BiFunction<BufferType.Chars, Integer, CharBuffer> constructorX = constructor.
+ andThen(charBufferType::transformToStringBuffer);
+
+ testBufferType(charBufferType, constructor, constructorX);
+ }
+
+
+ <B extends Buffer, E, BT extends BufferType<B, E>>
+ void testBufferType(BT bt,
+ BiFunction<BT, Integer, B> aConstructor,
+ BiFunction<BT, Integer, B> bConstructor) {
+ int n = arraySizeFor(bt.elementType);
+
+ for (int s : ranges(0, n)) {
+ B a = aConstructor.apply(bt, s);
+ B b = bConstructor.apply(bt, s);
+
+ for (int aFrom : ranges(0, s)) {
+ for (int aTo : ranges(aFrom, s)) {
+ int aLength = aTo - aFrom;
+
+ B as = aLength != s
+ ? bt.slice(a, aFrom, aTo)
+ : a;
+
+ for (int bFrom : ranges(0, s)) {
+ for (int bTo : ranges(bFrom, s)) {
+ int bLength = bTo - bFrom;
+
+ B bs = bLength != s
+ ? bt.slice(b, bFrom, bTo)
+ : b;
+
+ boolean eq = bt.pairWiseEquals(as, bs);
+ Assert.assertEquals(bt.equals(as, bs), eq);
+ Assert.assertEquals(bt.equals(bs, as), eq);
+ if (eq) {
+ Assert.assertEquals(bt.compare(as, bs), 0);
+ Assert.assertEquals(bt.compare(bs, as), 0);
+ }
+ else {
+ int aCb = bt.compare(as, bs);
+ int bCa = bt.compare(bs, as);
+ int v = Integer.signum(aCb) * Integer.signum(bCa);
+ Assert.assertTrue(v == -1);
+ }
+ }
+ }
+
+ if (aLength > 0 && !a.isReadOnly()) {
+ for (int i = aFrom; i < aTo; i++) {
+ B c = aConstructor.apply(bt, a.capacity());
+ B cs = aLength != s
+ ? bt.slice(c, aFrom, aTo)
+ : c;
+
+ // Create common prefix with a length of i - aFrom
+ bt.set(c, i, -1);
+
+ Assert.assertFalse(bt.equals(c, a));
+
+ int cCa = bt.compare(cs, as);
+ int aCc = bt.compare(as, cs);
+ int v = Integer.signum(cCa) * Integer.signum(aCc);
+ Assert.assertTrue(v == -1);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ static int[] ranges(int from, int to) {
+ int width = to - from;
+ switch (width) {
+ case 0:
+ return new int[]{};
+ case 1:
+ return new int[]{from, to};
+ case 2:
+ return new int[]{from, from + 1, to};
+ case 3:
+ return new int[]{from, from + 1, from + 2, to};
+ default:
+ return IntStream.of(from, from + 1, from + 2, to / 2 - 1, to / 2, to / 2 + 1, to - 2, to - 1, to)
+ .filter(i -> i >= from && i <= to)
+ .distinct().toArray();
+ }
+ }
+}
--- a/test/jdk/java/util/Locale/bcp47u/FormatTests.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/util/Locale/bcp47u/FormatTests.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
/*
*
* @test
- * @bug 8176841
+ * @bug 8176841 8194148
* @summary Tests *Format class deals with Unicode extensions
* correctly.
* @modules jdk.localedata
@@ -73,6 +73,7 @@
private static final String NUM_SINH = "\u0de7\u0de8,\u0de9\u0dea\u0deb.\u0dec\u0ded\u0dee\u0def";
private static final Date testDate = new Calendar.Builder()
+ .setCalendarType("gregory")
.setDate(2017, 7, 10)
.setTimeOfDay(15, 15, 0)
.setTimeZone(AMLA)
--- a/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,11 @@
/*
*
* @test
- * @bug 8176841
+ * @bug 8176841 8194148
* @summary Tests *FormatSymbols class deals with Unicode extensions
* correctly.
* @modules jdk.localedata
- * @run testng/othervm -Djava.locale.providers=CLDR FormatTests
+ * @run testng/othervm -Djava.locale.providers=CLDR SymbolsTests
*/
import static org.testng.Assert.assertEquals;
@@ -66,11 +66,11 @@
return new Object[][] {
// Locale, expected decimal separator, expected grouping separator
- {RG_AT, ",", "."},
- {Locale.US, ".", ","},
+ {RG_AT, ',', '.'},
+ {Locale.US, '.', ','},
// -nu & -rg mixed. -nu should win
- {Locale.forLanguageTag("ar-EG-u-nu-latn-rg-mazzzz"), ".", ","},
+ {Locale.forLanguageTag("ar-EG-u-nu-latn-rg-mazzzz"), '.', ','},
};
}
--- a/test/jdk/java/util/regex/RegExTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/util/regex/RegExTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
* 8027645 8035076 8039124 8035975 8074678 6854417 8143854 8147531 7071819
* 8151481 4867170 7080302 6728861 6995635 6736245 4916384 6328855 6192895
* 6345469 6988218 6693451 7006761 8140212 8143282 8158482 8176029 8184706
+ * 8194667
*
* @library /test/lib
* @build jdk.test.lib.RandomFactory
@@ -1367,24 +1368,35 @@
report("Reluctant Repetition");
}
+ private static Pattern serializedPattern(Pattern p) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(p);
+ oos.close();
+ try (ObjectInputStream ois = new ObjectInputStream(
+ new ByteArrayInputStream(baos.toByteArray()))) {
+ return (Pattern)ois.readObject();
+ }
+ }
+
private static void serializeTest() throws Exception {
String patternStr = "(b)";
String matchStr = "b";
Pattern pattern = Pattern.compile(patternStr);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(pattern);
- oos.close();
- ObjectInputStream ois = new ObjectInputStream(
- new ByteArrayInputStream(baos.toByteArray()));
- Pattern serializedPattern = (Pattern)ois.readObject();
- ois.close();
+ Pattern serializedPattern = serializedPattern(pattern);
Matcher matcher = serializedPattern.matcher(matchStr);
if (!matcher.matches())
failCount++;
if (matcher.groupCount() != 1)
failCount++;
+ pattern = Pattern.compile("a(?-i)b", Pattern.CASE_INSENSITIVE);
+ serializedPattern = serializedPattern(pattern);
+ if (!serializedPattern.matcher("Ab").matches())
+ failCount++;
+ if (serializedPattern.matcher("AB").matches())
+ failCount++;
+
report("Serialization");
}
--- a/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -47,6 +47,7 @@
/*
* @test
* @bug 8071597 8193856
+ * @run main/timeout=240
*/
@Test
public class WhileOpTest extends OpTestCase {
--- a/test/jdk/javax/net/ssl/compatibility/Parameter.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/javax/net/ssl/compatibility/Parameter.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -65,15 +65,15 @@
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_RSA_WITH_AES_256_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(),
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(),
TLS_RSA_WITH_AES_256_CBC_SHA(),
@@ -86,15 +86,15 @@
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_RSA_WITH_AES_128_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(
Protocol.TLSV1_2, JdkRelease.JDK7),
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(
- Protocol.TLSV1_2, JdkRelease.JDK7),
+ Protocol.TLSV1_2, JdkRelease.JDK6),
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(),
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(),
TLS_RSA_WITH_AES_128_CBC_SHA(),
--- a/test/jdk/jdk/internal/reflect/Reflection/GetCallerClassWithDepth.java Sun Jan 14 21:46:14 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8025799
- * @summary Reflection.getCallerClass(int)
- * @modules java.base/jdk.internal.reflect
- * @run main GetCallerClassWithDepth
- */
-
-import jdk.internal.reflect.Reflection;
-
-public class GetCallerClassWithDepth {
- public static void main(String[] args) throws Exception {
- Class<?> c = Test.test();
- assertEquals(c, GetCallerClassWithDepth.class);
- Class<?> caller = Test.caller();
- assertEquals(caller, GetCallerClassWithDepth.class);
- Test.selfTest();
-
- try {
- Reflection.getCallerClass(-1);
- throw new RuntimeException("getCallerClass(-1) should fail");
- } catch (Error e) {
- System.out.println("Expected: " + e.getMessage());
- }
- }
-
- public Class<?> getCallerClass() {
- // 0: Reflection 1: getCallerClass 2: Test.test 3: main
- return Reflection.getCallerClass(3);
- }
-
- static void assertEquals(Class<?> c, Class<?> expected) {
- if (c != expected) {
- throw new RuntimeException("Incorrect caller: " + c);
- }
- }
-
- static class Test {
- // Returns the caller of this method
- public static Class<?> test() {
- return new GetCallerClassWithDepth().getCallerClass();
- }
-
- // Returns the caller of this method
- public static Class<?> caller() {
- // 0: Reflection 1: Test.caller 2: main
- return Reflection.getCallerClass(2);
- }
- public static void selfTest() {
- // 0: Reflection 1: Test.selfTest
- Class<?> c = Reflection.getCallerClass(1);
- assertEquals(c, Test.class);
- Inner1.deep();
- }
-
- static class Inner1 {
- static void deep() {
- deeper();
- }
- static void deeper() {
- Inner2.deepest();
- }
- static class Inner2 {
- static void deepest() {
- // 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest
- Class<?> c = Reflection.getCallerClass(4);
- assertEquals(c, Test.class);
- }
- }
- }
- }
-}
--- a/test/jdk/lib/testlibrary/bootlib/java.base/java/util/stream/LambdaTestHelpers.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/lib/testlibrary/bootlib/java.base/java/util/stream/LambdaTestHelpers.java Tue Jan 16 22:24:20 2018 +0000
@@ -48,6 +48,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.fail;
/**
* LambdaTestHelpers -- assertion methods and useful objects for lambda test cases
@@ -277,7 +278,7 @@
public static<T> void assertContents(Iterable<T> actual, Iterable<T> expected) {
if (actual instanceof Collection && expected instanceof Collection) {
- assertEquals(actual, expected);
+ assertIterableEquals(actual, expected);
} else {
assertContents(actual.iterator(), expected.iterator());
}
@@ -287,6 +288,42 @@
assertEquals(toBoxedList(actual), toBoxedList(expected));
}
+ // Workaround excessive String creation in inner loop in org.testng.Assert.assertEquals(Iterable<?>, Iterable<?>)
+ static public void assertIterableEquals(Iterable<?> actual, Iterable<?> expected) {
+ if(actual == expected) {
+ return;
+ }
+
+ if(actual == null || expected == null) {
+ fail("Iterables not equal: expected: " + expected + " and actual: " + actual);
+ }
+
+ assertIteratorsEquals(actual.iterator(), expected.iterator());
+ }
+
+ // Workaround excessive String creation in inner loop in org.testng.Assert.assertEquals(Iterator<?>, Iterator<?>)
+ static public void assertIteratorsEquals(Iterator<?> actual, Iterator<?> expected) {
+ if (actual == expected) {
+ return;
+ }
+
+ if (actual == null || expected == null) {
+ fail("Iterators not equal: expected: " + expected + " and actual: " + actual);
+ }
+
+ while (actual.hasNext() && expected.hasNext()) {
+ Object e = expected.next();
+ Object a = actual.next();
+ assertEquals(a, e, "Iterator contents differ");
+ }
+
+ if(actual.hasNext()) {
+ fail("Actual iterator returned more elements than the expected iterator.");
+ } else if(expected.hasNext()) {
+ fail("Expected iterator returned more elements than the actual iterator.");
+ }
+ }
+
@SafeVarargs
@SuppressWarnings("varargs")
public static<T> void assertContents(Iterator<T> actual, T... expected) {
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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,12 +25,16 @@
import static jdk.testlibrary.Asserts.*;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintStream;
+import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
/**
* Utility class for verifying output and exit value from a {@code Process}.
@@ -446,8 +450,9 @@
/**
- * Get the contents of the output buffer (stdout and stderr) as list of strings.
- * Output will be split by system property 'line.separator'.
+ * Get the contents of the output buffer (stdout and stderr)
+ * as a list of strings. Output will be split at new-lines as
+ * recognized by java.io.BufferedReader.readLine().
*
* @return Contents of the output buffer as list of strings
*/
@@ -456,12 +461,8 @@
}
private List<String> asLines(String buffer) {
- List<String> l = new ArrayList<>();
- String[] a = buffer.split(Utils.NEW_LINE);
- for (String string : a) {
- l.add(string);
- }
- return l;
+ return new BufferedReader(new StringReader(buffer))
+ .lines().collect(Collectors.toList());
}
/**
--- a/test/jdk/sun/reflect/Reflection/GetCallerClassWithDepth.java Sun Jan 14 21:46:14 2018 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8137058
- * @summary Basic test for the unsupported Reflection.getCallerClass(int)
- * @modules jdk.unsupported
- */
-
-import sun.reflect.Reflection;
-
-public class GetCallerClassWithDepth {
- public static void main(String[] args) throws Exception {
- Class<?> c = Test.test();
- assertEquals(c, GetCallerClassWithDepth.class);
- Class<?> caller = Test.caller();
- assertEquals(caller, GetCallerClassWithDepth.class);
- Test.selfTest();
-
- try {
- Reflection.getCallerClass(-1);
- throw new RuntimeException("getCallerClass(-1) should fail");
- } catch (Error e) {
- System.out.println("Expected: " + e.getMessage());
- }
- }
-
- public Class<?> getCallerClass() {
- // 0: Reflection 1: getCallerClass 2: Test.test 3: main
- return Reflection.getCallerClass(3);
- }
-
- static void assertEquals(Class<?> c, Class<?> expected) {
- if (c != expected) {
- throw new RuntimeException("Incorrect caller: " + c);
- }
- }
-
- static class Test {
- // Returns the caller of this method
- public static Class<?> test() {
- return new GetCallerClassWithDepth().getCallerClass();
- }
-
- // Returns the caller of this method
- public static Class<?> caller() {
- // 0: Reflection 1: Test.caller 2: main
- return Reflection.getCallerClass(2);
- }
- public static void selfTest() {
- // 0: Reflection 1: Test.selfTest
- Class<?> c = Reflection.getCallerClass(1);
- assertEquals(c, Test.class);
- Inner1.deep();
- }
-
- static class Inner1 {
- static void deep() {
- deeper();
- }
- static void deeper() {
- Inner2.deepest();
- }
- static class Inner2 {
- static void deepest() {
- // 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest
- Class<?> c = Reflection.getCallerClass(4);
- assertEquals(c, Test.class);
- }
- }
- }
- }
-}
--- a/test/jdk/sun/security/ssl/CertPathRestrictions/JSSEServer.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/sun/security/ssl/CertPathRestrictions/JSSEServer.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,6 @@
private SSLServerSocket server = null;
- private Exception exception = null;
-
public JSSEServer(SSLContext context, String constraint,
boolean needClientAuth) throws Exception {
TLSRestrictions.setConstraint("Server", constraint);
@@ -49,35 +47,28 @@
System.out.println("Server: port=" + getPort());
}
- public void start() {
- new Thread(new Runnable() {
+ public Exception start() {
+ System.out.println("Server: started");
+ Exception exception = null;
+ try (SSLSocket socket = (SSLSocket) server.accept()) {
+ System.out.println("Server: accepted connection");
+ socket.setSoTimeout(TLSRestrictions.TIMEOUT);
+ InputStream sslIS = socket.getInputStream();
+ OutputStream sslOS = socket.getOutputStream();
+ sslIS.read();
+ sslOS.write('S');
+ sslOS.flush();
+ System.out.println("Server: finished");
+ } catch (Exception e) {
+ exception = e;
+ e.printStackTrace(System.out);
+ System.out.println("Server: failed");
+ }
- @Override
- public void run() {
- try {
- System.out.println("Server: started");
- try (SSLSocket socket = (SSLSocket) server.accept()) {
- socket.setSoTimeout(TLSRestrictions.TIMEOUT);
- InputStream sslIS = socket.getInputStream();
- OutputStream sslOS = socket.getOutputStream();
- sslIS.read();
- sslOS.write('S');
- sslOS.flush();
- System.out.println("Server: finished");
- }
- } catch (Exception e) {
- e.printStackTrace(System.out);
- exception = e;
- }
- }
- }).start();
+ return exception;
}
public int getPort() {
return server.getLocalPort();
}
-
- public Exception getException() {
- return exception;
- }
}
--- a/test/jdk/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/jdk/sun/security/ssl/CertPathRestrictions/TLSRestrictions.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,10 @@
import java.security.cert.CertificateFactory;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.net.ssl.KeyManagerFactory;
@@ -216,59 +220,59 @@
needClientAuth,
pass);
- JSSEServer server = new JSSEServer(
- createSSLContext(trustNames, certNames),
- serverConstraint,
- needClientAuth);
- int port = server.getPort();
- server.start();
-
- // Run client on another JVM so that its properties cannot be in conflict
- // with server's.
- OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
- "-Dcert.dir=" + CERT_DIR,
- "-Djava.security.debug=certpath",
- "-classpath",
- TEST_CLASSES,
- "JSSEClient",
- port + "",
- trustNameStr,
- certNameStr,
- clientConstraint);
- int exitValue = outputAnalyzer.getExitValue();
- String clientOut = outputAnalyzer.getOutput();
+ ExecutorService executor = Executors.newFixedThreadPool(1);
+ try {
+ JSSEServer server = new JSSEServer(
+ createSSLContext(trustNames, certNames),
+ serverConstraint,
+ needClientAuth);
+ int port = server.getPort();
+ Future<Exception> serverFuture = executor.submit(() -> server.start());
- Exception serverException = server.getException();
- if (serverException != null) {
- System.out.println("Server: failed");
- }
-
- System.out.println("---------- Client output start ----------");
- System.out.println(clientOut);
- System.out.println("---------- Client output end ----------");
+ // Run client on another JVM so that its properties cannot be in conflict
+ // with server's.
+ OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJvm(
+ "-Dcert.dir=" + CERT_DIR,
+ "-Djava.security.debug=certpath",
+ "-classpath",
+ TEST_CLASSES,
+ "JSSEClient",
+ port + "",
+ trustNameStr,
+ certNameStr,
+ clientConstraint);
+ int clientExitValue = outputAnalyzer.getExitValue();
+ String clientOut = outputAnalyzer.getOutput();
+ System.out.println("---------- Client output start ----------");
+ System.out.println(clientOut);
+ System.out.println("---------- Client output end ----------");
- if (serverException instanceof SocketTimeoutException
- || clientOut.contains("SocketTimeoutException")) {
- System.out.println("The communication gets timeout and skips the test.");
- return;
- }
-
- if (pass) {
- if (serverException != null || exitValue != 0) {
- throw new RuntimeException(
- "Unexpected failure. Operation was blocked.");
- }
- } else {
- if (serverException == null && exitValue == 0) {
- throw new RuntimeException(
- "Unexpected pass. Operation was allowed.");
+ Exception serverException = serverFuture.get(TIMEOUT, TimeUnit.MILLISECONDS);
+ if (serverException instanceof SocketTimeoutException
+ || clientOut.contains("SocketTimeoutException")) {
+ System.out.println("The communication gets timeout and skips the test.");
+ return;
}
- // The test may encounter non-SSL issues, like network problem.
- if (!(serverException instanceof SSLHandshakeException
- || clientOut.contains("SSLHandshakeException"))) {
- throw new RuntimeException("Failure with unexpected exception.");
+ if (pass) {
+ if (serverException != null || clientExitValue != 0) {
+ throw new RuntimeException(
+ "Unexpected failure. Operation was blocked.");
+ }
+ } else {
+ if (serverException == null && clientExitValue == 0) {
+ throw new RuntimeException(
+ "Unexpected pass. Operation was allowed.");
+ }
+
+ // The test may encounter non-SSL issues, like network problem.
+ if (!(serverException instanceof SSLHandshakeException
+ || clientOut.contains("SSLHandshakeException"))) {
+ throw new RuntimeException("Failure with unexpected exception.");
+ }
}
+ } finally {
+ executor.shutdown();
}
}
@@ -520,7 +524,6 @@
true);
break;
}
-
System.out.println("Case passed");
System.out.println("========================================");
}
--- a/test/langtools/ProblemList.txt Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/ProblemList.txt Tue Jan 16 22:24:20 2018 +0000
@@ -37,7 +37,7 @@
# jshell
jdk/jshell/UserJdiUserRemoteTest.java 8173079 linux-all
-jdk/jshell/UserInputTest.java 8169536 generic-all
+jdk/jshell/UserInputTest.java 8169536 generic-all
###########################################################################
#
@@ -54,6 +54,8 @@
tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java 8057687 generic-all emit correct byte code an attributes for type annotations
tools/javac/warnings/suppress/TypeAnnotations.java 8057683 generic-all improve ordering of errors with type annotations
tools/javac/modules/SourceInSymlinkTest.java 8180263 windows-all fails when run on a subst drive
+tools/javac/options/release/ReleaseOptionUnsupported.java 8193784 generic-all temporary until support for --release 11 is worked out
+tools/javac/jvm/VerboseOutTest.java 8194968 windows-all
###########################################################################
#
@@ -76,3 +78,5 @@
###########################################################################
#
# jdeps
+
+tools/jdeprscan/tests/jdk/jdeprscan/TestNotFound.java 8193784 generic-all temporary until support for --release 11 is worked out
--- a/test/langtools/TEST.ROOT Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/TEST.ROOT Tue Jan 16 22:24:20 2018 +0000
@@ -15,7 +15,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b08
+requiredVersion=4.2 b11
# Use new module options
useNewOptions=true
--- a/test/langtools/jdk/jshell/ToolShiftTabTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/jdk/jshell/ToolShiftTabTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8166334
+ * @bug 8166334 8188894
* @summary test shift-tab shortcuts "fixes"
* @modules
* jdk.jshell/jdk.internal.jshell.tool.resources:open
@@ -107,11 +107,12 @@
public void testFixImport() throws Exception {
doRunTest((inputSink, out) -> {
- inputSink.write("Frame");
- inputSink.write(FIX + "i");
- inputSink.write("1");
- inputSink.write(".WIDTH\n");
- waitOutput(out, "==> 1");
+ do {
+ inputSink.write("Frame");
+ inputSink.write(FIX + "i");
+ inputSink.write("1");
+ inputSink.write(".WIDTH\n");
+ } while (!waitOutput(out, "==> 1", "Results may be incomplete"));
inputSink.write("/import\n");
waitOutput(out, "| import java.awt.Frame");
--- a/test/langtools/jdk/jshell/UITesting.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/jdk/jshell/UITesting.java Tue Jan 16 22:24:20 2018 +0000
@@ -135,8 +135,19 @@
}
protected void waitOutput(StringBuilder out, String expected) {
+ waitOutput(out, expected, null);
+ }
+
+ // Return true if expected is found, false if secondary is found,
+ // otherwise, time out with an IllegalStateException
+ protected boolean waitOutput(StringBuilder out, String expected, String secondary) {
expected = expected.replaceAll("\n", laxLineEndings ? "\r?\n" : System.getProperty("line.separator"));
Pattern expectedPattern = Pattern.compile(expected, Pattern.DOTALL);
+ Pattern secondaryPattern = null;
+ if (secondary != null) {
+ secondary = secondary.replaceAll("\n", laxLineEndings ? "\r?\n" : System.getProperty("line.separator"));
+ secondaryPattern = Pattern.compile(secondary, Pattern.DOTALL);
+ }
synchronized (out) {
long s = System.currentTimeMillis();
@@ -144,7 +155,14 @@
Matcher m = expectedPattern.matcher(out);
if (m.find()) {
out.delete(0, m.end());
- return ;
+ return true;
+ }
+ if (secondaryPattern != null) {
+ m = secondaryPattern.matcher(out);
+ if (m.find()) {
+ out.delete(0, m.end());
+ return false;
+ }
}
long e = System.currentTimeMillis();
if ((e - s) > TIMEOUT) {
--- a/test/langtools/tools/javac/6330997/T6330997.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/6330997/T6330997.java Tue Jan 16 22:24:20 2018 +0000
@@ -32,8 +32,8 @@
* jdk.compiler/com.sun.tools.javac.main
* jdk.compiler/com.sun.tools.javac.util
* @clean T1 T2
- * @compile -source 10 -target 10 T1.java
- * @compile -source 10 -target 10 T2.java
+ * @compile -source 10 -target 11 T1.java
+ * @compile -source 10 -target 11 T2.java
* @run main/othervm T6330997
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8194932/Foo.jcod Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,115 @@
+class Foo {
+ 0xCAFEBABE;
+ 0; // minor version
+ 52; // version
+ [] { // Constant Pool
+ ; // first element is empty
+ Method #4 #14; // #1
+ String #15; // #2
+ class #16; // #3
+ class #17; // #4
+ Utf8 "<init>"; // #5
+ Utf8 "()V"; // #6
+ Utf8 "Code"; // #7
+ Utf8 "LineNumberTable"; // #8
+ Utf8 "m"; // #9
+ Utf8 "m2"; // #10
+ Utf8 "()Ljava/lang/String;"; // #11
+ Utf8 "SourceFile"; // #12
+ Utf8 "Foo.java"; // #13
+ NameAndType #5 #6; // #14
+ Utf8 "Hello"; // #15
+ Utf8 "Foo"; // #16
+ Utf8 "java/lang/Object"; // #17
+ } // Constant Pool
+
+ 0x0020; // access
+ #3;// this_cpx
+ #4;// super_cpx
+
+ [] { // Interfaces
+ } // Interfaces
+
+ [] { // fields
+ } // fields
+
+ [] { // methods
+ { // Member
+ 0x0000; // access
+ #5; // name_cpx
+ #6; // sig_cpx
+ [] { // Attributes
+ Attr(#7) { // Code
+ 1; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0x2AB70001B1;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#8) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 1;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x0000; // access
+ #9; // name_cpx
+ #6; // sig_cpx
+ [] { // Attributes
+ Attr(#7) { // Code
+ 0; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0xB1;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#8) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 2;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x0000; // access
+ #9; // name_cpx
+ #11; // sig_cpx
+ [] { // Attributes
+ Attr(#7) { // Code
+ 1; // max_stack
+ 1; // max_locals
+ Bytes[]{
+ 0x1202B0;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#8) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 3;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ } // methods
+
+ [] { // Attributes
+ Attr(#12) { // SourceFile
+ #13;
+ } // end SourceFile
+ } // Attributes
+} // end class Foo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8194932/T8194932.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8194932
+ * @summary no ambuguity error is emitted if classfile contains two identical methods with different return types
+ * @build Foo
+ * @compile/fail/ref=T8194932.out -XDrawDiagnostics T8194932.java
+ */
+
+class T8194932 {
+ void test(Foo foo) {
+ foo.m(); //should get an ambiguity here
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/8194932/T8194932.out Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,2 @@
+T8194932.java:11:12: compiler.err.ref.ambiguous: m, kindname.method, m(), Foo, kindname.method, m(), Foo
+1 error
--- a/test/langtools/tools/javac/BadCovar.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/BadCovar.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-BadCovar.java:22:10: compiler.err.types.incompatible.diff.ret: bad.covar.B, bad.covar.A, f()
+BadCovar.java:22:10: compiler.err.types.incompatible: bad.covar.B, bad.covar.A, (compiler.misc.incompatible.diff.ret: f, )
1 error
--- a/test/langtools/tools/javac/InconsistentInheritedSignature.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/InconsistentInheritedSignature.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-InconsistentInheritedSignature.java:17:1: compiler.err.types.incompatible.diff.ret: I2, I1, f()
+InconsistentInheritedSignature.java:17:1: compiler.err.types.incompatible: I2, I1, (compiler.misc.incompatible.diff.ret: f, )
1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/MethodParameters/ClassReaderTest/ClassReaderTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8007720 8177486
+ * @summary class reading of named parameters
+ * @library /tools/javac/lib
+ * @modules java.compiler
+ * jdk.compiler
+ * @compile -parameters ClassReaderTest.java MethodParameterProcessor.java
+ * @compile/process/ref=ClassReaderTest.out -proc:only -processor MethodParameterProcessor ClassReaderTest ClassReaderTest$I ClassReaderTest$E
+ */
+
+import static java.lang.annotation.RetentionPolicy.CLASS;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+public class ClassReaderTest {
+
+ @Retention(RUNTIME)
+ @interface RuntimeAnnoOne {
+ int value() default 0;
+ }
+
+ @Retention(RUNTIME)
+ @interface RuntimeAnnoTwo {
+ int value() default 0;
+ }
+
+ @Retention(CLASS)
+ @interface ClassAnno {
+ int value() default 0;
+ }
+
+ @MethodParameterProcessor.ParameterNames
+ void f(
+ @RuntimeAnnoOne(1) @RuntimeAnnoTwo(2) @ClassAnno(3) int a,
+ @RuntimeAnnoOne(4) @RuntimeAnnoTwo(5) @ClassAnno(6) String b) {}
+
+ class I {
+ @MethodParameterProcessor.ParameterNames
+ I(@ClassAnno(7) int d, @RuntimeAnnoOne(8) String e, Object o) {}
+ }
+
+ enum E {
+ ONE(42, "");
+
+ @MethodParameterProcessor.ParameterNames
+ E(int x, @RuntimeAnnoOne(9) String s) {}
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/MethodParameters/ClassReaderTest/ClassReaderTest.out Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,3 @@
+Note: ClassReaderTest.E.<init>(x, @ClassReaderTest.RuntimeAnnoOne(9) s)
+Note: ClassReaderTest.I.<init>(@ClassReaderTest.ClassAnno(7) d, @ClassReaderTest.RuntimeAnnoOne(8) e, o)
+Note: ClassReaderTest.f(@ClassReaderTest.ClassAnno(3) @ClassReaderTest.RuntimeAnnoOne(1) @ClassReaderTest.RuntimeAnnoTwo(2) a, @ClassReaderTest.ClassAnno(6) @ClassReaderTest.RuntimeAnnoOne(4) @ClassReaderTest.RuntimeAnnoTwo(5) b)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/MethodParameters/ClassReaderTest/MethodParameterProcessor.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2017 Google Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import static java.util.stream.Collectors.joining;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+
+@SupportedAnnotationTypes("MethodParameterProcessor.ParameterNames")
+public class MethodParameterProcessor extends JavacTestingAbstractProcessor {
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+ @interface ParameterNames {
+ String[] value() default {};
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ for (Element element : roundEnv.getElementsAnnotatedWith(ParameterNames.class)) {
+ ExecutableElement exec = (ExecutableElement)element;
+ String message = printNamesAndAnnotations(exec);
+ messager.printMessage(Kind.NOTE, message);
+ }
+ return false;
+ }
+
+ private String printNamesAndAnnotations(ExecutableElement exec) {
+ return String.format("%s.%s(%s)",
+ exec.getEnclosingElement(),
+ exec.getSimpleName(),
+ exec.getParameters().stream().map(this::printParameter).collect(joining(", ")));
+ }
+
+ private String printParameter(VariableElement param) {
+ return param.getAnnotationMirrors().stream().map(String::valueOf).collect(joining(" "))
+ + (param.getAnnotationMirrors().isEmpty() ? "" : " ")
+ + param.getSimpleName();
+ }
+}
--- a/test/langtools/tools/javac/OverrideChecks/InconsistentReturn.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/OverrideChecks/InconsistentReturn.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-InconsistentReturn.java:17:1: compiler.err.types.incompatible.diff.ret: I2, I1, f()
+InconsistentReturn.java:17:1: compiler.err.types.incompatible: I2, I1, (compiler.misc.incompatible.diff.ret: f, )
1 error
--- a/test/langtools/tools/javac/api/T6265137.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/api/T6265137.java Tue Jan 16 22:24:20 2018 +0000
@@ -52,7 +52,7 @@
String srcdir = System.getProperty("test.src");
Iterable<? extends JavaFileObject> files =
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
- javac.getTask(null, fm, dl, Arrays.asList("-target","10"), null, files).call();
+ javac.getTask(null, fm, dl, Arrays.asList("-target","11"), null, files).call();
}
}
}
--- a/test/langtools/tools/javac/api/T6395981.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/api/T6395981.java Tue Jan 16 22:24:20 2018 +0000
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6395981 6458819 7025784 8028543 8028544
+ * @bug 6395981 6458819 7025784 8028543 8028544 8193291
* @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
* @author Peter von der Ah\u00e9
* @modules java.compiler
@@ -31,7 +31,7 @@
* @run main/fail T6395981
* @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
* @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
- * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10
+ * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10 RELEASE_11
*/
import java.util.EnumSet;
--- a/test/langtools/tools/javac/classfiles/ClassVersionChecker.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/classfiles/ClassVersionChecker.java Tue Jan 16 22:24:20 2018 +0000
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7157626 8001112 8188870
+ * @bug 7157626 8001112 8188870 8173382
* @summary Test major version for all legal combinations for -source and -target
* @author sgoel
*
@@ -38,7 +38,7 @@
public class ClassVersionChecker {
int errors;
- String[] jdk = {"", "1.6", "1.7", "1.8", "1.9", "1.10"};
+ String[] jdk = {"", "1.6", "1.7", "1.8", "1.9", "1.10", "11"};
File javaFile = null;
public static void main(String[] args) throws Throwable {
@@ -58,11 +58,12 @@
* -1 => invalid combinations
*/
int[][] ver =
- {{54, -1, -1, -1, -1, -1},
- {54, 50, 51, 52, 53, 54},
- {54, -1, 51, 52, 53, 54},
- {54, -1, -1, 52, 53, 54},
- {54, -1, -1, -1, 53, 54}};
+ {{55, -1, -1, -1, -1, -1, -1},
+ {55, 50, 51, 52, 53, 54, 55},
+ {55, -1, 51, 52, 53, 54, 55},
+ {55, -1, -1, 52, 53, 54, 55},
+ {55, -1, -1, -1, 53, 54, 55},
+ {55, -1, -1, -1, -1, 54, 55}};
// Loop to run all possible combinations of source/target values
for (int i = 0; i< ver.length; i++) {
--- a/test/langtools/tools/javac/defaultMethods/Neg01.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/defaultMethods/Neg01.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-Neg01.java:14:12: compiler.err.types.incompatible.unrelated.defaults: kindname.class, Neg01.AB, m, , Neg01.IA, Neg01.IB
+Neg01.java:14:12: compiler.err.types.incompatible: Neg01.IA, Neg01.IB, (compiler.misc.incompatible.unrelated.defaults: kindname.class, Neg01.AB, m, , Neg01.IA, Neg01.IB)
1 error
--- a/test/langtools/tools/javac/defaultMethods/Neg02.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/defaultMethods/Neg02.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-Neg02.java:16:13: compiler.err.types.incompatible.unrelated.defaults: kindname.class, Neg02.X, m, , Neg02.A, Neg02.B
+Neg02.java:16:13: compiler.err.types.incompatible: Neg02.A, Neg02.B, (compiler.misc.incompatible.unrelated.defaults: kindname.class, Neg02.X, m, , Neg02.A, Neg02.B)
1 error
--- a/test/langtools/tools/javac/defaultMethods/Neg14.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/defaultMethods/Neg14.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-Neg14.java:10:14: compiler.err.types.incompatible.abstract.default: kindname.class, Neg14.AB, m, , Neg14.IB, Neg14.IA
+Neg14.java:10:14: compiler.err.types.incompatible: Neg14.IB, Neg14.IA, (compiler.misc.incompatible.abstract.default: kindname.class, Neg14.AB, m, , Neg14.IB, Neg14.IA)
1 error
--- a/test/langtools/tools/javac/diags/examples/IncompatibleDescsInFunctionalIntf.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/diags/examples/IncompatibleDescsInFunctionalIntf.java Tue Jan 16 22:24:20 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-// key: compiler.err.types.incompatible.diff.ret
+// key: compiler.err.types.incompatible
+// key: compiler.misc.incompatible.diff.ret
// key: compiler.err.prob.found.req
// key: compiler.misc.incompatible.descs.in.functional.intf
// key: compiler.misc.descriptor
--- a/test/langtools/tools/javac/diags/examples/TypesIncompatible.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/diags/examples/TypesIncompatible.java Tue Jan 16 22:24:20 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-// key: compiler.err.types.incompatible.diff.ret
+// key: compiler.err.types.incompatible
+// key: compiler.misc.incompatible.diff.ret
interface A {
int m();
--- a/test/langtools/tools/javac/diags/examples/TypesIncompatibleAbstractDefault.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/diags/examples/TypesIncompatibleAbstractDefault.java Tue Jan 16 22:24:20 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-// key: compiler.err.types.incompatible.abstract.default
+// key: compiler.err.types.incompatible
+// key: compiler.misc.incompatible.abstract.default
class TypesIncompatibleAbstractDefault {
interface A {
--- a/test/langtools/tools/javac/diags/examples/TypesIncompatibleUnrelatedDefaults.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/diags/examples/TypesIncompatibleUnrelatedDefaults.java Tue Jan 16 22:24:20 2018 +0000
@@ -21,7 +21,8 @@
* questions.
*/
-// key: compiler.err.types.incompatible.unrelated.defaults
+// key: compiler.err.types.incompatible
+// key: compiler.misc.incompatible.unrelated.defaults
class TypesIncompatibleUnrelatedDefaults {
interface A {
--- a/test/langtools/tools/javac/generics/6294779/T6294779c.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/generics/6294779/T6294779c.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-T6294779c.java:29:5: compiler.err.types.incompatible.diff.ret: T6294779c.I2, T6294779c.I1, get()
+T6294779c.java:29:5: compiler.err.types.incompatible: T6294779c.I2, T6294779c.I1, (compiler.misc.incompatible.diff.ret: get, )
1 error
--- a/test/langtools/tools/javac/generics/abstract/T4717181c.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/generics/abstract/T4717181c.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-T4717181c.java:15:21: compiler.err.types.incompatible.diff.ret: T4717181c.A<java.lang.Integer>, T4717181c.A<java.lang.Integer>, f(java.lang.Integer)
+T4717181c.java:15:21: compiler.err.types.incompatible: T4717181c.A<java.lang.Integer>, T4717181c.A<java.lang.Integer>, (compiler.misc.incompatible.diff.ret: f, java.lang.Integer)
1 error
--- a/test/langtools/tools/javac/generics/rawOverride/7157798/Test3.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/generics/rawOverride/7157798/Test3.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,6 +1,6 @@
-Test3.java:14:1: compiler.err.types.incompatible.diff.ret: B, A, m()
-Test3.java:19:1: compiler.err.types.incompatible.diff.ret: D, C, m()
-Test3.java:27:1: compiler.err.types.incompatible.diff.ret: E<T>, B, m()
-Test3.java:33:1: compiler.err.types.incompatible.diff.ret: F<V>, E<U>, m()
-Test3.java:37:1: compiler.err.types.incompatible.diff.ret: F<V>, E<U>, m()
+Test3.java:14:1: compiler.err.types.incompatible: B, A, (compiler.misc.incompatible.diff.ret: m, )
+Test3.java:19:1: compiler.err.types.incompatible: D, C, (compiler.misc.incompatible.diff.ret: m, )
+Test3.java:27:1: compiler.err.types.incompatible: E<T>, B, (compiler.misc.incompatible.diff.ret: m, )
+Test3.java:33:1: compiler.err.types.incompatible: F<V>, E<U>, (compiler.misc.incompatible.diff.ret: m, )
+Test3.java:37:1: compiler.err.types.incompatible: F<V>, E<U>, (compiler.misc.incompatible.diff.ret: m, )
5 errors
--- a/test/langtools/tools/javac/generics/typevars/4856983/T4856983a.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/generics/typevars/4856983/T4856983a.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-T4856983a.java:13:6: compiler.err.types.incompatible.diff.ret: I2, I1, m()
+T4856983a.java:13:6: compiler.err.types.incompatible: I2, I1, (compiler.misc.incompatible.diff.ret: m, )
1 error
--- a/test/langtools/tools/javac/generics/typevars/4856983/T4856983b.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/generics/typevars/4856983/T4856983b.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-T4856983b.java:12:24: compiler.err.types.incompatible.diff.ret: I2, I1, m()
+T4856983b.java:12:24: compiler.err.types.incompatible: I2, I1, (compiler.misc.incompatible.diff.ret: m, )
1 error
--- a/test/langtools/tools/javac/generics/typevars/6199146/T6199146.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/generics/typevars/6199146/T6199146.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-T6199146.java:9:25: compiler.err.types.incompatible.diff.ret: T6199146.I2, T6199146.I1, getFoo()
+T6199146.java:9:25: compiler.err.types.incompatible: T6199146.I2, T6199146.I1, (compiler.misc.incompatible.diff.ret: getFoo, )
1 error
--- a/test/langtools/tools/javac/generics/wildcards/7034495/T7034495.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/generics/wildcards/7034495/T7034495.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-T7034495.java:40:17: compiler.err.types.incompatible.diff.ret: T7034495.B<compiler.misc.type.captureof: 1, ?>, T7034495.A<compiler.misc.type.captureof: 2, ?>, foo()
+T7034495.java:40:17: compiler.err.types.incompatible: T7034495.B<compiler.misc.type.captureof: 1, ?>, T7034495.A<compiler.misc.type.captureof: 2, ?>, (compiler.misc.incompatible.diff.ret: foo, )
1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/jvm/VerboseOutTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8194893
+ * @summary javac -verbose prints wrong paths for output files
+ * @modules jdk.compiler
+ * @run main VerboseOutTest
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.spi.ToolProvider;
+
+public class VerboseOutTest {
+ public static void main(String... args) throws Exception {
+ new VerboseOutTest().run();
+ }
+
+ void run() throws Exception {
+ String className = getClass().getName();
+ Path testSrc = Paths.get(System.getProperty("test.src"));
+ Path file = testSrc.resolve(className + ".java");
+ ToolProvider javac = ToolProvider.findFirst("javac").orElseThrow();
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw, true);
+ int rc = javac.run(pw, pw,
+ "-d", ".",
+ "-verbose",
+ file.toString());
+ String log = sw.toString();
+ System.out.println(log);
+ if (rc != 0) {
+ throw new Exception("compilation failed: rc=" + rc);
+ }
+ String expected = "[wrote ./" + className + ".class]";
+ if (!log.contains(expected)) {
+ throw new Exception("expected output not found: " + expected);
+ }
+ }
+}
+
--- a/test/langtools/tools/javac/lambda/BadConv04.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/lambda/BadConv04.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,3 +1,3 @@
-BadConv04.java:19:5: compiler.err.types.incompatible.diff.ret: BadConv04.I2, BadConv04.I1, m()
+BadConv04.java:19:5: compiler.err.types.incompatible: BadConv04.I2, BadConv04.I1, (compiler.misc.incompatible.diff.ret: m, )
BadConv04.java:21:13: compiler.err.prob.found.req: (compiler.misc.incompatible.descs.in.functional.intf: kindname.interface, BadConv04.SAM,{(compiler.misc.descriptor: m, , long, ),(compiler.misc.descriptor: m, , int, )})
2 errors
--- a/test/langtools/tools/javac/lambda/bridge/template_tests/BridgeMethodsTemplateTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/lambda/bridge/template_tests/BridgeMethodsTemplateTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -1001,18 +1001,18 @@
public void testA5() throws IOException, ReflectiveOperationException {
compileSpec("C(A(Id0),Jd0)",
- "compiler.err.types.incompatible.unrelated.defaults");
+ "compiler.err.types.incompatible");
}
public void testA6() throws IOException, ReflectiveOperationException {
compileSpec("C(A(Ia0,Jd0))",
"compiler.err.does.not.override.abstract",
- "compiler.err.types.incompatible.abstract.default");
+ "compiler.err.types.incompatible");
}
public void testA7() throws IOException, ReflectiveOperationException {
compileSpec("C(A(Id0,Jd0))",
- "compiler.err.types.incompatible.unrelated.defaults");
+ "compiler.err.types.incompatible");
}
public void testA8() throws IOException, ReflectiveOperationException {
--- a/test/langtools/tools/javac/lambda/funcInterfaces/NonSAM2.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/lambda/funcInterfaces/NonSAM2.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,4 +1,4 @@
-NonSAM2.java:13:1: compiler.err.types.incompatible.diff.ret: Bar1, Foo1, getAge(java.lang.String)
+NonSAM2.java:13:1: compiler.err.types.incompatible: Bar1, Foo1, (compiler.misc.incompatible.diff.ret: getAge, java.lang.String)
NonSAM2.java:15:1: compiler.err.name.clash.same.erasure.no.override: getOldest, java.util.List<?>, C, getOldest, java.util.List<java.lang.Number>, A
NonSAM2.java:17:1: compiler.err.name.clash.same.erasure.no.override: getOldest, java.util.List<java.lang.Integer>, D, getOldest, java.util.List<java.lang.Number>, A
NonSAM2.java:21:1: compiler.err.name.clash.same.erasure.no.override: m, T2, Bar2, m, T1, Foo2
--- a/test/langtools/tools/javac/lib/DPrinter.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/lib/DPrinter.java Tue Jan 16 22:24:20 2018 +0000
@@ -1233,7 +1233,6 @@
public Void visitMethodSymbol(MethodSymbol sym, Void ignore) {
// code
printList("params", sym.params);
- printList("savedParameterNames", sym.savedParameterNames);
return visitSymbol(sym, null);
}
--- a/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java Tue Jan 16 22:24:20 2018 +0000
@@ -110,7 +110,7 @@
* corresponding platform visitor type.
*/
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor9<R, P> {
/**
@@ -121,7 +121,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static abstract class AbstractElementVisitor<R, P> extends AbstractElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
@@ -131,7 +131,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static abstract class AbstractTypeVisitor<R, P> extends AbstractTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call.
@@ -141,7 +141,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class ElementKindVisitor<R, P> extends ElementKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -162,7 +162,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class ElementScanner<R, P> extends ElementScanner9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -181,7 +181,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class SimpleAnnotationValueVisitor<R, P> extends SimpleAnnotationValueVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -202,7 +202,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class SimpleElementVisitor<R, P> extends SimpleElementVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -223,7 +223,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class SimpleTypeVisitor<R, P> extends SimpleTypeVisitor9<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
@@ -244,7 +244,7 @@
}
}
- @SupportedSourceVersion(RELEASE_10)
+ @SupportedSourceVersion(RELEASE_11)
public static class TypeKindVisitor<R, P> extends TypeKindVisitor9<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
--- a/test/langtools/tools/javac/miranda/4711056/T1.out Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/miranda/4711056/T1.out Tue Jan 16 22:24:20 2018 +0000
@@ -1,2 +1,2 @@
-T4.java:3:10: compiler.err.types.incompatible.diff.ret: iclss01004_2, iclss01004_1, foo(int)
+T4.java:3:10: compiler.err.types.incompatible: iclss01004_2, iclss01004_1, (compiler.misc.incompatible.diff.ret: foo, int)
1 error
--- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java Tue Jan 16 22:24:20 2018 +0000
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7025809 8028543 6415644 8028544 8029942 8187951
+ * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291
* @summary Test latest, latestSupported, underscore as keyword, etc.
* @author Joseph D. Darcy
* @modules java.compiler
@@ -46,7 +46,7 @@
}
private static void testLatestSupported() {
- if (SourceVersion.latest() != RELEASE_10 ||
+ if (SourceVersion.latest() != RELEASE_11 ||
SourceVersion.latestSupported() != RELEASE_10)
throw new RuntimeException("Unexpected release value(s) found:\n" +
"latest:\t" + SourceVersion.latest() + "\n" +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/warnings/TypeAlreadyExists/A.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class A {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/warnings/TypeAlreadyExists/B.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+class B {
+ A a;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/warnings/TypeAlreadyExists/TestProcTypeAlreadyExistsWarning.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8193216
+ * @summary Filer should warn if processors redefine symbols from the classpath or sourcepath
+ * @library /tools/javac/lib
+ * @modules java.compiler
+ * jdk.compiler
+ * @build JavacTestingAbstractProcessor TestProcTypeAlreadyExistsWarning
+ * @compile A.java
+ * @compile/ref=warn.out -XDrawDiagnostics -Xlint:processing -processor TestProcTypeAlreadyExistsWarning B.java
+ */
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.io.IOError;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("*")
+public class TestProcTypeAlreadyExistsWarning extends JavacTestingAbstractProcessor {
+
+ int round = 0;
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ round++;
+
+ if (round == 1) {
+ try (OutputStream os =
+ processingEnv.getFiler().createSourceFile("A").openOutputStream()) {
+ os.write("class A {}".getBytes(UTF_8));
+ } catch (IOException e) {
+ throw new IOError(e);
+ }
+ }
+
+ return false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/warnings/TypeAlreadyExists/warn.out Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,2 @@
+- compiler.warn.proc.type.already.exists: A
+1 warning
--- a/test/langtools/tools/javac/profiles/ProfileOptionTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/profiles/ProfileOptionTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -149,6 +149,7 @@
break;
case JDK1_9:
case JDK1_10:
+ case JDK1_11:
if (p == Profile.DEFAULT)
break;
if (ise == null)
--- a/test/langtools/tools/javac/versions/Versions.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/javac/versions/Versions.java Tue Jan 16 22:24:20 2018 +0000
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870
+ * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870 8173382 8173382
* @summary Check interpretation of -target and -source options
* @modules java.compiler
* jdk.compiler
@@ -64,28 +64,35 @@
String TC = "";
System.out.println("Version.java: Starting");
- check("54.0");
- check("54.0", "-source 1.6");
- check("54.0", "-source 1.7");
- check("54.0", "-source 1.8");
- check("54.0", "-source 1.9");
- check("54.0", "-source 1.10");
+ check("55.0");
+ check("55.0", "-source 1.6");
+ check("55.0", "-source 1.7");
+ check("55.0", "-source 1.8");
+ check("55.0", "-source 1.9");
+ check("55.0", "-source 1.10");
+ check("55.0", "-source 11");
- check_source_target("50.0", "6", "6");
- check_source_target("51.0", "6", "7");
- check_source_target("51.0", "7", "7");
- check_source_target("52.0", "6", "8");
- check_source_target("52.0", "7", "8");
- check_source_target("52.0", "8", "8");
- check_source_target("53.0", "6", "9");
- check_source_target("53.0", "7", "9");
- check_source_target("53.0", "8", "9");
- check_source_target("53.0", "9", "9");
- check_source_target("54.0", "6", "10");
- check_source_target("54.0", "7", "10");
- check_source_target("54.0", "8", "10");
- check_source_target("54.0", "9", "10");
- check_source_target("54.0", "10", "10");
+ check_source_target(true, "50.0", "6", "6");
+ check_source_target(true, "51.0", "6", "7");
+ check_source_target(true, "51.0", "7", "7");
+ check_source_target(true, "52.0", "6", "8");
+ check_source_target(true, "52.0", "7", "8");
+ check_source_target(true, "52.0", "8", "8");
+ check_source_target(true, "53.0", "6", "9");
+ check_source_target(true, "53.0", "7", "9");
+ check_source_target(true, "53.0", "8", "9");
+ check_source_target(true, "53.0", "9", "9");
+ check_source_target(true, "54.0", "6", "10");
+ check_source_target(true, "54.0", "7", "10");
+ check_source_target(true, "54.0", "8", "10");
+ check_source_target(true, "54.0", "9", "10");
+ check_source_target(true, "54.0", "10", "10");
+ check_source_target(false, "55.0", "6", "11");
+ check_source_target(false, "55.0", "7", "11");
+ check_source_target(false, "55.0", "8", "11");
+ check_source_target(false, "55.0", "9", "11");
+ check_source_target(false, "55.0", "10", "11");
+ check_source_target(false, "55.0", "11", "11");
checksrc16("-source 1.6");
checksrc16("-source 6");
@@ -108,8 +115,9 @@
checksrc110("-source 10");
checksrc110("-source 1.10", "-target 1.10");
checksrc110("-source 10", "-target 10");
- checksrc110("-target 1.10");
- checksrc110("-target 10");
+ checksrc111("-source 11");
+ checksrc111("-source 11", "-target 11");
+ checksrc111("-target 11");
fail("-source 7", "-target 1.6", "Base.java");
fail("-source 8", "-target 1.6", "Base.java");
@@ -118,6 +126,8 @@
fail("-source 9", "-target 1.8", "Base.java");
fail("-source 10", "-target 1.7", "Base.java");
fail("-source 10", "-target 1.8", "Base.java");
+ fail("-source 11", "-target 1.9", "Base.java");
+ fail("-source 11", "-target 1.10", "Base.java");
fail("-source 1.5", "-target 1.5", "Base.java");
fail("-source 1.4", "-target 1.4", "Base.java");
@@ -139,20 +149,24 @@
System.out.printf("\n", fname);
}
- protected void check_source_target(String... args) {
+ protected void check_source_target(boolean dotOne, String... args) {
printargs("check_source_target", args);
- check_target(args[0], args[1], args[2]);
- check_target(args[0], "1." + args[1], args[2]);
+ check_target(dotOne, args[0], args[1], args[2]);
+ if (dotOne) {
+ check_target(dotOne, args[0], "1." + args[1], args[2]);
+ }
}
- protected void check_target(String... args) {
+ protected void check_target(boolean dotOne, String... args) {
check(args[0], "-source " + args[1], "-target " + args[2]);
- check(args[0], "-source " + args[1], "-target 1." + args[2]);
+ if (dotOne) {
+ check(args[0], "-source " + args[1], "-target 1." + args[2]);
+ }
}
protected void check(String major, String... args) {
printargs("check", args);
- List<String> jcargs = new ArrayList<String>();
+ List<String> jcargs = new ArrayList<>();
jcargs.add("-Xlint:-options");
// add in args conforming to List requrements of JavaCompiler
@@ -207,6 +221,8 @@
pass(newargs);
newargs[asize] = "New18.java";
pass(newargs);
+ newargs[asize] = "New110.java";
+ fail(newargs);
}
protected void checksrc19(String... args) {
@@ -216,7 +232,20 @@
protected void checksrc110(String... args) {
printargs("checksrc110", args);
- checksrc19(args);
+ int asize = args.length;
+ String[] newargs = new String[asize+1];
+ System.arraycopy(args, 0, newargs,0 , asize);
+ newargs[asize] = "New17.java";
+ pass(newargs);
+ newargs[asize] = "New18.java";
+ pass(newargs);
+ newargs[asize] = "New110.java";
+ pass(newargs);
+ }
+
+ protected void checksrc111(String... args) {
+ printargs("checksrc111", args);
+ checksrc110(args);
}
protected void pass(String... args) {
@@ -347,6 +376,17 @@
"} \n"
);
+ /*
+ * Create a file with a new feature in 1.10, not in 1.9 : var
+ */
+ writeSourceFile("New110.java",
+ "public class New110 { \n" +
+ " void m() { \n" +
+ " var tmp = new Thread(() -> { }); \n" +
+ " } \n" +
+ "} \n"
+ );
+
}
protected boolean checkClassFileVersion
--- a/test/langtools/tools/jdeps/jdkinternals/RemovedJDKInternals.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/jdeps/jdkinternals/RemovedJDKInternals.java Tue Jan 16 22:24:20 2018 +0000
@@ -85,7 +85,8 @@
.reference("p.Main", "java.lang.Object", "java.base")
.reference("p.Main", "java.util.Iterator", "java.base")
.reference("p.S", "java.lang.Object", "java.base")
- .jdkInternal("p.Main", "sun.reflect.Reflection", "jdk.unsupported")
+ .jdkInternal("p.Main", "sun.reflect.ReflectionFactory", "jdk.unsupported")
+ .removedJdkInternal("p.Main", "sun.reflect.Reflection")
.removedJdkInternal("p.Main", "com.sun.image.codec.jpeg.JPEGCodec")
.removedJdkInternal("p.Main", "sun.misc.Service")
.removedJdkInternal("p.Main", "sun.misc.SoftCache")
@@ -118,7 +119,8 @@
"com.sun.image.codec.jpeg.JPEGCodec", "Use javax.imageio @since 1.4",
"sun.misc.Service", "Use java.util.ServiceLoader @since 1.6",
"sun.misc.SoftCache", "Removed. See http://openjdk.java.net/jeps/260",
- "sun.reflect.Reflection", "Use java.lang.StackWalker @since 9"
+ "sun.reflect.Reflection", "Use java.lang.StackWalker @since 9",
+ "sun.reflect.ReflectionFactory", "See http://openjdk.java.net/jeps/260"
);
@Test
@@ -139,6 +141,8 @@
int pos = line.indexOf("Use ");
if (pos < 0)
pos = line.indexOf("Removed. ");
+ if (pos < 0)
+ pos = line.indexOf("See ");
assertTrue(pos > 0);
String name = line.substring(0, pos).trim();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/jdeps/jdkinternals/patches/jdk.unsupported/sun/reflect/Reflection.java Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2017, 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 sun.reflect;
+
+/*
+ * JDK removed internal API
+ */
+public class Reflection {
+ public static Class<?> getCallerClass(int depth) {
+ return null;
+ }
+}
--- a/test/langtools/tools/jdeps/jdkinternals/src/p/Main.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/jdeps/jdkinternals/src/p/Main.java Tue Jan 16 22:24:20 2018 +0000
@@ -27,10 +27,14 @@
import sun.misc.Service;
import sun.misc.SoftCache;
import sun.reflect.Reflection;
+import sun.reflect.ReflectionFactory;
public class Main {
public static void main() {
// in jdk.unsupported
+ ReflectionFactory factory = ReflectionFactory.getReflectionFactory();
+
+ // removed from jdk.unsupported in JDK 11
Class<?> caller = Reflection.getCallerClass(2);
// removed
--- a/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java Tue Jan 16 22:24:20 2018 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,8 @@
public Object[][] jdkModules() {
return new Object[][]{
{"jdk.compiler", new String[]{
+ "java.base/jdk.internal.jmod",
+ "java.base/jdk.internal.misc",
"java.base/sun.reflect.annotation",
"java.compiler",
}
--- a/test/nashorn/TEST.ROOT Sun Jan 14 21:46:14 2018 -0800
+++ b/test/nashorn/TEST.ROOT Tue Jan 16 22:24:20 2018 +0000
@@ -8,7 +8,7 @@
groups=TEST.groups
# Minimum jtreg version
-requiredVersion=4.2 b08
+requiredVersion=4.2 b11
# Use new module options
useNewOptions=true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8157251.js Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8157251: BeanLinker relinks array length operations for array types
+ *
+ * @test
+ * @run
+ */
+
+var intArray = Java.type("int[]")
+var doubleArray = Java.type("double[]")
+var arrs = [new intArray(20), new doubleArray(0)]
+for (var i in arrs)
+ print(arrs[i].length)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8157251.js.EXPECTED Tue Jan 16 22:24:20 2018 +0000
@@ -0,0 +1,2 @@
+20
+0
\ No newline at end of file
--- a/test/nashorn/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java Sun Jan 14 21:46:14 2018 -0800
+++ b/test/nashorn/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java Tue Jan 16 22:24:20 2018 +0000
@@ -133,7 +133,7 @@
}
}
-
+ // This also covers overriding finalizer in JavaAdapter such as JDK-8194985
@Test
public void securitySystemExitFromFinalizerThread() throws ScriptException {
if (System.getSecurityManager() == null) {