diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index c325445921e..793584f8e9e 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -384,3 +384,4 @@ d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137
7dcf453eacae79ee86a6bcc75fd0b546fc99b48a jdk-9+139
a5815c6098a241d3a1df64d22b84b3524e4a77df jdk-9+140
f64afae7f1a5608e438585bbf0bc23785e69cba0 jdk-9+141
+2b3e5caafe3594ea507c37675c4d3086f415dc64 jdk-9+142
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index d6a4ef04152..96c7eece342 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -759,6 +759,10 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
;;
+ s390 )
+ $2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
+ $2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
+ ;;
* )
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
@@ -940,6 +944,10 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=power7 -mtune=power8"
fi
+ elif test "x$OPENJDK_$1_CPU" = xs390x; then
+ if test "x$OPENJDK_$1_OS" = xlinux; then
+ $2JVM_CFLAGS="[$]$2JVM_CFLAGS -mbackchain -march=z10"
+ fi
fi
if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
@@ -999,6 +1007,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
# Setup some hard coded includes
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-I${JDK_TOPDIR}/src/java.base/share/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 49acd1801d7..33f0da0c250 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -5093,7 +5093,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1477108079
+DATE_WHEN_GENERATED=1478079760
###############################################################################
#
@@ -49840,6 +49840,10 @@ $as_echo "$supports" >&6; }
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
;;
+ s390 )
+ COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
+ CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
+ ;;
* )
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
@@ -50122,6 +50126,10 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
JVM_CFLAGS="$JVM_CFLAGS -mcpu=power7 -mtune=power8"
fi
+ elif test "x$OPENJDK_TARGET_CPU" = xs390x; then
+ if test "x$OPENJDK_TARGET_OS" = xlinux; then
+ JVM_CFLAGS="$JVM_CFLAGS -mbackchain -march=z10"
+ fi
fi
if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
@@ -50270,6 +50278,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
# Setup some hard coded includes
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-I${JDK_TOPDIR}/src/java.base/share/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
@@ -50655,6 +50664,10 @@ $as_echo "$supports" >&6; }
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
;;
+ s390 )
+ OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
+ OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
+ ;;
* )
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
@@ -50937,6 +50950,10 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -mcpu=power7 -mtune=power8"
fi
+ elif test "x$OPENJDK_BUILD_CPU" = xs390x; then
+ if test "x$OPENJDK_BUILD_OS" = xlinux; then
+ OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -mbackchain -march=z10"
+ fi
fi
if test "x$OPENJDK_BUILD_CPU_ENDIAN" = xlittle; then
@@ -51085,6 +51102,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
# Setup some hard coded includes
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK \
+ -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-I${JDK_TOPDIR}/src/java.base/share/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_BUILD_OS/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/include \
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 7725e6fe84c..4e10e13a3c1 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -265,6 +265,10 @@ IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
BUNDLES_OUTPUTDIR=$(BUILD_OUTPUT)/bundles
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
+
+# By default, output javadoc directly into image
+JAVADOC_OUTPUTDIR = $(DOCS_IMAGE_DIR)
+
# This does not get overridden in a bootcycle build
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
@@ -788,7 +792,7 @@ INTERIM_IMAGE_DIR := $(SUPPORT_OUTPUTDIR)/interim-image
# Docs image
DOCS_IMAGE_SUBDIR := docs
-DOCS_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR)
+DOCS_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR)
# Macosx bundles directory definitions
JDK_MACOSX_BUNDLE_SUBDIR=jdk-bundle
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index c8f06620fdc..5d5cbc845dd 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -544,3 +544,4 @@ fc0956308c7a586267c5dd35dff74f773aa9c3eb jdk-9+138
08492e67bf3226784dab3bf9ae967382ddbc1af5 jdk-9+139
fec31089c2ef5a12dd64f401b0bf2e00f56ee0d0 jdk-9+140
160a00bc6ed0af1fdf8418fc65e6bddbbc0c536d jdk-9+141
+7b48d63dfd6b8e2657288de3d7b1f153dee02d7e jdk-9+142
diff --git a/hotspot/make/gensrc/GensrcJvmti.gmk b/hotspot/make/gensrc/GensrcJvmti.gmk
index 323c7e93da8..b834eae5673 100644
--- a/hotspot/make/gensrc/GensrcJvmti.gmk
+++ b/hotspot/make/gensrc/GensrcJvmti.gmk
@@ -135,14 +135,14 @@ TARGETS += $(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp
# Copy jvmti.h to include dir
# The file is the same regardless of jvm variant. Only let one do the copy.
-#ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
-# $(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
-# DEST := $(SUPPORT_OUTPUTDIR)/modules_include/java.base, \
-# FILES := $(JVMTI_OUTPUTDIR)/jvmti.h, \
-# ))
+ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
+ $(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
+ DEST := $(SUPPORT_OUTPUTDIR)/modules_include/java.base, \
+ FILES := $(JVMTI_OUTPUTDIR)/jvmti.h, \
+ ))
-# TARGETS += $(COPY_JVMTI_H)
-#endif
+ TARGETS += $(COPY_JVMTI_H)
+endif
################################################################################
# Create trace files in gensrc/tracefiles
diff --git a/hotspot/make/lib/CompileJvm.gmk b/hotspot/make/lib/CompileJvm.gmk
index 07fddfbaf35..5a6ec7c8211 100644
--- a/hotspot/make/lib/CompileJvm.gmk
+++ b/hotspot/make/lib/CompileJvm.gmk
@@ -176,6 +176,11 @@ endif
JVM_OPTIMIZATION ?= HIGHEST_JVM
+# Need to set JVM_STRIPFLAGS to the default value from SPEC since the STRIPFLAGS
+# parameter to SetupNativeCompilation allows an empty value to override the
+# default.
+JVM_STRIPFLAGS ?= $(STRIPFLAGS)
+
################################################################################
# Now set up the actual compilation of the main hotspot native library
@@ -204,6 +209,7 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
OBJECT_DIR := $(JVM_OUTPUTDIR)/objs, \
MAPFILE := $(JVM_MAPFILE), \
USE_MAPFILE_FOR_SYMBOLS := true, \
+ STRIPFLAGS := $(JVM_STRIPFLAGS), \
EMBED_MANIFEST := true, \
RC_FLAGS := $(JVM_RCFLAGS), \
VERSIONINFO_RESOURCE := $(HOTSPOT_TOPDIR)/src/os/windows/vm/version.rc, \
diff --git a/hotspot/make/lib/JvmFeatures.gmk b/hotspot/make/lib/JvmFeatures.gmk
index 40a3247c9a7..0cb2e3c1111 100644
--- a/hotspot/make/lib/JvmFeatures.gmk
+++ b/hotspot/make/lib/JvmFeatures.gmk
@@ -59,6 +59,10 @@ endif
ifeq ($(call check-jvm-feature, minimal), true)
JVM_CFLAGS_FEATURES += -DMINIMAL_JVM -DVMTYPE=\"Minimal\"
+ ifeq ($(OPENJDK_TARGET_OS), linux)
+ # Override the default -g with a more liberal strip policy for the minimal JVM
+ JVM_STRIPFLAGS := --strip-unneeded
+ endif
endif
ifeq ($(call check-jvm-feature, dtrace), true)
diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk
index dc6def4fbe6..a1ede807462 100644
--- a/hotspot/make/test/JtregNative.gmk
+++ b/hotspot/make/test/JtregNative.gmk
@@ -45,6 +45,7 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \
$(HOTSPOT_TOPDIR)/test/runtime/jni/8025979 \
$(HOTSPOT_TOPDIR)/test/runtime/jni/8033445 \
$(HOTSPOT_TOPDIR)/test/runtime/jni/checked \
+ $(HOTSPOT_TOPDIR)/test/runtime/jni/PrivateInterfaceMethods \
$(HOTSPOT_TOPDIR)/test/runtime/jni/ToStringInInterfaceTest \
$(HOTSPOT_TOPDIR)/test/runtime/modules/getModuleJNI \
$(HOTSPOT_TOPDIR)/test/runtime/SameObject \
diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad
index f338390dbbb..3708908e33f 100644
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad
@@ -3496,6 +3496,16 @@ bool Matcher::narrow_klass_use_complex_address() {
return false;
}
+bool Matcher::const_oop_prefer_decode() {
+ // Prefer ConN+DecodeN over ConP in simple compressed oops mode.
+ return Universe::narrow_oop_base() == NULL;
+}
+
+bool Matcher::const_klass_prefer_decode() {
+ // Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
+ return Universe::narrow_klass_base() == NULL;
+}
+
// Is it better to copy float constants, or load them directly from
// memory? Intel can load a float constant from a direct address,
// requiring no extra registers. Most RISCs will have to materialize
@@ -15502,6 +15512,24 @@ instruct string_indexof_conLU(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2,
ins_pipe(pipe_class_memory);
%}
+instruct string_indexofU_char(iRegP_R1 str1, iRegI_R2 cnt1, iRegI_R3 ch,
+ iRegI_R0 result, iRegI tmp1, iRegI tmp2,
+ iRegI tmp3, rFlagsReg cr)
+%{
+ match(Set result (StrIndexOfChar (Binary str1 cnt1) ch));
+ effect(USE_KILL str1, USE_KILL cnt1, USE_KILL ch,
+ TEMP tmp1, TEMP tmp2, TEMP tmp3, KILL cr);
+
+ format %{ "String IndexOf char[] $str1,$cnt1,$ch -> $result" %}
+
+ ins_encode %{
+ __ string_indexof_char($str1$$Register, $cnt1$$Register, $ch$$Register,
+ $result$$Register, $tmp1$$Register, $tmp2$$Register,
+ $tmp3$$Register);
+ %}
+ ins_pipe(pipe_class_memory);
+%}
+
instruct string_equalsL(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt,
iRegI_R0 result, rFlagsReg cr)
%{
diff --git a/hotspot/src/cpu/aarch64/vm/interpreterRT_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/interpreterRT_aarch64.cpp
index f6f499859d3..3914f4e4020 100644
--- a/hotspot/src/cpu/aarch64/vm/interpreterRT_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/interpreterRT_aarch64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -130,8 +130,8 @@ void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
if (_num_fp_args < Argument::n_float_register_parameters_c) {
__ ldrs(as_FloatRegister(_num_fp_args++), src);
} else {
- __ ldrh(r0, src);
- __ strh(r0, Address(to(), _stack_offset));
+ __ ldrw(r0, src);
+ __ strw(r0, Address(to(), _stack_offset));
_stack_offset += wordSize;
_num_fp_args++;
}
@@ -349,7 +349,7 @@ class SlowSignatureHandler
_num_fp_args++;
} else {
*_to++ = from_obj;
- _num_int_args++;
+ _num_fp_args++;
}
}
@@ -364,7 +364,7 @@ class SlowSignatureHandler
_num_fp_args++;
} else {
*_to++ = from_obj;
- _num_int_args++;
+ _num_fp_args++;
}
}
diff --git a/hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp
index a4110534eec..eb3cc447d74 100644
--- a/hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp
@@ -60,12 +60,12 @@ void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle constant, TRAPS)
void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, TRAPS) {
address pc = _instructions->start() + pc_offset;
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
- narrowKlass narrowOop = record_narrow_metadata_reference(constant, CHECK);
+ narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, CHECK);
TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop);
Unimplemented();
} else {
NativeMovConstReg* move = nativeMovConstReg_at(pc);
- void* reference = record_metadata_reference(constant, CHECK);
+ void* reference = record_metadata_reference(_instructions, pc, constant, CHECK);
move->set_data((intptr_t) reference);
TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference));
}
diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
index bd350716788..2a2034c2fae 100644
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
@@ -4508,6 +4508,67 @@ void MacroAssembler::string_indexof(Register str2, Register str1,
typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr);
typedef void (MacroAssembler::* uxt_insn)(Register Rd, Register Rn);
+void MacroAssembler::string_indexof_char(Register str1, Register cnt1,
+ Register ch, Register result,
+ Register tmp1, Register tmp2, Register tmp3)
+{
+ Label CH1_LOOP, HAS_ZERO, DO1_SHORT, DO1_LOOP, MATCH, NOMATCH, DONE;
+ Register cnt1_neg = cnt1;
+ Register ch1 = rscratch1;
+ Register result_tmp = rscratch2;
+
+ cmp(cnt1, 4);
+ br(LT, DO1_SHORT);
+
+ orr(ch, ch, ch, LSL, 16);
+ orr(ch, ch, ch, LSL, 32);
+
+ sub(cnt1, cnt1, 4);
+ mov(result_tmp, cnt1);
+ lea(str1, Address(str1, cnt1, Address::uxtw(1)));
+ sub(cnt1_neg, zr, cnt1, LSL, 1);
+
+ mov(tmp3, 0x0001000100010001);
+
+ BIND(CH1_LOOP);
+ ldr(ch1, Address(str1, cnt1_neg));
+ eor(ch1, ch, ch1);
+ sub(tmp1, ch1, tmp3);
+ orr(tmp2, ch1, 0x7fff7fff7fff7fff);
+ bics(tmp1, tmp1, tmp2);
+ br(NE, HAS_ZERO);
+ adds(cnt1_neg, cnt1_neg, 8);
+ br(LT, CH1_LOOP);
+
+ cmp(cnt1_neg, 8);
+ mov(cnt1_neg, 0);
+ br(LT, CH1_LOOP);
+ b(NOMATCH);
+
+ BIND(HAS_ZERO);
+ rev(tmp1, tmp1);
+ clz(tmp1, tmp1);
+ add(cnt1_neg, cnt1_neg, tmp1, LSR, 3);
+ b(MATCH);
+
+ BIND(DO1_SHORT);
+ mov(result_tmp, cnt1);
+ lea(str1, Address(str1, cnt1, Address::uxtw(1)));
+ sub(cnt1_neg, zr, cnt1, LSL, 1);
+ BIND(DO1_LOOP);
+ ldrh(ch1, Address(str1, cnt1_neg));
+ cmpw(ch, ch1);
+ br(EQ, MATCH);
+ adds(cnt1_neg, cnt1_neg, 2);
+ br(LT, DO1_LOOP);
+ BIND(NOMATCH);
+ mov(result, -1);
+ b(DONE);
+ BIND(MATCH);
+ add(result, result_tmp, cnt1_neg, ASR, 1);
+ BIND(DONE);
+}
+
// Compare strings.
void MacroAssembler::string_compare(Register str1, Register str2,
Register cnt1, Register cnt2, Register result,
diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
index 84fe75e305e..6c84aa6a312 100644
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp
@@ -1229,6 +1229,9 @@ public:
Register tmp1, Register tmp2,
Register tmp3, Register tmp4,
int int_cnt1, Register result, int ae);
+ void string_indexof_char(Register str1, Register cnt1,
+ Register ch, Register result,
+ Register tmp1, Register tmp2, Register tmp3);
private:
void add2_with_carry(Register final_dest_hi, Register dest_hi, Register dest_lo,
Register src1, Register src2);
diff --git a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
index d1c4dbb68a2..7cd7e95c258 100644
--- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
@@ -989,7 +989,16 @@ static void object_move(MacroAssembler* masm,
// A float arg may have to do float reg int reg conversion
static void float_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
- if (src.first() != dst.first()) {
+ assert(src.first()->is_stack() && dst.first()->is_stack() ||
+ src.first()->is_reg() && dst.first()->is_reg(), "Unexpected error");
+ if (src.first()->is_stack()) {
+ if (dst.first()->is_stack()) {
+ __ ldrw(rscratch1, Address(rfp, reg2offset_in(src.first())));
+ __ strw(rscratch1, Address(sp, reg2offset_out(dst.first())));
+ } else {
+ ShouldNotReachHere();
+ }
+ } else if (src.first() != dst.first()) {
if (src.is_single_phys_reg() && dst.is_single_phys_reg())
__ fmovs(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister());
else
@@ -1023,7 +1032,16 @@ static void long_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
// A double move
static void double_move(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
- if (src.first() != dst.first()) {
+ assert(src.first()->is_stack() && dst.first()->is_stack() ||
+ src.first()->is_reg() && dst.first()->is_reg(), "Unexpected error");
+ if (src.first()->is_stack()) {
+ if (dst.first()->is_stack()) {
+ __ ldr(rscratch1, Address(rfp, reg2offset_in(src.first())));
+ __ str(rscratch1, Address(sp, reg2offset_out(dst.first())));
+ } else {
+ ShouldNotReachHere();
+ }
+ } else if (src.first() != dst.first()) {
if (src.is_single_phys_reg() && dst.is_single_phys_reg())
__ fmovd(dst.first()->as_FloatRegister(), src.first()->as_FloatRegister());
else
diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
index 4df4aad6228..41a7956c20e 100644
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
@@ -2743,7 +2743,7 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
- Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52;
+ Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52, _L_finish;
const Register from = c_rarg0; // source array address
const Register to = c_rarg1; // destination array address
@@ -2754,9 +2754,12 @@ class StubGenerator: public StubCodeGenerator {
const Register keylen = rscratch1;
address start = __ pc();
+
__ enter();
- __ mov(rscratch2, len_reg);
+ __ subsw(rscratch2, len_reg, zr);
+ __ br(Assembler::LE, _L_finish);
+
__ ldrw(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
__ ld1(v0, __ T16B, rvec);
@@ -2814,11 +2817,13 @@ class StubGenerator: public StubCodeGenerator {
__ eor(v0, __ T16B, v0, v31);
__ st1(v0, __ T16B, __ post(to, 16));
- __ sub(len_reg, len_reg, 16);
- __ cbnz(len_reg, L_aes_loop);
+
+ __ subw(len_reg, len_reg, 16);
+ __ cbnzw(len_reg, L_aes_loop);
__ st1(v0, __ T16B, rvec);
+ __ BIND(_L_finish);
__ mov(r0, rscratch2);
__ leave();
@@ -2844,7 +2849,7 @@ class StubGenerator: public StubCodeGenerator {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
- Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52;
+ Label L_loadkeys_44, L_loadkeys_52, L_aes_loop, L_rounds_44, L_rounds_52, _L_finish;
const Register from = c_rarg0; // source array address
const Register to = c_rarg1; // destination array address
@@ -2855,9 +2860,12 @@ class StubGenerator: public StubCodeGenerator {
const Register keylen = rscratch1;
address start = __ pc();
+
__ enter();
- __ mov(rscratch2, len_reg);
+ __ subsw(rscratch2, len_reg, zr);
+ __ br(Assembler::LE, _L_finish);
+
__ ldrw(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
__ ld1(v2, __ T16B, rvec);
@@ -2920,11 +2928,12 @@ class StubGenerator: public StubCodeGenerator {
__ st1(v0, __ T16B, __ post(to, 16));
__ orr(v2, __ T16B, v1, v1);
- __ sub(len_reg, len_reg, 16);
- __ cbnz(len_reg, L_aes_loop);
+ __ subw(len_reg, len_reg, 16);
+ __ cbnzw(len_reg, L_aes_loop);
__ st1(v2, __ T16B, rvec);
+ __ BIND(_L_finish);
__ mov(r0, rscratch2);
__ leave();
diff --git a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp
index 122cac33cef..9750ba1b409 100644
--- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp
@@ -454,8 +454,9 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
__ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
#if INCLUDE_JVMCI
- // Check if we need to take lock at entry of synchronized method.
- if (UseJVMCICompiler) {
+ // Check if we need to take lock at entry of synchronized method. This can
+ // only occur on method entry so emit it only for vtos with step 0.
+ if (UseJVMCICompiler && state == vtos && step == 0) {
Label L;
__ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
__ cbz(rscratch1, L);
@@ -464,8 +465,17 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
// Take lock.
lock_method();
__ bind(L);
- }
+ } else {
+#ifdef ASSERT
+ if (UseJVMCICompiler) {
+ Label L;
+ __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
+ __ cbz(rscratch1, L);
+ __ stop("unexpected pending monitor in deopt entry");
+ __ bind(L);
+ }
#endif
+ }
// handle exceptions
{
Label L;
diff --git a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp
index b2f6e2329d3..471a94511ad 100644
--- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp
@@ -3717,19 +3717,15 @@ void TemplateTable::monitorenter()
// allocate one if there's no free slot
{
- Label entry, loop, no_adjust;
+ Label entry, loop;
// 1. compute new pointers // rsp: old expression stack top
__ ldr(c_rarg1, monitor_block_bot); // c_rarg1: old expression stack bottom
- __ sub(esp, esp, entry_size); // move expression stack top
+ __ sub(esp, esp, entry_size); // move expression stack top
__ sub(c_rarg1, c_rarg1, entry_size); // move expression stack bottom
__ mov(c_rarg3, esp); // set start value for copy loop
__ str(c_rarg1, monitor_block_bot); // set new monitor block bottom
- __ cmp(sp, c_rarg3); // Check if we need to move sp
- __ br(Assembler::LO, no_adjust); // to allow more stack space
- // for our new esp
- __ sub(sp, sp, 2 * wordSize);
- __ bind(no_adjust);
+ __ sub(sp, sp, entry_size); // make room for the monitor
__ b(entry);
// 2. move expression stack contents
diff --git a/hotspot/src/cpu/ppc/vm/c1_MacroAssembler_ppc.cpp b/hotspot/src/cpu/ppc/vm/c1_MacroAssembler_ppc.cpp
index 851b0b644ce..dc2c40d4f6c 100644
--- a/hotspot/src/cpu/ppc/vm/c1_MacroAssembler_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/c1_MacroAssembler_ppc.cpp
@@ -64,17 +64,16 @@ void C1_MacroAssembler::explicit_null_check(Register base) {
void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes) {
- assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
+ // Avoid stack bang as first instruction. It may get overwritten by patch_verified_entry.
+ const Register return_pc = R20;
+ mflr(return_pc);
+
// Make sure there is enough stack space for this method's activation.
+ assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
generate_stack_overflow_check(bang_size_in_bytes);
- // Create the frame.
- const Register return_pc = R0;
-
- mflr(return_pc);
- // Get callers sp.
- std(return_pc, _abi(lr), R1_SP); // SP->lr = return_pc
- push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
+ std(return_pc, _abi(lr), R1_SP); // SP->lr = return_pc
+ push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
}
diff --git a/hotspot/src/cpu/ppc/vm/ppc.ad b/hotspot/src/cpu/ppc/vm/ppc.ad
index 2f4939fb9b9..8bacecaecb2 100644
--- a/hotspot/src/cpu/ppc/vm/ppc.ad
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad
@@ -1097,21 +1097,19 @@ EmitCallOffsets emit_call_with_trampoline_stub(MacroAssembler &_masm, address en
// No entry point given, use the current pc.
if (entry_point == NULL) entry_point = __ pc();
- if (!Compile::current()->in_scratch_emit_size()) {
- // Put the entry point as a constant into the constant pool.
- const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
- if (entry_point_toc_addr == NULL) {
- ciEnv::current()->record_out_of_memory_failure();
- return offsets;
- }
- const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
-
- // Emit the trampoline stub which will be related to the branch-and-link below.
- CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
- if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
- __ relocate(rtype);
+ // Put the entry point as a constant into the constant pool.
+ const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
+ if (entry_point_toc_addr == NULL) {
+ ciEnv::current()->record_out_of_memory_failure();
+ return offsets;
}
-
+ const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
+
+ // Emit the trampoline stub which will be related to the branch-and-link below.
+ CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, offsets.insts_call_instruction_offset);
+ if (ciEnv::current()->failing()) { return offsets; } // Code cache may be full.
+ __ relocate(rtype);
+
// Note: At this point we do not have the address of the trampoline
// stub, and the entry point might be too far away for bl, so __ pc()
// serves as dummy and the bl will be patched later.
@@ -2166,6 +2164,16 @@ bool Matcher::narrow_klass_use_complex_address() {
return false;
}
+bool Matcher::const_oop_prefer_decode() {
+ // Prefer ConN+DecodeN over ConP in simple compressed oops mode.
+ return Universe::narrow_oop_base() == NULL;
+}
+
+bool Matcher::const_klass_prefer_decode() {
+ // Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
+ return Universe::narrow_klass_base() == NULL;
+}
+
// Is it better to copy float constants, or load them directly from memory?
// Intel can load a float constant from a direct address, requiring no
// extra registers. Most RISCs will have to materialize an address into a
@@ -2424,23 +2432,21 @@ encode %{
MacroAssembler _masm(&cbuf);
int toc_offset = 0;
- if (!ra_->C->in_scratch_emit_size()) {
- address const_toc_addr;
- // Create a non-oop constant, no relocation needed.
- // If it is an IC, it has a virtual_call_Relocation.
- const_toc_addr = __ long_constant((jlong)$src$$constant);
- if (const_toc_addr == NULL) {
- ciEnv::current()->record_out_of_memory_failure();
- return;
- }
-
- // Get the constant's TOC offset.
- toc_offset = __ offset_to_method_toc(const_toc_addr);
-
- // Keep the current instruction offset in mind.
- ((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
+ address const_toc_addr;
+ // Create a non-oop constant, no relocation needed.
+ // If it is an IC, it has a virtual_call_Relocation.
+ const_toc_addr = __ long_constant((jlong)$src$$constant);
+ if (const_toc_addr == NULL) {
+ ciEnv::current()->record_out_of_memory_failure();
+ return;
}
-
+
+ // Get the constant's TOC offset.
+ toc_offset = __ offset_to_method_toc(const_toc_addr);
+
+ // Keep the current instruction offset in mind.
+ ((loadConLNode*)this)->_cbuf_insts_offset = __ offset();
+
__ ld($dst$$Register, toc_offset, $toc$$Register);
%}
@@ -2576,32 +2582,30 @@ encode %{
MacroAssembler _masm(&cbuf);
int toc_offset = 0;
- if (!ra_->C->in_scratch_emit_size()) {
- intptr_t val = $src$$constant;
- relocInfo::relocType constant_reloc = $src->constant_reloc(); // src
- address const_toc_addr;
- if (constant_reloc == relocInfo::oop_type) {
- // Create an oop constant and a corresponding relocation.
- AddressLiteral a = __ allocate_oop_address((jobject)val);
- const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
- __ relocate(a.rspec());
- } else if (constant_reloc == relocInfo::metadata_type) {
- AddressLiteral a = __ constant_metadata_address((Metadata *)val);
- const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
- __ relocate(a.rspec());
- } else {
- // Create a non-oop constant, no relocation needed.
- const_toc_addr = __ long_constant((jlong)$src$$constant);
- }
-
- if (const_toc_addr == NULL) {
- ciEnv::current()->record_out_of_memory_failure();
- return;
- }
- // Get the constant's TOC offset.
- toc_offset = __ offset_to_method_toc(const_toc_addr);
+ intptr_t val = $src$$constant;
+ relocInfo::relocType constant_reloc = $src->constant_reloc(); // src
+ address const_toc_addr;
+ if (constant_reloc == relocInfo::oop_type) {
+ // Create an oop constant and a corresponding relocation.
+ AddressLiteral a = __ allocate_oop_address((jobject)val);
+ const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
+ __ relocate(a.rspec());
+ } else if (constant_reloc == relocInfo::metadata_type) {
+ AddressLiteral a = __ constant_metadata_address((Metadata *)val);
+ const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
+ __ relocate(a.rspec());
+ } else {
+ // Create a non-oop constant, no relocation needed.
+ const_toc_addr = __ long_constant((jlong)$src$$constant);
}
+ if (const_toc_addr == NULL) {
+ ciEnv::current()->record_out_of_memory_failure();
+ return;
+ }
+ // Get the constant's TOC offset.
+ toc_offset = __ offset_to_method_toc(const_toc_addr);
+
__ ld($dst$$Register, toc_offset, $toc$$Register);
%}
@@ -3272,28 +3276,26 @@ encode %{
} else {
// Remember the offset not the address.
const int start_offset = __ offset();
+
// The trampoline stub.
- if (!Compile::current()->in_scratch_emit_size()) {
- // No entry point given, use the current pc.
- // Make sure branch fits into
- if (entry_point == 0) entry_point = __ pc();
+ // No entry point given, use the current pc.
+ // Make sure branch fits into
+ if (entry_point == 0) entry_point = __ pc();
- // Put the entry point as a constant into the constant pool.
- const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
- if (entry_point_toc_addr == NULL) {
- ciEnv::current()->record_out_of_memory_failure();
- return;
- }
- const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
-
-
- // Emit the trampoline stub which will be related to the branch-and-link below.
- CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
- if (ciEnv::current()->failing()) { return; } // Code cache may be full.
- int method_index = resolved_method_index(cbuf);
- __ relocate(_optimized_virtual ? opt_virtual_call_Relocation::spec(method_index)
- : static_call_Relocation::spec(method_index));
+ // Put the entry point as a constant into the constant pool.
+ const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none);
+ if (entry_point_toc_addr == NULL) {
+ ciEnv::current()->record_out_of_memory_failure();
+ return;
}
+ const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr);
+
+ // Emit the trampoline stub which will be related to the branch-and-link below.
+ CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset);
+ if (ciEnv::current()->failing()) { return; } // Code cache may be full.
+ int method_index = resolved_method_index(cbuf);
+ __ relocate(_optimized_virtual ? opt_virtual_call_Relocation::spec(method_index)
+ : static_call_Relocation::spec(method_index));
// The real call.
// Note: At this point we do not have the address of the trampoline
diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
index 37934b4124d..610cf637575 100644
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
@@ -2550,7 +2550,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ lbzx(R17_tos, Rclass_or_obj, Roffset);
__ extsb(R17_tos, R17_tos);
__ push(ztos);
- if (!is_static) {
+ if (!is_static && rc == may_rewrite) {
// use btos rewriting, no truncating to t/f bit is needed for getfield.
patch_bytecode(Bytecodes::_fast_bgetfield, Rbc, Rscratch);
}
@@ -2874,7 +2874,9 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
if (!is_static) { pop_and_check_object(Rclass_or_obj); } // Kills R11_scratch1.
__ andi(R17_tos, R17_tos, 0x1);
__ stbx(R17_tos, Rclass_or_obj, Roffset);
- if (!is_static) { patch_bytecode(Bytecodes::_fast_zputfield, Rbc, Rscratch, true, byte_no); }
+ if (!is_static && rc == may_rewrite) {
+ patch_bytecode(Bytecodes::_fast_zputfield, Rbc, Rscratch, true, byte_no);
+ }
if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {
__ beq(CR_is_vol, Lvolatile); // Volatile?
}
diff --git a/hotspot/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp b/hotspot/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp
index 1abf436bc13..4976e1686b2 100644
--- a/hotspot/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp
@@ -71,7 +71,7 @@ void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, T
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
#ifdef _LP64
NativeMovConstReg32* move = nativeMovConstReg32_at(pc);
- narrowKlass narrowOop = record_narrow_metadata_reference(constant, CHECK);
+ narrowKlass narrowOop = record_narrow_metadata_reference(_instructions, pc, constant, CHECK);
move->set_data((intptr_t)narrowOop);
TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/0x%x", p2i(pc), narrowOop);
#else
@@ -79,7 +79,7 @@ void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, T
#endif
} else {
NativeMovConstReg* move = nativeMovConstReg_at(pc);
- void* reference = record_metadata_reference(constant, CHECK);
+ void* reference = record_metadata_reference(_instructions, pc, constant, CHECK);
move->set_data((intptr_t)reference);
TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(reference));
}
diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad
index 6e024bb7bf3..fa0bedae739 100644
--- a/hotspot/src/cpu/sparc/vm/sparc.ad
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad
@@ -2003,6 +2003,20 @@ bool Matcher::narrow_klass_use_complex_address() {
return false;
}
+bool Matcher::const_oop_prefer_decode() {
+ // TODO: Check if loading ConP from TOC in heap-based mode is better:
+ // Prefer ConN+DecodeN over ConP in simple compressed oops mode.
+ // return Universe::narrow_oop_base() == NULL;
+ return true;
+}
+
+bool Matcher::const_klass_prefer_decode() {
+ // TODO: Check if loading ConP from TOC in heap-based mode is better:
+ // Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
+ // return Universe::narrow_klass_base() == NULL;
+ return true;
+}
+
// Is it better to copy float constants, or load them directly from memory?
// Intel can load a float constant from a direct address, requiring no
// extra registers. Most RISCs will have to materialize an address into a
diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp
index 1f9fba2370b..b677a1dd662 100644
--- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp
@@ -384,8 +384,9 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
address entry = __ pc();
__ get_constant_pool_cache(LcpoolCache); // load LcpoolCache
#if INCLUDE_JVMCI
- // Check if we need to take lock at entry of synchronized method.
- if (UseJVMCICompiler) {
+ // Check if we need to take lock at entry of synchronized method. This can
+ // only occur on method entry so emit it only for vtos with step 0.
+ if (UseJVMCICompiler && state == vtos && step == 0) {
Label L;
Address pending_monitor_enter_addr(G2_thread, JavaThread::pending_monitorenter_offset());
__ ldbool(pending_monitor_enter_addr, Gtemp); // Load if pending monitor enter
@@ -395,6 +396,17 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
// Take lock.
lock_method();
__ bind(L);
+ } else {
+#ifdef ASSERT
+ if (UseJVMCICompiler) {
+ Label L;
+ Address pending_monitor_enter_addr(G2_thread, JavaThread::pending_monitorenter_offset());
+ __ ldbool(pending_monitor_enter_addr, Gtemp); // Load if pending monitor enter
+ __ cmp_and_br_short(Gtemp, G0, Assembler::equal, Assembler::pn, L);
+ __ stop("unexpected pending monitor in deopt entry");
+ __ bind(L);
+ }
+#endif
}
#endif
{ Label L;
diff --git a/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp b/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp
index c8a8daf2844..2c84cece3cc 100644
--- a/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp
+++ b/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp
@@ -84,7 +84,6 @@
declare_constant(VM_Version::sun4v_m) \
declare_constant(VM_Version::blk_init_instructions_m) \
declare_constant(VM_Version::fmaf_instructions_m) \
- declare_constant(VM_Version::fmau_instructions_m) \
declare_constant(VM_Version::sparc64_family_m) \
declare_constant(VM_Version::M_family_m) \
declare_constant(VM_Version::T_family_m) \
diff --git a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
index 8f68d1112f2..e9fee0c9a51 100644
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
@@ -179,7 +179,7 @@ void VM_Version::initialize() {
assert((OptoLoopAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
char buf[512];
- jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+ jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
(has_v9() ? ", v9" : (has_v8() ? ", v8" : "")),
(has_hardware_popc() ? ", popc" : ""),
(has_vis1() ? ", vis1" : ""),
@@ -193,6 +193,7 @@ void VM_Version::initialize() {
(has_sha512() ? ", sha512" : ""),
(has_crc32c() ? ", crc32c" : ""),
(is_ultra3() ? ", ultra3" : ""),
+ (has_sparc5_instr() ? ", sparc5" : ""),
(is_sun4v() ? ", sun4v" : ""),
(is_niagara_plus() ? ", niagara_plus" : (is_niagara() ? ", niagara" : "")),
(is_sparc64() ? ", sparc64" : ""),
@@ -487,16 +488,11 @@ int VM_Version::parse_features(const char* implementation) {
if (strstr(impl, "SPARC-T1") != NULL) {
features |= T1_model_m;
}
+ } else if (strstr(impl, "SUN4V-CPU") != NULL) {
+ // Generic or migration class LDOM
+ features |= T_family_m;
} else {
- if (strstr(impl, "SPARC") == NULL) {
-#ifndef PRODUCT
- // kstat on Solaris 8 virtual machines (branded zones)
- // returns "(unsupported)" implementation. Solaris 8 is not
- // supported anymore, but include this check to be on the
- // safe side.
- warning("Can't parse CPU implementation = '%s', assume generic SPARC", impl);
-#endif
- }
+ log_info(os, cpu)("Failed to parse CPU implementation = '%s'", impl);
}
os::free((void*)impl);
return features;
diff --git a/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp b/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp
index f2c5955905e..6c3b72b23cf 100644
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp
@@ -34,30 +34,29 @@ class VM_Version: public Abstract_VM_Version {
protected:
enum Feature_Flag {
- v8_instructions = 0,
- hardware_mul32 = 1,
- hardware_div32 = 2,
- hardware_fsmuld = 3,
- hardware_popc = 4,
- v9_instructions = 5,
- vis1_instructions = 6,
- vis2_instructions = 7,
- sun4v_instructions = 8,
+ v8_instructions = 0,
+ hardware_mul32 = 1,
+ hardware_div32 = 2,
+ hardware_fsmuld = 3,
+ hardware_popc = 4,
+ v9_instructions = 5,
+ vis1_instructions = 6,
+ vis2_instructions = 7,
+ sun4v_instructions = 8,
blk_init_instructions = 9,
- fmaf_instructions = 10,
- fmau_instructions = 11,
- vis3_instructions = 12,
- cbcond_instructions = 13,
- sparc64_family = 14,
- M_family = 15,
- T_family = 16,
- T1_model = 17,
- sparc5_instructions = 18,
- aes_instructions = 19,
- sha1_instruction = 20,
- sha256_instruction = 21,
- sha512_instruction = 22,
- crc32c_instruction = 23
+ fmaf_instructions = 10,
+ vis3_instructions = 11,
+ cbcond_instructions = 12,
+ sparc64_family = 13,
+ M_family = 14,
+ T_family = 15,
+ T1_model = 16,
+ sparc5_instructions = 17,
+ aes_instructions = 18,
+ sha1_instruction = 19,
+ sha256_instruction = 20,
+ sha512_instruction = 21,
+ crc32c_instruction = 22
};
enum Feature_Flag_Set {
@@ -75,7 +74,6 @@ protected:
sun4v_m = 1 << sun4v_instructions,
blk_init_instructions_m = 1 << blk_init_instructions,
fmaf_instructions_m = 1 << fmaf_instructions,
- fmau_instructions_m = 1 << fmau_instructions,
vis3_instructions_m = 1 << vis3_instructions,
cbcond_instructions_m = 1 << cbcond_instructions,
sparc64_family_m = 1 << sparc64_family,
diff --git a/hotspot/src/cpu/x86/vm/jvmciCodeInstaller_x86.cpp b/hotspot/src/cpu/x86/vm/jvmciCodeInstaller_x86.cpp
index ff308c09c5f..e2ddb71aa9d 100644
--- a/hotspot/src/cpu/x86/vm/jvmciCodeInstaller_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/jvmciCodeInstaller_x86.cpp
@@ -89,14 +89,14 @@ void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle constant, T
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
#ifdef _LP64
address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand);
- *((narrowKlass*) operand) = record_narrow_metadata_reference(constant, CHECK);
+ *((narrowKlass*) operand) = record_narrow_metadata_reference(_instructions, operand, constant, CHECK);
TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
#else
JVMCI_ERROR("compressed Klass* on 32bit");
#endif
} else {
address operand = Assembler::locate_operand(pc, Assembler::imm_operand);
- *((void**) operand) = record_metadata_reference(constant, CHECK);
+ *((void**) operand) = record_metadata_reference(_instructions, operand, constant, CHECK);
TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
}
}
diff --git a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp
index dd978fd1020..e82c70d9eb2 100644
--- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp
@@ -254,8 +254,9 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
const Register thread = NOT_LP64(rcx) LP64_ONLY(r15_thread);
NOT_LP64(__ get_thread(thread));
#if INCLUDE_JVMCI
- // Check if we need to take lock at entry of synchronized method.
- if (UseJVMCICompiler) {
+ // Check if we need to take lock at entry of synchronized method. This can
+ // only occur on method entry so emit it only for vtos with step 0.
+ if (UseJVMCICompiler && state == vtos && step == 0) {
Label L;
__ cmpb(Address(thread, JavaThread::pending_monitorenter_offset()), 0);
__ jcc(Assembler::zero, L);
@@ -266,6 +267,16 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
// Take lock.
lock_method();
__ bind(L);
+ } else {
+#ifdef ASSERT
+ if (UseJVMCICompiler) {
+ Label L;
+ __ cmpb(Address(r15_thread, JavaThread::pending_monitorenter_offset()), 0);
+ __ jccb(Assembler::zero, L);
+ __ stop("unexpected pending monitor in deopt entry");
+ __ bind(L);
+ }
+#endif
}
#endif
// handle exceptions
diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad
index cbfe7668335..e82361ba810 100644
--- a/hotspot/src/cpu/x86/vm/x86_32.ad
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad
@@ -1452,6 +1452,15 @@ bool Matcher::narrow_klass_use_complex_address() {
return true;
}
+bool Matcher::const_oop_prefer_decode() {
+ ShouldNotCallThis();
+ return true;
+}
+
+bool Matcher::const_klass_prefer_decode() {
+ ShouldNotCallThis();
+ return true;
+}
// Is it better to copy float constants, or load them directly from memory?
// Intel can load a float constant from a direct address, requiring no
diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad
index 6be113df68e..dd8e5beba6e 100644
--- a/hotspot/src/cpu/x86/vm/x86_64.ad
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad
@@ -1660,6 +1660,19 @@ bool Matcher::narrow_klass_use_complex_address() {
return (LogKlassAlignmentInBytes <= 3);
}
+bool Matcher::const_oop_prefer_decode() {
+ // Prefer ConN+DecodeN over ConP.
+ return true;
+}
+
+bool Matcher::const_klass_prefer_decode() {
+ // TODO: Either support matching DecodeNKlass (heap-based) in operand
+ // or condisider the following:
+ // Prefer ConNKlass+DecodeNKlass over ConP in simple compressed klass mode.
+ //return Universe::narrow_klass_base() == NULL;
+ return true;
+}
+
// Is it better to copy float constants, or load them directly from
// memory? Intel can load a float constant from a direct address,
// requiring no extra registers. Most RISCs will have to materialize
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java
index e5b2d65b1ec..d2fb255e721 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java
@@ -96,9 +96,6 @@ public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFacto
if ((config.vmVersionFeatures & config.sparcFmafInstructions) != 0) {
features.add(CPUFeature.FMAF);
}
- if ((config.vmVersionFeatures & config.sparcFmauInstructions) != 0) {
- features.add(CPUFeature.FMAU);
- }
if ((config.vmVersionFeatures & config.sparcSparc64Family) != 0) {
features.add(CPUFeature.SPARC64_FAMILY);
}
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotVMConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotVMConfig.java
index d5eee90672f..f0b1591554a 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotVMConfig.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotVMConfig.java
@@ -55,7 +55,6 @@ class SPARCHotSpotVMConfig extends HotSpotVMConfigAccess {
final int sparcSun4v = getConstant("VM_Version::sun4v_m", Integer.class);
final int sparcBlkInitInstructions = getConstant("VM_Version::blk_init_instructions_m", Integer.class);
final int sparcFmafInstructions = getConstant("VM_Version::fmaf_instructions_m", Integer.class);
- final int sparcFmauInstructions = getConstant("VM_Version::fmau_instructions_m", Integer.class);
final int sparcSparc64Family = getConstant("VM_Version::sparc64_family_m", Integer.class);
final int sparcMFamily = getConstant("VM_Version::M_family_m", Integer.class);
final int sparcTFamily = getConstant("VM_Version::T_family_m", Integer.class);
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EmptyEventProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/EmptyEventProvider.java
similarity index 95%
rename from hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EmptyEventProvider.java
rename to hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/EmptyEventProvider.java
index c217964fb34..c2c228ecb80 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EmptyEventProvider.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/EmptyEventProvider.java
@@ -20,17 +20,13 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.vm.ci.hotspot.services;
+package jdk.vm.ci.hotspot;
/**
* An empty implementation for {@link EventProvider}. This implementation is used when no logging is
* requested.
*/
-final class EmptyEventProvider extends EventProvider {
-
- EmptyEventProvider() {
- super(null);
- }
+final class EmptyEventProvider implements EventProvider {
static InternalError shouldNotReachHere() {
throw new InternalError("should not reach here");
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EventProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/EventProvider.java
similarity index 78%
rename from hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EventProvider.java
rename to hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/EventProvider.java
index d351060d452..0f46e5e4a07 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/EventProvider.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/EventProvider.java
@@ -20,58 +20,36 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.vm.ci.hotspot.services;
+package jdk.vm.ci.hotspot;
-import jdk.vm.ci.hotspot.services.EmptyEventProvider.EmptyCompilationEvent;
-import jdk.vm.ci.hotspot.services.EmptyEventProvider.EmptyCompilerFailureEvent;
+import jdk.vm.ci.hotspot.EmptyEventProvider.EmptyCompilationEvent;
+import jdk.vm.ci.hotspot.EmptyEventProvider.EmptyCompilerFailureEvent;
import jdk.vm.ci.services.JVMCIPermission;
/**
* Service-provider class for logging compiler related events.
*/
-public abstract class EventProvider {
-
- private static Void checkPermission() {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(new JVMCIPermission());
- }
- return null;
- }
-
- @SuppressWarnings("unused")
- EventProvider(Void ignore) {
- }
-
- /**
- * Initializes a new instance of this class.
- *
- * @throws SecurityException if a security manager has been installed and it denies
- * {@link JVMCIPermission}
- */
- protected EventProvider() {
- this(checkPermission());
- }
+public interface EventProvider {
/**
* Creates and returns an empty implementation for {@link EventProvider}. This implementation
* can be used when no logging is requested.
*/
- public static EventProvider createEmptyEventProvider() {
+ static EventProvider createEmptyEventProvider() {
return new EmptyEventProvider();
}
/**
* Creates and returns an empty implementation for {@link CompilationEvent}.
*/
- public static CompilationEvent createEmptyCompilationEvent() {
+ static CompilationEvent createEmptyCompilationEvent() {
return new EmptyCompilationEvent();
}
/**
* Creates and returns an empty implementation for {@link CompilationEvent}.
*/
- public static CompilerFailureEvent createEmptyCompilerFailureEvent() {
+ static CompilerFailureEvent createEmptyCompilerFailureEvent() {
return new EmptyCompilerFailureEvent();
}
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java
index 89e2ae2c199..366fe5f25a9 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java
@@ -26,8 +26,10 @@ import jdk.vm.ci.code.CompilationRequest;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
import jdk.vm.ci.runtime.JVMCICompiler;
+import jdk.vm.ci.runtime.JVMCICompilerFactory;
import jdk.vm.ci.runtime.JVMCIRuntime;
-import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
+import jdk.vm.ci.services.JVMCIServiceLocator;
+import jdk.vm.ci.services.JVMCIPermission;
import jdk.vm.ci.services.Services;
final class HotSpotJVMCICompilerConfig {
@@ -37,7 +39,7 @@ final class HotSpotJVMCICompilerConfig {
* to perform a compilation. This allows the reflective parts of the JVMCI API to be used
* without requiring a compiler implementation to be available.
*/
- private static class DummyCompilerFactory extends JVMCICompilerFactory implements JVMCICompiler {
+ private static class DummyCompilerFactory implements JVMCICompilerFactory, JVMCICompiler {
public HotSpotCompilationRequestResult compileMethod(CompilationRequest request) {
throw new JVMCIError("no JVMCI compiler selected");
@@ -63,15 +65,16 @@ final class HotSpotJVMCICompilerConfig {
* Gets the selected system compiler factory.
*
* @return the selected system compiler factory
+ * @throws SecurityException if a security manager is present and it denies
+ * {@link JVMCIPermission} for any {@link JVMCIServiceLocator} loaded by this method
*/
static JVMCICompilerFactory getCompilerFactory() {
if (compilerFactory == null) {
JVMCICompilerFactory factory = null;
String compilerName = Option.Compiler.getString();
if (compilerName != null) {
- for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
+ for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) {
if (f.getCompilerName().equals(compilerName)) {
- Services.exportJVMCITo(f.getClass());
factory = f;
}
}
@@ -80,8 +83,9 @@ final class HotSpotJVMCICompilerConfig {
}
} else {
// Auto select a single available compiler
- for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
+ for (JVMCICompilerFactory f : JVMCIServiceLocator.getProviders(JVMCICompilerFactory.class)) {
if (factory == null) {
+ Services.exportJVMCITo(f.getClass());
factory = f;
} else {
// Multiple factories seen - cancel auto selection
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerFactory.java
similarity index 95%
rename from hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java
rename to hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerFactory.java
index e629bc91150..fcde6f970ce 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerFactory.java
@@ -20,14 +20,14 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.vm.ci.hotspot.services;
+package jdk.vm.ci.hotspot;
-import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
+import jdk.vm.ci.runtime.JVMCICompilerFactory;
/**
* HotSpot extensions to {@link JVMCICompilerFactory}.
*/
-public abstract class HotSpotJVMCICompilerFactory extends JVMCICompilerFactory {
+public abstract class HotSpotJVMCICompilerFactory implements JVMCICompilerFactory {
/**
* Gets 0 or more prefixes identifying classes that should by compiled by C1 in simple mode
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
index 3c70ea7bbf0..4f3f97de116 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
@@ -27,13 +27,11 @@ import static jdk.vm.ci.common.InitTimer.timer;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.ServiceLoader;
import java.util.TreeMap;
import jdk.internal.misc.VM;
@@ -43,16 +41,15 @@ import jdk.vm.ci.code.CompiledCode;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.common.InitTimer;
import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.hotspot.services.HotSpotJVMCICompilerFactory;
-import jdk.vm.ci.hotspot.services.HotSpotJVMCICompilerFactory.CompilationLevel;
-import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
+import jdk.vm.ci.hotspot.HotSpotJVMCICompilerFactory.CompilationLevel;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
import jdk.vm.ci.meta.ResolvedJavaType;
import jdk.vm.ci.runtime.JVMCI;
import jdk.vm.ci.runtime.JVMCIBackend;
import jdk.vm.ci.runtime.JVMCICompiler;
-import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
+import jdk.vm.ci.runtime.JVMCICompilerFactory;
+import jdk.vm.ci.services.JVMCIServiceLocator;
import jdk.vm.ci.services.Services;
/**
@@ -90,14 +87,17 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
* A list of all supported JVMCI options.
*/
public enum Option {
+ // @formatter:off
Compiler(String.class, null, "Selects the system compiler."),
// Note: The following one is not used (see InitTimer.ENABLED). It is added here
- // so that -Djvmci.PrintFlags=true shows the option.
- InitTimer(boolean.class, false, "Specifies if initialization timing is enabled."),
- PrintConfig(boolean.class, false, "Prints VM configuration available via JVMCI and exits."),
- PrintFlags(boolean.class, false, "Prints all JVMCI flags and exits."),
- ShowFlags(boolean.class, false, "Prints all JVMCI flags and continues."),
- TraceMethodDataFilter(String.class, null, "");
+ // so that -XX:+JVMCIPrintProperties shows the option.
+ InitTimer(Boolean.class, false, "Specifies if initialization timing is enabled."),
+ PrintConfig(Boolean.class, false, "Prints VM configuration available via JVMCI."),
+ TraceMethodDataFilter(String.class, null,
+ "Enables tracing of profiling info when read by JVMCI.",
+ "Empty value: trace all methods",
+ "Non-empty value: trace methods whose fully qualified name contains the value.");
+ // @formatter:on
/**
* The prefix for system properties that are JVMCI options.
@@ -113,25 +113,25 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
private Object value;
private final Object defaultValue;
private boolean isDefault;
- private final String help;
+ private final String[] helpLines;
- Option(Class> type, Object defaultValue, String help) {
+ Option(Class> type, Object defaultValue, String... helpLines) {
assert Character.isUpperCase(name().charAt(0)) : "Option name must start with upper-case letter: " + name();
this.type = type;
this.value = UNINITIALIZED;
this.defaultValue = defaultValue;
- this.help = help;
+ this.helpLines = helpLines;
}
@SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "sentinel must be String since it's a static final in an enum")
private Object getValue() {
if (value == UNINITIALIZED) {
- String propertyValue = VM.getSavedProperty(JVMCI_OPTION_PROPERTY_PREFIX + name());
+ String propertyValue = VM.getSavedProperty(getPropertyName());
if (propertyValue == null) {
this.value = defaultValue;
this.isDefault = true;
} else {
- if (type == boolean.class) {
+ if (type == Boolean.class) {
this.value = Boolean.parseBoolean(propertyValue);
} else if (type == String.class) {
this.value = propertyValue;
@@ -146,6 +146,13 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
return value;
}
+ /**
+ * Gets the name of system property from which this option gets its value.
+ */
+ public String getPropertyName() {
+ return JVMCI_OPTION_PROPERTY_PREFIX + name();
+ }
+
/**
* Returns the option's value as boolean.
*
@@ -165,16 +172,31 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
}
/**
- * Prints all option flags to {@code out}.
+ * Prints a description of the properties used to configure shared JVMCI code.
*
* @param out stream to print to
*/
- public static void printFlags(PrintStream out) {
- out.println("[List of JVMCI options]");
- for (Option option : values()) {
+ public static void printProperties(PrintStream out) {
+ out.println("[JVMCI properties]");
+ int typeWidth = 0;
+ int nameWidth = 0;
+ Option[] values = values();
+ for (Option option : values) {
+ typeWidth = Math.max(typeWidth, option.type.getSimpleName().length());
+ nameWidth = Math.max(nameWidth, option.getPropertyName().length());
+ }
+ for (Option option : values) {
Object value = option.getValue();
- String assign = option.isDefault ? ":=" : " =";
- out.printf("%9s %-40s %s %-14s %s%n", option.type.getSimpleName(), option, assign, value, option.help);
+ if (value instanceof String) {
+ value = '"' + String.valueOf(value) + '"';
+ }
+ String assign = option.isDefault ? " =" : ":=";
+ String format = "%" + (typeWidth + 1) + "s %-" + (nameWidth + 1) + "s %s %s%n";
+ out.printf(format, option.type.getSimpleName(), option.getPropertyName(), assign, value);
+ String helpFormat = "%" + (typeWidth + 1) + "s %s%n";
+ for (String line : option.helpLines) {
+ out.printf(helpFormat, "", line);
+ }
}
}
}
@@ -221,11 +243,7 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
if (vmEventListeners == null) {
synchronized (this) {
if (vmEventListeners == null) {
- List listeners = new ArrayList<>();
- for (HotSpotVMEventListener vmEventListener : ServiceLoader.load(HotSpotVMEventListener.class)) {
- listeners.add(vmEventListener);
- }
- vmEventListeners = listeners;
+ vmEventListeners = JVMCIServiceLocator.getProviders(HotSpotVMEventListener.class);
}
}
}
@@ -239,7 +257,6 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
@SuppressWarnings("unused") private final String[] trivialPrefixes;
@SuppressWarnings("try")
- @SuppressFBWarnings(value = "DM_EXIT", justification = "PrintFlags is meant to exit the VM")
private HotSpotJVMCIRuntime() {
compilerToVm = new CompilerToVM();
@@ -261,20 +278,6 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
metaAccessContext = new HotSpotJVMCIMetaAccessContext();
- boolean printFlags = Option.PrintFlags.getBoolean();
- boolean showFlags = Option.ShowFlags.getBoolean();
- if (printFlags || showFlags) {
- Option.printFlags(System.out);
- if (printFlags) {
- System.exit(0);
- }
- }
-
- if (Option.PrintConfig.getBoolean()) {
- printConfig(configStore, compilerToVm);
- System.exit(0);
- }
-
compilerFactory = HotSpotJVMCICompilerConfig.getCompilerFactory();
if (compilerFactory instanceof HotSpotJVMCICompilerFactory) {
hsCompilerFactory = (HotSpotJVMCICompilerFactory) compilerFactory;
@@ -298,6 +301,16 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider {
trivialPrefixes = null;
compilationLevelAdjustment = config.compLevelAdjustmentNone;
}
+
+ if (config.getFlag("JVMCIPrintProperties", Boolean.class)) {
+ PrintStream out = new PrintStream(getLogStream());
+ Option.printProperties(out);
+ compilerFactory.printProperties(out);
+ }
+
+ if (Option.PrintConfig.getBoolean()) {
+ printConfig(configStore, compilerToVm);
+ }
}
private JVMCIBackend registerBackend(JVMCIBackend backend) {
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java
index 0471ae50c48..ddc7331b28f 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java
@@ -53,9 +53,9 @@ final class HotSpotMethodData {
* Reference to the C++ MethodData object.
*/
final long metaspaceMethodData;
- @SuppressWarnings("unused") private final HotSpotResolvedJavaMethodImpl method;
+ private final HotSpotResolvedJavaMethodImpl method;
- public HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) {
+ HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) {
this.metaspaceMethodData = metaspaceMethodData;
this.method = method;
}
@@ -107,6 +107,18 @@ final class HotSpotMethodData {
return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF;
}
+ public int getDecompileCount() {
+ return UNSAFE.getInt(metaspaceMethodData + config.methodDataDecompiles);
+ }
+
+ public int getOverflowRecompileCount() {
+ return UNSAFE.getInt(metaspaceMethodData + config.methodDataOverflowRecompiles);
+ }
+
+ public int getOverflowTrapCount() {
+ return UNSAFE.getInt(metaspaceMethodData + config.methodDataOverflowTraps);
+ }
+
public HotSpotMethodDataAccessor getNormalData(int position) {
if (position >= normalDataSize()) {
return null;
@@ -214,6 +226,12 @@ final class HotSpotMethodData {
StringBuilder sb = new StringBuilder();
String nl = String.format("%n");
String nlIndent = String.format("%n%38s", "");
+ sb.append("Raw method data for ");
+ sb.append(method.format("%H.%n(%p)"));
+ sb.append(":");
+ sb.append(nl);
+ sb.append(String.format("nof_decompiles(%d) nof_overflow_recompiles(%d) nof_overflow_traps(%d)%n",
+ getDecompileCount(), getOverflowRecompileCount(), getOverflowTrapCount()));
if (hasNormalData()) {
int pos = 0;
HotSpotMethodDataAccessor data;
@@ -427,6 +445,10 @@ final class HotSpotMethodData {
protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position);
+ public int getNonprofiledCount(HotSpotMethodData data, int position) {
+ return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
+ }
+
private JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile profile) {
if (profile.entries <= 0 || profile.totalCount <= 0) {
return null;
@@ -462,7 +484,7 @@ final class HotSpotMethodData {
TriState nullSeen = getNullSeen(data, pos);
TriState exceptionSeen = getExceptionSeen(data, pos);
sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen,
- getTypesNotRecordedExecutionCount(data, pos), profile.entries));
+ getNonprofiledCount(data, pos), profile.entries));
for (int i = 0; i < profile.entries; i++) {
long count = profile.counts[i];
sb.append(format("%n %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount));
@@ -490,7 +512,7 @@ final class HotSpotMethodData {
@Override
protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) {
- return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
+ return getNonprofiledCount(data, position);
}
}
@@ -788,7 +810,8 @@ final class HotSpotMethodData {
@Override
public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
- return null;
+ sb.append("unknown profile data with tag: " + tag);
+ return sb;
}
}
@@ -822,10 +845,10 @@ final class HotSpotMethodData {
private static boolean checkAccessorTags() {
int expectedTag = 0;
for (HotSpotMethodDataAccessor accessor : PROFILE_DATA_ACCESSORS) {
- if (expectedTag ==0 ) {
+ if (expectedTag == 0) {
assert accessor == null;
} else {
- assert accessor.tag == expectedTag: expectedTag + " != " + accessor.tag + " " + accessor;
+ assert accessor.tag == expectedTag : expectedTag + " != " + accessor.tag + " " + accessor;
}
expectedTag++;
}
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotProfilingInfo.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotProfilingInfo.java
index 0e71f74bf8a..20c877041ee 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotProfilingInfo.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotProfilingInfo.java
@@ -57,6 +57,18 @@ public final class HotSpotProfilingInfo implements ProfilingInfo {
return method.getCodeSize();
}
+ public int getDecompileCount() {
+ return methodData.getDecompileCount();
+ }
+
+ public int getOverflowRecompileCount() {
+ return methodData.getOverflowRecompileCount();
+ }
+
+ public int getOverflowTrapCount() {
+ return methodData.getOverflowTrapCount();
+ }
+
@Override
public JavaTypeProfile getTypeProfile(int bci) {
if (!isMature) {
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java
index 6ebdc4b33c1..091fdcc7847 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java
@@ -434,7 +434,6 @@ final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSp
methodData = new HotSpotMethodData(metaspaceMethodData, this);
String methodDataFilter = Option.TraceMethodDataFilter.getString();
if (methodDataFilter != null && this.format("%H.%n").contains(methodDataFilter)) {
- System.out.println("Raw method data for " + this.format("%H.%n(%p)") + ":");
System.out.println(methodData.toString());
}
}
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
index a731b8aff4d..c598f8a6f3f 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
@@ -160,6 +160,10 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess {
final int methodDataOopTrapHistoryOffset = getFieldOffset("MethodData::_trap_hist._array[0]", Integer.class, "u1");
final int methodDataIRSizeOffset = getFieldOffset("MethodData::_jvmci_ir_size", Integer.class, "int");
+ final int methodDataDecompiles = getFieldOffset("MethodData::_nof_decompiles", Integer.class, "uint");
+ final int methodDataOverflowRecompiles = getFieldOffset("MethodData::_nof_overflow_recompiles", Integer.class, "uint");
+ final int methodDataOverflowTraps = getFieldOffset("MethodData::_nof_overflow_traps", Integer.class, "uint");
+
final int nmethodCompLevelOffset = getFieldOffset("nmethod::_comp_level", Integer.class, "int");
final int compilationLevelNone = getConstant("CompLevel_none", Integer.class);
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMEventListener.java
similarity index 54%
rename from hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java
rename to hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMEventListener.java
index e59b42c91bf..e6c8b39eeac 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMEventListener.java
@@ -20,59 +20,35 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.vm.ci.hotspot.services;
+package jdk.vm.ci.hotspot;
import jdk.vm.ci.code.CompiledCode;
import jdk.vm.ci.code.InstalledCode;
-import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
-import jdk.vm.ci.services.JVMCIPermission;
/**
- * Service-provider class for responding to VM events.
+ * Listener for responding to VM events.
*/
-public abstract class HotSpotVMEventListener {
-
- private static Void checkPermission() {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(new JVMCIPermission());
- }
- return null;
- }
-
- @SuppressWarnings("unused")
- HotSpotVMEventListener(Void ignore) {
- }
-
- /**
- * Initializes a new instance of this class.
- *
- * @throws SecurityException if a security manager has been installed and it denies
- * {@link JVMCIPermission}
- */
- protected HotSpotVMEventListener() {
- this(checkPermission());
- }
+public interface HotSpotVMEventListener {
/**
* Notifies this client that the VM is shutting down.
*/
- public void notifyShutdown() {
+ default void notifyShutdown() {
}
/**
* Notify on successful install into the code cache.
*
- * @param hotSpotCodeCacheProvider
- * @param installedCode
- * @param compiledCode
+ * @param hotSpotCodeCacheProvider the code cache into which the code was installed
+ * @param installedCode the code that was installed
+ * @param compiledCode the compiled code from which {@code installedCode} was produced
*/
- public void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) {
+ default void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) {
}
/**
* Notify on completion of a bootstrap.
*/
- public void notifyBootstrapFinished() {
+ default void notifyBootstrapFinished() {
}
}
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompilerFactory.java
similarity index 61%
rename from hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java
rename to hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompilerFactory.java
index d18ea2db104..bae1713175d 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompilerFactory.java
@@ -20,54 +20,38 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.vm.ci.runtime.services;
+package jdk.vm.ci.runtime;
-import jdk.vm.ci.runtime.JVMCICompiler;
-import jdk.vm.ci.runtime.JVMCIRuntime;
-import jdk.vm.ci.services.JVMCIPermission;
+import java.io.PrintStream;
/**
- * Service-provider class for creating JVMCI compilers.
+ * Factory for creating JVMCI compilers.
*/
-public abstract class JVMCICompilerFactory {
-
- private static Void checkPermission() {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(new JVMCIPermission());
- }
- return null;
- }
-
- @SuppressWarnings("unused")
- private JVMCICompilerFactory(Void ignore) {
- }
-
- /**
- * Initializes a new instance of this class.
- *
- * @throws SecurityException if a security manager has been installed and it denies
- * {@link JVMCIPermission}
- */
- protected JVMCICompilerFactory() {
- this(checkPermission());
- }
+public interface JVMCICompilerFactory {
/**
* Get the name of this compiler. The name is used by JVMCI to determine which factory to use.
*/
- public abstract String getCompilerName();
+ String getCompilerName();
/**
* Notifies this object that it has been selected to {@linkplain #createCompiler(JVMCIRuntime)
* create} a compiler and it should now perform any heavy weight initialization that it deferred
* during construction.
*/
- public void onSelection() {
+ default void onSelection() {
}
/**
* Create a new instance of a {@link JVMCICompiler}.
*/
- public abstract JVMCICompiler createCompiler(JVMCIRuntime runtime);
+ JVMCICompiler createCompiler(JVMCIRuntime runtime);
+
+ /**
+ * Prints a description of the properties used to configure this compiler.
+ *
+ * @param out where to print the message
+ */
+ default void printProperties(PrintStream out) {
+ }
}
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/JVMCIServiceLocator.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/JVMCIServiceLocator.java
new file mode 100644
index 00000000000..7d695ea27d7
--- /dev/null
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.services/src/jdk/vm/ci/services/JVMCIServiceLocator.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.vm.ci.services;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Service-provider class for the runtime to locate providers of JVMCI services where the latter are
+ * not in packages exported by the JVMCI module. As part of instantiating
+ * {@link JVMCIServiceLocator}, all JVMCI packages will be {@linkplain Services#exportJVMCITo(Class)
+ * exported} to the module defining the class of the instantiated object.
+ *
+ * While the {@link #getProvider(Class)} method can be used directly, it's usually easier to use
+ * {@link #getProviders(Class)}.
+ */
+public abstract class JVMCIServiceLocator {
+
+ private static Void checkPermission() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(new JVMCIPermission());
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unused")
+ private JVMCIServiceLocator(Void ignore) {
+ }
+
+ /**
+ * Creates a capability for accessing JVMCI. Once successfully instantiated, JVMCI exports all
+ * its packages to the module defining the type of this object.
+ *
+ * @throws SecurityException if a security manager has been installed and it denies
+ * {@link JVMCIPermission}
+ */
+ protected JVMCIServiceLocator() {
+ this(checkPermission());
+ Services.exportJVMCITo(getClass());
+ }
+
+ /**
+ * Gets the provider of the service defined by {@code service} or {@code null} if this object
+ * does not have a provider for {@code service}.
+ */
+ public abstract S getProvider(Class service);
+
+ /**
+ * Gets the providers of the service defined by {@code service} by querying the
+ * {@link JVMCIServiceLocator} providers obtained by {@link Services#load(Class)}.
+ */
+ public static List getProviders(Class service) {
+ List providers = new ArrayList<>();
+ for (JVMCIServiceLocator access : Services.load(JVMCIServiceLocator.class)) {
+ S provider = access.getProvider(service);
+ if (provider != null) {
+ providers.add(provider);
+ }
+ }
+ return providers;
+ }
+}
diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java
index 672970c2026..eb3d78e2933 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java
@@ -349,7 +349,6 @@ public class SPARC extends Architecture {
SUN4V,
BLK_INIT_INSTRUCTIONS,
FMAF,
- FMAU,
SPARC64_FAMILY,
M_FAMILY,
T_FAMILY,
diff --git a/hotspot/src/jdk.vm.ci/share/classes/module-info.java b/hotspot/src/jdk.vm.ci/share/classes/module-info.java
index 062737395e2..f1a766e43f5 100644
--- a/hotspot/src/jdk.vm.ci/share/classes/module-info.java
+++ b/hotspot/src/jdk.vm.ci/share/classes/module-info.java
@@ -25,12 +25,9 @@
module jdk.vm.ci {
exports jdk.vm.ci.services;
- exports jdk.vm.ci.runtime.services;
- exports jdk.vm.ci.hotspot.services;
- uses jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
+ uses jdk.vm.ci.services.JVMCIServiceLocator;
uses jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
- uses jdk.vm.ci.runtime.services.JVMCICompilerFactory;
provides jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory with
jdk.vm.ci.hotspot.aarch64.AArch64HotSpotJVMCIBackendFactory;
diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index 4c4268486b1..1c1182388f3 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -2563,7 +2563,7 @@ bool os::get_page_info(char *start, page_info* info) {
uint64_t outdata[2];
uint_t validity = 0;
- if (os::Solaris::meminfo(&addr, 1, info_types, 2, outdata, &validity) < 0) {
+ if (meminfo(&addr, 1, info_types, 2, outdata, &validity) < 0) {
return false;
}
@@ -2601,7 +2601,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected,
addrs_count++;
}
- if (os::Solaris::meminfo(addrs, addrs_count, info_types, types, outdata, validity) < 0) {
+ if (meminfo(addrs, addrs_count, info_types, types, outdata, validity) < 0) {
return NULL;
}
@@ -4160,9 +4160,6 @@ void os::Solaris::install_signal_handlers() {
void report_error(const char* file_name, int line_no, const char* title,
const char* format, ...);
-// (Static) wrapper for getisax(2) call.
-os::Solaris::getisax_func_t os::Solaris::_getisax = 0;
-
// (Static) wrappers for the liblgrp API
os::Solaris::lgrp_home_func_t os::Solaris::_lgrp_home;
os::Solaris::lgrp_init_func_t os::Solaris::_lgrp_init;
@@ -4174,9 +4171,6 @@ os::Solaris::lgrp_nlgrps_func_t os::Solaris::_lgrp_nlgrps;
os::Solaris::lgrp_cookie_stale_func_t os::Solaris::_lgrp_cookie_stale;
os::Solaris::lgrp_cookie_t os::Solaris::_lgrp_cookie = 0;
-// (Static) wrapper for meminfo() call.
-os::Solaris::meminfo_func_t os::Solaris::_meminfo = 0;
-
static address resolve_symbol_lazy(const char* name) {
address addr = (address) dlsym(RTLD_DEFAULT, name);
if (addr == NULL) {
@@ -4300,27 +4294,6 @@ bool os::Solaris::liblgrp_init() {
return false;
}
-void os::Solaris::misc_sym_init() {
- address func;
-
- // getisax
- func = resolve_symbol_lazy("getisax");
- if (func != NULL) {
- os::Solaris::_getisax = CAST_TO_FN_PTR(getisax_func_t, func);
- }
-
- // meminfo
- func = resolve_symbol_lazy("meminfo");
- if (func != NULL) {
- os::Solaris::set_meminfo(CAST_TO_FN_PTR(meminfo_func_t, func));
- }
-}
-
-uint_t os::Solaris::getisax(uint32_t* array, uint_t n) {
- assert(_getisax != NULL, "_getisax not set");
- return _getisax(array, n);
-}
-
// int pset_getloadavg(psetid_t pset, double loadavg[], int nelem);
typedef long (*pset_getloadavg_type)(psetid_t pset, double loadavg[], int nelem);
static pset_getloadavg_type pset_getloadavg_ptr = NULL;
@@ -4351,10 +4324,6 @@ void os::init(void) {
Solaris::initialize_system_info();
- // Initialize misc. symbols as soon as possible, so we can use them
- // if we need them.
- Solaris::misc_sym_init();
-
int fd = ::open("/dev/zero", O_RDWR);
if (fd < 0) {
fatal("os::init: cannot open /dev/zero (%s)", os::strerror(errno));
diff --git a/hotspot/src/os/solaris/vm/os_solaris.hpp b/hotspot/src/os/solaris/vm/os_solaris.hpp
index 150abcb6486..7add07365ad 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.hpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.hpp
@@ -73,8 +73,6 @@ class Solaris {
LGRP_VIEW_OS // what's available to operating system
} lgrp_view_t;
- typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n);
-
typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id);
typedef lgrp_cookie_t (*lgrp_init_func_t)(lgrp_view_t view);
typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie);
@@ -86,11 +84,6 @@ class Solaris {
lgrp_rsrc_t type);
typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie);
typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie);
- typedef int (*meminfo_func_t)(const uint64_t inaddr[], int addr_count,
- const uint_t info_req[], int info_count,
- uint64_t outdata[], uint_t validity[]);
-
- static getisax_func_t _getisax;
static lgrp_home_func_t _lgrp_home;
static lgrp_init_func_t _lgrp_init;
@@ -102,8 +95,6 @@ class Solaris {
static lgrp_cookie_stale_func_t _lgrp_cookie_stale;
static lgrp_cookie_t _lgrp_cookie;
- static meminfo_func_t _meminfo;
-
// Large Page Support
static bool is_valid_page_size(size_t bytes);
static size_t page_size_for_alignment(size_t alignment);
@@ -191,8 +182,6 @@ class Solaris {
static void libthread_init();
static void synchronization_init();
static bool liblgrp_init();
- // Load miscellaneous symbols.
- static void misc_sym_init();
// This boolean allows users to forward their own non-matching signals
// to JVM_handle_solaris_signal, harmlessly.
static bool signal_handlers_are_installed;
@@ -272,17 +261,6 @@ class Solaris {
}
static lgrp_cookie_t lgrp_cookie() { return _lgrp_cookie; }
- static bool supports_getisax() { return _getisax != NULL; }
- static uint_t getisax(uint32_t* array, uint_t n);
-
- static void set_meminfo(meminfo_func_t func) { _meminfo = func; }
- static int meminfo (const uint64_t inaddr[], int addr_count,
- const uint_t info_req[], int info_count,
- uint64_t outdata[], uint_t validity[]) {
- return _meminfo != NULL ? _meminfo(inaddr, addr_count, info_req, info_count,
- outdata, validity) : -1;
- }
-
static sigset_t* unblocked_signals();
static sigset_t* vm_signals();
static sigset_t* allowdebug_blocked_signals();
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index 5af74d3668f..d27e502ccc1 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -784,7 +784,7 @@ void os::set_native_thread_name(const char *name) {
__try {
RaiseException (MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info );
- } __except(EXCEPTION_CONTINUE_EXECUTION) {}
+ } __except(EXCEPTION_EXECUTE_HANDLER) {}
}
bool os::distribute_processes(uint length, uint* distribution) {
diff --git a/hotspot/src/os/windows/vm/perfMemory_windows.cpp b/hotspot/src/os/windows/vm/perfMemory_windows.cpp
index 5ef9f9b6a8c..582d2c75606 100644
--- a/hotspot/src/os/windows/vm/perfMemory_windows.cpp
+++ b/hotspot/src/os/windows/vm/perfMemory_windows.cpp
@@ -1404,12 +1404,14 @@ static HANDLE open_sharedmem_object(const char* objectname, DWORD ofm_access, TR
objectname); /* name for object */
if (fmh == NULL) {
+ DWORD lasterror = GetLastError();
if (PrintMiscellaneous && Verbose) {
warning("OpenFileMapping failed for shared memory object %s:"
- " lasterror = %d\n", objectname, GetLastError());
+ " lasterror = %d\n", objectname, lasterror);
}
- THROW_MSG_(vmSymbols::java_lang_Exception(),
- "Could not open PerfMemory", INVALID_HANDLE_VALUE);
+ THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
+ err_msg("Could not open PerfMemory, error %d", lasterror),
+ INVALID_HANDLE_VALUE);
}
return fmh;;
diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp
index def37cd0b63..04c33ff69ed 100644
--- a/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp
@@ -343,8 +343,15 @@ public:
#define _SC_L2CACHE_LINESZ 527 /* Size of L2 cache line */
#endif
+// Hardware capability bits that appeared after Solaris 11.1
+#ifndef AV_SPARC_FMAF
+#define AV_SPARC_FMAF 0x00000100 /* Fused Multiply-Add */
+#endif
+#ifndef AV2_SPARC_SPARC5
+#define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */
+#endif
+
int VM_Version::platform_features(int features) {
- assert(os::Solaris::supports_getisax(), "getisax() must be available");
// Check 32-bit architecture.
if (Sysinfo(SI_ARCHITECTURE_32).match("sparc")) {
@@ -357,119 +364,75 @@ int VM_Version::platform_features(int features) {
}
// Extract valid instruction set extensions.
- uint_t avs[2];
- uint_t avn = os::Solaris::getisax(avs, 2);
- assert(avn <= 2, "should return two or less av's");
- uint_t av = avs[0];
+ uint_t avs[AV_HW2_IDX + 1];
+ uint_t avn = getisax(avs, ARRAY_SIZE(avs));
- log_info(os, cpu)("getisax(2) returned: " PTR32_FORMAT, av);
- if (avn > 1) {
- log_info(os, cpu)(" " PTR32_FORMAT, avs[1]);
+ log_info(os, cpu)("getisax(2) returned %d words:", avn);
+ for (int i = 0; i < avn; i++) {
+ log_info(os, cpu)(" word %d: " PTR32_FORMAT, i, avs[i]);
}
- if (av & AV_SPARC_MUL32) features |= hardware_mul32_m;
- if (av & AV_SPARC_DIV32) features |= hardware_div32_m;
- if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m;
- if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m;
- if (av & AV_SPARC_POPC) features |= hardware_popc_m;
- if (av & AV_SPARC_VIS) features |= vis1_instructions_m;
- if (av & AV_SPARC_VIS2) features |= vis2_instructions_m;
- if (avn > 1) {
- uint_t av2 = avs[1];
-#ifndef AV2_SPARC_SPARC5
-#define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */
-#endif
- if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m;
+ uint_t av1 = avs[AV_HW1_IDX];
+ if (av1 & AV_SPARC_MUL32) features |= hardware_mul32_m;
+ if (av1 & AV_SPARC_DIV32) features |= hardware_div32_m;
+ if (av1 & AV_SPARC_FSMULD) features |= hardware_fsmuld_m;
+ if (av1 & AV_SPARC_V8PLUS) features |= v9_instructions_m;
+ if (av1 & AV_SPARC_POPC) features |= hardware_popc_m;
+ if (av1 & AV_SPARC_VIS) features |= vis1_instructions_m;
+ if (av1 & AV_SPARC_VIS2) features |= vis2_instructions_m;
+ if (av1 & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
+ if (av1 & AV_SPARC_FMAF) features |= fmaf_instructions_m;
+ if (av1 & AV_SPARC_VIS3) features |= vis3_instructions_m;
+ if (av1 & AV_SPARC_CBCOND) features |= cbcond_instructions_m;
+ if (av1 & AV_SPARC_CRC32C) features |= crc32c_instruction_m;
+ if (av1 & AV_SPARC_AES) features |= aes_instructions_m;
+ if (av1 & AV_SPARC_SHA1) features |= sha1_instruction_m;
+ if (av1 & AV_SPARC_SHA256) features |= sha256_instruction_m;
+ if (av1 & AV_SPARC_SHA512) features |= sha512_instruction_m;
+
+ if (avn > AV_HW2_IDX) {
+ uint_t av2 = avs[AV_HW2_IDX];
+ if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m;
}
- // We only build on Solaris 10 and up, but some of the values below
- // are not defined on all versions of Solaris 10, so we define them,
- // if necessary.
-#ifndef AV_SPARC_ASI_BLK_INIT
-#define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */
-#endif
- if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
-
-#ifndef AV_SPARC_FMAF
-#define AV_SPARC_FMAF 0x0100 /* Fused Multiply-Add */
-#endif
- if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m;
-
-#ifndef AV_SPARC_FMAU
-#define AV_SPARC_FMAU 0x0200 /* Unfused Multiply-Add */
-#endif
- if (av & AV_SPARC_FMAU) features |= fmau_instructions_m;
-
-#ifndef AV_SPARC_VIS3
-#define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */
-#endif
- if (av & AV_SPARC_VIS3) features |= vis3_instructions_m;
-
-#ifndef AV_SPARC_CBCOND
-#define AV_SPARC_CBCOND 0x10000000 /* compare and branch instrs supported */
-#endif
- if (av & AV_SPARC_CBCOND) features |= cbcond_instructions_m;
-
-#ifndef AV_SPARC_CRC32C
-#define AV_SPARC_CRC32C 0x20000000 /* crc32c instruction supported */
-#endif
- if (av & AV_SPARC_CRC32C) features |= crc32c_instruction_m;
-
-#ifndef AV_SPARC_AES
-#define AV_SPARC_AES 0x00020000 /* aes instrs supported */
-#endif
- if (av & AV_SPARC_AES) features |= aes_instructions_m;
-
-#ifndef AV_SPARC_SHA1
-#define AV_SPARC_SHA1 0x00400000 /* sha1 instruction supported */
-#endif
- if (av & AV_SPARC_SHA1) features |= sha1_instruction_m;
-
-#ifndef AV_SPARC_SHA256
-#define AV_SPARC_SHA256 0x00800000 /* sha256 instruction supported */
-#endif
- if (av & AV_SPARC_SHA256) features |= sha256_instruction_m;
-
-#ifndef AV_SPARC_SHA512
-#define AV_SPARC_SHA512 0x01000000 /* sha512 instruction supported */
-#endif
- if (av & AV_SPARC_SHA512) features |= sha512_instruction_m;
-
// Determine the machine type.
if (Sysinfo(SI_MACHINE).match("sun4v")) {
features |= sun4v_m;
}
- bool use_solaris_12_api = false;
- Sysinfo impl(SI_CPUBRAND);
- if (impl.valid()) {
- // If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
- // is available to us as well
- use_solaris_12_api = true;
- features |= parse_features(impl.value());
+ // If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes
+ // is available to us as well
+ Sysinfo cpu_info(SI_CPUBRAND);
+ bool use_solaris_12_api = cpu_info.valid();
+ const char* impl;
+ int impl_m = 0;
+ if (use_solaris_12_api) {
+ impl = cpu_info.value();
+ log_info(os, cpu)("Parsing CPU implementation from %s", impl);
+ impl_m = parse_features(impl);
} else {
// Otherwise use kstat to determine the machine type.
kstat_ctl_t* kc = kstat_open();
- kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
- const char* implementation;
- bool has_implementation = false;
- if (ksp != NULL) {
- if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
- kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
- for (int i = 0; i < ksp->ks_ndata; i++) {
- if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
- implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
- has_implementation = true;
- log_info(os, cpu)("cpu_info.implementation: %s", implementation);
- features |= parse_features(implementation);
- break;
+ if (kc != NULL) {
+ kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
+ if (ksp != NULL) {
+ if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
+ kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
+ for (int i = 0; i < ksp->ks_ndata; i++) {
+ if (strcmp((const char*)&(knm[i].name), "implementation") == 0) {
+ impl = KSTAT_NAMED_STR_PTR(&knm[i]);
+ log_info(os, cpu)("Parsing CPU implementation from %s", impl);
+ impl_m = parse_features(impl);
+ break;
+ }
}
- } // for(
+ }
}
+ kstat_close(kc);
}
- assert(has_implementation, "unknown cpu info (changed kstat interface?)");
- kstat_close(kc);
}
+ assert(impl_m != 0, "Unknown CPU implementation %s", impl);
+ features |= impl_m;
bool is_sun4v = (features & sun4v_m) != 0;
if (use_solaris_12_api && is_sun4v) {
diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp
index 120b68e39a7..ec4d7d8a44b 100644
--- a/hotspot/src/share/vm/asm/assembler.cpp
+++ b/hotspot/src/share/vm/asm/assembler.cpp
@@ -153,6 +153,8 @@ void AbstractAssembler::generate_stack_overflow_check(int frame_size_in_bytes) {
void Label::add_patch_at(CodeBuffer* cb, int branch_loc) {
assert(_loc == -1, "Label is unbound");
+ // Don't add patch locations during scratch emit.
+ if (cb->insts()->scratch_emit()) { return; }
if (_patch_index < PatchCacheSize) {
_patches[_patch_index] = branch_loc;
} else {
diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp
index c3fba978d66..bd9d8dae97a 100644
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp
@@ -331,6 +331,8 @@ void CodeSection::relocate(address at, relocInfo::relocType rtype, int format, j
}
void CodeSection::relocate(address at, RelocationHolder const& spec, int format) {
+ // Do not relocate in scratch buffers.
+ if (scratch_emit()) { return; }
Relocation* reloc = spec.reloc();
relocInfo::relocType rtype = (relocInfo::relocType) reloc->type();
if (rtype == relocInfo::none) return;
diff --git a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp
index a6c0e848216..f33ffdaede9 100644
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp
@@ -92,6 +92,7 @@ class CodeSection VALUE_OBJ_CLASS_SPEC {
address _locs_point; // last relocated position (grows upward)
bool _locs_own; // did I allocate the locs myself?
bool _frozen; // no more expansion of this section
+ bool _scratch_emit; // Buffer is used for scratch emit, don't relocate.
char _index; // my section number (SECT_INST, etc.)
CodeBuffer* _outer; // enclosing CodeBuffer
@@ -108,6 +109,7 @@ class CodeSection VALUE_OBJ_CLASS_SPEC {
_locs_point = NULL;
_locs_own = false;
_frozen = false;
+ _scratch_emit = false;
debug_only(_index = (char)-1);
debug_only(_outer = (CodeBuffer*)badAddress);
}
@@ -166,6 +168,10 @@ class CodeSection VALUE_OBJ_CLASS_SPEC {
bool is_frozen() const { return _frozen; }
bool has_locs() const { return _locs_end != NULL; }
+ // Mark scratch buffer.
+ void set_scratch_emit() { _scratch_emit = true; }
+ bool scratch_emit() { return _scratch_emit; }
+
CodeBuffer* outer() const { return _outer; }
// is a given address in this section? (2nd version is end-inclusive)
diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
index e25e81fdd04..b71a0b5ed10 100644
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
@@ -1493,6 +1493,21 @@ void GraphBuilder::method_return(Value x, bool ignore_return) {
// Check to see whether we are inlining. If so, Return
// instructions become Gotos to the continuation point.
if (continuation() != NULL) {
+
+ int invoke_bci = state()->caller_state()->bci();
+
+ if (x != NULL && !ignore_return) {
+ ciMethod* caller = state()->scope()->caller()->method();
+ Bytecodes::Code invoke_raw_bc = caller->raw_code_at_bci(invoke_bci);
+ if (invoke_raw_bc == Bytecodes::_invokehandle || invoke_raw_bc == Bytecodes::_invokedynamic) {
+ ciType* declared_ret_type = caller->get_declared_signature_at_bci(invoke_bci)->return_type();
+ if (declared_ret_type->is_klass() && x->exact_type() == NULL &&
+ x->declared_type() != declared_ret_type && declared_ret_type != compilation()->env()->Object_klass()) {
+ x = append(new TypeCast(declared_ret_type->as_klass(), x, copy_state_before()));
+ }
+ }
+ }
+
assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
if (compilation()->env()->dtrace_method_probes()) {
@@ -1516,7 +1531,6 @@ void GraphBuilder::method_return(Value x, bool ignore_return) {
// State at end of inlined method is the state of the caller
// without the method parameters on stack, including the
// return value, if any, of the inlined method on operand stack.
- int invoke_bci = state()->caller_state()->bci();
set_state(state()->caller_state()->copy_for_parsing());
if (x != NULL) {
if (!ignore_return) {
@@ -1929,7 +1943,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
// number of implementors for decl_interface is 0 or 1. If
// it's 0 then no class implements decl_interface and there's
// no point in inlining.
- if (!holder->is_loaded() || decl_interface->nof_implementors() != 1 || decl_interface->has_default_methods()) {
+ if (!holder->is_loaded() || decl_interface->nof_implementors() != 1 || decl_interface->has_nonstatic_concrete_methods()) {
singleton = NULL;
}
}
@@ -4308,7 +4322,7 @@ void GraphBuilder::print_stats() {
void GraphBuilder::profile_call(ciMethod* callee, Value recv, ciKlass* known_holder, Values* obj_args, bool inlined) {
assert(known_holder == NULL || (known_holder->is_instance_klass() &&
(!known_holder->is_interface() ||
- ((ciInstanceKlass*)known_holder)->has_default_methods())), "should be default method");
+ ((ciInstanceKlass*)known_holder)->has_nonstatic_concrete_methods())), "should be non-static concrete method");
if (known_holder != NULL) {
if (known_holder->exact_klass() == NULL) {
known_holder = compilation()->cha_exact_type(known_holder);
diff --git a/hotspot/src/share/vm/c1/c1_Instruction.cpp b/hotspot/src/share/vm/c1/c1_Instruction.cpp
index ffb439d1150..172c46106da 100644
--- a/hotspot/src/share/vm/c1/c1_Instruction.cpp
+++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp
@@ -360,7 +360,8 @@ void Invoke::state_values_do(ValueVisitor* f) {
}
ciType* Invoke::declared_type() const {
- ciType *t = _target->signature()->return_type();
+ ciSignature* declared_signature = state()->scope()->method()->get_declared_signature_at_bci(state()->bci());
+ ciType *t = declared_signature->return_type();
assert(t->basic_type() != T_VOID, "need return value of void method?");
return t;
}
diff --git a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp
index dbb3b31a741..b8133ab754e 100644
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp
@@ -58,7 +58,7 @@ ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) :
_init_state = ik->init_state();
_nonstatic_field_size = ik->nonstatic_field_size();
_has_nonstatic_fields = ik->has_nonstatic_fields();
- _has_default_methods = ik->has_default_methods();
+ _has_nonstatic_concrete_methods = ik->has_nonstatic_concrete_methods();
_is_anonymous = ik->is_anonymous();
_nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
_has_injected_fields = -1;
diff --git a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp
index d55d272842d..1215c089ff4 100644
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@ private:
bool _has_finalizer;
bool _has_subklass;
bool _has_nonstatic_fields;
- bool _has_default_methods;
+ bool _has_nonstatic_concrete_methods;
bool _is_anonymous;
ciFlags _flags;
@@ -174,9 +174,9 @@ public:
return 2;
}
}
- bool has_default_methods() {
+ bool has_nonstatic_concrete_methods() {
assert(is_loaded(), "must be loaded");
- return _has_default_methods;
+ return _has_nonstatic_concrete_methods;
}
bool is_anonymous() {
diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp
index 94e6ac523c7..2580f40f3ea 100644
--- a/hotspot/src/share/vm/ci/ciMethod.hpp
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp
@@ -256,6 +256,14 @@ class ciMethod : public ciMetadata {
return get_method_at_bci(bci, ignored_will_link, &ignored_declared_signature);
}
+ ciSignature* get_declared_signature_at_bci(int bci) {
+ bool ignored_will_link;
+ ciSignature* declared_signature;
+ get_method_at_bci(bci, ignored_will_link, &declared_signature);
+ assert(declared_signature != NULL, "cannot be null");
+ return declared_signature;
+ }
+
// Given a certain calling environment, find the monomorphic target
// for the call. Return NULL if the call is not monomorphic in
// its calling environment.
diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index 9daa5e38769..22f18286c74 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -798,11 +798,11 @@ static bool put_after_lookup(const Symbol* name, const Symbol* sig, NameSigHash*
void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
const int itfs_len,
ConstantPool* const cp,
- bool* const has_default_methods,
+ bool* const has_nonstatic_concrete_methods,
TRAPS) {
assert(stream != NULL, "invariant");
assert(cp != NULL, "invariant");
- assert(has_default_methods != NULL, "invariant");
+ assert(has_nonstatic_concrete_methods != NULL, "invariant");
if (itfs_len == 0) {
_local_interfaces = Universe::the_empty_klass_array();
@@ -844,8 +844,8 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
"Implementing class");
}
- if (InstanceKlass::cast(interf())->has_default_methods()) {
- *has_default_methods = true;
+ if (InstanceKlass::cast(interf())->has_nonstatic_concrete_methods()) {
+ *has_nonstatic_concrete_methods = true;
}
_local_interfaces->at_put(index, interf());
}
@@ -2830,12 +2830,12 @@ void ClassFileParser::parse_methods(const ClassFileStream* const cfs,
bool is_interface,
AccessFlags* promoted_flags,
bool* has_final_method,
- bool* declares_default_methods,
+ bool* declares_nonstatic_concrete_methods,
TRAPS) {
assert(cfs != NULL, "invariant");
assert(promoted_flags != NULL, "invariant");
assert(has_final_method != NULL, "invariant");
- assert(declares_default_methods != NULL, "invariant");
+ assert(declares_nonstatic_concrete_methods != NULL, "invariant");
assert(NULL == _methods, "invariant");
@@ -2860,11 +2860,11 @@ void ClassFileParser::parse_methods(const ClassFileStream* const cfs,
if (method->is_final()) {
*has_final_method = true;
}
- // declares_default_methods: declares concrete instance methods, any access flags
+ // declares_nonstatic_concrete_methods: declares concrete instance methods, any access flags
// used for interface initialization, and default method inheritance analysis
- if (is_interface && !(*declares_default_methods)
+ if (is_interface && !(*declares_nonstatic_concrete_methods)
&& !method->is_abstract() && !method->is_static()) {
- *declares_default_methods = true;
+ *declares_nonstatic_concrete_methods = true;
}
_methods->at_put(index, method);
}
@@ -5250,8 +5250,8 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
ik->set_minor_version(_minor_version);
ik->set_major_version(_major_version);
- ik->set_has_default_methods(_has_default_methods);
- ik->set_declares_default_methods(_declares_default_methods);
+ ik->set_has_nonstatic_concrete_methods(_has_nonstatic_concrete_methods);
+ ik->set_declares_nonstatic_concrete_methods(_declares_nonstatic_concrete_methods);
if (_host_klass != NULL) {
assert (ik->is_anonymous(), "should be the same");
@@ -5311,12 +5311,9 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
// check if this class overrides any final method
check_final_method_override(ik, CHECK);
- // check that if this class is an interface then it doesn't have static methods
- if (ik->is_interface()) {
- /* An interface in a JAVA 8 classfile can be static */
- if (_major_version < JAVA_8_VERSION) {
- check_illegal_static_method(ik, CHECK);
- }
+ // reject static interface methods prior to Java 8
+ if (ik->is_interface() && _major_version < JAVA_8_VERSION) {
+ check_illegal_static_method(ik, CHECK);
}
// Obtain this_klass' module entry
@@ -5336,9 +5333,9 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa
assert(_all_mirandas != NULL, "invariant");
- // Generate any default methods - default methods are interface methods
- // that have a default implementation. This is new with Lambda project.
- if (_has_default_methods ) {
+ // Generate any default methods - default methods are public interface methods
+ // that have a default implementation. This is new with Java 8.
+ if (_has_nonstatic_concrete_methods) {
DefaultMethods::generate_default_methods(ik,
_all_mirandas,
CHECK);
@@ -5523,8 +5520,8 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
_java_fields_count(0),
_need_verify(false),
_relax_verify(false),
- _has_default_methods(false),
- _declares_default_methods(false),
+ _has_nonstatic_concrete_methods(false),
+ _declares_nonstatic_concrete_methods(false),
_has_final_method(false),
_has_finalizer(false),
_has_empty_finalizer(false),
@@ -5778,9 +5775,22 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
// Anonymous classes such as generated LambdaForm classes are also not included.
if (SystemDictionaryShared::is_sharing_possible(_loader_data) &&
_host_klass == NULL) {
+ oop class_loader = _loader_data->class_loader();
ResourceMark rm(THREAD);
- classlist_file->print_cr("%s", _class_name->as_C_string());
- classlist_file->flush();
+ // For the boot and platform class loaders, check if the class is not found in the
+ // java runtime image. Additional check for the boot class loader is if the class
+ // is not found in the boot loader's appended entries. This indicates that the class
+ // is not useable during run time, such as the ones found in the --patch-module entries,
+ // so it should not be included in the classlist file.
+ if (((class_loader == NULL && !ClassLoader::contains_append_entry(stream->source())) ||
+ SystemDictionary::is_platform_class_loader(class_loader)) &&
+ !ClassLoader::is_jrt(stream->source())) {
+ tty->print_cr("skip writing class %s from source %s to classlist file",
+ _class_name->as_C_string(), stream->source());
+ } else {
+ classlist_file->print_cr("%s", _class_name->as_C_string());
+ classlist_file->flush();
+ }
}
}
#endif
@@ -5798,7 +5808,7 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
parse_interfaces(stream,
_itfs_len,
cp,
- &_has_default_methods,
+ &_has_nonstatic_concrete_methods,
CHECK);
assert(_local_interfaces != NULL, "invariant");
@@ -5821,7 +5831,7 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
_access_flags.is_interface(),
&promoted_flags,
&_has_final_method,
- &_declares_default_methods,
+ &_declares_nonstatic_concrete_methods,
CHECK);
assert(_methods != NULL, "invariant");
@@ -5829,8 +5839,8 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream,
// promote flags from parse_methods() to the klass' flags
_access_flags.add_promoted_flags(promoted_flags.as_int());
- if (_declares_default_methods) {
- _has_default_methods = true;
+ if (_declares_nonstatic_concrete_methods) {
+ _has_nonstatic_concrete_methods = true;
}
// Additional attributes/annotations
@@ -5884,8 +5894,8 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
}
if (_super_klass != NULL) {
- if (_super_klass->has_default_methods()) {
- _has_default_methods = true;
+ if (_super_klass->has_nonstatic_concrete_methods()) {
+ _has_nonstatic_concrete_methods = true;
}
if (_super_klass->is_interface()) {
diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp
index 8cc820a450a..ad62052e904 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp
@@ -139,8 +139,8 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
bool _need_verify;
bool _relax_verify;
- bool _has_default_methods;
- bool _declares_default_methods;
+ bool _has_nonstatic_concrete_methods;
+ bool _declares_nonstatic_concrete_methods;
bool _has_final_method;
// precomputed flags
@@ -186,7 +186,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
void parse_interfaces(const ClassFileStream* const stream,
const int itfs_len,
ConstantPool* const cp,
- bool* has_default_methods,
+ bool* has_nonstatic_concrete_methods,
TRAPS);
const InstanceKlass* parse_super_class(ConstantPool* const cp,
@@ -224,7 +224,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
bool is_interface,
AccessFlags* const promoted_flags,
bool* const has_final_method,
- bool* const declares_default_methods,
+ bool* const declares_nonstatic_concrete_methods,
TRAPS);
const u2* parse_exception_table(const ClassFileStream* const stream,
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 46847f67644..a7e2222fe4d 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -81,7 +81,6 @@ typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
typedef void (JNICALL *ZipClose_t)(jzfile *zip);
typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *sizeP, jint *nameLen);
typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
-typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
@@ -91,7 +90,6 @@ static ZipOpen_t ZipOpen = NULL;
static ZipClose_t ZipClose = NULL;
static FindEntry_t FindEntry = NULL;
static ReadEntry_t ReadEntry = NULL;
-static ReadMappedEntry_t ReadMappedEntry = NULL;
static GetNextEntry_t GetNextEntry = NULL;
static canonicalize_fn_t CanonicalizeEntry = NULL;
static ZipInflateFully_t ZipInflateFully = NULL;
@@ -353,15 +351,10 @@ u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_ter
filename = NEW_RESOURCE_ARRAY(char, name_len + 1);
}
- // file found, get pointer to the entry in mmapped jar file.
- if (ReadMappedEntry == NULL ||
- !(*ReadMappedEntry)(_zip, entry, &buffer, filename)) {
- // mmapped access not available, perhaps due to compression,
- // read contents into resource array
- int size = (*filesize) + ((nul_terminate) ? 1 : 0);
- buffer = NEW_RESOURCE_ARRAY(u1, size);
- if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL;
- }
+ // read contents into resource array
+ int size = (*filesize) + ((nul_terminate) ? 1 : 0);
+ buffer = NEW_RESOURCE_ARRAY(u1, size);
+ if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL;
// return result
if (nul_terminate) {
@@ -952,11 +945,11 @@ ClassPathZipEntry* ClassLoader::create_class_path_zip_entry(const char *path, bo
}
// returns true if entry already on class path
-bool ClassLoader::contains_entry(ClassPathEntry *entry) {
+bool ClassLoader::contains_append_entry(const char* name) {
ClassPathEntry* e = _first_append_entry;
while (e != NULL) {
// assume zip entries have been canonicalized
- if (strcmp(entry->name(), e->name()) == 0) {
+ if (strcmp(name, e->name()) == 0) {
return true;
}
e = e->next();
@@ -998,7 +991,7 @@ bool ClassLoader::update_class_path_entry_list(const char *path,
// Do not reorder the bootclasspath which would break get_system_package().
// Add new entry to linked list
- if (!check_for_duplicates || !contains_entry(new_entry)) {
+ if (!check_for_duplicates || !contains_append_entry(new_entry->name())) {
ClassLoaderExt::add_class_path_entry(path, check_for_duplicates, new_entry);
}
return true;
@@ -1079,7 +1072,6 @@ void ClassLoader::load_zip_library() {
ZipClose = CAST_TO_FN_PTR(ZipClose_t, os::dll_lookup(handle, "ZIP_Close"));
FindEntry = CAST_TO_FN_PTR(FindEntry_t, os::dll_lookup(handle, "ZIP_FindEntry"));
ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
- ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
@@ -2049,7 +2041,6 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
if (nm != NULL && !m->is_method_handle_intrinsic()) {
// Throw out the code so that the code cache doesn't fill up
nm->make_not_entrant();
- m->clear_code();
}
CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization,
methodHandle(), 0, CompileTask::Reason_CTW, THREAD);
@@ -2068,7 +2059,6 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
if (nm != NULL && !m->is_method_handle_intrinsic()) {
// Throw out the code so that the code cache doesn't fill up
nm->make_not_entrant();
- m->clear_code();
}
}
}
diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp
index 8e7811af1b1..1bdbd7025b8 100644
--- a/hotspot/src/share/vm/classfile/classLoader.hpp
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp
@@ -451,7 +451,7 @@ class ClassLoader: AllStatic {
static void set_first_append_entry(ClassPathEntry* entry);
// indicates if class path already contains a entry (exact match by name)
- static bool contains_entry(ClassPathEntry* entry);
+ static bool contains_append_entry(const char* name);
// adds a class path list
static void add_to_list(ClassPathEntry* new_entry);
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp
index 9dea595e3aa..7beff8953f3 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp
@@ -639,7 +639,6 @@ const char* ClassLoaderData::loader_name() {
#undef CLD_DUMP_KLASSES
void ClassLoaderData::dump(outputStream * const out) {
- ResourceMark rm;
out->print("ClassLoaderData CLD: " PTR_FORMAT ", loader: " PTR_FORMAT ", loader_klass: " PTR_FORMAT " %s {",
p2i(this), p2i((void *)class_loader()),
p2i(class_loader() != NULL ? class_loader()->klass() : NULL), loader_name());
@@ -656,7 +655,6 @@ void ClassLoaderData::dump(outputStream * const out) {
#ifdef CLD_DUMP_KLASSES
if (Verbose) {
- ResourceMark rm;
Klass* k = _klasses;
while (k != NULL) {
out->print_cr("klass " PTR_FORMAT ", %s, CT: %d, MUT: %d", k, k->name()->as_C_string(),
diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp
index 1b8cf3084ed..b9e6afcaf01 100644
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -914,7 +914,7 @@ static void create_defaults_and_exceptions(
BytecodeBuffer buffer;
if (log_is_enabled(Debug, defaultmethods)) {
- ResourceMark rm;
+ ResourceMark rm(THREAD);
outputStream* logstream = Log(defaultmethods)::debug_stream();
logstream->print("for slot: ");
slot->print_on(logstream);
@@ -929,6 +929,7 @@ static void create_defaults_and_exceptions(
if (method->has_target()) {
Method* selected = method->get_selected_target();
if (selected->method_holder()->is_interface()) {
+ assert(!selected->is_private(), "pushing private interface method as default");
defaults.push(selected);
}
} else if (method->throws_exception()) {
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index eac3f934276..df8cfd821de 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -780,19 +780,26 @@ void java_lang_Class::set_mirror_module_field(KlassHandle k, Handle mirror, Hand
// Put the class on the fixup_module_list to patch later when the java.lang.reflect.Module
// for java.base is known.
assert(!Universe::is_module_initialized(), "Incorrect java.lang.reflect.Module pre module system initialization");
- MutexLocker m1(Module_lock, THREAD);
- // Keep list of classes needing java.base module fixup
- if (!ModuleEntryTable::javabase_defined()) {
- if (fixup_module_field_list() == NULL) {
- GrowableArray* list =
- new (ResourceObj::C_HEAP, mtModule) GrowableArray(500, true);
- set_fixup_module_field_list(list);
+
+ bool javabase_was_defined = false;
+ {
+ MutexLocker m1(Module_lock, THREAD);
+ // Keep list of classes needing java.base module fixup
+ if (!ModuleEntryTable::javabase_defined()) {
+ if (fixup_module_field_list() == NULL) {
+ GrowableArray* list =
+ new (ResourceObj::C_HEAP, mtModule) GrowableArray(500, true);
+ set_fixup_module_field_list(list);
+ }
+ k->class_loader_data()->inc_keep_alive();
+ fixup_module_field_list()->push(k());
+ } else {
+ javabase_was_defined = true;
}
- k->class_loader_data()->inc_keep_alive();
- fixup_module_field_list()->push(k());
- } else {
- // java.base was defined at some point between calling create_mirror()
- // and obtaining the Module_lock, patch this particular class with java.base.
+ }
+
+ // If java.base was already defined then patch this particular class with java.base.
+ if (javabase_was_defined) {
ModuleEntry *javabase_entry = ModuleEntryTable::javabase_moduleEntry();
assert(javabase_entry != NULL && javabase_entry->module() != NULL,
"Setting class module field, java.base should be defined");
diff --git a/hotspot/src/share/vm/classfile/klassFactory.cpp b/hotspot/src/share/vm/classfile/klassFactory.cpp
index 0c95ac7907d..9b9507e418c 100644
--- a/hotspot/src/share/vm/classfile/klassFactory.cpp
+++ b/hotspot/src/share/vm/classfile/klassFactory.cpp
@@ -74,7 +74,7 @@ instanceKlassHandle KlassFactory::check_shared_class_file_load_hook(
(SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
ClassFileStream* stream = new ClassFileStream(ptr,
end_ptr - ptr,
- ent->_name,
+ ent == NULL ? NULL : ent->_name,
ClassFileStream::verify);
ClassFileParser parser(stream,
class_name,
diff --git a/hotspot/src/share/vm/classfile/moduleEntry.cpp b/hotspot/src/share/vm/classfile/moduleEntry.cpp
index 2be85c2ebd8..f400f9c9b8a 100644
--- a/hotspot/src/share/vm/classfile/moduleEntry.cpp
+++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp
@@ -368,9 +368,6 @@ void ModuleEntryTable::finalize_javabase(Handle module_handle, Symbol* version,
// Store pointer to the ModuleEntry for java.base in the java.lang.reflect.Module object.
java_lang_reflect_Module::set_module_entry(module_handle(), jb_module);
-
- // Patch any previously loaded classes' module field with java.base's java.lang.reflect.Module.
- patch_javabase_entries(module_handle);
}
// Within java.lang.Class instances there is a java.lang.reflect.Module field
@@ -378,7 +375,6 @@ void ModuleEntryTable::finalize_javabase(Handle module_handle, Symbol* version,
// definition, classes needing their module field set are added to the fixup_module_list.
// Their module field is set once java.base's java.lang.reflect.Module is known to the VM.
void ModuleEntryTable::patch_javabase_entries(Handle module_handle) {
- assert(Module_lock->owned_by_self(), "should have the Module_lock");
if (module_handle.is_null()) {
fatal("Unable to patch the module field of classes loaded prior to java.base's definition, invalid java.lang.reflect.Module");
}
diff --git a/hotspot/src/share/vm/classfile/modules.cpp b/hotspot/src/share/vm/classfile/modules.cpp
index f7b15b141d7..a4cdacc6035 100644
--- a/hotspot/src/share/vm/classfile/modules.cpp
+++ b/hotspot/src/share/vm/classfile/modules.cpp
@@ -244,6 +244,12 @@ static void define_javabase_module(jobject module, jstring version,
"Module java.base is already defined");
}
+ // Only the thread that actually defined the base module will get here,
+ // so no locking is needed.
+
+ // Patch any previously loaded class's module field with java.base's java.lang.reflect.Module.
+ ModuleEntryTable::patch_javabase_entries(module_handle);
+
log_debug(modules)("define_javabase_module(): Definition of module: java.base,"
" version: %s, location: %s, package #: %d",
module_version != NULL ? module_version : "NULL",
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index 02e1dbae6bc..f9a5835ad9d 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -1234,7 +1234,7 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
SharedClassPathEntry* ent =
(SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
if (!Universe::is_module_initialized()) {
- assert(ent->is_jrt(),
+ assert(ent != NULL && ent->is_jrt(),
"Loading non-bootstrap classes before the module system is initialized");
assert(class_loader.is_null(), "sanity");
return true;
@@ -1257,6 +1257,7 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
}
if (class_loader.is_null()) {
+ assert(ent != NULL, "Shared class for NULL classloader must have valid SharedClassPathEntry");
// The NULL classloader can load archived class originated from the
// "modules" jimage and the -Xbootclasspath/a. For class from the
// "modules" jimage, the PackageEntry/ModuleEntry must be defined
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp
index bf10995a578..4cd5e40ffa8 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp
@@ -226,7 +226,7 @@ class SystemDictionary : AllStatic {
WKID_LIMIT,
#if INCLUDE_JVMCI
- FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(HotSpotCompiledCode_klass),
+ FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(JVMCI_klass),
LAST_JVMCI_WKID = WK_KLASS_ENUM_NAME(Value_klass),
#endif
diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp
index db757f7faa0..70ee634e51e 100644
--- a/hotspot/src/share/vm/code/nmethod.cpp
+++ b/hotspot/src/share/vm/code/nmethod.cpp
@@ -1252,7 +1252,7 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
if (method() != NULL && (method()->code() == this ||
method()->from_compiled_entry() == verified_entry_point())) {
HandleMark hm;
- method()->clear_code();
+ method()->clear_code(false /* already owns Patching_lock */);
}
} // leave critical region under Patching_lock
diff --git a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
index 77584314dcf..cb558729b94 100644
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
@@ -2340,13 +2340,11 @@ void CMSCollector::verify_after_remark_work_1() {
{
StrongRootsScope srs(1);
- gch->gen_process_roots(&srs,
- GenCollectedHeap::OldGen,
+ gch->cms_process_roots(&srs,
true, // young gen as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
- NULL,
NULL);
}
@@ -2414,13 +2412,11 @@ void CMSCollector::verify_after_remark_work_2() {
{
StrongRootsScope srs(1);
- gch->gen_process_roots(&srs,
- GenCollectedHeap::OldGen,
+ gch->cms_process_roots(&srs,
true, // young gen as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
- NULL,
&cld_closure);
}
@@ -2903,13 +2899,11 @@ void CMSCollector::checkpointRootsInitialWork() {
StrongRootsScope srs(1);
- gch->gen_process_roots(&srs,
- GenCollectedHeap::OldGen,
+ gch->cms_process_roots(&srs,
true, // young gen as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
¬Older,
- NULL,
&cld_closure);
}
}
@@ -4290,13 +4284,11 @@ void CMSParInitialMarkTask::work(uint worker_id) {
CLDToOopClosure cld_closure(&par_mri_cl, true);
- gch->gen_process_roots(_strong_roots_scope,
- GenCollectedHeap::OldGen,
+ gch->cms_process_roots(_strong_roots_scope,
false, // yg was scanned above
GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
_collector->should_unload_classes(),
&par_mri_cl,
- NULL,
&cld_closure);
assert(_collector->should_unload_classes()
|| (_collector->CMSCollector::roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache),
@@ -4421,13 +4413,11 @@ void CMSParRemarkTask::work(uint worker_id) {
// ---------- remaining roots --------------
_timer.reset();
_timer.start();
- gch->gen_process_roots(_strong_roots_scope,
- GenCollectedHeap::OldGen,
+ gch->cms_process_roots(_strong_roots_scope,
false, // yg was scanned above
GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
_collector->should_unload_classes(),
&par_mrias_cl,
- NULL,
NULL); // The dirty klasses will be handled below
assert(_collector->should_unload_classes()
@@ -4970,13 +4960,11 @@ void CMSCollector::do_remark_non_parallel() {
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
StrongRootsScope srs(1);
- gch->gen_process_roots(&srs,
- GenCollectedHeap::OldGen,
+ gch->cms_process_roots(&srs,
true, // young gen as roots
GenCollectedHeap::ScanningOption(roots_scanning_options()),
should_unload_classes(),
&mrias_cl,
- NULL,
NULL); // The dirty klasses will be handled below
assert(should_unload_classes()
diff --git a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp
index 78839d983f6..06466ed77e4 100644
--- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp
@@ -605,14 +605,10 @@ void ParNewGenTask::work(uint worker_id) {
false);
par_scan_state.start_strong_roots();
- gch->gen_process_roots(_strong_roots_scope,
- GenCollectedHeap::YoungGen,
- true, // Process younger gens, if any, as strong roots.
- GenCollectedHeap::SO_ScavengeCodeCache,
- GenCollectedHeap::StrongAndWeakRoots,
- &par_scan_state.to_space_root_closure(),
- &par_scan_state.older_gen_closure(),
- &cld_scan_closure);
+ gch->young_process_roots(_strong_roots_scope,
+ &par_scan_state.to_space_root_closure(),
+ &par_scan_state.older_gen_closure(),
+ &cld_scan_closure);
par_scan_state.end_strong_roots();
diff --git a/hotspot/src/share/vm/gc/g1/g1BiasedArray.cpp b/hotspot/src/share/vm/gc/g1/g1BiasedArray.cpp
index 002864dd64b..0d9a3caf4eb 100644
--- a/hotspot/src/share/vm/gc/g1/g1BiasedArray.cpp
+++ b/hotspot/src/share/vm/gc/g1/g1BiasedArray.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,99 +53,4 @@ void G1BiasedMappedArrayBase::verify_biased_index_inclusive_end(idx_t biased_ind
biased_index, bias(), length());
}
-class TestMappedArray : public G1BiasedMappedArray {
-protected:
- virtual int default_value() const { return 0xBAADBABE; }
-public:
- static void test_biasedarray() {
- const size_t REGION_SIZE_IN_WORDS = 512;
- const size_t NUM_REGIONS = 20;
- HeapWord* fake_heap = (HeapWord*)LP64_ONLY(0xBAAA00000) NOT_LP64(0xBA000000); // Any value that is non-zero
-
- TestMappedArray array;
- array.initialize(fake_heap, fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS,
- REGION_SIZE_IN_WORDS * HeapWordSize);
- // Check address calculation (bounds)
- assert(array.bottom_address_mapped() == fake_heap,
- "bottom mapped address should be " PTR_FORMAT ", but is " PTR_FORMAT, p2i(fake_heap), p2i(array.bottom_address_mapped()));
- assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be");
-
- int* bottom = array.address_mapped_to(fake_heap);
- assert((void*)bottom == (void*) array.base(), "must be");
- int* end = array.address_mapped_to(fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS);
- assert((void*)end == (void*)(array.base() + array.length()), "must be");
- // The entire array should contain default value elements
- for (int* current = bottom; current < end; current++) {
- assert(*current == array.default_value(), "must be");
- }
-
- // Test setting values in the table
-
- HeapWord* region_start_address = fake_heap + REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2);
- HeapWord* region_end_address = fake_heap + (REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2) + REGION_SIZE_IN_WORDS - 1);
-
- // Set/get by address tests: invert some value; first retrieve one
- int actual_value = array.get_by_index(NUM_REGIONS / 2);
- array.set_by_index(NUM_REGIONS / 2, ~actual_value);
- // Get the same value by address, should correspond to the start of the "region"
- int value = array.get_by_address(region_start_address);
- assert(value == ~actual_value, "must be");
- // Get the same value by address, at one HeapWord before the start
- value = array.get_by_address(region_start_address - 1);
- assert(value == array.default_value(), "must be");
- // Get the same value by address, at the end of the "region"
- value = array.get_by_address(region_end_address);
- assert(value == ~actual_value, "must be");
- // Make sure the next value maps to another index
- value = array.get_by_address(region_end_address + 1);
- assert(value == array.default_value(), "must be");
-
- // Reset the value in the array
- array.set_by_address(region_start_address + (region_end_address - region_start_address) / 2, actual_value);
-
- // The entire array should have the default value again
- for (int* current = bottom; current < end; current++) {
- assert(*current == array.default_value(), "must be");
- }
-
- // Set/get by index tests: invert some value
- idx_t index = NUM_REGIONS / 2;
- actual_value = array.get_by_index(index);
- array.set_by_index(index, ~actual_value);
-
- value = array.get_by_index(index);
- assert(value == ~actual_value, "must be");
-
- value = array.get_by_index(index - 1);
- assert(value == array.default_value(), "must be");
-
- value = array.get_by_index(index + 1);
- assert(value == array.default_value(), "must be");
-
- array.set_by_index(0, 0);
- value = array.get_by_index(0);
- assert(value == 0, "must be");
-
- array.set_by_index(array.length() - 1, 0);
- value = array.get_by_index(array.length() - 1);
- assert(value == 0, "must be");
-
- array.set_by_index(index, 0);
-
- // The array should have three zeros, and default values otherwise
- size_t num_zeros = 0;
- for (int* current = bottom; current < end; current++) {
- assert(*current == array.default_value() || *current == 0, "must be");
- if (*current == 0) {
- num_zeros++;
- }
- }
- assert(num_zeros == 3, "must be");
- }
-};
-
-void TestG1BiasedArray_test() {
- TestMappedArray::test_biasedarray();
-}
-
#endif
diff --git a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp
index 58801231438..57d08c9fa8e 100644
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp
@@ -648,15 +648,10 @@ void DefNewGeneration::collect(bool full,
// See: CardTableModRefBSForCTRS::non_clean_card_iterate_possibly_parallel.
StrongRootsScope srs(0);
- gch->gen_process_roots(&srs,
- GenCollectedHeap::YoungGen,
- true, // Process younger gens, if any,
- // as strong roots.
- GenCollectedHeap::SO_ScavengeCodeCache,
- GenCollectedHeap::StrongAndWeakRoots,
- &fsc_with_no_gc_barrier,
- &fsc_with_gc_barrier,
- &cld_scan_closure);
+ gch->young_process_roots(&srs,
+ &fsc_with_no_gc_barrier,
+ &fsc_with_gc_barrier,
+ &cld_scan_closure);
}
// "evacuate followers".
diff --git a/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp b/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp
index 9a3bb7e27de..1c02f41080b 100644
--- a/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp
+++ b/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp
@@ -196,14 +196,13 @@ void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
{
StrongRootsScope srs(1);
- gch->gen_process_roots(&srs,
- GenCollectedHeap::OldGen,
- false, // Younger gens are not roots.
- GenCollectedHeap::SO_None,
- ClassUnloading,
- &follow_root_closure,
- &follow_root_closure,
- &follow_cld_closure);
+ gch->full_process_roots(&srs,
+ false, // not the adjust phase
+ GenCollectedHeap::SO_None,
+ ClassUnloading, // only strong roots if ClassUnloading
+ // is enabled
+ &follow_root_closure,
+ &follow_cld_closure);
}
// Process reference objects found during marking
@@ -295,14 +294,12 @@ void GenMarkSweep::mark_sweep_phase3() {
{
StrongRootsScope srs(1);
- gch->gen_process_roots(&srs,
- GenCollectedHeap::OldGen,
- false, // Younger gens are not roots.
- GenCollectedHeap::SO_AllCodeCache,
- GenCollectedHeap::StrongAndWeakRoots,
- &adjust_pointer_closure,
- &adjust_pointer_closure,
- &adjust_cld_closure);
+ gch->full_process_roots(&srs,
+ true, // this is the adjust phase
+ GenCollectedHeap::SO_AllCodeCache,
+ false, // all roots
+ &adjust_pointer_closure,
+ &adjust_cld_closure);
}
gch->gen_process_weak_roots(&adjust_pointer_closure);
diff --git a/hotspot/src/share/vm/gc/shared/gcTraceTime.inline.hpp b/hotspot/src/share/vm/gc/shared/gcTraceTime.inline.hpp
index b324e60f1cc..4b9c4e1ba88 100644
--- a/hotspot/src/share/vm/gc/shared/gcTraceTime.inline.hpp
+++ b/hotspot/src/share/vm/gc/shared/gcTraceTime.inline.hpp
@@ -35,7 +35,6 @@
#include "prims/jni_md.h"
#include "utilities/ticks.hpp"
-#define LOG_STOP_TIME_FORMAT "(%.3fs, %.3fs) %.3fms"
#define LOG_STOP_HEAP_FORMAT SIZE_FORMAT "M->" SIZE_FORMAT "M(" SIZE_FORMAT "M)"
inline void GCTraceTimeImpl::log_start(jlong start_counter) {
@@ -46,7 +45,7 @@ inline void GCTraceTimeImpl::log_start(jlong start_counter) {
if (_gc_cause != GCCause::_no_gc) {
out.print(" (%s)", GCCause::to_string(_gc_cause));
}
- out.print_cr(" (%.3fs)", TimeHelper::counter_to_seconds(start_counter));
+ out.cr();
}
}
@@ -71,7 +70,7 @@ inline void GCTraceTimeImpl::log_stop(jlong start_counter, jlong stop_counter) {
out.print(" " LOG_STOP_HEAP_FORMAT, used_before_m, used_m, capacity_m);
}
- out.print_cr(" " LOG_STOP_TIME_FORMAT, start_time_in_secs, stop_time_in_secs, duration_in_ms);
+ out.print_cr(" %.3fms", duration_in_ms);
}
inline void GCTraceTimeImpl::time_stamp(Ticks& ticks) {
@@ -117,7 +116,7 @@ template ::GCTraceConcTimeImpl(const char* title) :
_enabled(LogImpl::is_level(Level)), _start_time(os::elapsed_counter()), _title(title) {
if (_enabled) {
- LogImpl::template write("%s (%.3fs)", _title, TimeHelper::counter_to_seconds(_start_time));
+ LogImpl::template write("%s", _title);
}
}
@@ -125,11 +124,8 @@ template ::~GCTraceConcTimeImpl() {
if (_enabled) {
jlong stop_time = os::elapsed_counter();
- LogImpl::template write("%s " LOG_STOP_TIME_FORMAT,
- _title,
- TimeHelper::counter_to_seconds(_start_time),
- TimeHelper::counter_to_seconds(stop_time),
- TimeHelper::counter_to_millis(stop_time - _start_time));
+ LogImpl::template write("%s %0.3fms", _title,
+ TimeHelper::counter_to_millis(stop_time - _start_time));
}
}
diff --git a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp
index b5cd1047beb..2b4a720093f 100644
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp
@@ -613,16 +613,6 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
SystemDictionary::roots_oops_do(strong_roots, weak_roots);
}
- // All threads execute the following. A specific chunk of buckets
- // from the StringTable are the individual tasks.
- if (weak_roots != NULL) {
- if (is_par) {
- StringTable::possibly_parallel_oops_do(weak_roots);
- } else {
- StringTable::oops_do(weak_roots);
- }
- }
-
if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) {
if (so & SO_ScavengeCodeCache) {
assert(code_roots != NULL, "must supply closure for code cache");
@@ -644,46 +634,82 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
}
}
-void GenCollectedHeap::gen_process_roots(StrongRootsScope* scope,
- GenerationType type,
+void GenCollectedHeap::process_string_table_roots(StrongRootsScope* scope,
+ OopClosure* root_closure) {
+ assert(root_closure != NULL, "Must be set");
+ // All threads execute the following. A specific chunk of buckets
+ // from the StringTable are the individual tasks.
+ if (scope->n_threads() > 1) {
+ StringTable::possibly_parallel_oops_do(root_closure);
+ } else {
+ StringTable::oops_do(root_closure);
+ }
+}
+
+void GenCollectedHeap::young_process_roots(StrongRootsScope* scope,
+ OopsInGenClosure* root_closure,
+ OopsInGenClosure* old_gen_closure,
+ CLDClosure* cld_closure) {
+ MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);
+
+ process_roots(scope, SO_ScavengeCodeCache, root_closure, root_closure,
+ cld_closure, cld_closure, &mark_code_closure);
+ process_string_table_roots(scope, root_closure);
+
+ if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
+ root_closure->reset_generation();
+ }
+
+ // When collection is parallel, all threads get to cooperate to do
+ // old generation scanning.
+ old_gen_closure->set_generation(_old_gen);
+ rem_set()->younger_refs_iterate(_old_gen, old_gen_closure, scope->n_threads());
+ old_gen_closure->reset_generation();
+
+ _process_strong_tasks->all_tasks_completed(scope->n_threads());
+}
+
+void GenCollectedHeap::cms_process_roots(StrongRootsScope* scope,
bool young_gen_as_roots,
ScanningOption so,
bool only_strong_roots,
- OopsInGenClosure* not_older_gens,
- OopsInGenClosure* older_gens,
+ OopsInGenClosure* root_closure,
CLDClosure* cld_closure) {
- const bool is_adjust_phase = !only_strong_roots && !young_gen_as_roots;
-
- bool is_moving_collection = false;
- if (type == YoungGen || is_adjust_phase) {
- // young collections are always moving
- is_moving_collection = true;
- }
-
- MarkingCodeBlobClosure mark_code_closure(not_older_gens, is_moving_collection);
- OopsInGenClosure* weak_roots = only_strong_roots ? NULL : not_older_gens;
+ MarkingCodeBlobClosure mark_code_closure(root_closure, !CodeBlobToOopClosure::FixRelocations);
+ OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
- process_roots(scope, so,
- not_older_gens, weak_roots,
- cld_closure, weak_cld_closure,
- &mark_code_closure);
-
- if (young_gen_as_roots) {
- if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
- if (type == OldGen) {
- not_older_gens->set_generation(_young_gen);
- _young_gen->oop_iterate(not_older_gens);
- }
- not_older_gens->reset_generation();
- }
+ process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
+ if (!only_strong_roots) {
+ process_string_table_roots(scope, root_closure);
}
- // When collection is parallel, all threads get to cooperate to do
- // old generation scanning.
- if (type == YoungGen) {
- older_gens->set_generation(_old_gen);
- rem_set()->younger_refs_iterate(_old_gen, older_gens, scope->n_threads());
- older_gens->reset_generation();
+
+ if (young_gen_as_roots &&
+ !_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
+ root_closure->set_generation(_young_gen);
+ _young_gen->oop_iterate(root_closure);
+ root_closure->reset_generation();
+ }
+
+ _process_strong_tasks->all_tasks_completed(scope->n_threads());
+}
+
+void GenCollectedHeap::full_process_roots(StrongRootsScope* scope,
+ bool is_adjust_phase,
+ ScanningOption so,
+ bool only_strong_roots,
+ OopsInGenClosure* root_closure,
+ CLDClosure* cld_closure) {
+ MarkingCodeBlobClosure mark_code_closure(root_closure, is_adjust_phase);
+ OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
+ CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
+
+ process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
+ if (is_adjust_phase) {
+ // We never treat the string table as roots during marking
+ // for the full gc, so we only need to process it during
+ // the adjust phase.
+ process_string_table_roots(scope, root_closure);
}
_process_strong_tasks->all_tasks_completed(scope->n_threads());
diff --git a/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp b/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp
index 2e22d47a51d..4d9087341d4 100644
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp
@@ -374,16 +374,7 @@ public:
// asserted to be this type.
static GenCollectedHeap* heap();
- // Invoke the "do_oop" method of one of the closures "not_older_gens"
- // or "older_gens" on root locations for the generations depending on
- // the type. (The "older_gens" closure is used for scanning references
- // from older generations; "not_older_gens" is used everywhere else.)
- // If "younger_gens_as_roots" is false, younger generations are
- // not scanned as roots; in this case, the caller must be arranging to
- // scan the younger generations itself. (For example, a generation might
- // explicitly mark reachable objects in younger generations, to avoid
- // excess storage retention.)
- // The "so" argument determines which of the roots
+ // The ScanningOption determines which of the roots
// the closure is applied to:
// "SO_None" does none;
enum ScanningOption {
@@ -401,19 +392,34 @@ public:
CLDClosure* weak_cld_closure,
CodeBlobToOopClosure* code_roots);
- public:
- static const bool StrongAndWeakRoots = false;
- static const bool StrongRootsOnly = true;
+ void process_string_table_roots(StrongRootsScope* scope,
+ OopClosure* root_closure);
- void gen_process_roots(StrongRootsScope* scope,
- GenerationType type,
+ public:
+ void young_process_roots(StrongRootsScope* scope,
+ OopsInGenClosure* root_closure,
+ OopsInGenClosure* old_gen_closure,
+ CLDClosure* cld_closure);
+
+ // If "young_gen_as_roots" is false, younger generations are
+ // not scanned as roots; in this case, the caller must be arranging to
+ // scan the younger generations itself. (For example, a generation might
+ // explicitly mark reachable objects in younger generations, to avoid
+ // excess storage retention.)
+ void cms_process_roots(StrongRootsScope* scope,
bool young_gen_as_roots,
ScanningOption so,
bool only_strong_roots,
- OopsInGenClosure* not_older_gens,
- OopsInGenClosure* older_gens,
+ OopsInGenClosure* root_closure,
CLDClosure* cld_closure);
+ void full_process_roots(StrongRootsScope* scope,
+ bool is_adjust_phase,
+ ScanningOption so,
+ bool only_strong_roots,
+ OopsInGenClosure* root_closure,
+ CLDClosure* cld_closure);
+
// Apply "root_closure" to all the weak roots of the system.
// These include JNI weak roots, string table,
// and referents of reachable weak refs.
diff --git a/hotspot/src/share/vm/interpreter/invocationCounter.hpp b/hotspot/src/share/vm/interpreter/invocationCounter.hpp
index 0409b02f693..0218c65687d 100644
--- a/hotspot/src/share/vm/interpreter/invocationCounter.hpp
+++ b/hotspot/src/share/vm/interpreter/invocationCounter.hpp
@@ -40,6 +40,7 @@
class InvocationCounter VALUE_OBJ_CLASS_SPEC {
friend class VMStructs;
+ friend class JVMCIVMStructs;
friend class ciReplay;
private: // bit no: |31 3| 2 | 1 0 |
unsigned int _counter; // format: [count|carry|state]
diff --git a/hotspot/src/share/vm/interpreter/linkResolver.cpp b/hotspot/src/share/vm/interpreter/linkResolver.cpp
index 1591012fe2f..9fc214ed028 100644
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp
@@ -858,8 +858,10 @@ methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info, B
}
if (log_develop_is_enabled(Trace, itables)) {
- trace_method_resolution("invokeinterface resolved method: caller-class",
- link_info.current_klass(), resolved_klass,
+ char buf[200];
+ jio_snprintf(buf, sizeof(buf), "%s resolved interface method: caller-class:",
+ Bytecodes::name(code));
+ trace_method_resolution(buf, link_info.current_klass(), resolved_klass,
resolved_method, true);
}
@@ -1424,7 +1426,7 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result,
}
if (log_develop_is_enabled(Trace, itables)) {
- trace_method_resolution("invokeinterface selected method: receiver-class",
+ trace_method_resolution("invokeinterface selected method: receiver-class:",
recv_klass, resolved_klass, sel_method, true);
}
// setup result
diff --git a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp
index 6ec47c90782..95c7deb796a 100644
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp
@@ -172,7 +172,7 @@ OopMap* CodeInstaller::create_oop_map(Handle debug_info, TRAPS) {
return map;
}
-void* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) {
+void* CodeInstaller::record_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS) {
/*
* This method needs to return a raw (untyped) pointer, since the value of a pointer to the base
* class is in general not equal to the pointer of the subclass. When patching metaspace pointers,
@@ -184,12 +184,14 @@ void* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) {
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass));
int index = _oop_recorder->find_index(klass);
+ section->relocate(dest, metadata_Relocation::spec(index));
TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
return klass;
} else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj);
assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method));
int index = _oop_recorder->find_index(method);
+ section->relocate(dest, metadata_Relocation::spec(index));
TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string());
return method;
} else {
@@ -198,7 +200,7 @@ void* CodeInstaller::record_metadata_reference(Handle constant, TRAPS) {
}
#ifdef _LP64
-narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle constant, TRAPS) {
+narrowKlass CodeInstaller::record_narrow_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS) {
oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
assert(HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected uncompressed pointer");
@@ -208,6 +210,7 @@ narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle constant, TRA
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
int index = _oop_recorder->find_index(klass);
+ section->relocate(dest, metadata_Relocation::spec(index));
TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
return Klass::encode_klass(klass);
}
@@ -701,12 +704,12 @@ JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer,
if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
#ifdef _LP64
- *((narrowKlass*) dest) = record_narrow_metadata_reference(constant, CHECK_OK);
+ *((narrowKlass*) dest) = record_narrow_metadata_reference(_constants, dest, constant, CHECK_OK);
#else
JVMCI_ERROR_OK("unexpected compressed Klass* in 32-bit mode");
#endif
} else {
- *((void**) dest) = record_metadata_reference(constant, CHECK_OK);
+ *((void**) dest) = record_metadata_reference(_constants, dest, constant, CHECK_OK);
}
} else if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
Handle obj = HotSpotObjectConstantImpl::object(constant);
diff --git a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp
index d9afec758e6..8c4aa51dcdb 100644
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp
@@ -189,9 +189,9 @@ protected:
ScopeValue* get_scope_value(Handle value, BasicType type, GrowableArray* objects, ScopeValue* &second, TRAPS);
MonitorValue* get_monitor_value(Handle value, GrowableArray* objects, TRAPS);
- void* record_metadata_reference(Handle constant, TRAPS);
+ void* record_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS);
#ifdef _LP64
- narrowKlass record_narrow_metadata_reference(Handle constant, TRAPS);
+ narrowKlass record_narrow_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS);
#endif
// extract the fields of the HotSpotCompiledCode
diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp
index 0c504a858dc..0fdec7c7fcf 100644
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp
@@ -640,8 +640,6 @@ JVM_ENTRY(jobject, JVM_GetJVMCIRuntime(JNIEnv *env, jclass c))
JVM_END
Handle JVMCIRuntime::callStatic(const char* className, const char* methodName, const char* signature, JavaCallArguments* args, TRAPS) {
- guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime");
-
TempNewSymbol name = SymbolTable::new_symbol(className, CHECK_(Handle()));
KlassHandle klass = SystemDictionary::resolve_or_fail(name, true, CHECK_(Handle()));
TempNewSymbol runtime = SymbolTable::new_symbol(methodName, CHECK_(Handle()));
@@ -656,42 +654,37 @@ Handle JVMCIRuntime::callStatic(const char* className, const char* methodName, c
}
void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) {
- if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) {
- ResourceMark rm;
-#ifdef ASSERT
- // This should only be called in the context of the JVMCI class being initialized
- TempNewSymbol name = SymbolTable::new_symbol("jdk/vm/ci/runtime/JVMCI", CHECK);
- Klass* k = SystemDictionary::resolve_or_null(name, CHECK);
- instanceKlassHandle klass = InstanceKlass::cast(k);
- assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD),
- "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization");
-#endif
+ guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime");
+ JVMCIRuntime::initialize_well_known_classes(CHECK);
+ // This should only be called in the context of the JVMCI class being initialized
+ instanceKlassHandle klass = InstanceKlass::cast(SystemDictionary::JVMCI_klass());
+ guarantee(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD),
+ "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization");
- Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime",
- "runtime",
- "()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK);
- objArrayOop trivial_prefixes = HotSpotJVMCIRuntime::trivialPrefixes(result);
- if (trivial_prefixes != NULL) {
- char** prefixes = NEW_C_HEAP_ARRAY(char*, trivial_prefixes->length(), mtCompiler);
- for (int i = 0; i < trivial_prefixes->length(); i++) {
- oop str = trivial_prefixes->obj_at(i);
- if (str == NULL) {
- THROW(vmSymbols::java_lang_NullPointerException());
- } else {
- prefixes[i] = strdup(java_lang_String::as_utf8_string(str));
- }
+ Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime",
+ "runtime",
+ "()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK);
+ objArrayOop trivial_prefixes = HotSpotJVMCIRuntime::trivialPrefixes(result);
+ if (trivial_prefixes != NULL) {
+ char** prefixes = NEW_C_HEAP_ARRAY(char*, trivial_prefixes->length(), mtCompiler);
+ for (int i = 0; i < trivial_prefixes->length(); i++) {
+ oop str = trivial_prefixes->obj_at(i);
+ if (str == NULL) {
+ THROW(vmSymbols::java_lang_NullPointerException());
+ } else {
+ prefixes[i] = strdup(java_lang_String::as_utf8_string(str));
}
- _trivial_prefixes = prefixes;
- _trivial_prefixes_count = trivial_prefixes->length();
}
- int adjustment = HotSpotJVMCIRuntime::compilationLevelAdjustment(result);
- assert(adjustment >= JVMCIRuntime::none &&
- adjustment <= JVMCIRuntime::by_full_signature,
- "compilation level adjustment out of bounds");
- _comp_level_adjustment = (CompLevelAdjustment) adjustment;
- _HotSpotJVMCIRuntime_initialized = true;
- _HotSpotJVMCIRuntime_instance = JNIHandles::make_global(result());
+ _trivial_prefixes = prefixes;
+ _trivial_prefixes_count = trivial_prefixes->length();
}
+ int adjustment = HotSpotJVMCIRuntime::compilationLevelAdjustment(result);
+ assert(adjustment >= JVMCIRuntime::none &&
+ adjustment <= JVMCIRuntime::by_full_signature,
+ "compilation level adjustment out of bounds");
+ _comp_level_adjustment = (CompLevelAdjustment) adjustment;
+ _HotSpotJVMCIRuntime_initialized = true;
+ _HotSpotJVMCIRuntime_instance = JNIHandles::make_global(result());
}
void JVMCIRuntime::initialize_JVMCI(TRAPS) {
diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp
index bb300a32d1c..2eeb981f206 100644
--- a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp
+++ b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp
@@ -85,6 +85,7 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
CHECK_NOT_SET(JVMCIUseFastLocking, EnableJVMCI)
CHECK_NOT_SET(JVMCINMethodSizeLimit, EnableJVMCI)
CHECK_NOT_SET(MethodProfileWidth, EnableJVMCI)
+ CHECK_NOT_SET(JVMCIPrintProperties, EnableJVMCI)
CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI)
#ifndef PRODUCT
diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp
index ea6fd77c18f..0292b9936ae 100644
--- a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp
+++ b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp
@@ -49,6 +49,9 @@
experimental(bool, UseJVMCICompiler, false, \
"Use JVMCI as the default compiler") \
\
+ experimental(bool, JVMCIPrintProperties, false, \
+ "Prints properties used by the JVMCI compiler") \
+ \
experimental(bool, BootstrapJVMCI, false, \
"Bootstrap JVMCI before running Java main method") \
\
diff --git a/hotspot/src/share/vm/jvmci/systemDictionary_jvmci.hpp b/hotspot/src/share/vm/jvmci/systemDictionary_jvmci.hpp
index cd0bb6c20bd..bc6d1d8c6a9 100644
--- a/hotspot/src/share/vm/jvmci/systemDictionary_jvmci.hpp
+++ b/hotspot/src/share/vm/jvmci/systemDictionary_jvmci.hpp
@@ -29,6 +29,7 @@
#else
#define JVMCI_WK_KLASSES_DO(do_klass) \
/* JVMCI classes. These are loaded on-demand. */ \
+ do_klass(JVMCI_klass, jdk_vm_ci_runtime_JVMCI, Jvmci) \
do_klass(HotSpotCompiledCode_klass, jdk_vm_ci_hotspot_HotSpotCompiledCode, Jvmci) \
do_klass(HotSpotCompiledCode_Comment_klass, jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment, Jvmci) \
do_klass(HotSpotCompiledNmethod_klass, jdk_vm_ci_hotspot_HotSpotCompiledNmethod, Jvmci) \
diff --git a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp
index 65459bd4a3a..0117b4b9d93 100644
--- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp
+++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp
@@ -169,6 +169,8 @@
nonstatic_field(JVMCIEnv, _task, CompileTask*) \
nonstatic_field(JVMCIEnv, _jvmti_can_hotswap_or_post_breakpoint, bool) \
\
+ nonstatic_field(InvocationCounter, _counter, unsigned int) \
+ \
nonstatic_field(Klass, _secondary_super_cache, Klass*) \
nonstatic_field(Klass, _secondary_supers, Array*) \
nonstatic_field(Klass, _super, Klass*) \
@@ -199,13 +201,34 @@
volatile_nonstatic_field(Method, _code, CompiledMethod*) \
volatile_nonstatic_field(Method, _from_compiled_entry, address) \
\
+ nonstatic_field(MethodCounters, _nmethod_age, int) \
+ nonstatic_field(MethodCounters, _interpreter_invocation_limit, int) \
+ nonstatic_field(MethodCounters, _interpreter_backward_branch_limit, int) \
+ nonstatic_field(MethodCounters, _interpreter_profile_limit, int) \
+ nonstatic_field(MethodCounters, _invoke_mask, int) \
+ nonstatic_field(MethodCounters, _backedge_mask, int) \
+ nonstatic_field(MethodCounters, _interpreter_invocation_count, int) \
+ nonstatic_field(MethodCounters, _interpreter_throwout_count, u2) \
+ JVMTI_ONLY(nonstatic_field(MethodCounters, _number_of_breakpoints, u2)) \
nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \
nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \
\
nonstatic_field(MethodData, _size, int) \
+ nonstatic_field(MethodData, _method, Method*) \
nonstatic_field(MethodData, _data_size, int) \
nonstatic_field(MethodData, _data[0], intptr_t) \
+ nonstatic_field(MethodData, _parameters_type_data_di, int) \
+ nonstatic_field(MethodData, _nof_decompiles, uint) \
+ nonstatic_field(MethodData, _nof_overflow_recompiles, uint) \
+ nonstatic_field(MethodData, _nof_overflow_traps, uint) \
nonstatic_field(MethodData, _trap_hist._array[0], u1) \
+ nonstatic_field(MethodData, _eflags, intx) \
+ nonstatic_field(MethodData, _arg_local, intx) \
+ nonstatic_field(MethodData, _arg_stack, intx) \
+ nonstatic_field(MethodData, _arg_returned, intx) \
+ nonstatic_field(MethodData, _tenure_traps, uint) \
+ nonstatic_field(MethodData, _invoke_mask, int) \
+ nonstatic_field(MethodData, _backedge_mask, int) \
nonstatic_field(MethodData, _jvmci_ir_size, int) \
\
nonstatic_field(nmethod, _verified_entry_point, address) \
@@ -290,6 +313,7 @@
declare_toplevel_type(ExceptionTableElement) \
declare_toplevel_type(Flag) \
declare_toplevel_type(Flag*) \
+ declare_toplevel_type(InvocationCounter) \
declare_toplevel_type(JVMCIEnv) \
declare_toplevel_type(LocalVariableTableElement) \
declare_toplevel_type(narrowKlass) \
@@ -688,7 +712,6 @@
declare_constant(VM_Version::sun4v_m) \
declare_constant(VM_Version::blk_init_instructions_m) \
declare_constant(VM_Version::fmaf_instructions_m) \
- declare_constant(VM_Version::fmau_instructions_m) \
declare_constant(VM_Version::sparc64_family_m) \
declare_constant(VM_Version::M_family_m) \
declare_constant(VM_Version::T_family_m) \
diff --git a/hotspot/src/share/vm/jvmci/vmSymbols_jvmci.hpp b/hotspot/src/share/vm/jvmci/vmSymbols_jvmci.hpp
index 84cdc649d14..b6ff2ae43f1 100644
--- a/hotspot/src/share/vm/jvmci/vmSymbols_jvmci.hpp
+++ b/hotspot/src/share/vm/jvmci/vmSymbols_jvmci.hpp
@@ -29,6 +29,7 @@
#define JVMCI_VM_SYMBOLS_DO(template, do_alias)
#else
#define JVMCI_VM_SYMBOLS_DO(template, do_alias) \
+ template(jdk_vm_ci_runtime_JVMCI, "jdk/vm/ci/runtime/JVMCI") \
template(jdk_vm_ci_hotspot_HotSpotCompiledCode, "jdk/vm/ci/hotspot/HotSpotCompiledCode") \
template(jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment, "jdk/vm/ci/hotspot/HotSpotCompiledCode$Comment") \
template(jdk_vm_ci_hotspot_HotSpotCompiledNmethod, "jdk/vm/ci/hotspot/HotSpotCompiledNmethod") \
diff --git a/hotspot/src/share/vm/logging/log.cpp b/hotspot/src/share/vm/logging/log.cpp
deleted file mode 100644
index 3f63d143f27..00000000000
--- a/hotspot/src/share/vm/logging/log.cpp
+++ /dev/null
@@ -1,1197 +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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-
-/////////////// Unit tests ///////////////
-
-#ifndef PRODUCT
-
-#include "gc/shared/gcTraceTime.inline.hpp"
-#include "logging/log.hpp"
-#include "logging/logConfiguration.hpp"
-#include "logging/logFileOutput.hpp"
-#include "logging/logMessage.hpp"
-#include "logging/logMessageBuffer.hpp"
-#include "logging/logOutput.hpp"
-#include "logging/logTagLevelExpression.hpp"
-#include "logging/logTagSet.hpp"
-#include "logging/logTagSetDescriptions.hpp"
-#include "logging/logStream.inline.hpp"
-#include "memory/resourceArea.hpp"
-
-#define assert_str_eq(s1, s2) \
- assert(strcmp(s1, s2) == 0, "Expected '%s' to equal '%s'", s1, s2)
-
-#define assert_char_in(c, s) \
- assert(strchr(s, c) != NULL, "Expected '%s' to contain character '%c'", s, c)
-
-#define assert_char_not_in(c, s) \
- assert(strchr(s, c) == NULL, "Expected '%s' to *not* contain character '%c'", s, c)
-
-void Test_log_tag_combinations_limit() {
- assert(LogTagLevelExpression::MaxCombinations > LogTagSet::ntagsets(),
- "Combination limit (" SIZE_FORMAT ") not sufficient "
- "for configuring all available tag sets (" SIZE_FORMAT ")",
- LogTagLevelExpression::MaxCombinations, LogTagSet::ntagsets());
-}
-
-// Read a complete line from fp and return it as a resource allocated string.
-// Returns NULL on EOF.
-static char* read_line(FILE* fp) {
- assert(fp != NULL, "bad fp");
- int buflen = 512;
- char* buf = NEW_RESOURCE_ARRAY(char, buflen);
- long pos = ftell(fp);
-
- char* ret = fgets(buf, buflen, fp);
- while (ret != NULL && buf[strlen(buf) - 1] != '\n' && !feof(fp)) {
- // retry with a larger buffer
- buf = REALLOC_RESOURCE_ARRAY(char, buf, buflen, buflen * 2);
- buflen *= 2;
- // rewind to beginning of line
- fseek(fp, pos, SEEK_SET);
- // retry read with new buffer
- ret = fgets(buf, buflen, fp);
- }
- return ret;
-}
-
-static bool file_contains_substrings_in_order(const char* filename, const char* substrs[]) {
- FILE* fp = fopen(filename, "r");
- assert(fp != NULL, "error opening file %s: %s", filename, strerror(errno));
-
- size_t idx = 0;
- while (substrs[idx] != NULL) {
- ResourceMark rm;
- char* line = read_line(fp);
- if (line == NULL) {
- break;
- }
- for (char* match = strstr(line, substrs[idx]); match != NULL;) {
- size_t match_len = strlen(substrs[idx]);
- idx++;
- if (substrs[idx] == NULL) {
- break;
- }
- match = strstr(match + match_len, substrs[idx]);
- }
- }
-
- fclose(fp);
- return substrs[idx] == NULL;
-}
-
-static bool file_contains_substring(const char* filename, const char* substr) {
- const char* strs[] = {substr, NULL};
- return file_contains_substrings_in_order(filename, strs);
-}
-
-static size_t number_of_lines_with_substring_in_file(const char* filename,
- const char* substr) {
- FILE* fp = fopen(filename, "r");
- assert(fp != NULL, "error opening file %s: %s", filename, strerror(errno));
-
- size_t ret = 0;
- for (;;) {
- ResourceMark rm;
- char* line = read_line(fp);
- if (line == NULL) {
- break;
- }
- if (strstr(line, substr) != NULL) {
- ret++;
- }
- }
-
- fclose(fp);
- return ret;
-}
-
-static bool file_exists(const char* filename) {
- struct stat st;
- return os::stat(filename, &st) == 0;
-}
-
-static void delete_file(const char* filename) {
- if (!file_exists(filename)) {
- return;
- }
- int ret = remove(filename);
- assert(ret == 0, "failed to remove file '%s': %s", filename, strerror(errno));
-}
-
-static void create_directory(const char* name) {
- assert(!file_exists(name), "can't create directory: %s already exists", name);
- bool failed;
-#ifdef _WINDOWS
- failed = !CreateDirectory(name, NULL);
-#else
- failed = mkdir(name, 0777);
-#endif
- assert(!failed, "failed to create directory %s", name);
-}
-
-class TestLogFile {
- private:
- char file_name[256];
-
- void set_name(const char* test_name) {
- const char* tmpdir = os::get_temp_directory();
- int pos = jio_snprintf(file_name, sizeof(file_name), "%s%svmtest.%s.%d.log", tmpdir, os::file_separator(), test_name, os::current_process_id());
- assert(pos > 0, "too small log file name buffer");
- assert((size_t)pos < sizeof(file_name), "too small log file name buffer");
- }
-
- public:
- TestLogFile(const char* test_name) {
- set_name(test_name);
- remove(name());
- }
-
- ~TestLogFile() {
- remove(name());
- }
-
- const char* name() {
- return file_name;
- }
-};
-
-class TestLogSavedConfig {
- private:
- char* _saved_config;
- char* _new_output;
- Log(logging) _log;
- public:
- TestLogSavedConfig(const char* apply_output = NULL, const char* apply_setting = NULL) : _new_output(0) {
- ResourceMark rm;
- _saved_config = os::strdup_check_oom(LogOutput::Stdout->config_string());
- bool success = LogConfiguration::parse_log_arguments("stdout", "all=off", NULL, NULL, _log.error_stream());
- assert(success, "test unable to turn all off");
-
- if (apply_output) {
- _new_output = os::strdup_check_oom(apply_output);
- bool success = LogConfiguration::parse_log_arguments(_new_output, apply_setting, NULL, NULL, _log.error_stream());
- assert(success, "test unable to apply test log configuration");
- }
- }
-
- ~TestLogSavedConfig() {
- ResourceMark rm;
- if (_new_output) {
- bool success = LogConfiguration::parse_log_arguments(_new_output, "all=off", NULL, NULL, _log.error_stream());
- assert(success, "test unable to turn all off");
- os::free(_new_output);
- }
-
- bool success = LogConfiguration::parse_log_arguments("stdout", _saved_config, NULL, NULL, _log.error_stream());
- assert(success, "test unable to restore log configuration");
- os::free(_saved_config);
- }
-};
-
-void Test_configure_stdout() {
- LogOutput* stdoutput = LogOutput::Stdout;
- TestLogSavedConfig tlsc;
-
- // Enable 'logging=info', verifying it has been set
- LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(logging));
- assert_str_eq("logging=info", stdoutput->config_string());
- assert(log_is_enabled(Info, logging), "logging was not properly enabled");
-
- // Enable 'gc=debug' (no wildcard), verifying no other tags are enabled
- LogConfiguration::configure_stdout(LogLevel::Debug, true, LOG_TAGS(gc));
- // No '+' character means only single tags are enabled, and no combinations
- assert_char_not_in('+', stdoutput->config_string());
- assert(log_is_enabled(Debug, gc), "logging was not properly enabled");
-
- // Enable 'gc*=trace' (with wildcard), verifying at least one tag combination is enabled (gc+...)
- LogConfiguration::configure_stdout(LogLevel::Trace, false, LOG_TAGS(gc));
- assert_char_in('+', stdoutput->config_string());
- assert(log_is_enabled(Trace, gc), "logging was not properly enabled");
-
- // Disable 'gc*' and 'logging', verifying all logging is properly disabled
- LogConfiguration::configure_stdout(LogLevel::Off, false, LOG_TAGS(gc));
- LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(logging));
- assert_str_eq("all=off", stdoutput->config_string());
-}
-
-static const char* ExpectedLine = "a (hopefully) unique log line for testing";
-
-static void init_file(const char* filename, const char* options = "") {
- LogConfiguration::parse_log_arguments(filename, "logging=trace", "", options,
- Log(logging)::error_stream());
- log_debug(logging)("%s", ExpectedLine);
- LogConfiguration::parse_log_arguments(filename, "all=off", "", "",
- Log(logging)::error_stream());
-}
-
-void Test_log_file_startup_rotation() {
- ResourceMark rm;
- const size_t rotations = 5;
- const char* filename = "start-rotate-test";
- char* rotated_file[rotations];
- for (size_t i = 0; i < rotations; i++) {
- size_t len = strlen(filename) + 3;
- rotated_file[i] = NEW_RESOURCE_ARRAY(char, len);
- jio_snprintf(rotated_file[i], len, "%s." SIZE_FORMAT, filename, i);
- delete_file(rotated_file[i]);
- };
-
- delete_file(filename);
- init_file(filename);
- assert(file_exists(filename),
- "configured logging to file '%s' but file was not found", filename);
-
- // Initialize the same file a bunch more times to trigger rotations
- for (size_t i = 0; i < rotations; i++) {
- init_file(filename);
- assert(file_exists(rotated_file[i]), "existing file was not rotated");
- }
-
- // Remove a file and expect its slot to be re-used
- delete_file(rotated_file[1]);
- init_file(filename);
- assert(file_exists(rotated_file[1]), "log file not properly rotated");
-
- // Clean up after test
- delete_file(filename);
- for (size_t i = 0; i < rotations; i++) {
- delete_file(rotated_file[i]);
- }
-}
-
-void Test_log_file_startup_truncation() {
- ResourceMark rm;
- const char* filename = "start-truncate-test";
- const char* archived_filename = "start-truncate-test.0";
-
- delete_file(filename);
- delete_file(archived_filename);
-
- // Use the same log file twice and expect it to be overwritten/truncated
- init_file(filename, "filecount=0");
- assert(file_exists(filename), "couldn't find log file: %s", filename);
-
- init_file(filename, "filecount=0");
- assert(file_exists(filename), "couldn't find log file: %s", filename);
- assert(!file_exists(archived_filename),
- "existing log file %s was not properly truncated when filecount was 0",
- filename);
-
- // Verify that the file was really truncated and not just appended
- assert(number_of_lines_with_substring_in_file(filename, ExpectedLine) == 1,
- "log file %s appended rather than truncated", filename);
-
- delete_file(filename);
- delete_file(archived_filename);
-}
-
-class LogMessageTest {
- private:
- static Log(logging) _log;
- static const char* _level_filename[];
-
- static void test_level_inclusion();
- static void test_long_message();
- static void test_message_with_many_lines();
- static void test_line_order();
- static void test_prefixing();
- static void test_scoped_messages();
- static void test_scoped_flushing();
- static void test_scoped_reset();
-
- public:
- static void test();
-};
-
-const char* LogMessageTest::_level_filename[] = {
- NULL, // LogLevel::Off
-#define LOG_LEVEL(name, printname) "multiline-" #printname ".log",
- LOG_LEVEL_LIST
-#undef LOG_LEVEL
-};
-
-void Test_multiline_logging() {
- LogMessageTest::test();
-}
-
-void LogMessageTest::test() {
- ResourceMark rm;
-
- for (int i = 0; i < LogLevel::Count; i++) {
- char buf[32];
- // Attempt to remove possibly pre-existing log files
- remove(_level_filename[i]);
-
- jio_snprintf(buf, sizeof(buf), "logging=%s", LogLevel::name(static_cast(i)));
- bool success = LogConfiguration::parse_log_arguments(_level_filename[i], buf,
- NULL, NULL, _log.error_stream());
- assert(success, "unable to configure logging to file '%s'", _level_filename[i]);
- }
-
- test_level_inclusion();
- test_line_order();
- test_long_message();
- test_message_with_many_lines();
- test_prefixing();
- test_scoped_messages();
- test_scoped_flushing();
- test_scoped_reset();
-
- // Stop logging to the files and remove them.
- for (int i = 0; i < LogLevel::Count; i++) {
- LogConfiguration::parse_log_arguments(_level_filename[i], "all=off", NULL, NULL, _log.error_stream());
- remove(_level_filename[i]);
- }
-}
-
-// Verify that messages with multiple levels are written
-// to outputs configured for all the corresponding levels
-void LogMessageTest::test_level_inclusion() {
- const size_t message_count = 10;
- LogMessageBuffer msg[message_count];
-
- struct {
- int message_number;
- LogLevelType level;
- } lines[] = {
- { 0, LogLevel::Error },
- { 1, LogLevel::Info },
- { 2, LogLevel::Info }, { 2, LogLevel::Debug },
- { 3, LogLevel::Info }, { 3, LogLevel::Warning },
- { 4, LogLevel::Debug }, { 4, LogLevel::Warning },
- { 5, LogLevel::Trace }, { 5, LogLevel::Debug },
- { 6, LogLevel::Warning }, { 6, LogLevel::Error },
- { 7, LogLevel::Trace }, { 7, LogLevel::Info }, { 7, LogLevel::Debug },
- { 8, LogLevel::Trace }, { 8, LogLevel::Debug }, { 8, LogLevel::Info },
- { 8, LogLevel::Warning }, { 8, LogLevel::Error},
- { 9, LogLevel::Trace }
- };
-
- // Fill in messages with the above lines
- for (size_t i = 0; i < ARRAY_SIZE(lines); i++) {
- switch (lines[i].level) {
-#define LOG_LEVEL(name, printname) \
- case LogLevel::name: \
- msg[lines[i].message_number].printname("msg[%d]: " #printname, lines[i].message_number); \
- break;
-LOG_LEVEL_LIST
-#undef LOG_LEVEL
- }
- }
-
- for (size_t i = 0; i < message_count; i++) {
- _log.write(msg[i]);
- }
-
- // Verify that lines are written to the expected log files
- for (size_t i = 0; i < ARRAY_SIZE(lines); i++) {
- char expected[256];
- jio_snprintf(expected, sizeof(expected), "msg[%d]: %s",
- lines[i].message_number, LogLevel::name(lines[i].level));
- for (int level = lines[i].level; level > 0; level--) {
- assert(file_contains_substring(_level_filename[level], expected),
- "line #" SIZE_FORMAT " missing from log file '%s'", i, _level_filename[level]);
- }
- for (int level = lines[i].level + 1; level < LogLevel::Count; level++) {
- assert(!file_contains_substring(_level_filename[level], expected),
- "line #" SIZE_FORMAT " erroneously included in log file '%s'", i, _level_filename[level]);
- }
- }
-}
-
-// Verify that messages are logged in the order they are added to the log message
-void LogMessageTest::test_line_order() {
- LogMessageBuffer msg;
- msg.info("info line").error("error line").trace("trace line")
- .error("another error").warning("warning line").debug("debug line");
- _log.write(msg);
-
- const char* expected[] = { "info line", "error line", "trace line",
- "another error", "warning line", "debug line", NULL };
- assert(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected),
- "output missing or in incorrect order");
-}
-
-void LogMessageTest::test_long_message() {
- // Write 10K bytes worth of log data
- LogMessageBuffer msg;
- const size_t size = 10 * K;
- const char* start_marker = "#start#";
- const char* end_marker = "#the end#";
- char* data = NEW_C_HEAP_ARRAY(char, size, mtLogging);
-
- // fill buffer with start_marker...some data...end_marker
- sprintf(data, "%s", start_marker);
- for (size_t i = strlen(start_marker); i < size; i++) {
- data[i] = '0' + (i % 10);
- }
- sprintf(data + size - strlen(end_marker) - 1, "%s", end_marker);
-
- msg.trace("%s", data); // Adds a newline, making the message exactly 10K in length.
- _log.write(msg);
-
- const char* expected[] = { start_marker, "0123456789", end_marker, NULL };
- assert(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected),
- "unable to print long line");
- FREE_C_HEAP_ARRAY(char, data);
-}
-
-void LogMessageTest::test_message_with_many_lines() {
- const size_t lines = 100;
- const size_t line_length = 16;
-
- LogMessageBuffer msg;
- for (size_t i = 0; i < lines; i++) {
- msg.info("Line #" SIZE_FORMAT, i);
- }
- _log.write(msg);
-
- char expected_lines_data[lines][line_length];
- const char* expected_lines[lines + 1];
- for (size_t i = 0; i < lines; i++) {
- jio_snprintf(&expected_lines_data[i][0], line_length, "Line #" SIZE_FORMAT, i);
- expected_lines[i] = expected_lines_data[i];
- }
- expected_lines[lines] = NULL;
-
- assert(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected_lines),
- "couldn't find all lines in multiline message");
-}
-
-static size_t dummy_prefixer(char* buf, size_t len) {
- static int i = 0;
- const char* prefix = "some prefix: ";
- const size_t prefix_len = strlen(prefix);
- if (len < prefix_len) {
- return prefix_len;
- }
- jio_snprintf(buf, len, "%s", prefix);
- return prefix_len;
-}
-
-void LogMessageTest::test_prefixing() {
- LogMessageBuffer msg;
- msg.set_prefix(dummy_prefixer);
- for (int i = 0; i < 3; i++) {
- msg.info("test %d", i);
- }
- msg.set_prefix(NULL);
- msg.info("test 3");
- _log.write(msg);
-
- const char* expected[] = {
- "] some prefix: test 0",
- "] some prefix: test 1",
- "] some prefix: test 2",
- "] test 3",
- NULL
- };
- assert(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected), "error in prefixed output");
-}
-
-void LogMessageTest::test_scoped_messages() {
- {
- LogMessage(logging) msg;
- msg.info("scoped info");
- msg.warning("scoped warn");
- assert(!file_contains_substring(_level_filename[LogLevel::Info], "scoped info"),
- "scoped log message written prematurely");
- }
- assert(file_contains_substring(_level_filename[LogLevel::Info], "scoped info"),
- "missing output from scoped log message");
- assert(file_contains_substring(_level_filename[LogLevel::Warning], "scoped warn"),
- "missing output from scoped log message");
-}
-
-void LogMessageTest::test_scoped_flushing() {
- {
- LogMessage(logging) msg;
- msg.info("manual flush info");
- msg.flush();
- assert(file_contains_substring(_level_filename[LogLevel::Info], "manual flush info"),
- "missing output from manually flushed scoped log message");
- }
- const char* tmp[] = {"manual flush info", "manual flush info", NULL};
- assert(!file_contains_substrings_in_order(_level_filename[LogLevel::Info], tmp),
- "log file contains duplicate lines from single scoped log message");
-}
-
-void LogMessageTest::test_scoped_reset() {
- {
- LogMessage(logging) msg, partial;
- msg.info("%s", "info reset msg");
- msg.reset();
- partial.info("%s", "info reset msg");
- partial.reset();
- partial.trace("%s", "trace reset msg");
- }
- assert(!file_contains_substring(_level_filename[LogLevel::Info], "info reset msg"),
- "reset message written anyway");
- assert(file_contains_substring(_level_filename[LogLevel::Trace], "trace reset msg"),
- "missing message from partially reset scoped log message");
-}
-
-
-static int Test_logconfiguration_subscribe_triggered = 0;
-
-static void Test_logconfiguration_subscribe_helper() {
- Test_logconfiguration_subscribe_triggered++;
-}
-
-void Test_logconfiguration_subscribe() {
- ResourceMark rm;
- Log(logging) log;
-
- TestLogSavedConfig log_cfg("stdout", "logging*=trace");
-
- LogConfiguration::register_update_listener(&Test_logconfiguration_subscribe_helper);
-
- LogConfiguration::parse_log_arguments("stdout", "logging=trace", NULL, NULL, log.error_stream());
- assert(Test_logconfiguration_subscribe_triggered == 1, "subscription not triggered (1)");
-
- LogConfiguration::configure_stdout(LogLevel::Debug, true, LOG_TAGS(gc));
- assert(Test_logconfiguration_subscribe_triggered == 2, "subscription not triggered (2)");
-
- LogConfiguration::disable_logging();
- assert(Test_logconfiguration_subscribe_triggered == 3, "subscription not triggered (3)");
-}
-
-#define LOG_PREFIX_STR "THE_PREFIX "
-#define LOG_LINE_STR "a log line"
-
-size_t Test_log_prefix_prefixer(char* buf, size_t len) {
- int ret = jio_snprintf(buf, len, LOG_PREFIX_STR);
- assert(ret > 0, "Failed to print prefix. Log buffer too small?");
- return (size_t) ret;
-}
-
-void Test_log_prefix() {
- TestLogFile log_file("log_prefix");
- TestLogSavedConfig log_cfg(log_file.name(), "logging+test=trace");
-
- log_trace(logging, test)(LOG_LINE_STR);
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
- char output[1024];
- if (fgets(output, 1024, fp) != NULL) {
- assert(strstr(output, LOG_PREFIX_STR LOG_LINE_STR), "logging prefix error");
- }
- fclose(fp);
-}
-
-void Test_log_big() {
- char big_msg[4096] = {0};
- char Xchar = '~';
-
- TestLogFile log_file("log_big");
- TestLogSavedConfig log_cfg(log_file.name(), "logging+test=trace");
-
- memset(big_msg, Xchar, sizeof(big_msg) - 1);
-
- log_trace(logging, test)("%s", big_msg);
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
- char output[sizeof(big_msg)+128 /*decorators*/ ];
- if (fgets(output, sizeof(output), fp) != NULL) {
- assert(strstr(output, LOG_PREFIX_STR), "logging prefix error");
- size_t count = 0;
- for (size_t ps = 0 ; output[ps + count] != '\0'; output[ps + count] == Xchar ? count++ : ps++);
- assert(count == (sizeof(big_msg) - 1) , "logging msg error");
- }
- fclose(fp);
-}
-
-void Test_logtagset_duplicates() {
- for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
- char ts_name[512];
- ts->label(ts_name, sizeof(ts_name), ",");
-
- // verify that NO_TAG is never followed by a real tag
- for (size_t i = 0; i < LogTag::MaxTags; i++) {
- if (ts->tag(i) == LogTag::__NO_TAG) {
- for (i++; i < LogTag::MaxTags; i++) {
- assert(ts->tag(i) == LogTag::__NO_TAG,
- "NO_TAG was followed by a real tag (%s) in tagset %s",
- LogTag::name(ts->tag(i)), ts_name);
- }
- }
- }
-
- // verify that there are no duplicate tagsets (same tags in different order)
- for (LogTagSet* other = ts->next(); other != NULL; other = other->next()) {
- if (ts->ntags() != other->ntags()) {
- continue;
- }
- bool equal = true;
- for (size_t i = 0; i < ts->ntags(); i++) {
- LogTagType tag = ts->tag(i);
- if (!other->contains(tag)) {
- equal = false;
- break;
- }
- }
- // Since tagsets are implemented using template arguments, using both of
- // the (logically equivalent) tagsets (t1, t2) and (t2, t1) somewhere will
- // instantiate two different LogTagSetMappings. This causes multiple
- // tagset instances to be created for the same logical set. We want to
- // avoid this to save time, memory and prevent any confusion around it.
- if (equal) {
- char other_name[512];
- other->label(other_name, sizeof(other_name), ",");
- assert(false, "duplicate LogTagSets found: '%s' vs '%s' "
- "(tags must always be specified in the same order for each tagset)",
- ts_name, other_name);
- }
- }
- }
-}
-
-#define Test_logtarget_string_literal "First line"
-
-
-static void Test_logtarget_on() {
- TestLogFile log_file("log_target");
- TestLogSavedConfig tlsc(log_file.name(), "gc=debug");
-
- LogTarget(Debug, gc) log;
-
- assert(log.is_enabled(), "assert");
-
- // Log the line and expect it to be available in the output file.
- log.print(Test_logtarget_string_literal);
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp != NULL, "File read error");
-
- char output[256 /* Large enough buffer */];
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- assert(strstr(output, Test_logtarget_string_literal) != NULL, "log line missing");
-
- fclose(fp);
-}
-
-static void Test_logtarget_off() {
- TestLogFile log_file("log_target");
- TestLogSavedConfig tlsc(log_file.name(), "gc=info");
-
- LogTarget(Debug, gc) log;
-
- if (log.is_enabled()) {
- // The log config could have been redirected gc=debug to a file. If gc=debug
- // is enabled, we can only test that the LogTarget returns the same value
- // as the log_is_enabled function. The rest of the test will be ignored.
- assert(log.is_enabled() == log_is_enabled(Debug, gc), "assert");
- log_warning(logging)("This test doesn't support runs with -Xlog");
- return;
- }
-
- // Try to log, but expect this to be filtered out.
- log.print(Test_logtarget_string_literal);
-
- // Log a dummy line so that fgets doesn't return NULL because the file is empty.
- log_info(gc)("Dummy line");
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp != NULL, "File read error");
-
- char output[256 /* Large enough buffer */];
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- assert(strstr(output, Test_logtarget_string_literal) == NULL, "log line not missing");
-
- fclose(fp);
-}
-
-void Test_logtarget() {
- Test_logtarget_on();
- Test_logtarget_off();
-}
-
-
-static void Test_logstream_helper(outputStream* stream) {
- TestLogFile log_file("log_stream");
- TestLogSavedConfig tlsc(log_file.name(), "gc=debug");
-
- // Try to log, but expect this to be filtered out.
- stream->print("%d ", 3); stream->print("workers"); stream->cr();
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp != NULL, "File read error");
-
- char output[256 /* Large enough buffer */];
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- assert(strstr(output, "3 workers") != NULL, "log line missing");
-
- fclose(fp);
-}
-
-static void Test_logstream_log() {
- Log(gc) log;
- LogStream stream(log.debug());
-
- Test_logstream_helper(&stream);
-}
-
-static void Test_logstream_logtarget() {
- LogTarget(Debug, gc) log;
- LogStream stream(log);
-
- Test_logstream_helper(&stream);
-}
-
-static void Test_logstream_logstreamhandle() {
- LogStreamHandle(Debug, gc) stream;
-
- Test_logstream_helper(&stream);
-}
-
-static void Test_logstream_no_rm() {
- ResourceMark rm;
- outputStream* stream = LogTarget(Debug, gc)::stream();
-
- Test_logstream_helper(stream);
-}
-
-static void Test_logstreamcheap_log() {
- Log(gc) log;
- LogStreamCHeap stream(log.debug());
-
- Test_logstream_helper(&stream);
-}
-
-static void Test_logstreamcheap_logtarget() {
- LogTarget(Debug, gc) log;
- LogStreamCHeap stream(log);
-
- Test_logstream_helper(&stream);
-}
-
-void Test_logstream() {
- // Test LogStreams with embedded ResourceMark.
- Test_logstream_log();
- Test_logstream_logtarget();
- Test_logstream_logstreamhandle();
-
- // Test LogStreams without embedded ResourceMark.
- Test_logstream_no_rm();
-
- // Test LogStreams backed by CHeap memory.
- Test_logstreamcheap_log();
- Test_logstreamcheap_logtarget();
-}
-
-void Test_loghandle_on() {
- TestLogFile log_file("log_handle");
- TestLogSavedConfig tlsc(log_file.name(), "gc=debug");
-
- Log(gc) log;
- LogHandle log_handle(log);
-
- assert(log_handle.is_debug(), "assert");
-
- // Try to log through a LogHandle.
- log_handle.debug("%d workers", 3);
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- assert(strstr(output, "3 workers") != NULL, "log line missing");
-
- fclose(fp);
-}
-
-void Test_loghandle_off() {
- TestLogFile log_file("log_handle");
- TestLogSavedConfig tlsc(log_file.name(), "gc=info");
-
- Log(gc) log;
- LogHandle log_handle(log);
-
- if (log_handle.is_debug()) {
- // The log config could have been redirected gc=debug to a file. If gc=debug
- // is enabled, we can only test that the LogTarget returns the same value
- // as the log_is_enabled function. The rest of the test will be ignored.
- assert(log_handle.is_debug() == log_is_enabled(Debug, gc), "assert");
- log_warning(logging)("This test doesn't support runs with -Xlog");
- return;
- }
-
- // Try to log through a LogHandle. Should fail, since only info is turned on.
- log_handle.debug("%d workers", 3);
-
- // Log a dummy line so that fgets doesn't return NULL because the file is empty.
- log_info(gc)("Dummy line");
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- assert(strstr(output, "3 workers") == NULL, "log line missing");
-
- fclose(fp);
-}
-
-void Test_loghandle() {
- Test_loghandle_on();
- Test_loghandle_off();
-}
-
-static void Test_logtargethandle_on() {
- TestLogFile log_file("log_handle");
- TestLogSavedConfig tlsc(log_file.name(), "gc=debug");
-
- LogTarget(Debug, gc) log;
- LogTargetHandle log_handle(log);
-
- assert(log_handle.is_enabled(), "assert");
-
- // Try to log through a LogHandle.
- log_handle.print("%d workers", 3);
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- assert(strstr(output, "3 workers") != NULL, "log line missing");
-
- fclose(fp);
-}
-
-static void Test_logtargethandle_off() {
- TestLogFile log_file("log_handle");
- TestLogSavedConfig tlsc(log_file.name(), "gc=info");
-
- LogTarget(Debug, gc) log;
- LogTargetHandle log_handle(log);
-
- if (log_handle.is_enabled()) {
- // The log config could have been redirected gc=debug to a file. If gc=debug
- // is enabled, we can only test that the LogTarget returns the same value
- // as the log_is_enabled function. The rest of the test will be ignored.
- assert(log_handle.is_enabled() == log_is_enabled(Debug, gc), "assert");
- log_warning(logging)("This test doesn't support runs with -Xlog");
- return;
- }
-
- // Try to log through a LogHandle. Should fail, since only info is turned on.
- log_handle.print("%d workers", 3);
-
- // Log a dummy line so that fgets doesn't return NULL because the file is empty.
- log_info(gc)("Dummy line");
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- assert(strstr(output, "3 workers") == NULL, "log line missing");
-
- fclose(fp);
-}
-
-void Test_logtargethandle() {
- Test_logtargethandle_on();
- Test_logtargethandle_off();
-}
-
-static void Test_log_gctracetime_full() {
- TestLogFile log_file("log_gctracetime");
- TestLogSavedConfig tlsc(log_file.name(), "gc=debug,gc+start=debug");
-
- LogTarget(Debug, gc) gc_debug;
- LogTarget(Debug, gc, start) gc_start_debug;
-
- assert(gc_debug.is_enabled(), "assert");
- assert(gc_start_debug.is_enabled(), "assert");
-
- {
- MutexLocker lock(Heap_lock); // Needed to read heap usage
- GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_allocation_failure, true);
- }
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
-
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc,start] Test GC (Allocation Failure) (2.975s)
- assert(strstr(output, "[gc,start") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (Allocation Failure) (") != NULL, "Incorrect log line");
- assert(strstr(output, "s)") != NULL, "Incorrect log line");
-
- res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc ] Test GC (Allocation Failure) 59M->59M(502M) (2.975s, 2.975s) 0.026ms
- assert(strstr(output, "[gc ") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (Allocation Failure) ") != NULL, "Incorrect log line");
- assert(strstr(output, "M) (") != NULL, "Incorrect log line");
- assert(strstr(output, "s, ") != NULL, "Incorrect log line");
- assert(strstr(output, "s) ") != NULL, "Incorrect log line");
- assert(strstr(output, "ms") != NULL, "Incorrect log line");
-
- fclose(fp);
-}
-
-static void Test_log_gctracetime_full_multitag() {
- TestLogFile log_file("log_gctracetime");
- TestLogSavedConfig tlsc(log_file.name(), "gc+ref=debug,gc+ref+start=debug");
-
- LogTarget(Debug, gc, ref) gc_debug;
- LogTarget(Debug, gc, ref, start) gc_start_debug;
-
- assert(gc_debug.is_enabled(), "assert");
- assert(gc_start_debug.is_enabled(), "assert");
-
- {
- MutexLocker lock(Heap_lock); // Needed to read heap usage
- GCTraceTime(Debug, gc, ref) timer("Test GC", NULL, GCCause::_allocation_failure, true);
- }
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
-
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc,start] Test GC (Allocation Failure) (2.975s)
- assert(strstr(output, "[gc,ref,start") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (Allocation Failure) (") != NULL, "Incorrect log line");
- assert(strstr(output, "s)") != NULL, "Incorrect log line");
-
- res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc ] Test GC (Allocation Failure) 59M->59M(502M) (2.975s, 2.975s) 0.026ms
- assert(strstr(output, "[gc,ref ") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (Allocation Failure) ") != NULL, "Incorrect log line");
- assert(strstr(output, "M) (") != NULL, "Incorrect log line");
- assert(strstr(output, "s, ") != NULL, "Incorrect log line");
- assert(strstr(output, "s) ") != NULL, "Incorrect log line");
- assert(strstr(output, "ms") != NULL, "Incorrect log line");
-
- fclose(fp);
-}
-
-static void Test_log_gctracetime_no_heap() {
- TestLogFile log_file("log_gctracetime");
- TestLogSavedConfig tlsc(log_file.name(), "gc=debug,gc+start=debug");
-
- LogTarget(Debug, gc) gc_debug;
- LogTarget(Debug, gc, start) gc_start_debug;
-
- assert(gc_debug.is_enabled(), "assert");
- assert(gc_start_debug.is_enabled(), "assert");
-
- {
- GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_allocation_failure, false);
- }
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
-
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc,start] Test GC (Allocation Failure) (2.975s)
- assert(strstr(output, "[gc,start") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (Allocation Failure) (") != NULL, "Incorrect log line");
- assert(strstr(output, "s)") != NULL, "Incorrect log line");
-
- res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc ] Test GC (Allocation Failure) (2.975s, 2.975s) 0.026ms
- assert(strstr(output, "[gc ") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (Allocation Failure) (") != NULL, "Incorrect log line");
- assert(strstr(output, "M) (") == NULL, "Incorrect log line");
- assert(strstr(output, "s, ") != NULL, "Incorrect log line");
- assert(strstr(output, "s) ") != NULL, "Incorrect log line");
- assert(strstr(output, "ms") != NULL, "Incorrect log line");
-
- fclose(fp);
-}
-
-static void Test_log_gctracetime_no_cause() {
- TestLogFile log_file("log_gctracetime");
- TestLogSavedConfig tlsc(log_file.name(), "gc=debug,gc+start=debug");
-
- LogTarget(Debug, gc) gc_debug;
- LogTarget(Debug, gc, start) gc_start_debug;
-
- assert(gc_debug.is_enabled(), "assert");
- assert(gc_start_debug.is_enabled(), "assert");
-
- {
- MutexLocker lock(Heap_lock); // Needed to read heap usage
- GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_no_gc, true);
- }
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
-
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc,start] Test GC (2.975s)
- assert(strstr(output, "[gc,start") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (") != NULL, "Incorrect log line");
- assert(strstr(output, "s)") != NULL, "Incorrect log line");
-
- res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc ] Test GC 59M->59M(502M) (2.975s, 2.975s) 0.026ms
- assert(strstr(output, "[gc ") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC ") != NULL, "Incorrect log line");
- assert(strstr(output, "M) (") != NULL, "Incorrect log line");
- assert(strstr(output, "s, ") != NULL, "Incorrect log line");
- assert(strstr(output, "s) ") != NULL, "Incorrect log line");
- assert(strstr(output, "ms") != NULL, "Incorrect log line");
-
- fclose(fp);
-}
-
-static void Test_log_gctracetime_no_heap_no_cause() {
- TestLogFile log_file("log_gctracetime");
- TestLogSavedConfig tlsc(log_file.name(), "gc=debug,gc+start=debug");
-
- LogTarget(Debug, gc) gc_debug;
- LogTarget(Debug, gc, start) gc_start_debug;
-
- assert(gc_debug.is_enabled(), "assert");
- assert(gc_start_debug.is_enabled(), "assert");
-
- {
- MutexLocker lock(Heap_lock); // Needed to read heap usage
- GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_no_gc, false);
- }
-
- FILE* fp = fopen(log_file.name(), "r");
- assert(fp, "File read error");
-
- char output[256 /* Large enough buffer */];
-
- char* res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc,start] Test GC (2.975s)
- assert(strstr(output, "[gc,start") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (") != NULL, "Incorrect log line");
- assert(strstr(output, "s)") != NULL, "Incorrect log line");
-
- res = fgets(output, sizeof(output), fp);
- assert(res != NULL, "assert");
-
- // [2.975s][debug][gc ] Test GC (2.975s, 2.975s) 0.026ms
- assert(strstr(output, "[gc ") != NULL, "Incorrect tag set");
- assert(strstr(output, "] Test GC (") != NULL, "Incorrect log line");
- assert(strstr(output, "M) (") == NULL, "Incorrect log line");
- assert(strstr(output, "s, ") != NULL, "Incorrect log line");
- assert(strstr(output, "s) ") != NULL, "Incorrect log line");
- assert(strstr(output, "ms") != NULL, "Incorrect log line");
-
- fclose(fp);
-}
-
-void Test_log_gctracetime() {
- Test_log_gctracetime_full();
- Test_log_gctracetime_full_multitag();
- Test_log_gctracetime_no_heap();
- Test_log_gctracetime_no_cause();
- Test_log_gctracetime_no_heap_no_cause();
-}
-
-void Test_invalid_log_file() {
- ResourceMark rm;
- stringStream ss;
- const char* target_name = "tmplogdir";
-
- // Attempt to log to a directory (existing log not a regular file)
- create_directory(target_name);
- LogFileOutput bad_file("file=tmplogdir");
- assert(bad_file.initialize("", &ss) == false, "file was initialized "
- "when there was an existing directory with the same name");
- assert(strstr(ss.as_string(), "tmplogdir is not a regular file") != NULL,
- "missing expected error message, received msg: %s", ss.as_string());
- ss.reset();
- remove(target_name);
-}
-
-// Ensure -Xlog:help and LogConfiguration::describe contain tagset descriptions
-void Test_logtagset_descriptions() {
- for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
- char expected[1024];
- d->tagset->label(expected, sizeof(expected), "+");
- jio_snprintf(expected + strlen(expected),
- sizeof(expected) - strlen(expected),
- ": %s", d->descr);
-
- ResourceMark rm;
- stringStream ss;
- LogConfiguration::describe(&ss);
- assert(strstr(ss.as_string(), expected) != NULL,
- "missing log tag set descriptions in LogConfiguration::describe");
-
- TestLogFile file("log_tagset_descriptions");
- FILE* fp = fopen(file.name(), "w+");
- assert(fp != NULL, "File open error");
- LogConfiguration::print_command_line_help(fp);
- fclose(fp);
- assert(number_of_lines_with_substring_in_file(file.name(), expected) > 0,
- "missing log tag set descriptions in -Xlog:help output");
- }
-}
-#endif // PRODUCT
diff --git a/hotspot/src/share/vm/logging/logFileOutput.cpp b/hotspot/src/share/vm/logging/logFileOutput.cpp
index 3f431ef3e54..868454172ee 100644
--- a/hotspot/src/share/vm/logging/logFileOutput.cpp
+++ b/hotspot/src/share/vm/logging/logFileOutput.cpp
@@ -97,11 +97,7 @@ static bool is_regular_file(const char* filename) {
if (ret != 0) {
return false;
}
-#ifdef _WINDOWS
- return (st.st_mode & S_IFMT) == _S_IFREG;
-#else
- return S_ISREG(st.st_mode);
-#endif
+ return (st.st_mode & S_IFMT) == S_IFREG;
}
// Try to find the next number that should be used for file rotation.
diff --git a/hotspot/src/share/vm/logging/logTag.hpp b/hotspot/src/share/vm/logging/logTag.hpp
index 9cbb568b414..a729b8d5150 100644
--- a/hotspot/src/share/vm/logging/logTag.hpp
+++ b/hotspot/src/share/vm/logging/logTag.hpp
@@ -40,6 +40,7 @@
LOG_TAG(attach) \
LOG_TAG(barrier) \
LOG_TAG(biasedlocking) \
+ LOG_TAG(blocks) \
LOG_TAG(bot) \
LOG_TAG(breakpoint) \
LOG_TAG(census) \
@@ -105,6 +106,7 @@
LOG_TAG(scavenge) \
LOG_TAG(scrub) \
LOG_TAG(stacktrace) \
+ LOG_TAG(stackwalk) \
LOG_TAG(start) \
LOG_TAG(startuptime) \
LOG_TAG(state) \
diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp
index 8c64dc53540..70f9f983210 100644
--- a/hotspot/src/share/vm/memory/filemap.cpp
+++ b/hotspot/src/share/vm/memory/filemap.cpp
@@ -263,7 +263,7 @@ void FileMapInfo::allocate_classpath_entry_table() {
} else {
struct stat st;
if (os::stat(name, &st) == 0) {
- if ((st.st_mode & S_IFDIR) == S_IFDIR) {
+ if ((st.st_mode & S_IFMT) == S_IFDIR) {
if (!os::dir_is_empty(name)) {
ClassLoader::exit_with_path_failure(
"Cannot have non-empty directory in archived classpaths", name);
diff --git a/hotspot/src/share/vm/memory/filemap.hpp b/hotspot/src/share/vm/memory/filemap.hpp
index fa1a0502ae2..086533e3b8f 100644
--- a/hotspot/src/share/vm/memory/filemap.hpp
+++ b/hotspot/src/share/vm/memory/filemap.hpp
@@ -283,11 +283,15 @@ public:
bool validate_classpath_entry_table();
static SharedClassPathEntry* shared_classpath(int index) {
+ if (index < 0) {
+ return NULL;
+ }
char* p = (char*)_classpath_entry_table;
p += _classpath_entry_size * index;
return (SharedClassPathEntry*)p;
}
static const char* shared_classpath_name(int index) {
+ assert(index >= 0, "Sanity");
return shared_classpath(index)->_name;
}
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index 4ba897e7ab9..948629b6684 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -249,10 +249,65 @@ class ChunkManager : public CHeapObj {
void print_on(outputStream* st) const;
};
+class SmallBlocks : public CHeapObj {
+ const static uint _small_block_max_size = sizeof(TreeChunk >)/HeapWordSize;
+ const static uint _small_block_min_size = sizeof(Metablock)/HeapWordSize;
+
+ private:
+ FreeList _small_lists[_small_block_max_size - _small_block_min_size];
+
+ FreeList& list_at(size_t word_size) {
+ assert(word_size >= _small_block_min_size, "There are no metaspace objects less than %u words", _small_block_min_size);
+ return _small_lists[word_size - _small_block_min_size];
+ }
+
+ public:
+ SmallBlocks() {
+ for (uint i = _small_block_min_size; i < _small_block_max_size; i++) {
+ uint k = i - _small_block_min_size;
+ _small_lists[k].set_size(i);
+ }
+ }
+
+ size_t total_size() const {
+ size_t result = 0;
+ for (uint i = _small_block_min_size; i < _small_block_max_size; i++) {
+ uint k = i - _small_block_min_size;
+ result = result + _small_lists[k].count() * _small_lists[k].size();
+ }
+ return result;
+ }
+
+ static uint small_block_max_size() { return _small_block_max_size; }
+ static uint small_block_min_size() { return _small_block_min_size; }
+
+ MetaWord* get_block(size_t word_size) {
+ if (list_at(word_size).count() > 0) {
+ MetaWord* new_block = (MetaWord*) list_at(word_size).get_chunk_at_head();
+ return new_block;
+ } else {
+ return NULL;
+ }
+ }
+ void return_block(Metablock* free_chunk, size_t word_size) {
+ list_at(word_size).return_chunk_at_head(free_chunk, false);
+ assert(list_at(word_size).count() > 0, "Should have a chunk");
+ }
+
+ void print_on(outputStream* st) const {
+ st->print_cr("SmallBlocks:");
+ for (uint i = _small_block_min_size; i < _small_block_max_size; i++) {
+ uint k = i - _small_block_min_size;
+ st->print_cr("small_lists size " SIZE_FORMAT " count " SIZE_FORMAT, _small_lists[k].size(), _small_lists[k].count());
+ }
+ }
+};
+
// Used to manage the free list of Metablocks (a block corresponds
// to the allocation of a quantum of metadata).
-class BlockFreelist VALUE_OBJ_CLASS_SPEC {
+class BlockFreelist : public CHeapObj {
BlockTreeDictionary* const _dictionary;
+ SmallBlocks* _small_blocks;
// Only allocate and split from freelist if the size of the allocation
// is at least 1/4th the size of the available block.
@@ -260,6 +315,12 @@ class BlockFreelist VALUE_OBJ_CLASS_SPEC {
// Accessors
BlockTreeDictionary* dictionary() const { return _dictionary; }
+ SmallBlocks* small_blocks() {
+ if (_small_blocks == NULL) {
+ _small_blocks = new SmallBlocks();
+ }
+ return _small_blocks;
+ }
public:
BlockFreelist();
@@ -269,8 +330,15 @@ class BlockFreelist VALUE_OBJ_CLASS_SPEC {
MetaWord* get_block(size_t word_size);
void return_block(MetaWord* p, size_t word_size);
- size_t total_size() { return dictionary()->total_size(); }
+ size_t total_size() const {
+ size_t result = dictionary()->total_size();
+ if (_small_blocks != NULL) {
+ result = result + _small_blocks->total_size();
+ }
+ return result;
+ }
+ static size_t min_dictionary_size() { return TreeChunk >::min_size(); }
void print_on(outputStream* st) const;
};
@@ -629,7 +697,7 @@ class SpaceManager : public CHeapObj {
// are assumed to be in chunks in use by the SpaceManager
// and all chunks in use by a SpaceManager are freed when
// the class loader using the SpaceManager is collected.
- BlockFreelist _block_freelists;
+ BlockFreelist* _block_freelists;
// protects virtualspace and chunk expansions
static const char* _expand_lock_name;
@@ -643,9 +711,7 @@ class SpaceManager : public CHeapObj {
_chunks_in_use[index] = v;
}
- BlockFreelist* block_freelists() const {
- return (BlockFreelist*) &_block_freelists;
- }
+ BlockFreelist* block_freelists() const { return _block_freelists; }
Metaspace::MetadataType mdtype() { return _mdtype; }
@@ -763,7 +829,9 @@ class SpaceManager : public CHeapObj {
void verify_allocated_blocks_words();
#endif
- size_t get_raw_word_size(size_t word_size) {
+ // This adjusts the size given to be greater than the minimum allocation size in
+ // words for data in metaspace. Esentially the minimum size is currently 3 words.
+ size_t get_allocation_word_size(size_t word_size) {
size_t byte_size = word_size * BytesPerWord;
size_t raw_bytes_size = MAX2(byte_size, sizeof(Metablock));
@@ -807,20 +875,45 @@ void VirtualSpaceNode::verify_container_count() {
// BlockFreelist methods
-BlockFreelist::BlockFreelist() : _dictionary(new BlockTreeDictionary()) {}
+BlockFreelist::BlockFreelist() : _dictionary(new BlockTreeDictionary()), _small_blocks(NULL) {}
BlockFreelist::~BlockFreelist() {
delete _dictionary;
+ if (_small_blocks != NULL) {
+ delete _small_blocks;
+ }
}
void BlockFreelist::return_block(MetaWord* p, size_t word_size) {
+ assert(word_size >= SmallBlocks::small_block_min_size(), "never return dark matter");
+
Metablock* free_chunk = ::new (p) Metablock(word_size);
+ if (word_size < SmallBlocks::small_block_max_size()) {
+ small_blocks()->return_block(free_chunk, word_size);
+ } else {
dictionary()->return_chunk(free_chunk);
}
+ log_trace(gc, metaspace, freelist, blocks)("returning block at " INTPTR_FORMAT " size = "
+ SIZE_FORMAT, p2i(free_chunk), word_size);
+}
MetaWord* BlockFreelist::get_block(size_t word_size) {
- if (word_size < TreeChunk >::min_size()) {
- // Dark matter. Too small for dictionary.
+ assert(word_size >= SmallBlocks::small_block_min_size(), "never get dark matter");
+
+ // Try small_blocks first.
+ if (word_size < SmallBlocks::small_block_max_size()) {
+ // Don't create small_blocks() until needed. small_blocks() allocates the small block list for
+ // this space manager.
+ MetaWord* new_block = (MetaWord*) small_blocks()->get_block(word_size);
+ if (new_block != NULL) {
+ log_trace(gc, metaspace, freelist, blocks)("getting block at " INTPTR_FORMAT " size = " SIZE_FORMAT,
+ p2i(new_block), word_size);
+ return new_block;
+ }
+ }
+
+ if (word_size < BlockFreelist::min_dictionary_size()) {
+ // If allocation in small blocks fails, this is Dark Matter. Too small for dictionary.
return NULL;
}
@@ -839,15 +932,20 @@ MetaWord* BlockFreelist::get_block(size_t word_size) {
MetaWord* new_block = (MetaWord*)free_block;
assert(block_size >= word_size, "Incorrect size of block from freelist");
const size_t unused = block_size - word_size;
- if (unused >= TreeChunk >::min_size()) {
+ if (unused >= SmallBlocks::small_block_min_size()) {
return_block(new_block + word_size, unused);
}
+ log_trace(gc, metaspace, freelist, blocks)("getting block at " INTPTR_FORMAT " size = " SIZE_FORMAT,
+ p2i(new_block), word_size);
return new_block;
}
void BlockFreelist::print_on(outputStream* st) const {
dictionary()->print_free_lists(st);
+ if (_small_blocks != NULL) {
+ _small_blocks->print_on(st);
+ }
}
// VirtualSpaceNode methods
@@ -2075,6 +2173,7 @@ SpaceManager::SpaceManager(Metaspace::MetadataType mdtype,
_allocated_blocks_words(0),
_allocated_chunks_words(0),
_allocated_chunks_count(0),
+ _block_freelists(NULL),
_lock(lock)
{
initialize();
@@ -2164,8 +2263,10 @@ SpaceManager::~SpaceManager() {
log.trace("~SpaceManager(): " PTR_FORMAT, p2i(this));
ResourceMark rm;
locked_print_chunks_in_use_on(log.trace_stream());
+ if (block_freelists() != NULL) {
block_freelists()->print_on(log.trace_stream());
}
+ }
// Have to update before the chunks_in_use lists are emptied
// below.
@@ -2215,6 +2316,10 @@ SpaceManager::~SpaceManager() {
}
log.trace("updated dictionary count " SIZE_FORMAT " %s", chunk_manager()->humongous_dictionary()->total_count(), chunk_size_name(HumongousIndex));
chunk_manager()->slow_locked_verify();
+
+ if (_block_freelists != NULL) {
+ delete _block_freelists;
+ }
}
const char* SpaceManager::chunk_size_name(ChunkIndex index) const {
@@ -2253,10 +2358,12 @@ ChunkIndex ChunkManager::list_index(size_t size) {
void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
assert_lock_strong(_lock);
- size_t raw_word_size = get_raw_word_size(word_size);
- size_t min_size = TreeChunk >::min_size();
- assert(raw_word_size >= min_size,
- "Should not deallocate dark matter " SIZE_FORMAT "<" SIZE_FORMAT, word_size, min_size);
+ // Allocations and deallocations are in raw_word_size
+ size_t raw_word_size = get_allocation_word_size(word_size);
+ // Lazily create a block_freelist
+ if (block_freelists() == NULL) {
+ _block_freelists = new BlockFreelist();
+ }
block_freelists()->return_block(p, raw_word_size);
}
@@ -2312,8 +2419,9 @@ void SpaceManager::add_chunk(Metachunk* new_chunk, bool make_current) {
void SpaceManager::retire_current_chunk() {
if (current_chunk() != NULL) {
size_t remaining_words = current_chunk()->free_word_size();
- if (remaining_words >= TreeChunk >::min_size()) {
- block_freelists()->return_block(current_chunk()->allocate(remaining_words), remaining_words);
+ if (remaining_words >= BlockFreelist::min_dictionary_size()) {
+ MetaWord* ptr = current_chunk()->allocate(remaining_words);
+ deallocate(ptr, remaining_words);
inc_used_metrics(remaining_words);
}
}
@@ -2350,7 +2458,7 @@ Metachunk* SpaceManager::get_new_chunk(size_t word_size,
* will be made to allocate a small chunk.
*/
MetaWord* SpaceManager::get_small_chunk_and_allocate(size_t word_size) {
- size_t raw_word_size = get_raw_word_size(word_size);
+ size_t raw_word_size = get_allocation_word_size(word_size);
if (raw_word_size + Metachunk::overhead() > small_chunk_size()) {
return NULL;
@@ -2380,8 +2488,7 @@ MetaWord* SpaceManager::get_small_chunk_and_allocate(size_t word_size) {
MetaWord* SpaceManager::allocate(size_t word_size) {
MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
-
- size_t raw_word_size = get_raw_word_size(word_size);
+ size_t raw_word_size = get_allocation_word_size(word_size);
BlockFreelist* fl = block_freelists();
MetaWord* p = NULL;
// Allocation from the dictionary is expensive in the sense that
@@ -2389,7 +2496,7 @@ MetaWord* SpaceManager::allocate(size_t word_size) {
// from the dictionary until it starts to get fat. Is this
// a reasonable policy? Maybe an skinny dictionary is fast enough
// for allocations. Do some profiling. JJJ
- if (fl->total_size() > allocation_from_dictionary_limit) {
+ if (fl != NULL && fl->total_size() > allocation_from_dictionary_limit) {
p = fl->get_block(raw_word_size);
}
if (p == NULL) {
@@ -2441,7 +2548,7 @@ void SpaceManager::verify() {
// If there are blocks in the dictionary, then
// verification of chunks does not work since
// being in the dictionary alters a chunk.
- if (block_freelists()->total_size() == 0) {
+ if (block_freelists() != NULL && block_freelists()->total_size() == 0) {
for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
Metachunk* curr = chunks_in_use(i);
while (curr != NULL) {
@@ -2499,7 +2606,7 @@ void SpaceManager::dump(outputStream* const out) const {
}
if (log_is_enabled(Trace, gc, metaspace, freelist)) {
- block_freelists()->print_on(out);
+ if (block_freelists() != NULL) block_freelists()->print_on(out);
}
size_t free = current_chunk() == NULL ? 0 : current_chunk()->free_word_size();
@@ -3410,18 +3517,11 @@ void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) {
|| Thread::current()->is_VM_thread(), "should be the VM thread");
if (DumpSharedSpaces && PrintSharedSpaces) {
- record_deallocation(ptr, vsm()->get_raw_word_size(word_size));
+ record_deallocation(ptr, vsm()->get_allocation_word_size(word_size));
}
MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
- if (word_size < TreeChunk >::min_size()) {
- // Dark matter. Too small for dictionary.
-#ifdef ASSERT
- Copy::fill_to_words((HeapWord*)ptr, word_size, 0xf5f5f5f5);
-#endif
- return;
- }
if (is_class && using_class_space()) {
class_vsm()->deallocate(ptr, word_size);
} else {
@@ -3451,7 +3551,7 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
report_out_of_shared_space(read_only ? SharedReadOnly : SharedReadWrite);
}
if (PrintSharedSpaces) {
- space->record_allocation(result, type, space->vsm()->get_raw_word_size(word_size));
+ space->record_allocation(result, type, space->vsm()->get_allocation_word_size(word_size));
}
// Zero initialize.
@@ -3509,10 +3609,11 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s
// If result is still null, we are out of memory.
Log(gc, metaspace, freelist) log;
- if (log.is_trace()) {
- log.trace("Metaspace allocation failed for size " SIZE_FORMAT, word_size);
+ if (log.is_info()) {
+ log.info("Metaspace (%s) allocation failed for size " SIZE_FORMAT,
+ is_class_space_allocation(mdtype) ? "class" : "data", word_size);
ResourceMark rm;
- outputStream* out = log.trace_stream();
+ outputStream* out = log.info_stream();
if (loader_data->metaspace_or_null() != NULL) {
loader_data->dump(out);
}
diff --git a/hotspot/src/share/vm/oops/constMethod.cpp b/hotspot/src/share/vm/oops/constMethod.cpp
index 8de67525a27..34fe9f9e8be 100644
--- a/hotspot/src/share/vm/oops/constMethod.cpp
+++ b/hotspot/src/share/vm/oops/constMethod.cpp
@@ -368,23 +368,36 @@ AnnotationArray** ConstMethod::default_annotations_addr() const {
return (AnnotationArray**)constMethod_end() - offset;
}
+Array* copy_annotations(ClassLoaderData* loader_data, AnnotationArray* from, TRAPS) {
+ int length = from->length();
+ Array* a = MetadataFactory::new_array(loader_data, length, 0, CHECK_NULL);
+ memcpy((void*)a->adr_at(0), (void*)from->adr_at(0), length);
+ return a;
+}
+
// copy annotations from 'cm' to 'this'
-void ConstMethod::copy_annotations_from(ConstMethod* cm) {
+// Must make copy because these are deallocated with their constMethod, if redefined.
+void ConstMethod::copy_annotations_from(ClassLoaderData* loader_data, ConstMethod* cm, TRAPS) {
+ Array* a;
if (cm->has_method_annotations()) {
assert(has_method_annotations(), "should be allocated already");
- set_method_annotations(cm->method_annotations());
+ a = copy_annotations(loader_data, cm->method_annotations(), CHECK);
+ set_method_annotations(a);
}
if (cm->has_parameter_annotations()) {
assert(has_parameter_annotations(), "should be allocated already");
- set_parameter_annotations(cm->parameter_annotations());
+ a = copy_annotations(loader_data, cm->parameter_annotations(), CHECK);
+ set_parameter_annotations(a);
}
if (cm->has_type_annotations()) {
assert(has_type_annotations(), "should be allocated already");
- set_type_annotations(cm->type_annotations());
+ a = copy_annotations(loader_data, cm->type_annotations(), CHECK);
+ set_type_annotations(a);
}
if (cm->has_default_annotations()) {
assert(has_default_annotations(), "should be allocated already");
- set_default_annotations(cm->default_annotations());
+ a = copy_annotations(loader_data, cm->default_annotations(), CHECK);
+ set_default_annotations(a);
}
}
diff --git a/hotspot/src/share/vm/oops/constMethod.hpp b/hotspot/src/share/vm/oops/constMethod.hpp
index 7f63d9e2b38..568c6c49283 100644
--- a/hotspot/src/share/vm/oops/constMethod.hpp
+++ b/hotspot/src/share/vm/oops/constMethod.hpp
@@ -469,7 +469,7 @@ public:
}
// Copy annotations from other ConstMethod
- void copy_annotations_from(ConstMethod* cm);
+ void copy_annotations_from(ClassLoaderData* loader_data, ConstMethod* cm, TRAPS);
// byte codes
void set_code(address code) {
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index 1af90ceec69..db65cefa550 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -674,20 +674,20 @@ void InstanceKlass::link_methods(TRAPS) {
// Eagerly initialize superinterfaces that declare default methods (concrete instance: any access)
void InstanceKlass::initialize_super_interfaces(instanceKlassHandle this_k, TRAPS) {
- assert (this_k->has_default_methods(), "caller should have checked this");
+ assert (this_k->has_nonstatic_concrete_methods(), "caller should have checked this");
for (int i = 0; i < this_k->local_interfaces()->length(); ++i) {
Klass* iface = this_k->local_interfaces()->at(i);
InstanceKlass* ik = InstanceKlass::cast(iface);
// Initialization is depth first search ie. we start with top of the inheritance tree
- // has_default_methods drives searching superinterfaces since it
- // means has_default_methods in its superinterface hierarchy
- if (ik->has_default_methods()) {
+ // has_nonstatic_concrete_methods drives searching superinterfaces since it
+ // means has_nonstatic_concrete_methods in its superinterface hierarchy
+ if (ik->has_nonstatic_concrete_methods()) {
ik->initialize_super_interfaces(ik, CHECK);
}
// Only initialize() interfaces that "declare" concrete methods.
- if (ik->should_be_initialized() && ik->declares_default_methods()) {
+ if (ik->should_be_initialized() && ik->declares_nonstatic_concrete_methods()) {
ik->initialize(CHECK);
}
}
@@ -761,11 +761,11 @@ void InstanceKlass::initialize_impl(instanceKlassHandle this_k, TRAPS) {
if (super_klass != NULL && super_klass->should_be_initialized()) {
super_klass->initialize(THREAD);
}
- // If C implements any interfaces that declares a non-abstract, non-static method,
+ // If C implements any interface that declares a non-static, concrete method,
// the initialization of C triggers initialization of its super interfaces.
- // Only need to recurse if has_default_methods which includes declaring and
- // inheriting default methods
- if (!HAS_PENDING_EXCEPTION && this_k->has_default_methods()) {
+ // Only need to recurse if has_nonstatic_concrete_methods which includes declaring and
+ // having a superinterface that declares, non-static, concrete methods
+ if (!HAS_PENDING_EXCEPTION && this_k->has_nonstatic_concrete_methods()) {
this_k->initialize_super_interfaces(this_k, THREAD);
}
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index cdba02b1119..f187ef56d02 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -207,18 +207,18 @@ class InstanceKlass: public Klass {
// Start after _misc_kind field.
enum {
- _misc_rewritten = 1 << 2, // methods rewritten.
- _misc_has_nonstatic_fields = 1 << 3, // for sizing with UseCompressedOops
- _misc_should_verify_class = 1 << 4, // allow caching of preverification
- _misc_is_anonymous = 1 << 5, // has embedded _host_klass field
- _misc_is_contended = 1 << 6, // marked with contended annotation
- _misc_has_default_methods = 1 << 7, // class/superclass/implemented interfaces has default methods
- _misc_declares_default_methods = 1 << 8, // directly declares default methods (any access)
- _misc_has_been_redefined = 1 << 9, // class has been redefined
- _misc_is_scratch_class = 1 << 10, // class is the redefined scratch class
- _misc_is_shared_boot_class = 1 << 11, // defining class loader is boot class loader
- _misc_is_shared_platform_class = 1 << 12, // defining class loader is platform class loader
- _misc_is_shared_app_class = 1 << 13 // defining class loader is app class loader
+ _misc_rewritten = 1 << 2, // methods rewritten.
+ _misc_has_nonstatic_fields = 1 << 3, // for sizing with UseCompressedOops
+ _misc_should_verify_class = 1 << 4, // allow caching of preverification
+ _misc_is_anonymous = 1 << 5, // has embedded _host_klass field
+ _misc_is_contended = 1 << 6, // marked with contended annotation
+ _misc_has_nonstatic_concrete_methods = 1 << 7, // class/superclass/implemented interfaces has non-static, concrete methods
+ _misc_declares_nonstatic_concrete_methods = 1 << 8, // directly declares non-static, concrete methods
+ _misc_has_been_redefined = 1 << 9, // class has been redefined
+ _misc_is_scratch_class = 1 << 10, // class is the redefined scratch class
+ _misc_is_shared_boot_class = 1 << 11, // defining class loader is boot class loader
+ _misc_is_shared_platform_class = 1 << 12, // defining class loader is platform class loader
+ _misc_is_shared_app_class = 1 << 13 // defining class loader is app class loader
};
u2 loader_type_bits() {
return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
@@ -814,25 +814,25 @@ public:
#endif // INCLUDE_JVMTI
- bool has_default_methods() const {
- return (_misc_flags & _misc_has_default_methods) != 0;
+ bool has_nonstatic_concrete_methods() const {
+ return (_misc_flags & _misc_has_nonstatic_concrete_methods) != 0;
}
- void set_has_default_methods(bool b) {
+ void set_has_nonstatic_concrete_methods(bool b) {
if (b) {
- _misc_flags |= _misc_has_default_methods;
+ _misc_flags |= _misc_has_nonstatic_concrete_methods;
} else {
- _misc_flags &= ~_misc_has_default_methods;
+ _misc_flags &= ~_misc_has_nonstatic_concrete_methods;
}
}
- bool declares_default_methods() const {
- return (_misc_flags & _misc_declares_default_methods) != 0;
+ bool declares_nonstatic_concrete_methods() const {
+ return (_misc_flags & _misc_declares_nonstatic_concrete_methods) != 0;
}
- void set_declares_default_methods(bool b) {
+ void set_declares_nonstatic_concrete_methods(bool b) {
if (b) {
- _misc_flags |= _misc_declares_default_methods;
+ _misc_flags |= _misc_declares_nonstatic_concrete_methods;
} else {
- _misc_flags &= ~_misc_declares_default_methods;
+ _misc_flags &= ~_misc_declares_nonstatic_concrete_methods;
}
}
diff --git a/hotspot/src/share/vm/oops/klassVtable.cpp b/hotspot/src/share/vm/oops/klassVtable.cpp
index c3118cc24e6..9715d2b087a 100644
--- a/hotspot/src/share/vm/oops/klassVtable.cpp
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp
@@ -226,7 +226,7 @@ void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) {
HandleMark hm(THREAD);
assert(default_methods->at(i)->is_method(), "must be a Method*");
methodHandle mh(THREAD, default_methods->at(i));
-
+ assert(!mh->is_private(), "private interface method in the default method list");
bool needs_new_entry = update_inherited_vtable(ik(), mh, super_vtable_len, i, checkconstraints, CHECK);
// needs new entry
@@ -362,14 +362,16 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle tar
Array* def_vtable_indices = NULL;
bool is_default = false;
- // default methods are concrete methods in superinterfaces which are added to the vtable
- // with their real method_holder
+
+ // default methods are non-private concrete methods in superinterfaces which are added
+ // to the vtable with their real method_holder.
// Since vtable and itable indices share the same storage, don't touch
- // the default method's real vtable/itable index
+ // the default method's real vtable/itable index.
// default_vtable_indices stores the vtable value relative to this inheritor
if (default_index >= 0 ) {
is_default = true;
def_vtable_indices = klass->default_vtable_indices();
+ assert(!target_method()->is_private(), "private interface method flagged as default");
assert(def_vtable_indices != NULL, "def vtable alloc?");
assert(default_index <= def_vtable_indices->length(), "def vtable len?");
} else {
@@ -395,12 +397,15 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle tar
// This method will either be assigned its own itable index later,
// or be assigned an inherited vtable index in the loop below.
// default methods inherited by classes store their vtable indices
- // in the inheritor's default_vtable_indices
+ // in the inheritor's default_vtable_indices.
// default methods inherited by interfaces may already have a
- // valid itable index, if so, don't change it
- // overpass methods in an interface will be assigned an itable index later
- // by an inheriting class
- if (!is_default || !target_method()->has_itable_index()) {
+ // valid itable index, if so, don't change it.
+ // Overpass methods in an interface will be assigned an itable index later
+ // by an inheriting class.
+ // Private interface methods have no itable index and are always invoked nonvirtually,
+ // so they retain their nonvirtual_vtable_index value, and therefore can_be_statically_bound()
+ // will return true.
+ if ((!is_default || !target_method()->has_itable_index()) && !target_method()->is_private()) {
target_method()->set_vtable_index(Method::pending_itable_index);
}
}
@@ -597,7 +602,9 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
// abstract method entries using default inheritance rules
if (target_method()->method_holder() != NULL &&
target_method()->method_holder()->is_interface() &&
- !target_method()->is_abstract() ) {
+ !target_method()->is_abstract()) {
+ assert(target_method()->is_default_method() || target_method()->is_private(),
+ "unexpected interface method type");
return false;
}
@@ -606,10 +613,8 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
return true;
}
- // private methods in classes always have a new entry in the vtable
- // specification interpretation since classic has
- // private methods not overriding
- // JDK8 adds private methods in interfaces which require invokespecial
+ // private methods in classes always have a new entry in the vtable.
+ // Specification interpretation since classic has private methods not overriding.
if (target_method()->is_private()) {
return true;
}
@@ -1088,6 +1093,7 @@ void klassItable::initialize_itable(bool checkconstraints, TRAPS) {
inline bool interface_method_needs_itable_index(Method* m) {
if (m->is_static()) return false; // e.g., Stream.empty
if (m->is_initializer()) return false; // or
+ if (m->is_private()) return false; // requires invokeSpecial
// If an interface redeclares a method from java.lang.Object,
// it should already have a vtable index, don't touch it.
// e.g., CharSequence.toString (from initialize_vtable)
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index 95e38717dc5..0cd830f1934 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -97,7 +97,7 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags) {
// Fix and bury in Method*
set_interpreter_entry(NULL); // sets i2i entry and from_int
set_adapter_entry(NULL);
- clear_code(); // from_c/from_i get set to c2i/i2i
+ clear_code(false /* don't need a lock */); // from_c/from_i get set to c2i/i2i
if (access_flags.is_native()) {
clear_native_function();
@@ -277,7 +277,8 @@ int Method::validate_bci_from_bcp(address bcp) const {
}
address Method::bcp_from(int bci) const {
- assert((is_native() && bci == 0) || (!is_native() && 0 <= bci && bci < code_size()), "illegal bci: %d", bci);
+ assert((is_native() && bci == 0) || (!is_native() && 0 <= bci && bci < code_size()),
+ "illegal bci: %d for %s method", bci, is_native() ? "native" : "non-native");
address bcp = code_base() + bci;
assert(is_native() && bcp == code_base() || contains(bcp), "bcp doesn't belong to this method");
return bcp;
@@ -558,7 +559,7 @@ bool Method::compute_has_loops_flag() {
bool Method::is_final_method(AccessFlags class_access_flags) const {
// or "does_not_require_vtable_entry"
// default method or overpass can occur, is not final (reuses vtable entry)
- // private methods get vtable entries for backward class compatibility.
+ // private methods in classes get vtable entries for backward class compatibility.
if (is_overpass() || is_default_method()) return false;
return is_final() || class_access_flags.is_final();
}
@@ -570,7 +571,7 @@ bool Method::is_final_method() const {
bool Method::is_default_method() const {
if (method_holder() != NULL &&
method_holder()->is_interface() &&
- !is_abstract()) {
+ !is_abstract() && !is_private()) {
return true;
} else {
return false;
@@ -583,7 +584,9 @@ bool Method::can_be_statically_bound(AccessFlags class_access_flags) const {
ResourceMark rm;
bool is_nonv = (vtable_index() == nonvirtual_vtable_index);
if (class_access_flags.is_interface()) {
- assert(is_nonv == is_static(), "is_nonv=%s", name_and_sig_as_C_string());
+ assert(is_nonv == is_static() || is_nonv == is_private(),
+ "nonvirtual unexpected for non-static, non-private: %s",
+ name_and_sig_as_C_string());
}
#endif
assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question");
@@ -904,8 +907,8 @@ void Method::set_not_osr_compilable(int comp_level, bool report, const char* rea
}
// Revert to using the interpreter and clear out the nmethod
-void Method::clear_code() {
-
+void Method::clear_code(bool acquire_lock /* = true */) {
+ MutexLockerEx pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
// this may be NULL if c2i adapters have not been made yet
// Only should happen at allocate time.
if (adapter() == NULL) {
@@ -1074,6 +1077,7 @@ bool Method::check_code() const {
// Install compiled code. Instantly it can execute.
void Method::set_code(methodHandle mh, CompiledMethod *code) {
+ MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
assert( code, "use clear_code to remove code" );
assert( mh->check_code(), "" );
@@ -1376,7 +1380,7 @@ methodHandle Method::clone_with_new_data(methodHandle m, u_char* new_code, int n
}
// copy annotations over to new method
- newcm->copy_annotations_from(cm);
+ newcm->copy_annotations_from(loader_data, cm, CHECK_NULL);
return newm;
}
diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp
index 92cca9e3839..d8f51ca6b00 100644
--- a/hotspot/src/share/vm/oops/method.hpp
+++ b/hotspot/src/share/vm/oops/method.hpp
@@ -436,7 +436,7 @@ class Method : public Metadata {
address verified_code_entry();
bool check_code() const; // Not inline to avoid circular ref
CompiledMethod* volatile code() const { assert( check_code(), "" ); return (CompiledMethod *)OrderAccess::load_ptr_acquire(&_code); }
- void clear_code(); // Clear out any compiled code
+ void clear_code(bool acquire_lock = true); // Clear out any compiled code
static void set_code(methodHandle mh, CompiledMethod* code);
void set_adapter_entry(AdapterHandlerEntry* adapter) {
constMethod()->set_adapter_entry(adapter);
@@ -584,6 +584,7 @@ class Method : public Metadata {
// checks method and its method holder
bool is_final_method() const;
bool is_final_method(AccessFlags class_access_flags) const;
+ // interface method declared with 'default' - excludes private interface methods
bool is_default_method() const;
// true if method needs no dynamic dispatch (final and/or no vtable entry)
diff --git a/hotspot/src/share/vm/oops/methodData.hpp b/hotspot/src/share/vm/oops/methodData.hpp
index ee39f066288..a85b64e8801 100644
--- a/hotspot/src/share/vm/oops/methodData.hpp
+++ b/hotspot/src/share/vm/oops/methodData.hpp
@@ -1190,12 +1190,11 @@ protected:
#if INCLUDE_JVMCI
// Description of the different counters
// ReceiverTypeData for instanceof/checkcast/aastore:
- // C1/C2: count is incremented on type overflow and decremented for failed type checks
- // JVMCI: count decremented for failed type checks and nonprofiled_count is incremented on type overflow
- // TODO (chaeubl): in fact, JVMCI should also increment the count for failed type checks to mimic the C1/C2 behavior
+ // count is decremented for failed type checks
+ // JVMCI only: nonprofiled_count is incremented on type overflow
// VirtualCallData for invokevirtual/invokeinterface:
- // C1/C2: count is incremented on type overflow
- // JVMCI: count is incremented on type overflow, nonprofiled_count is incremented on method overflow
+ // count is incremented on type overflow
+ // JVMCI only: nonprofiled_count is incremented on method overflow
// JVMCI is interested in knowing the percentage of type checks involving a type not explicitly in the profile
nonprofiled_count_off_set = counter_cell_count,
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index f0b0e398ec1..b8379ec10ee 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -574,6 +574,10 @@ uint Compile::scratch_emit_size(const Node* n) {
buf.consts()->initialize_shared_locs(&locs_buf[lsize * 0], lsize);
buf.insts()->initialize_shared_locs( &locs_buf[lsize * 1], lsize);
buf.stubs()->initialize_shared_locs( &locs_buf[lsize * 2], lsize);
+ // Mark as scratch buffer.
+ buf.consts()->set_scratch_emit();
+ buf.insts()->set_scratch_emit();
+ buf.stubs()->set_scratch_emit();
// Do the emission.
@@ -2867,15 +2871,20 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
addp->Opcode() == Op_ConP &&
addp == n->in(AddPNode::Base) &&
n->in(AddPNode::Offset)->is_Con()) {
+ // If the transformation of ConP to ConN+DecodeN is beneficial depends
+ // on the platform and on the compressed oops mode.
// Use addressing with narrow klass to load with offset on x86.
- // On sparc loading 32-bits constant and decoding it have less
- // instructions (4) then load 64-bits constant (7).
+ // Some platforms can use the constant pool to load ConP.
// Do this transformation here since IGVN will convert ConN back to ConP.
const Type* t = addp->bottom_type();
- if (t->isa_oopptr() || t->isa_klassptr()) {
+ bool is_oop = t->isa_oopptr() != NULL;
+ bool is_klass = t->isa_klassptr() != NULL;
+
+ if ((is_oop && Matcher::const_oop_prefer_decode() ) ||
+ (is_klass && Matcher::const_klass_prefer_decode())) {
Node* nn = NULL;
- int op = t->isa_oopptr() ? Op_ConN : Op_ConNKlass;
+ int op = is_oop ? Op_ConN : Op_ConNKlass;
// Look for existing ConN node of the same exact type.
Node* r = root();
@@ -2891,7 +2900,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
if (nn != NULL) {
// Decode a narrow oop to match address
// [R12 + narrow_oop_reg<<3 + offset]
- if (t->isa_oopptr()) {
+ if (is_oop) {
nn = new DecodeNNode(nn, t);
} else {
nn = new DecodeNKlassNode(nn, t);
diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp
index 727e0b920cc..7909014b53e 100644
--- a/hotspot/src/share/vm/opto/loopnode.cpp
+++ b/hotspot/src/share/vm/opto/loopnode.cpp
@@ -1687,6 +1687,12 @@ void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) {
Node *init2 = phi2->in( LoopNode::EntryControl );
int stride_con2 = incr2->in(2)->get_int();
+ // The ratio of the two strides cannot be represented as an int
+ // if stride_con2 is min_int and stride_con is -1.
+ if (stride_con2 == min_jint && stride_con == -1) {
+ continue;
+ }
+
// The general case here gets a little tricky. We want to find the
// GCD of all possible parallel IV's and make a new IV using this
// GCD for the loop. Then all possible IVs are simple multiples of
diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp
index 8aaeb0e4637..369af1f6905 100644
--- a/hotspot/src/share/vm/opto/macro.cpp
+++ b/hotspot/src/share/vm/opto/macro.cpp
@@ -439,12 +439,6 @@ Node* PhaseMacroExpand::make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset,
Node* adr = _igvn.transform(new AddPNode(base, base, MakeConX(offset)));
const TypePtr* adr_type = _igvn.type(base)->is_ptr()->add_offset(offset);
Node* m = ac->in(TypeFunc::Memory);
- while (m->is_MergeMem()) {
- m = m->as_MergeMem()->memory_at(C->get_alias_index(adr_type));
- if (m->is_Proj() && m->in(0)->is_MemBar()) {
- m = m->in(0)->in(TypeFunc::Memory);
- }
- }
res = LoadNode::make(_igvn, ctl, m, adr, adr_type, type, bt, MemNode::unordered, LoadNode::Pinned);
} else {
if (ac->modifies(offset, offset, &_igvn, true)) {
@@ -978,6 +972,17 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray proj_out(TypeFunc::Control);
+ Node* mem_proj = n->proj_out(TypeFunc::Memory);
+ if (ctl_proj != NULL) {
+ igvn.replace_node(ctl_proj, n->in(0));
+ }
+ if (mem_proj != NULL) {
+ igvn.replace_node(mem_proj, n->in(TypeFunc::Memory));
+ }
+}
+
// Process users of eliminated allocation.
void PhaseMacroExpand::process_users_of_allocation(CallNode *alloc) {
Node* res = alloc->result_cast();
@@ -1008,13 +1013,13 @@ void PhaseMacroExpand::process_users_of_allocation(CallNode *alloc) {
// Disconnect ArrayCopy node
ArrayCopyNode* ac = n->as_ArrayCopy();
assert(ac->is_clonebasic(), "unexpected array copy kind");
- Node* ctl_proj = ac->proj_out(TypeFunc::Control);
- Node* mem_proj = ac->proj_out(TypeFunc::Memory);
- if (ctl_proj != NULL) {
- _igvn.replace_node(ctl_proj, n->in(0));
- }
- if (mem_proj != NULL) {
- _igvn.replace_node(mem_proj, n->in(TypeFunc::Memory));
+ Node* membar_after = ac->proj_out(TypeFunc::Control)->unique_ctrl_out();
+ disconnect_projections(ac, _igvn);
+ assert(alloc->in(0)->is_Proj() && alloc->in(0)->in(0)->Opcode() == Op_MemBarCPUOrder, "mem barrier expected before allocation");
+ Node* membar_before = alloc->in(0)->in(0);
+ disconnect_projections(membar_before->as_MemBar(), _igvn);
+ if (membar_after->is_MemBar()) {
+ disconnect_projections(membar_after->as_MemBar(), _igvn);
}
} else {
eliminate_card_mark(n);
diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp
index 74d7361d08c..faaf04cdef3 100644
--- a/hotspot/src/share/vm/opto/matcher.hpp
+++ b/hotspot/src/share/vm/opto/matcher.hpp
@@ -457,6 +457,9 @@ public:
static bool narrow_oop_use_complex_address();
static bool narrow_klass_use_complex_address();
+ static bool const_oop_prefer_decode();
+ static bool const_klass_prefer_decode();
+
// Generate implicit null check for narrow oops if it can fold
// into address expression (x64).
//
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
index f083a74c7aa..bb67d13caa3 100644
--- a/hotspot/src/share/vm/prims/jni.cpp
+++ b/hotspot/src/share/vm/prims/jni.cpp
@@ -1173,7 +1173,7 @@ static void jni_invoke_nonstatic(JNIEnv *env, JavaValue* result, jobject receive
args->set_java_argument_object(&java_args);
// handle arguments
- assert(!method->is_static(), "method should not be static");
+ assert(!method->is_static(), "method %s should not be static", method->name_and_sig_as_C_string());
args->push_receiver(h_recv); // Push jobject handle
// Fill out JavaCallArguments object
diff --git a/hotspot/src/share/vm/prims/stackwalk.cpp b/hotspot/src/share/vm/prims/stackwalk.cpp
index 0948e50e8be..e130127318a 100644
--- a/hotspot/src/share/vm/prims/stackwalk.cpp
+++ b/hotspot/src/share/vm/prims/stackwalk.cpp
@@ -26,6 +26,7 @@
#include "classfile/javaClasses.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "classfile/vmSymbols.hpp"
+#include "logging/log.hpp"
#include "memory/oopFactory.hpp"
#include "oops/oop.inline.hpp"
#include "oops/objArrayOop.inline.hpp"
@@ -105,10 +106,8 @@ int StackWalk::fill_in_frames(jlong mode, BaseFrameStream& stream,
int max_nframes, int start_index,
objArrayHandle frames_array,
int& end_index, TRAPS) {
- if (TraceStackWalk) {
- tty->print_cr("fill_in_frames limit=%d start=%d frames length=%d",
- max_nframes, start_index, frames_array->length());
- }
+ log_debug(stackwalk)("fill_in_frames limit=%d start=%d frames length=%d",
+ max_nframes, start_index, frames_array->length());
assert(max_nframes > 0, "invalid max_nframes");
assert(start_index + max_nframes <= frames_array->length(), "oob");
@@ -122,18 +121,24 @@ int StackWalk::fill_in_frames(jlong mode, BaseFrameStream& stream,
// not set) and when StackWalker::getCallerClass is called
if (!ShowHiddenFrames && (skip_hidden_frames(mode) || get_caller_class(mode))) {
if (method->is_hidden()) {
- if (TraceStackWalk) {
- tty->print(" hidden method: "); method->print_short_name();
- tty->print("\n");
+ if (log_is_enabled(Debug, stackwalk)) {
+ ResourceMark rm(THREAD);
+ outputStream* st = Log(stackwalk)::debug_stream();
+ st->print(" hidden method: ");
+ method->print_short_name(st);
+ st->cr();
}
continue;
}
}
int index = end_index++;
- if (TraceStackWalk) {
- tty->print(" %d: frame method: ", index); method->print_short_name();
- tty->print_cr(" bci=%d", stream.bci());
+ if (log_is_enabled(Debug, stackwalk)) {
+ ResourceMark rm(THREAD);
+ outputStream* st = Log(stackwalk)::debug_stream();
+ st->print(" %d: frame method: ", index);
+ method->print_short_name(st);
+ st->print_cr(" bci=%d", stream.bci());
}
if (!need_method_info(mode) && get_caller_class(mode) &&
@@ -317,10 +322,8 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
TRAPS) {
ResourceMark rm(THREAD);
JavaThread* jt = (JavaThread*)THREAD;
- if (TraceStackWalk) {
- tty->print_cr("Start walking: mode " JLONG_FORMAT " skip %d frames batch size %d",
- mode, skip_frames, frame_count);
- }
+ log_debug(stackwalk)("Start walking: mode " JLONG_FORMAT " skip %d frames batch size %d",
+ mode, skip_frames, frame_count);
if (frames_array.is_null()) {
THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", NULL);
@@ -355,8 +358,12 @@ oop StackWalk::fetchFirstBatch(BaseFrameStream& stream, Handle stackStream,
break;
}
- if (TraceStackWalk) {
- tty->print(" skip "); stream.method()->print_short_name(); tty->print("\n");
+ if (log_is_enabled(Debug, stackwalk)) {
+ ResourceMark rm(THREAD);
+ outputStream* st = Log(stackwalk)::debug_stream();
+ st->print(" skip ");
+ stream.method()->print_short_name(st);
+ st->cr();
}
stream.next();
}
@@ -364,8 +371,12 @@ oop StackWalk::fetchFirstBatch(BaseFrameStream& stream, Handle stackStream,
// stack frame has been traversed individually and resume stack walk
// from the stack frame at depth == skip_frames.
for (int n=0; n < skip_frames && !stream.at_end(); stream.next(), n++) {
- if (TraceStackWalk) {
- tty->print(" skip "); stream.method()->print_short_name(); tty->cr();
+ if (log_is_enabled(Debug, stackwalk)) {
+ ResourceMark rm(THREAD);
+ outputStream* st = Log(stackwalk)::debug_stream();
+ st->print(" skip ");
+ stream.method()->print_short_name(st);
+ st->cr();
}
}
}
@@ -438,10 +449,9 @@ jint StackWalk::fetchNextBatch(Handle stackStream, jlong mode, jlong magic,
THROW_MSG_(vmSymbols::java_lang_NullPointerException(), "frames_array is NULL", 0L);
}
- if (TraceStackWalk) {
- tty->print_cr("StackWalk::fetchNextBatch frame_count %d existing_stream " PTR_FORMAT " start %d frames %d",
- frame_count, p2i(existing_stream), start_index, frames_array->length());
- }
+ log_debug(stackwalk)("StackWalk::fetchNextBatch frame_count %d existing_stream "
+ PTR_FORMAT " start %d frames %d",
+ frame_count, p2i(existing_stream), start_index, frames_array->length());
int end_index = start_index;
if (frame_count <= 0) {
return end_index; // No operation.
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index cdd3559fda1..b02fa54e95f 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -351,14 +351,6 @@ void Arguments::init_version_specific_system_properties() {
* Deprecated options should be tested in VMDeprecatedOptions.java.
*/
-// Obsolete or deprecated -XX flag.
-typedef struct {
- const char* name;
- JDK_Version deprecated_in; // When the deprecation warning started (or "undefined").
- JDK_Version obsolete_in; // When the obsolete warning started (or "undefined").
- JDK_Version expired_in; // When the option expires (or "undefined").
-} SpecialFlag;
-
// The special_jvm_flags table declares options that are being deprecated and/or obsoleted. The
// "deprecated_in" or "obsolete_in" fields may be set to "undefined", but not both.
// When the JDK version reaches 'deprecated_in' limit, the JVM will process this flag on
@@ -380,6 +372,8 @@ static SpecialFlag const special_jvm_flags[] = {
// -------------- Deprecated Flags --------------
// --- Non-alias flags - sorted by obsolete_in then expired_in:
{ "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
+ { "AutoGCSelectPauseMillis", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
+ { "UseAutoGCSelectPolicy", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
{ "UseParNewGC", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(10) },
{ "ConvertSleepToYield", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) },
{ "ConvertYieldToSleep", JDK_Version::jdk(9), JDK_Version::jdk(10), JDK_Version::jdk(11) },
@@ -500,7 +494,14 @@ static bool version_less_than(JDK_Version v, JDK_Version other) {
}
}
+extern bool lookup_special_flag_ext(const char *flag_name, SpecialFlag& flag);
+
static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) {
+ // Allow extensions to have priority
+ if (lookup_special_flag_ext(flag_name, flag)) {
+ return true;
+ }
+
for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) {
flag = special_jvm_flags[i];
@@ -1805,10 +1806,15 @@ bool Arguments::gc_selected() {
void Arguments::select_gc_ergonomically() {
#if INCLUDE_ALL_GCS
if (os::is_server_class_machine()) {
- if (should_auto_select_low_pause_collector()) {
- FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true);
+ if (!UseAutoGCSelectPolicy) {
+ FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
} else {
- FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
+ if (should_auto_select_low_pause_collector()) {
+ FLAG_SET_ERGO_IF_DEFAULT(bool, UseConcMarkSweepGC, true);
+ FLAG_SET_ERGO_IF_DEFAULT(bool, UseParNewGC, true);
+ } else {
+ FLAG_SET_ERGO_IF_DEFAULT(bool, UseParallelGC, true);
+ }
}
} else {
FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
@@ -2875,11 +2881,13 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true) != Flag::SUCCESS) {
return JNI_EINVAL;
}
+ handle_extra_cms_flags("-Xconcgc uses UseConcMarkSweepGC");
// -Xnoconcgc
} else if (match_option(option, "-Xnoconcgc")) {
if (FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false) != Flag::SUCCESS) {
return JNI_EINVAL;
}
+ handle_extra_cms_flags("-Xnoconcgc uses UseConcMarkSweepGC");
// -Xbatch
} else if (match_option(option, "-Xbatch")) {
if (FLAG_SET_CMDLINE(bool, BackgroundCompilation, false) != Flag::SUCCESS) {
@@ -4169,6 +4177,15 @@ bool Arguments::handle_deprecated_print_gc_flags() {
return true;
}
+void Arguments::handle_extra_cms_flags(const char* msg) {
+ SpecialFlag flag;
+ const char *flag_name = "UseConcMarkSweepGC";
+ if (lookup_special_flag(flag_name, flag)) {
+ handle_aliases_and_deprecation(flag_name, /* print warning */ true);
+ warning("%s", msg);
+ }
+}
+
// Parse entry point called from JNI_CreateJavaVM
jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index c989e61fe07..ce94e553d04 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -41,6 +41,14 @@ extern "C" {
typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args) ATTRIBUTE_PRINTF(2, 0);
}
+// Obsolete or deprecated -XX flag.
+struct SpecialFlag {
+ const char* name;
+ JDK_Version deprecated_in; // When the deprecation warning started (or "undefined").
+ JDK_Version obsolete_in; // When the obsolete warning started (or "undefined").
+ JDK_Version expired_in; // When the option expires (or "undefined").
+};
+
// PathString is used as:
// - the underlying value for a SystemProperty
// - the path portion of an --patch-module module/path pair
@@ -519,6 +527,8 @@ class Arguments : AllStatic {
static bool handle_deprecated_print_gc_flags();
+ static void handle_extra_cms_flags(const char* msg);
+
static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args,
const JavaVMInitArgs *java_options_args,
const JavaVMInitArgs *cmd_line_args);
diff --git a/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c b/hotspot/src/share/vm/runtime/arguments_ext.cpp
similarity index 65%
rename from hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c
rename to hotspot/src/share/vm/runtime/arguments_ext.cpp
index c18c53c750e..3d26a5fbc02 100644
--- a/hotspot/test/compiler/floatingpoint/libTest15FloatJNIArgs.c
+++ b/hotspot/src/share/vm/runtime/arguments_ext.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -19,23 +19,12 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
+ *
*/
-#include
+#include "precompiled.hpp"
+#include "runtime/arguments.hpp"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-JNIEXPORT jfloat JNICALL Java_compiler_floatingpoint_Test15FloatJNIArgs_add15floats
- (JNIEnv *env, jclass cls,
- jfloat f1, jfloat f2, jfloat f3, jfloat f4,
- jfloat f5, jfloat f6, jfloat f7, jfloat f8,
- jfloat f9, jfloat f10, jfloat f11, jfloat f12,
- jfloat f13, jfloat f14, jfloat f15) {
- return f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13 + f14 + f15;
+bool lookup_special_flag_ext(const char *flag_name, SpecialFlag& flag) {
+ return false;
}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index ec1c15f7184..4d613d6c572 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -2887,9 +2887,6 @@ public:
"exceptions (0 means all)") \
range(0, max_jint/2) \
\
- develop(bool, TraceStackWalk, false, \
- "Trace stack walking") \
- \
/* notice: the max range value here is max_jint, not max_intx */ \
/* because of overflow issue */ \
diagnostic(intx, GuaranteedSafepointInterval, 1000, \
diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp
index 86e11841cda..675dbfb89e5 100644
--- a/hotspot/src/share/vm/runtime/mutex.cpp
+++ b/hotspot/src/share/vm/runtime/mutex.cpp
@@ -452,7 +452,7 @@ void Monitor::ILock(Thread * Self) {
ParkEvent * const ESelf = Self->_MutexEvent;
assert(_OnDeck != ESelf, "invariant");
- // As an optimization, spinners could conditionally try to set ONDECK to _LBIT
+ // As an optimization, spinners could conditionally try to set _OnDeck to _LBIT
// Synchronizer.cpp uses a similar optimization.
if (TrySpin(Self)) goto Exeunt;
@@ -463,7 +463,7 @@ void Monitor::ILock(Thread * Self) {
OrderAccess::fence();
// Optional optimization ... try barging on the inner lock
- if ((NativeMonitorFlags & 32) && CASPTR (&_OnDeck, NULL, UNS(Self)) == 0) {
+ if ((NativeMonitorFlags & 32) && CASPTR (&_OnDeck, NULL, UNS(ESelf)) == 0) {
goto OnDeck_LOOP;
}
@@ -471,14 +471,14 @@ void Monitor::ILock(Thread * Self) {
// At any given time there is at most one ondeck thread.
// ondeck implies not resident on cxq and not resident on EntryList
- // Only the OnDeck thread can try to acquire -- contended for -- the lock.
+ // Only the OnDeck thread can try to acquire -- contend for -- the lock.
// CONSIDER: use Self->OnDeck instead of m->OnDeck.
// Deschedule Self so that others may run.
- while (_OnDeck != ESelf) {
+ while (OrderAccess::load_ptr_acquire(&_OnDeck) != ESelf) {
ParkCommon(ESelf, 0);
}
- // Self is now in the ONDECK position and will remain so until it
+ // Self is now in the OnDeck position and will remain so until it
// manages to acquire the lock.
OnDeck_LOOP:
for (;;) {
@@ -501,8 +501,8 @@ void Monitor::ILock(Thread * Self) {
// A. Shift or defer dropping the inner lock until the subsequent IUnlock() operation.
// This might avoid potential reacquisition of the inner lock in IUlock().
// B. While still holding the inner lock, attempt to opportunistically select
- // and unlink the next ONDECK thread from the EntryList.
- // If successful, set ONDECK to refer to that thread, otherwise clear ONDECK.
+ // and unlink the next OnDeck thread from the EntryList.
+ // If successful, set OnDeck to refer to that thread, otherwise clear OnDeck.
// It's critical that the select-and-unlink operation run in constant-time as
// it executes when holding the outer lock and may artificially increase the
// effective length of the critical section.
@@ -529,7 +529,7 @@ void Monitor::IUnlock(bool RelaxAssert) {
OrderAccess::release_store(&_LockWord.Bytes[_LSBINDEX], 0); // drop outer lock
OrderAccess::storeload();
- ParkEvent * const w = _OnDeck;
+ ParkEvent * const w = _OnDeck; // raw load as we will just return if non-NULL
assert(RelaxAssert || w != Thread::current()->_MutexEvent, "invariant");
if (w != NULL) {
// Either we have a valid ondeck thread or ondeck is transiently "locked"
@@ -537,7 +537,7 @@ void Monitor::IUnlock(bool RelaxAssert) {
// OnDeck allows us to discriminate two cases. If the latter, the
// responsibility for progress and succession lies with that other thread.
// For good performance, we also depend on the fact that redundant unpark()
- // operations are cheap. That is, repeated Unpark()ing of the ONDECK thread
+ // operations are cheap. That is, repeated Unpark()ing of the OnDeck thread
// is inexpensive. This approach provides implicit futile wakeup throttling.
// Note that the referent "w" might be stale with respect to the lock.
// In that case the following unpark() is harmless and the worst that'll happen
@@ -586,8 +586,13 @@ void Monitor::IUnlock(bool RelaxAssert) {
_EntryList = w->ListNext;
// as a diagnostic measure consider setting w->_ListNext = BAD
assert(UNS(_OnDeck) == _LBIT, "invariant");
- _OnDeck = w; // pass OnDeck to w.
- // w will clear OnDeck once it acquires the outer lock
+
+ // Pass OnDeck role to w, ensuring that _EntryList has been set first.
+ // w will clear _OnDeck once it acquires the outer lock.
+ // Note that once we set _OnDeck that thread can acquire the mutex, proceed
+ // with its critical section and then enter this code to unlock the mutex. So
+ // you can have multiple threads active in IUnlock at the same time.
+ OrderAccess::release_store_ptr(&_OnDeck, w);
// Another optional optimization ...
// For heavily contended locks it's not uncommon that some other
@@ -835,7 +840,7 @@ int Monitor::IWait(Thread * Self, jlong timo) {
// ESelf is now on the cxq, EntryList or at the OnDeck position.
// The following fragment is extracted from Monitor::ILock()
for (;;) {
- if (_OnDeck == ESelf && TrySpin(Self)) break;
+ if (OrderAccess::load_ptr_acquire(&_OnDeck) == ESelf && TrySpin(Self)) break;
ParkCommon(ESelf, 0);
}
assert(_OnDeck == ESelf, "invariant");
@@ -1050,10 +1055,10 @@ void Monitor::jvm_raw_lock() {
// At any given time there is at most one ondeck thread.
// ondeck implies not resident on cxq and not resident on EntryList
- // Only the OnDeck thread can try to acquire -- contended for -- the lock.
+ // Only the OnDeck thread can try to acquire -- contend for -- the lock.
// CONSIDER: use Self->OnDeck instead of m->OnDeck.
for (;;) {
- if (_OnDeck == ESelf && TrySpin(NULL)) break;
+ if (OrderAccess::load_ptr_acquire(&_OnDeck) == ESelf && TrySpin(NULL)) break;
ParkCommon(ESelf, 0);
}
diff --git a/hotspot/src/share/vm/runtime/mutex.hpp b/hotspot/src/share/vm/runtime/mutex.hpp
index a510cdb6e6f..99f6011554d 100644
--- a/hotspot/src/share/vm/runtime/mutex.hpp
+++ b/hotspot/src/share/vm/runtime/mutex.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -81,7 +81,9 @@ class ParkEvent ;
// *in that order*. If their implementations change such that these
// assumptions are violated, a whole lot of code will break.
-// The default length of monitor name is chosen to be 64 to avoid false sharing.
+// The default length of monitor name was originally chosen to be 64 to avoid
+// false sharing. Now, PaddedMonitor is available for this purpose.
+// TODO: Check if _name[MONITOR_NAME_LEN] should better get replaced by const char*.
static const int MONITOR_NAME_LEN = 64;
class Monitor : public CHeapObj {
@@ -254,6 +256,18 @@ class Monitor : public CHeapObj {
};
+class PaddedMonitor : public Monitor {
+ enum {
+ CACHE_LINE_PADDING = (int)DEFAULT_CACHE_LINE_SIZE - (int)sizeof(Monitor),
+ PADDING_LEN = CACHE_LINE_PADDING > 0 ? CACHE_LINE_PADDING : 1
+ };
+ char _padding[PADDING_LEN];
+ public:
+ PaddedMonitor(int rank, const char *name, bool allow_vm_block = false,
+ SafepointCheckRequired safepoint_check_required = _safepoint_check_always) :
+ Monitor(rank, name, allow_vm_block, safepoint_check_required) {};
+};
+
// Normally we'd expect Monitor to extend Mutex in the sense that a monitor
// constructed from pthreads primitives might extend a mutex by adding
// a condvar and some extra metadata. In fact this was the case until J2SE7.
@@ -292,5 +306,16 @@ class Mutex : public Monitor { // degenerate Monitor
}
};
+class PaddedMutex : public Mutex {
+ enum {
+ CACHE_LINE_PADDING = (int)DEFAULT_CACHE_LINE_SIZE - (int)sizeof(Mutex),
+ PADDING_LEN = CACHE_LINE_PADDING > 0 ? CACHE_LINE_PADDING : 1
+ };
+ char _padding[PADDING_LEN];
+public:
+ PaddedMutex(int rank, const char *name, bool allow_vm_block = false,
+ SafepointCheckRequired safepoint_check_required = _safepoint_check_always) :
+ Mutex(rank, name, allow_vm_block, safepoint_check_required) {};
+};
#endif // SHARE_VM_RUNTIME_MUTEX_HPP
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp
index 88f5ab04457..29ad520e1f0 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp
@@ -169,122 +169,123 @@ void assert_lock_strong(const Monitor * lock) {
_mutex_array[_num_mutex++] = var; \
}
+// Using Padded subclasses to prevent false sharing of these global monitors and mutexes.
void mutex_init() {
- def(tty_lock , Mutex , event, true, Monitor::_safepoint_check_never); // allow to lock in VM
+ def(tty_lock , PaddedMutex , event, true, Monitor::_safepoint_check_never); // allow to lock in VM
- def(CGC_lock , Monitor, special, true, Monitor::_safepoint_check_never); // coordinate between fore- and background GC
- def(STS_lock , Monitor, leaf, true, Monitor::_safepoint_check_never);
+ def(CGC_lock , PaddedMonitor, special, true, Monitor::_safepoint_check_never); // coordinate between fore- and background GC
+ def(STS_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_never);
if (UseConcMarkSweepGC || UseG1GC) {
- def(FullGCCount_lock , Monitor, leaf, true, Monitor::_safepoint_check_never); // in support of ExplicitGCInvokesConcurrent
+ def(FullGCCount_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_never); // in support of ExplicitGCInvokesConcurrent
}
if (UseG1GC) {
- def(SATB_Q_FL_lock , Mutex , special, true, Monitor::_safepoint_check_never);
- def(SATB_Q_CBL_mon , Monitor, nonleaf, true, Monitor::_safepoint_check_never);
- def(Shared_SATB_Q_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
+ def(SATB_Q_FL_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
+ def(SATB_Q_CBL_mon , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_never);
+ def(Shared_SATB_Q_lock , PaddedMutex , nonleaf, true, Monitor::_safepoint_check_never);
- def(DirtyCardQ_FL_lock , Mutex , special, true, Monitor::_safepoint_check_never);
- def(DirtyCardQ_CBL_mon , Monitor, nonleaf, true, Monitor::_safepoint_check_never);
- def(Shared_DirtyCardQ_lock , Mutex, nonleaf, true, Monitor::_safepoint_check_never);
+ def(DirtyCardQ_FL_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
+ def(DirtyCardQ_CBL_mon , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_never);
+ def(Shared_DirtyCardQ_lock , PaddedMutex , nonleaf, true, Monitor::_safepoint_check_never);
- def(FreeList_lock , Mutex, leaf , true, Monitor::_safepoint_check_never);
- def(SecondaryFreeList_lock , Monitor, leaf , true, Monitor::_safepoint_check_never);
- def(OldSets_lock , Mutex , leaf , true, Monitor::_safepoint_check_never);
- def(RootRegionScan_lock , Monitor, leaf , true, Monitor::_safepoint_check_never);
- def(MMUTracker_lock , Mutex , leaf , true, Monitor::_safepoint_check_never);
+ def(FreeList_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_never);
+ def(SecondaryFreeList_lock , PaddedMonitor, leaf , true, Monitor::_safepoint_check_never);
+ def(OldSets_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_never);
+ def(RootRegionScan_lock , PaddedMonitor, leaf , true, Monitor::_safepoint_check_never);
+ def(MMUTracker_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_never);
- def(StringDedupQueue_lock , Monitor, leaf, true, Monitor::_safepoint_check_never);
- def(StringDedupTable_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
+ def(StringDedupQueue_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_never);
+ def(StringDedupTable_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
- def(MarkStackFreeList_lock , Mutex , leaf , true, Monitor::_safepoint_check_never);
- def(MarkStackChunkList_lock , Mutex , leaf , true, Monitor::_safepoint_check_never);
+ def(MarkStackFreeList_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_never);
+ def(MarkStackChunkList_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_never);
}
- def(ParGCRareEvent_lock , Mutex , leaf , true, Monitor::_safepoint_check_sometimes);
- def(DerivedPointerTableGC_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
- def(CodeCache_lock , Mutex , special, true, Monitor::_safepoint_check_never);
- def(RawMonitor_lock , Mutex, special, true, Monitor::_safepoint_check_never);
- def(OopMapCacheAlloc_lock , Mutex, leaf, true, Monitor::_safepoint_check_always); // used for oop_map_cache allocation.
+ def(ParGCRareEvent_lock , PaddedMutex , leaf , true, Monitor::_safepoint_check_sometimes);
+ def(DerivedPointerTableGC_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
+ def(CodeCache_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
+ def(RawMonitor_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
+ def(OopMapCacheAlloc_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for oop_map_cache allocation.
- def(Patching_lock , Mutex , special, true, Monitor::_safepoint_check_never); // used for safepointing and code patching.
- def(Service_lock , Monitor, special, true, Monitor::_safepoint_check_never); // used for service thread operations
- def(JmethodIdCreation_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // used for creating jmethodIDs.
+ def(Patching_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never); // used for safepointing and code patching.
+ def(Service_lock , PaddedMonitor, special, true, Monitor::_safepoint_check_never); // used for service thread operations
+ def(JmethodIdCreation_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for creating jmethodIDs.
- def(SystemDictionary_lock , Monitor, leaf, true, Monitor::_safepoint_check_always); // lookups done by VM thread
- def(Module_lock , Mutex , leaf+2, true, Monitor::_safepoint_check_always);
- def(InlineCacheBuffer_lock , Mutex , leaf, true, Monitor::_safepoint_check_always);
- def(VMStatistic_lock , Mutex , leaf, false, Monitor::_safepoint_check_always);
- def(ExpandHeap_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // Used during compilation by VM thread
- def(JNIHandleBlockFreeList_lock , Mutex , leaf, true, Monitor::_safepoint_check_never); // handles are used by VM thread
- def(SignatureHandlerLibrary_lock , Mutex , leaf, false, Monitor::_safepoint_check_always);
- def(SymbolTable_lock , Mutex , leaf+2, true, Monitor::_safepoint_check_always);
- def(StringTable_lock , Mutex , leaf, true, Monitor::_safepoint_check_always);
- def(ProfilePrint_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
- def(ExceptionCache_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
- def(OsrList_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
- def(Debug1_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
+ def(SystemDictionary_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_always); // lookups done by VM thread
+ def(Module_lock , PaddedMutex , leaf+2, true, Monitor::_safepoint_check_always);
+ def(InlineCacheBuffer_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always);
+ def(VMStatistic_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always);
+ def(ExpandHeap_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // Used during compilation by VM thread
+ def(JNIHandleBlockFreeList_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never); // handles are used by VM thread
+ def(SignatureHandlerLibrary_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always);
+ def(SymbolTable_lock , PaddedMutex , leaf+2, true, Monitor::_safepoint_check_always);
+ def(StringTable_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always);
+ def(ProfilePrint_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
+ def(ExceptionCache_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // serial profile printing
+ def(OsrList_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
+ def(Debug1_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
#ifndef PRODUCT
- def(FullGCALot_lock , Mutex , leaf, false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
+ def(FullGCALot_lock , PaddedMutex , leaf, false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
#endif
- def(BeforeExit_lock , Monitor, leaf, true, Monitor::_safepoint_check_always);
- def(PerfDataMemAlloc_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // used for allocating PerfData memory for performance data
- def(PerfDataManager_lock , Mutex , leaf, true, Monitor::_safepoint_check_always); // used for synchronized access to PerfDataManager resources
+ def(BeforeExit_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_always);
+ def(PerfDataMemAlloc_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for allocating PerfData memory for performance data
+ def(PerfDataManager_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always); // used for synchronized access to PerfDataManager resources
// CMS_modUnionTable_lock leaf
// CMS_bitMap_lock leaf 1
// CMS_freeList_lock leaf 2
- def(Safepoint_lock , Monitor, safepoint, true, Monitor::_safepoint_check_sometimes); // locks SnippetCache_lock/Threads_lock
+ def(Safepoint_lock , PaddedMonitor, safepoint, true, Monitor::_safepoint_check_sometimes); // locks SnippetCache_lock/Threads_lock
- def(Threads_lock , Monitor, barrier, true, Monitor::_safepoint_check_sometimes);
+ def(Threads_lock , PaddedMonitor, barrier, true, Monitor::_safepoint_check_sometimes);
- def(VMOperationQueue_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes); // VM_thread allowed to block on these
- def(VMOperationRequest_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes);
- def(RetData_lock , Mutex , nonleaf, false, Monitor::_safepoint_check_always);
- def(Terminator_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_sometimes);
- def(VtableStubs_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always);
- def(Notify_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_always);
- def(JNIGlobalHandle_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always); // locks JNIHandleBlockFreeList_lock
- def(JNICritical_lock , Monitor, nonleaf, true, Monitor::_safepoint_check_always); // used for JNI critical regions
- def(AdapterHandlerLibrary_lock , Mutex , nonleaf, true, Monitor::_safepoint_check_always);
+ def(VMOperationQueue_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_sometimes); // VM_thread allowed to block on these
+ def(VMOperationRequest_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_sometimes);
+ def(RetData_lock , PaddedMutex , nonleaf, false, Monitor::_safepoint_check_always);
+ def(Terminator_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_sometimes);
+ def(VtableStubs_lock , PaddedMutex , nonleaf, true, Monitor::_safepoint_check_always);
+ def(Notify_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_always);
+ def(JNIGlobalHandle_lock , PaddedMutex , nonleaf, true, Monitor::_safepoint_check_always); // locks JNIHandleBlockFreeList_lock
+ def(JNICritical_lock , PaddedMonitor, nonleaf, true, Monitor::_safepoint_check_always); // used for JNI critical regions
+ def(AdapterHandlerLibrary_lock , PaddedMutex , nonleaf, true, Monitor::_safepoint_check_always);
- def(Heap_lock , Monitor, nonleaf+1, false, Monitor::_safepoint_check_sometimes);
- def(JfieldIdCreation_lock , Mutex , nonleaf+1, true, Monitor::_safepoint_check_always); // jfieldID, Used in VM_Operation
- def(MemberNameTable_lock , Mutex , nonleaf+1, false, Monitor::_safepoint_check_always); // Used to protect MemberNameTable
+ def(Heap_lock , PaddedMonitor, nonleaf+1, false, Monitor::_safepoint_check_sometimes);
+ def(JfieldIdCreation_lock , PaddedMutex , nonleaf+1, true, Monitor::_safepoint_check_always); // jfieldID, Used in VM_Operation
+ def(MemberNameTable_lock , PaddedMutex , nonleaf+1, false, Monitor::_safepoint_check_always); // Used to protect MemberNameTable
- def(CompiledIC_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks VtableStubs_lock, InlineCacheBuffer_lock
- def(CompileTaskAlloc_lock , Mutex , nonleaf+2, true, Monitor::_safepoint_check_always);
- def(CompileStatistics_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always);
- def(DirectivesStack_lock , Mutex , special, true, Monitor::_safepoint_check_never);
- def(MultiArray_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks SymbolTable_lock
+ def(CompiledIC_lock , PaddedMutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks VtableStubs_lock, InlineCacheBuffer_lock
+ def(CompileTaskAlloc_lock , PaddedMutex , nonleaf+2, true, Monitor::_safepoint_check_always);
+ def(CompileStatistics_lock , PaddedMutex , nonleaf+2, false, Monitor::_safepoint_check_always);
+ def(DirectivesStack_lock , PaddedMutex , special, true, Monitor::_safepoint_check_never);
+ def(MultiArray_lock , PaddedMutex , nonleaf+2, false, Monitor::_safepoint_check_always); // locks SymbolTable_lock
- def(JvmtiThreadState_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
- def(Management_lock , Mutex , nonleaf+2, false, Monitor::_safepoint_check_always); // used for JVM management
+ def(JvmtiThreadState_lock , PaddedMutex , nonleaf+2, false, Monitor::_safepoint_check_always); // Used by JvmtiThreadState/JvmtiEventController
+ def(Management_lock , PaddedMutex , nonleaf+2, false, Monitor::_safepoint_check_always); // used for JVM management
- def(Compile_lock , Mutex , nonleaf+3, true, Monitor::_safepoint_check_sometimes);
- def(MethodData_lock , Mutex , nonleaf+3, false, Monitor::_safepoint_check_always);
- def(TouchedMethodLog_lock , Mutex , nonleaf+3, false, Monitor::_safepoint_check_always);
+ def(Compile_lock , PaddedMutex , nonleaf+3, true, Monitor::_safepoint_check_sometimes);
+ def(MethodData_lock , PaddedMutex , nonleaf+3, false, Monitor::_safepoint_check_always);
+ def(TouchedMethodLog_lock , PaddedMutex , nonleaf+3, false, Monitor::_safepoint_check_always);
- def(MethodCompileQueue_lock , Monitor, nonleaf+4, true, Monitor::_safepoint_check_always);
- def(Debug2_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
- def(Debug3_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never);
- def(CompileThread_lock , Monitor, nonleaf+5, false, Monitor::_safepoint_check_always);
- def(PeriodicTask_lock , Monitor, nonleaf+5, true, Monitor::_safepoint_check_sometimes);
- def(RedefineClasses_lock , Monitor, nonleaf+5, true, Monitor::_safepoint_check_always);
+ def(MethodCompileQueue_lock , PaddedMonitor, nonleaf+4, true, Monitor::_safepoint_check_always);
+ def(Debug2_lock , PaddedMutex , nonleaf+4, true, Monitor::_safepoint_check_never);
+ def(Debug3_lock , PaddedMutex , nonleaf+4, true, Monitor::_safepoint_check_never);
+ def(CompileThread_lock , PaddedMonitor, nonleaf+5, false, Monitor::_safepoint_check_always);
+ def(PeriodicTask_lock , PaddedMonitor, nonleaf+5, true, Monitor::_safepoint_check_sometimes);
+ def(RedefineClasses_lock , PaddedMonitor, nonleaf+5, true, Monitor::_safepoint_check_always);
if (WhiteBoxAPI) {
- def(Compilation_lock , Monitor, leaf, false, Monitor::_safepoint_check_never);
+ def(Compilation_lock , PaddedMonitor, leaf, false, Monitor::_safepoint_check_never);
}
#ifdef INCLUDE_TRACE
- def(JfrMsg_lock , Monitor, leaf, true, Monitor::_safepoint_check_always);
- def(JfrBuffer_lock , Mutex, leaf, true, Monitor::_safepoint_check_never);
- def(JfrThreadGroups_lock , Mutex, leaf, true, Monitor::_safepoint_check_always);
- def(JfrStream_lock , Mutex, leaf+1, true, Monitor::_safepoint_check_never); // ensure to rank lower than 'safepoint'
- def(JfrStacktrace_lock , Mutex, special, true, Monitor::_safepoint_check_sometimes);
+ def(JfrMsg_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_always);
+ def(JfrBuffer_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_never);
+ def(JfrThreadGroups_lock , PaddedMutex , leaf, true, Monitor::_safepoint_check_always);
+ def(JfrStream_lock , PaddedMutex , leaf+1, true, Monitor::_safepoint_check_never); // ensure to rank lower than 'safepoint'
+ def(JfrStacktrace_lock , PaddedMutex , special, true, Monitor::_safepoint_check_sometimes);
#endif
#ifndef SUPPORTS_NATIVE_CX8
- def(UnsafeJlong_lock , Mutex, special, false, Monitor::_safepoint_check_never);
+ def(UnsafeJlong_lock , PaddedMutex , special, false, Monitor::_safepoint_check_never);
#endif
}
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index aa17ff69641..24e224292a1 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -3768,10 +3768,21 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
SystemDictionary::compute_java_system_loader(CHECK_(JNI_ERR));
#if INCLUDE_JVMCI
- if (EnableJVMCI && UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation)) {
- // 8145270: Force initialization of JVMCI runtime otherwise requests for blocking
- // compilations via JVMCI will not actually block until JVMCI is initialized.
- JVMCIRuntime::force_initialization(CHECK_JNI_ERR);
+ if (EnableJVMCI) {
+ // Initialize JVMCI eagerly if JVMCIPrintProperties is enabled.
+ // The JVMCI Java initialization code will read this flag and
+ // do the printing if it's set.
+ bool init = JVMCIPrintProperties;
+
+ if (!init) {
+ // 8145270: Force initialization of JVMCI runtime otherwise requests for blocking
+ // compilations via JVMCI will not actually block until JVMCI is initialized.
+ init = UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation);
+ }
+
+ if (init) {
+ JVMCIRuntime::force_initialization(CHECK_JNI_ERR);
+ }
}
#endif
diff --git a/hotspot/src/share/vm/utilities/internalVMTests.cpp b/hotspot/src/share/vm/utilities/internalVMTests.cpp
index c132386c4e6..22bc9e51f44 100644
--- a/hotspot/src/share/vm/utilities/internalVMTests.cpp
+++ b/hotspot/src/share/vm/utilities/internalVMTests.cpp
@@ -58,30 +58,12 @@ void InternalVMTests::run() {
run_unit_test(TestNewSize_test);
run_unit_test(TestOldSize_test);
run_unit_test(TestBitMap_test);
- run_unit_test(TestResourcehash_test);
run_unit_test(ObjectMonitor_test);
- run_unit_test(Test_log_tag_combinations_limit);
- run_unit_test(Test_logtarget);
- run_unit_test(Test_logstream);
- run_unit_test(Test_loghandle);
- run_unit_test(Test_logtargethandle);
- run_unit_test(Test_log_gctracetime);
- run_unit_test(Test_configure_stdout);
- run_unit_test(Test_logconfiguration_subscribe);
- run_unit_test(Test_log_prefix);
- run_unit_test(Test_log_big);
- run_unit_test(Test_logtagset_duplicates);
- run_unit_test(Test_logtagset_descriptions);
- run_unit_test(Test_log_file_startup_rotation);
- run_unit_test(Test_log_file_startup_truncation);
- run_unit_test(Test_invalid_log_file);
- run_unit_test(Test_multiline_logging);
run_unit_test(DirectivesParser_test);
#if INCLUDE_VM_STRUCTS
run_unit_test(VMStructs_test);
#endif
#if INCLUDE_ALL_GCS
- run_unit_test(TestG1BiasedArray_test);
run_unit_test(TestBufferingOopClosure_test);
if (UseG1GC) {
run_unit_test(FreeRegionList_test);
diff --git a/hotspot/src/share/vm/utilities/resourceHash.cpp b/hotspot/src/share/vm/utilities/resourceHash.cpp
deleted file mode 100644
index 7365c0c11c1..00000000000
--- a/hotspot/src/share/vm/utilities/resourceHash.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "memory/allocation.hpp"
-#include "memory/resourceArea.hpp"
-#include "utilities/debug.hpp"
-#include "utilities/resourceHash.hpp"
-
-#ifndef PRODUCT
-
-/////////////// Unit tests ///////////////
-
-class TestResourceHashtable : public AllStatic {
- typedef void* K;
- typedef int V;
-
- static unsigned identity_hash(const K& k) {
- return (unsigned)(uintptr_t)k;
- }
-
- static unsigned bad_hash(const K& k) {
- return 1;
- }
-
- class EqualityTestIter {
- public:
- bool do_entry(K const& k, V const& v) {
- assert((uintptr_t)k == (uintptr_t)v, "");
- return true; // continue iteration
- }
- };
-
- template<
- unsigned (*HASH) (K const&) = primitive_hash,
- bool (*EQUALS)(K const&, K const&) = primitive_equals,
- unsigned SIZE = 256,
- ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA,
- MEMFLAGS MEM_TYPE = mtInternal
- >
- class Runner : public AllStatic {
- static void* as_K(uintptr_t val) { return (void*)val; }
-
- public:
- static void test_small() {
- EqualityTestIter et;
- ResourceHashtable rh;
-
- assert(!rh.contains(as_K(0x1)), "");
-
- assert(rh.put(as_K(0x1), 0x1), "");
- assert(rh.contains(as_K(0x1)), "");
-
- assert(!rh.put(as_K(0x1), 0x1), "");
-
- assert(rh.put(as_K(0x2), 0x2), "");
- assert(rh.put(as_K(0x3), 0x3), "");
- assert(rh.put(as_K(0x4), 0x4), "");
- assert(rh.put(as_K(0x5), 0x5), "");
-
- assert(!rh.remove(as_K(0x0)), "");
- rh.iterate(&et);
-
- assert(rh.remove(as_K(0x1)), "");
- rh.iterate(&et);
-
- }
-
- // We use keys with the low bits cleared since the default hash will do some shifting
- static void test_small_shifted() {
- EqualityTestIter et;
- ResourceHashtable rh;
-
- assert(!rh.contains(as_K(0x10)), "");
-
- assert(rh.put(as_K(0x10), 0x10), "");
- assert(rh.contains(as_K(0x10)), "");
-
- assert(!rh.put(as_K(0x10), 0x10), "");
-
- assert(rh.put(as_K(0x20), 0x20), "");
- assert(rh.put(as_K(0x30), 0x30), "");
- assert(rh.put(as_K(0x40), 0x40), "");
- assert(rh.put(as_K(0x50), 0x50), "");
-
- assert(!rh.remove(as_K(0x00)), "");
-
- assert(rh.remove(as_K(0x10)), "");
-
- rh.iterate(&et);
- }
-
- static void test(unsigned num_elements = SIZE) {
- EqualityTestIter et;
- ResourceHashtable rh;
-
- for (uintptr_t i = 0; i < num_elements; ++i) {
- assert(rh.put(as_K(i), i), "");
- }
-
- rh.iterate(&et);
-
- for (uintptr_t i = num_elements; i > 0; --i) {
- uintptr_t index = i - 1;
- assert(rh.remove(as_K(index)), "");
- }
- rh.iterate(&et);
- for (uintptr_t i = num_elements; i > 0; --i) {
- uintptr_t index = i - 1;
- assert(!rh.remove(as_K(index)), "");
- }
- rh.iterate(&et);
- }
- };
-
- public:
- static void run_tests() {
- {
- ResourceMark rm;
- Runner<>::test_small();
- Runner<>::test_small_shifted();
- Runner<>::test();
- }
-
- {
- ResourceMark rm;
- Runner::test_small();
- Runner::test_small_shifted();
- Runner::test();
- }
-
- {
- ResourceMark rm;
- Runner::test_small();
- Runner::test_small_shifted();
- Runner::test();
- }
-
-
- assert(Thread::current()->resource_area()->nesting() == 0, "this code depends on not having an active ResourceMark");
- // The following test calls will cause an assert if resource allocations occur since we don't have an active mark
- Runner, primitive_equals, 512, ResourceObj::C_HEAP>::test_small();
- Runner, primitive_equals, 512, ResourceObj::C_HEAP>::test_small_shifted();
- Runner, primitive_equals, 512, ResourceObj::C_HEAP>::test();
-
- Runner, 512, ResourceObj::C_HEAP>::test_small();
- Runner, 512, ResourceObj::C_HEAP>::test_small_shifted();
- Runner, 512, ResourceObj::C_HEAP>::test();
-
- Runner, 1, ResourceObj::C_HEAP>::test_small();
- Runner, 1, ResourceObj::C_HEAP>::test_small_shifted();
- Runner, 1, ResourceObj::C_HEAP>::test(512);
- }
-};
-
-void TestResourcehash_test() {
- TestResourceHashtable::run_tests();
-}
-
-#endif // not PRODUCT
-
diff --git a/hotspot/test/Makefile b/hotspot/test/Makefile
index 07f12c40801..4a6c45f654e 100644
--- a/hotspot/test/Makefile
+++ b/hotspot/test/Makefile
@@ -66,6 +66,7 @@ ifeq ($(UNAME_S), SunOS)
ifeq ($(ARCH), i386)
ARCH=i586
endif
+ NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line)
endif
ifeq ($(UNAME_S), Linux)
PLATFORM = linux
@@ -74,6 +75,7 @@ ifeq ($(UNAME_S), Linux)
ifeq ($(ARCH), i386)
ARCH = i586
endif
+ NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor)
endif
ifeq ($(UNAME_S), Darwin)
PLATFORM = bsd
@@ -82,6 +84,7 @@ ifeq ($(UNAME_S), Darwin)
ifeq ($(ARCH), i386)
ARCH = i586
endif
+ NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
endif
ifeq ($(findstring BSD,$(UNAME_S)), BSD)
PLATFORM = bsd
@@ -115,6 +118,13 @@ ifeq ($(PLATFORM),)
endif
endif
EXESUFFIX = .exe
+ ifneq ($(NUMBER_OF_PROCESSORS), )
+ NUM_CORES := $(NUMBER_OF_PROCESSORS)
+ else
+ ifneq ($(HOTSPOT_BUILD_JOBS), )
+ NUM_CORES := $(HOTSPOT_BUILD_JOBS)
+ endif
+ endif
endif
ifdef ALT_SLASH_JAVA
@@ -308,9 +318,22 @@ ifdef TESTDIRS
TEST_SELECTION = $(TESTDIRS)
endif
-ifdef CONCURRENCY
- JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
+# Concurrency based on min(cores / 2, 12)
+ifdef NUM_CORES
+ CONCURRENCY := $(shell expr $(NUM_CORES) / 2)
+ ifeq ($(CONCURRENCY), 0)
+ CONCURRENCY := 1
+ else ifeq ($(shell expr $(CONCURRENCY) \> 12), 1)
+ CONCURRENCY := 12
+ endif
+else
+ CONCURRENCY := 1
endif
+JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
+
+# Make sure MaxRAMFraction is high enough to not cause OOM or swapping since we may end up with a lot of JVM's
+JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMFraction=$(shell expr $(CONCURRENCY) \* 4)
+
ifdef EXTRA_JTREG_OPTIONS
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
endif
diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index 74658bc86af..620252378f8 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -370,6 +370,7 @@ hotspot_fast_runtime = \
-runtime/modules/ModuleStress/ModuleStressGC.java \
-runtime/NMT \
-runtime/RedefineObject/TestRedefineObject.java \
+ -runtime/RedefineTests/RedefineLeak.java \
-runtime/RedefineTests/RedefinePreviousVersions.java \
-runtime/RedefineTests/RedefineRunningMethods.java \
-runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java \
diff --git a/hotspot/test/compiler/arraycopy/TestEliminatedCloneBadMemEdge.java b/hotspot/test/compiler/arraycopy/TestEliminatedCloneBadMemEdge.java
new file mode 100644
index 00000000000..228932205e1
--- /dev/null
+++ b/hotspot/test/compiler/arraycopy/TestEliminatedCloneBadMemEdge.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016, Red Hat, 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 8166836
+ * @summary Elimination of clone's ArrayCopyNode may make compilation fail silently
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEliminatedCloneBadMemEdge::not_inlined TestEliminatedCloneBadMemEdge
+ *
+ */
+
+public class TestEliminatedCloneBadMemEdge implements Cloneable {
+
+ int f1;
+ int f2;
+ int f3;
+ int f4;
+ int f5;
+ int f6;
+ int f7;
+ int f8;
+ int f9;
+
+ static void not_inlined() {}
+
+ static void test(TestEliminatedCloneBadMemEdge o1) throws CloneNotSupportedException {
+ TestEliminatedCloneBadMemEdge o2 = (TestEliminatedCloneBadMemEdge)o1.clone();
+ not_inlined();
+ o2.f1 = 0x42;
+ }
+
+ static public void main(String[] args) throws CloneNotSupportedException {
+ TestEliminatedCloneBadMemEdge o1 = new TestEliminatedCloneBadMemEdge();
+ for (int i = 0; i < 20000; i++) {
+ test(o1);
+ }
+ }
+}
diff --git a/hotspot/test/compiler/c1/NullCheckTest.java b/hotspot/test/compiler/c1/NullCheckTest.java
index 24f72a45976..9c485781267 100644
--- a/hotspot/test/compiler/c1/NullCheckTest.java
+++ b/hotspot/test/compiler/c1/NullCheckTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test6579789.java b/hotspot/test/compiler/c1/Test6579789.java
index 23603eaaa15..7639cedb0fb 100644
--- a/hotspot/test/compiler/c1/Test6579789.java
+++ b/hotspot/test/compiler/c1/Test6579789.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test6795465.java b/hotspot/test/compiler/c1/Test6795465.java
index 5f3ca9c945e..5452ca60e7d 100644
--- a/hotspot/test/compiler/c1/Test6795465.java
+++ b/hotspot/test/compiler/c1/Test6795465.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test6849574.java b/hotspot/test/compiler/c1/Test6849574.java
index 70d1a294e89..cac7cf6c711 100644
--- a/hotspot/test/compiler/c1/Test6849574.java
+++ b/hotspot/test/compiler/c1/Test6849574.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test6855215.java b/hotspot/test/compiler/c1/Test6855215.java
index 3ea0ad53853..e32fc9ba23b 100644
--- a/hotspot/test/compiler/c1/Test6855215.java
+++ b/hotspot/test/compiler/c1/Test6855215.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test6932496.java b/hotspot/test/compiler/c1/Test6932496.java
index 2679c7ecac9..84628f0037d 100644
--- a/hotspot/test/compiler/c1/Test6932496.java
+++ b/hotspot/test/compiler/c1/Test6932496.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test7042153.java b/hotspot/test/compiler/c1/Test7042153.java
index c743920662c..f43d6c5332c 100644
--- a/hotspot/test/compiler/c1/Test7042153.java
+++ b/hotspot/test/compiler/c1/Test7042153.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test7090976.java b/hotspot/test/compiler/c1/Test7090976.java
index 8f7764196b8..51624112c6e 100644
--- a/hotspot/test/compiler/c1/Test7090976.java
+++ b/hotspot/test/compiler/c1/Test7090976.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test7103261.java b/hotspot/test/compiler/c1/Test7103261.java
index a5d7eca0da0..b4766d6fceb 100644
--- a/hotspot/test/compiler/c1/Test7103261.java
+++ b/hotspot/test/compiler/c1/Test7103261.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test7123108.java b/hotspot/test/compiler/c1/Test7123108.java
index 908f0abb45f..a3bba35b04a 100644
--- a/hotspot/test/compiler/c1/Test7123108.java
+++ b/hotspot/test/compiler/c1/Test7123108.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/Test8004051.java b/hotspot/test/compiler/c1/Test8004051.java
index 73667f7776b..f5aa251840f 100644
--- a/hotspot/test/compiler/c1/Test8004051.java
+++ b/hotspot/test/compiler/c1/Test8004051.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/TestArrayCopy.java b/hotspot/test/compiler/c1/TestArrayCopy.java
index 01ffd0ab221..b2f26d4984d 100644
--- a/hotspot/test/compiler/c1/TestArrayCopy.java
+++ b/hotspot/test/compiler/c1/TestArrayCopy.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/TestDeoptInt.java b/hotspot/test/compiler/c1/TestDeoptInt.java
index 75d0d2bfc9f..9049e3e5532 100644
--- a/hotspot/test/compiler/c1/TestDeoptInt.java
+++ b/hotspot/test/compiler/c1/TestDeoptInt.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c1/TestUnalignedLoad.java b/hotspot/test/compiler/c1/TestUnalignedLoad.java
index 114949386a3..34a2d5bb699 100644
--- a/hotspot/test/compiler/c1/TestUnalignedLoad.java
+++ b/hotspot/test/compiler/c1/TestUnalignedLoad.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/FloatingPointFoldingTest.java b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
index 78431c2a82c..82638bae23f 100644
--- a/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
+++ b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/IVTest.java b/hotspot/test/compiler/c2/IVTest.java
index b6239d0da9a..33ac7493cde 100644
--- a/hotspot/test/compiler/c2/IVTest.java
+++ b/hotspot/test/compiler/c2/IVTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/InterruptedTest.java b/hotspot/test/compiler/c2/InterruptedTest.java
index b4caace938d..bf3992ab743 100644
--- a/hotspot/test/compiler/c2/InterruptedTest.java
+++ b/hotspot/test/compiler/c2/InterruptedTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/c2/Test6186134.java b/hotspot/test/compiler/c2/Test6186134.java
index bf00dc89659..b2f580a8ab3 100644
--- a/hotspot/test/compiler/c2/Test6186134.java
+++ b/hotspot/test/compiler/c2/Test6186134.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6196102.java b/hotspot/test/compiler/c2/Test6196102.java
index aec261620cc..fa090e46264 100644
--- a/hotspot/test/compiler/c2/Test6196102.java
+++ b/hotspot/test/compiler/c2/Test6196102.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6357214.java b/hotspot/test/compiler/c2/Test6357214.java
index e9ed37c6db6..bc3f4b44f94 100644
--- a/hotspot/test/compiler/c2/Test6357214.java
+++ b/hotspot/test/compiler/c2/Test6357214.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6443505.java b/hotspot/test/compiler/c2/Test6443505.java
index d86cc7581d9..9b09a7e07aa 100644
--- a/hotspot/test/compiler/c2/Test6443505.java
+++ b/hotspot/test/compiler/c2/Test6443505.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6559156.java b/hotspot/test/compiler/c2/Test6559156.java
index fafe58697ff..8c37913d064 100644
--- a/hotspot/test/compiler/c2/Test6559156.java
+++ b/hotspot/test/compiler/c2/Test6559156.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6661247.java b/hotspot/test/compiler/c2/Test6661247.java
index 5175e385214..b11eca7cba0 100644
--- a/hotspot/test/compiler/c2/Test6661247.java
+++ b/hotspot/test/compiler/c2/Test6661247.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/c2/Test6732154.java b/hotspot/test/compiler/c2/Test6732154.java
index bc695fe0cea..97364c86a26 100644
--- a/hotspot/test/compiler/c2/Test6732154.java
+++ b/hotspot/test/compiler/c2/Test6732154.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6753639.java b/hotspot/test/compiler/c2/Test6753639.java
index 6eba35afcac..0730eaf35d7 100644
--- a/hotspot/test/compiler/c2/Test6753639.java
+++ b/hotspot/test/compiler/c2/Test6753639.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6792161.java b/hotspot/test/compiler/c2/Test6792161.java
index c2b22412681..9685fbb50e8 100644
--- a/hotspot/test/compiler/c2/Test6792161.java
+++ b/hotspot/test/compiler/c2/Test6792161.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6796786.java b/hotspot/test/compiler/c2/Test6796786.java
index 285f0d8e41e..211e50ee145 100644
--- a/hotspot/test/compiler/c2/Test6796786.java
+++ b/hotspot/test/compiler/c2/Test6796786.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6799693.java b/hotspot/test/compiler/c2/Test6799693.java
index 8e3e83a6f32..e0d30757f65 100644
--- a/hotspot/test/compiler/c2/Test6799693.java
+++ b/hotspot/test/compiler/c2/Test6799693.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/c2/Test6823453.java b/hotspot/test/compiler/c2/Test6823453.java
index 96675ad09ba..bbbdb69d697 100644
--- a/hotspot/test/compiler/c2/Test6823453.java
+++ b/hotspot/test/compiler/c2/Test6823453.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/c2/Test6832293.java b/hotspot/test/compiler/c2/Test6832293.java
index d75c9ab32f1..227b81fc30c 100644
--- a/hotspot/test/compiler/c2/Test6832293.java
+++ b/hotspot/test/compiler/c2/Test6832293.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/c2/Test6850611.java b/hotspot/test/compiler/c2/Test6850611.java
index bbfa34fbfef..8b3fb43bd5a 100644
--- a/hotspot/test/compiler/c2/Test6850611.java
+++ b/hotspot/test/compiler/c2/Test6850611.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6851282.java b/hotspot/test/compiler/c2/Test6851282.java
index 8031a050fd0..857ecf688d0 100644
--- a/hotspot/test/compiler/c2/Test6851282.java
+++ b/hotspot/test/compiler/c2/Test6851282.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6852078.java b/hotspot/test/compiler/c2/Test6852078.java
index dbf89a0e218..b8a57cbc068 100644
--- a/hotspot/test/compiler/c2/Test6852078.java
+++ b/hotspot/test/compiler/c2/Test6852078.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6857159.java b/hotspot/test/compiler/c2/Test6857159.java
index efe9653ebe3..daf6d3471a9 100644
--- a/hotspot/test/compiler/c2/Test6857159.java
+++ b/hotspot/test/compiler/c2/Test6857159.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6885584.java b/hotspot/test/compiler/c2/Test6885584.java
index e5ba96ff8d8..76f15159dbc 100644
--- a/hotspot/test/compiler/c2/Test6885584.java
+++ b/hotspot/test/compiler/c2/Test6885584.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6897150.java b/hotspot/test/compiler/c2/Test6897150.java
index 9fde86d3da8..8292bdc1229 100644
--- a/hotspot/test/compiler/c2/Test6897150.java
+++ b/hotspot/test/compiler/c2/Test6897150.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6905845.java b/hotspot/test/compiler/c2/Test6905845.java
index 18db36b38b8..bd11140dee0 100644
--- a/hotspot/test/compiler/c2/Test6905845.java
+++ b/hotspot/test/compiler/c2/Test6905845.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6910605_1.java b/hotspot/test/compiler/c2/Test6910605_1.java
index 6ab1ff4f9c7..38c597e0fa9 100644
--- a/hotspot/test/compiler/c2/Test6910605_1.java
+++ b/hotspot/test/compiler/c2/Test6910605_1.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6910605_2.java b/hotspot/test/compiler/c2/Test6910605_2.java
index 50dbedc250c..3a1b417a3e8 100644
--- a/hotspot/test/compiler/c2/Test6910605_2.java
+++ b/hotspot/test/compiler/c2/Test6910605_2.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6916644.java b/hotspot/test/compiler/c2/Test6916644.java
index 8ad9e7bbf3b..fa5e824cfed 100644
--- a/hotspot/test/compiler/c2/Test6916644.java
+++ b/hotspot/test/compiler/c2/Test6916644.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6930043.java b/hotspot/test/compiler/c2/Test6930043.java
index 66cbe109bef..1702e6c6c9c 100644
--- a/hotspot/test/compiler/c2/Test6930043.java
+++ b/hotspot/test/compiler/c2/Test6930043.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6931567.java b/hotspot/test/compiler/c2/Test6931567.java
index 7f753903798..4abce716a4a 100644
--- a/hotspot/test/compiler/c2/Test6931567.java
+++ b/hotspot/test/compiler/c2/Test6931567.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6935022.java b/hotspot/test/compiler/c2/Test6935022.java
index da098a8fbfb..ce6f3a0ef38 100644
--- a/hotspot/test/compiler/c2/Test6935022.java
+++ b/hotspot/test/compiler/c2/Test6935022.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6956668.java b/hotspot/test/compiler/c2/Test6956668.java
index 54b78d2a9c5..03e3bc4596a 100644
--- a/hotspot/test/compiler/c2/Test6956668.java
+++ b/hotspot/test/compiler/c2/Test6956668.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6959129.java b/hotspot/test/compiler/c2/Test6959129.java
index fb58383121e..8dac45e6bd5 100644
--- a/hotspot/test/compiler/c2/Test6959129.java
+++ b/hotspot/test/compiler/c2/Test6959129.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6968348.java b/hotspot/test/compiler/c2/Test6968348.java
index 29da68e4af2..17a2d61716b 100644
--- a/hotspot/test/compiler/c2/Test6968348.java
+++ b/hotspot/test/compiler/c2/Test6968348.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6985295.java b/hotspot/test/compiler/c2/Test6985295.java
index ab180396c57..a0427da65da 100644
--- a/hotspot/test/compiler/c2/Test6985295.java
+++ b/hotspot/test/compiler/c2/Test6985295.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test6992759.java b/hotspot/test/compiler/c2/Test6992759.java
index 8df7b264bfc..848e9982348 100644
--- a/hotspot/test/compiler/c2/Test6992759.java
+++ b/hotspot/test/compiler/c2/Test6992759.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7002666.java b/hotspot/test/compiler/c2/Test7002666.java
index ebb0d971fd5..676f177bc46 100644
--- a/hotspot/test/compiler/c2/Test7002666.java
+++ b/hotspot/test/compiler/c2/Test7002666.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7009359.java b/hotspot/test/compiler/c2/Test7009359.java
index 48280c5e83c..2ba6b5e3b91 100644
--- a/hotspot/test/compiler/c2/Test7009359.java
+++ b/hotspot/test/compiler/c2/Test7009359.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7020614.java b/hotspot/test/compiler/c2/Test7020614.java
index 05b2481b960..6dde96044a4 100644
--- a/hotspot/test/compiler/c2/Test7020614.java
+++ b/hotspot/test/compiler/c2/Test7020614.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7024475.java b/hotspot/test/compiler/c2/Test7024475.java
index 646993f1b6f..739bebfb1e4 100644
--- a/hotspot/test/compiler/c2/Test7024475.java
+++ b/hotspot/test/compiler/c2/Test7024475.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7041100.java b/hotspot/test/compiler/c2/Test7041100.java
index 937253ace51..04b67b043b1 100644
--- a/hotspot/test/compiler/c2/Test7041100.java
+++ b/hotspot/test/compiler/c2/Test7041100.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7046096.java b/hotspot/test/compiler/c2/Test7046096.java
index f0937c495ed..46eb935e2d0 100644
--- a/hotspot/test/compiler/c2/Test7046096.java
+++ b/hotspot/test/compiler/c2/Test7046096.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7047069.java b/hotspot/test/compiler/c2/Test7047069.java
index 812a5ace4b5..f5f93eb954e 100644
--- a/hotspot/test/compiler/c2/Test7047069.java
+++ b/hotspot/test/compiler/c2/Test7047069.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7048332.java b/hotspot/test/compiler/c2/Test7048332.java
index 2c850a44045..ab1e530260c 100644
--- a/hotspot/test/compiler/c2/Test7048332.java
+++ b/hotspot/test/compiler/c2/Test7048332.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7068051.java b/hotspot/test/compiler/c2/Test7068051.java
index d16629077d9..6e8b9361084 100644
--- a/hotspot/test/compiler/c2/Test7068051.java
+++ b/hotspot/test/compiler/c2/Test7068051.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7110586.java b/hotspot/test/compiler/c2/Test7110586.java
index 62d2f5d2a98..bcebfb821b9 100644
--- a/hotspot/test/compiler/c2/Test7110586.java
+++ b/hotspot/test/compiler/c2/Test7110586.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7125879.java b/hotspot/test/compiler/c2/Test7125879.java
index a751c5ac7bb..97e18954cbf 100644
--- a/hotspot/test/compiler/c2/Test7125879.java
+++ b/hotspot/test/compiler/c2/Test7125879.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7160610.java b/hotspot/test/compiler/c2/Test7160610.java
index 31d71340f09..8157fbd1436 100644
--- a/hotspot/test/compiler/c2/Test7160610.java
+++ b/hotspot/test/compiler/c2/Test7160610.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7169782.java b/hotspot/test/compiler/c2/Test7169782.java
index 8fbb9c139d3..32bd68b6085 100644
--- a/hotspot/test/compiler/c2/Test7169782.java
+++ b/hotspot/test/compiler/c2/Test7169782.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7174363.java b/hotspot/test/compiler/c2/Test7174363.java
index 77f2ff08c7f..43204d18a9a 100644
--- a/hotspot/test/compiler/c2/Test7174363.java
+++ b/hotspot/test/compiler/c2/Test7174363.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7177917.java b/hotspot/test/compiler/c2/Test7177917.java
index ae4529a52f9..d0448af9ca5 100644
--- a/hotspot/test/compiler/c2/Test7177917.java
+++ b/hotspot/test/compiler/c2/Test7177917.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test7190310.java b/hotspot/test/compiler/c2/Test7190310.java
index 3e388e879ba..b175f47e09a 100644
--- a/hotspot/test/compiler/c2/Test7190310.java
+++ b/hotspot/test/compiler/c2/Test7190310.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/c2/Test7190310_unsafe.java b/hotspot/test/compiler/c2/Test7190310_unsafe.java
index deaefb729ba..fb2b6f9f26a 100644
--- a/hotspot/test/compiler/c2/Test7190310_unsafe.java
+++ b/hotspot/test/compiler/c2/Test7190310_unsafe.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/c2/Test7199742.java b/hotspot/test/compiler/c2/Test7199742.java
index a0ce4b03291..15ead54c09c 100644
--- a/hotspot/test/compiler/c2/Test7199742.java
+++ b/hotspot/test/compiler/c2/Test7199742.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/Test8002069.java b/hotspot/test/compiler/c2/Test8002069.java
index 5f19f5689af..8debe1575f0 100644
--- a/hotspot/test/compiler/c2/Test8002069.java
+++ b/hotspot/test/compiler/c2/Test8002069.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java b/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java
index 9b2e724dbba..2a997cd5fca 100644
--- a/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java
+++ b/hotspot/test/compiler/c2/TestDominatingDeadCheckCast.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr6340864/TestByteVect.java b/hotspot/test/compiler/c2/cr6340864/TestByteVect.java
index b10453077a2..404210ff709 100644
--- a/hotspot/test/compiler/c2/cr6340864/TestByteVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestByteVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java b/hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java
index adf143961c3..e6a5282c4b3 100644
--- a/hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestDoubleVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr6340864/TestFloatVect.java b/hotspot/test/compiler/c2/cr6340864/TestFloatVect.java
index 9940a3207fb..f5f35a524eb 100644
--- a/hotspot/test/compiler/c2/cr6340864/TestFloatVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestFloatVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr6340864/TestIntVect.java b/hotspot/test/compiler/c2/cr6340864/TestIntVect.java
index 9f05bca3d7d..f221d94b10a 100644
--- a/hotspot/test/compiler/c2/cr6340864/TestIntVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestIntVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr6340864/TestLongVect.java b/hotspot/test/compiler/c2/cr6340864/TestLongVect.java
index 670576e2db1..7c27969ce71 100644
--- a/hotspot/test/compiler/c2/cr6340864/TestLongVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestLongVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr6340864/TestShortVect.java b/hotspot/test/compiler/c2/cr6340864/TestShortVect.java
index a5c0d4b85db..9002343dbb7 100644
--- a/hotspot/test/compiler/c2/cr6340864/TestShortVect.java
+++ b/hotspot/test/compiler/c2/cr6340864/TestShortVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr6663854/Test6663854.java b/hotspot/test/compiler/c2/cr6663854/Test6663854.java
index 26aad09eb76..092caa81eac 100644
--- a/hotspot/test/compiler/c2/cr6663854/Test6663854.java
+++ b/hotspot/test/compiler/c2/cr6663854/Test6663854.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr6711117/Test.java b/hotspot/test/compiler/c2/cr6711117/Test.java
index b5a2f6d68b1..83fb9365f02 100644
--- a/hotspot/test/compiler/c2/cr6711117/Test.java
+++ b/hotspot/test/compiler/c2/cr6711117/Test.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/c2/cr6890943/Test6890943.java b/hotspot/test/compiler/c2/cr6890943/Test6890943.java
index 605e9ff5c60..b8abd4d310e 100644
--- a/hotspot/test/compiler/c2/cr6890943/Test6890943.java
+++ b/hotspot/test/compiler/c2/cr6890943/Test6890943.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr7005594/Test7005594.java b/hotspot/test/compiler/c2/cr7005594/Test7005594.java
index 0dbe8271cb3..d7e6a892d50 100644
--- a/hotspot/test/compiler/c2/cr7005594/Test7005594.java
+++ b/hotspot/test/compiler/c2/cr7005594/Test7005594.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr7192963/TestByteVect.java b/hotspot/test/compiler/c2/cr7192963/TestByteVect.java
index 208a9aa4cd5..1e0d5921d09 100644
--- a/hotspot/test/compiler/c2/cr7192963/TestByteVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestByteVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java b/hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java
index f969cf79fbf..4de6112a6ef 100644
--- a/hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestDoubleVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr7192963/TestFloatVect.java b/hotspot/test/compiler/c2/cr7192963/TestFloatVect.java
index d608deffde0..526344a82b9 100644
--- a/hotspot/test/compiler/c2/cr7192963/TestFloatVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestFloatVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr7192963/TestIntVect.java b/hotspot/test/compiler/c2/cr7192963/TestIntVect.java
index d9f25abe74a..fc3922ed870 100644
--- a/hotspot/test/compiler/c2/cr7192963/TestIntVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestIntVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr7192963/TestLongVect.java b/hotspot/test/compiler/c2/cr7192963/TestLongVect.java
index d0f2eba1c00..47a86e6257a 100644
--- a/hotspot/test/compiler/c2/cr7192963/TestLongVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestLongVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr7192963/TestShortVect.java b/hotspot/test/compiler/c2/cr7192963/TestShortVect.java
index ae0dcf31544..4c9cefc8375 100644
--- a/hotspot/test/compiler/c2/cr7192963/TestShortVect.java
+++ b/hotspot/test/compiler/c2/cr7192963/TestShortVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr7200264/TestIntVect.java b/hotspot/test/compiler/c2/cr7200264/TestIntVect.java
index 1a248157520..088df3346b1 100644
--- a/hotspot/test/compiler/c2/cr7200264/TestIntVect.java
+++ b/hotspot/test/compiler/c2/cr7200264/TestIntVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java
index fa2fafbb193..6b90ebb9717 100644
--- a/hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicCAS.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java
index d7f115183e7..0387f4f1d94 100644
--- a/hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicOrdered.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java
index 6b1a06756b9..0eb0769fa1b 100644
--- a/hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntAtomicVolatile.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java
index ec953664cc2..f7838dd6c97 100644
--- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java
index 4625fcce04d..b7354c88dae 100644
--- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java
index f0272b4faaf..3ff0a132379 100644
--- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
index bc6a2023360..e92af3cc28e 100644
--- a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
+++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
index e02eef8f7bb..9f34a8681de 100644
--- a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
+++ b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.codecache.stress;
diff --git a/hotspot/test/compiler/codecache/stress/Helper.java b/hotspot/test/compiler/codecache/stress/Helper.java
index 1e2f04f617b..d9fb8d3a843 100644
--- a/hotspot/test/compiler/codecache/stress/Helper.java
+++ b/hotspot/test/compiler/codecache/stress/Helper.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.codecache.stress;
diff --git a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java
index c831ffc6782..0392afef4d3 100644
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java
index 21f602b39a7..2b678f78928 100644
--- a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java
+++ b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
index a6b3a6cb9e4..7fc391cdd8c 100644
--- a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
+++ b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/codegen/Test6431242.java b/hotspot/test/compiler/codegen/Test6431242.java
index 68b92a9793c..670f414faaf 100644
--- a/hotspot/test/compiler/codegen/Test6431242.java
+++ b/hotspot/test/compiler/codegen/Test6431242.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/codegen/Test6909839.java b/hotspot/test/compiler/codegen/Test6909839.java
index daea8b798d1..af47a5dd81e 100644
--- a/hotspot/test/compiler/codegen/Test6909839.java
+++ b/hotspot/test/compiler/codegen/Test6909839.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/Test6942326.java b/hotspot/test/compiler/codegen/Test6942326.java
index 08e754d6e63..1575b05edde 100644
--- a/hotspot/test/compiler/codegen/Test6942326.java
+++ b/hotspot/test/compiler/codegen/Test6942326.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/Test7009231.java b/hotspot/test/compiler/codegen/Test7009231.java
index a384d0f1190..acc94914d83 100644
--- a/hotspot/test/compiler/codegen/Test7009231.java
+++ b/hotspot/test/compiler/codegen/Test7009231.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/Test7100757.java b/hotspot/test/compiler/codegen/Test7100757.java
index 6dbae9c6cab..8537fc5ea76 100644
--- a/hotspot/test/compiler/codegen/Test7100757.java
+++ b/hotspot/test/compiler/codegen/Test7100757.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestBooleanVect.java b/hotspot/test/compiler/codegen/TestBooleanVect.java
index 2b6363e71e0..ec28e06c558 100644
--- a/hotspot/test/compiler/codegen/TestBooleanVect.java
+++ b/hotspot/test/compiler/codegen/TestBooleanVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestByteDoubleVect.java b/hotspot/test/compiler/codegen/TestByteDoubleVect.java
index e9376c1b407..d91f3f2c302 100644
--- a/hotspot/test/compiler/codegen/TestByteDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestByteDoubleVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestByteFloatVect.java b/hotspot/test/compiler/codegen/TestByteFloatVect.java
index d718f48fccb..3edb787f85c 100644
--- a/hotspot/test/compiler/codegen/TestByteFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestByteFloatVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestByteIntVect.java b/hotspot/test/compiler/codegen/TestByteIntVect.java
index 2e2b8b469a2..147f2a3b205 100644
--- a/hotspot/test/compiler/codegen/TestByteIntVect.java
+++ b/hotspot/test/compiler/codegen/TestByteIntVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestByteLongVect.java b/hotspot/test/compiler/codegen/TestByteLongVect.java
index 23a57e252d1..efeceede22a 100644
--- a/hotspot/test/compiler/codegen/TestByteLongVect.java
+++ b/hotspot/test/compiler/codegen/TestByteLongVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestByteShortVect.java b/hotspot/test/compiler/codegen/TestByteShortVect.java
index 0b4b4d78a59..efe660d488a 100644
--- a/hotspot/test/compiler/codegen/TestByteShortVect.java
+++ b/hotspot/test/compiler/codegen/TestByteShortVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestByteVect.java b/hotspot/test/compiler/codegen/TestByteVect.java
index 06bc2bb9a57..385ba2dc8ea 100644
--- a/hotspot/test/compiler/codegen/TestByteVect.java
+++ b/hotspot/test/compiler/codegen/TestByteVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestCharShortVect.java b/hotspot/test/compiler/codegen/TestCharShortVect.java
index 5ae572e387f..1d0398a01df 100644
--- a/hotspot/test/compiler/codegen/TestCharShortVect.java
+++ b/hotspot/test/compiler/codegen/TestCharShortVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestCharVect.java b/hotspot/test/compiler/codegen/TestCharVect.java
index ef21a88b4a0..1cef590c15b 100644
--- a/hotspot/test/compiler/codegen/TestCharVect.java
+++ b/hotspot/test/compiler/codegen/TestCharVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestCharVect2.java b/hotspot/test/compiler/codegen/TestCharVect2.java
index 748d3be0ff0..327dcab3fb8 100644
--- a/hotspot/test/compiler/codegen/TestCharVect2.java
+++ b/hotspot/test/compiler/codegen/TestCharVect2.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestDoubleVect.java b/hotspot/test/compiler/codegen/TestDoubleVect.java
index b8772d94a70..e73f2e466d2 100644
--- a/hotspot/test/compiler/codegen/TestDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestDoubleVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestFloatDoubleVect.java b/hotspot/test/compiler/codegen/TestFloatDoubleVect.java
index d90d295af56..6baff17a8cd 100644
--- a/hotspot/test/compiler/codegen/TestFloatDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestFloatDoubleVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestFloatVect.java b/hotspot/test/compiler/codegen/TestFloatVect.java
index 523761a8a97..f0af7b4c798 100644
--- a/hotspot/test/compiler/codegen/TestFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestFloatVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestIntDoubleVect.java b/hotspot/test/compiler/codegen/TestIntDoubleVect.java
index 739353d9511..2eedbcb2f50 100644
--- a/hotspot/test/compiler/codegen/TestIntDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestIntDoubleVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestIntFloatVect.java b/hotspot/test/compiler/codegen/TestIntFloatVect.java
index c41d8249178..9074a699738 100644
--- a/hotspot/test/compiler/codegen/TestIntFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestIntFloatVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestIntLongVect.java b/hotspot/test/compiler/codegen/TestIntLongVect.java
index 02c4b62f259..447586bdd49 100644
--- a/hotspot/test/compiler/codegen/TestIntLongVect.java
+++ b/hotspot/test/compiler/codegen/TestIntLongVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestIntVect.java b/hotspot/test/compiler/codegen/TestIntVect.java
index cb2b31b2b80..1eb4a980f4b 100644
--- a/hotspot/test/compiler/codegen/TestIntVect.java
+++ b/hotspot/test/compiler/codegen/TestIntVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestLongDoubleVect.java b/hotspot/test/compiler/codegen/TestLongDoubleVect.java
index c73cc98dcf9..47517a19f8d 100644
--- a/hotspot/test/compiler/codegen/TestLongDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestLongDoubleVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestLongFloatVect.java b/hotspot/test/compiler/codegen/TestLongFloatVect.java
index ef00e6fc5f2..9d1060e5b69 100644
--- a/hotspot/test/compiler/codegen/TestLongFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestLongFloatVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestLongVect.java b/hotspot/test/compiler/codegen/TestLongVect.java
index d76025a038e..512c2d6d13f 100644
--- a/hotspot/test/compiler/codegen/TestLongVect.java
+++ b/hotspot/test/compiler/codegen/TestLongVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestShortDoubleVect.java b/hotspot/test/compiler/codegen/TestShortDoubleVect.java
index f36baa31ef4..e8eed50ee3c 100644
--- a/hotspot/test/compiler/codegen/TestShortDoubleVect.java
+++ b/hotspot/test/compiler/codegen/TestShortDoubleVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestShortFloatVect.java b/hotspot/test/compiler/codegen/TestShortFloatVect.java
index 7704a1b0763..5d27cb2de90 100644
--- a/hotspot/test/compiler/codegen/TestShortFloatVect.java
+++ b/hotspot/test/compiler/codegen/TestShortFloatVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestShortIntVect.java b/hotspot/test/compiler/codegen/TestShortIntVect.java
index d979fad9853..858b2cfa374 100644
--- a/hotspot/test/compiler/codegen/TestShortIntVect.java
+++ b/hotspot/test/compiler/codegen/TestShortIntVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestShortLongVect.java b/hotspot/test/compiler/codegen/TestShortLongVect.java
index b6c0c79ccc8..51df46d6c4e 100644
--- a/hotspot/test/compiler/codegen/TestShortLongVect.java
+++ b/hotspot/test/compiler/codegen/TestShortLongVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/TestShortVect.java b/hotspot/test/compiler/codegen/TestShortVect.java
index 04b4ecbd1d9..03c0c9f8c36 100644
--- a/hotspot/test/compiler/codegen/TestShortVect.java
+++ b/hotspot/test/compiler/codegen/TestShortVect.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/codegen/aes/TestAESBase.java b/hotspot/test/compiler/codegen/aes/TestAESBase.java
index ca2d5c9cef9..f73cdd51a9b 100644
--- a/hotspot/test/compiler/codegen/aes/TestAESBase.java
+++ b/hotspot/test/compiler/codegen/aes/TestAESBase.java
@@ -19,10 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
-
package compiler.codegen.aes;
import jdk.test.lib.Utils;
diff --git a/hotspot/test/compiler/codegen/aes/TestAESDecode.java b/hotspot/test/compiler/codegen/aes/TestAESDecode.java
index b485520dfb9..da5b1742389 100644
--- a/hotspot/test/compiler/codegen/aes/TestAESDecode.java
+++ b/hotspot/test/compiler/codegen/aes/TestAESDecode.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.codegen.aes;
diff --git a/hotspot/test/compiler/codegen/aes/TestAESEncode.java b/hotspot/test/compiler/codegen/aes/TestAESEncode.java
index c31da699f72..ffd8a6ac61a 100644
--- a/hotspot/test/compiler/codegen/aes/TestAESEncode.java
+++ b/hotspot/test/compiler/codegen/aes/TestAESEncode.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.codegen.aes;
diff --git a/hotspot/test/compiler/codegen/aes/TestAESMain.java b/hotspot/test/compiler/codegen/aes/TestAESMain.java
index 4c9398de8da..6ae8cd5bda7 100644
--- a/hotspot/test/compiler/codegen/aes/TestAESMain.java
+++ b/hotspot/test/compiler/codegen/aes/TestAESMain.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java b/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java
index b3c3d038887..527a722ff3d 100644
--- a/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java
+++ b/hotspot/test/compiler/controldependency/TestEliminatedCastPPAtPhi.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java b/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java
index 476b52d09d0..92f51d056b0 100644
--- a/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java
+++ b/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.cpuflags;
diff --git a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java
index a649e045bed..5fa126bad72 100644
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java
index 4defa877afb..bd3a1b4309e 100644
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java b/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java
index b1af81299b5..812c7061a65 100644
--- a/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java
+++ b/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java b/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java
index 3ec85e654f2..c2ac3e24316 100644
--- a/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java
+++ b/hotspot/test/compiler/cpuflags/predicate/AESSupportPredicate.java
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
package compiler.cpuflags.predicate;
import sun.hotspot.cpuinfo.CPUInfo;
diff --git a/hotspot/test/compiler/escapeAnalysis/Test6726999.java b/hotspot/test/compiler/escapeAnalysis/Test6726999.java
index becc1d87d64..3da60db3cf1 100644
--- a/hotspot/test/compiler/escapeAnalysis/Test6726999.java
+++ b/hotspot/test/compiler/escapeAnalysis/Test6726999.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/escapeAnalysis/Test6775880.java b/hotspot/test/compiler/escapeAnalysis/Test6775880.java
index 31e0afa06a8..bc97e4249a8 100644
--- a/hotspot/test/compiler/escapeAnalysis/Test6775880.java
+++ b/hotspot/test/compiler/escapeAnalysis/Test6775880.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/escapeAnalysis/Test6895383.java b/hotspot/test/compiler/escapeAnalysis/Test6895383.java
index 24462a69883..84141c95a0c 100644
--- a/hotspot/test/compiler/escapeAnalysis/Test6895383.java
+++ b/hotspot/test/compiler/escapeAnalysis/Test6895383.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/escapeAnalysis/Test6896727.java b/hotspot/test/compiler/escapeAnalysis/Test6896727.java
index 042ab2abe52..2f7d758c971 100644
--- a/hotspot/test/compiler/escapeAnalysis/Test6896727.java
+++ b/hotspot/test/compiler/escapeAnalysis/Test6896727.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java b/hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java
index 8c5bbd44828..186a40f11eb 100644
--- a/hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java
+++ b/hotspot/test/compiler/escapeAnalysis/cr6795161/Test.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java b/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java
deleted file mode 100644
index 7b4b51a4c5e..00000000000
--- a/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2015 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
- * 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 8139258
- * @summary Regression test for 8139258 which failed to properly pass float args
- * to a jni function on ppc64le.
- *
- * @run main/othervm/native -Xint compiler.floatingpoint.Test15FloatJNIArgs
- * @run main/othervm/native -XX:+TieredCompilation -Xcomp compiler.floatingpoint.Test15FloatJNIArgs
- * @run main/othervm/native -XX:-TieredCompilation -Xcomp compiler.floatingpoint.Test15FloatJNIArgs
- */
-
-package compiler.floatingpoint;
-
-public class Test15FloatJNIArgs {
- static {
- try {
- System.loadLibrary("Test15FloatJNIArgs");
- } catch (UnsatisfiedLinkError e) {
- System.out.println("could not load native lib: " + e);
- }
- }
-
- public static native float add15floats(
- float f1, float f2, float f3, float f4,
- float f5, float f6, float f7, float f8,
- float f9, float f10, float f11, float f12,
- float f13, float f14, float f15);
-
- static void test() throws Exception {
- float sum = Test15FloatJNIArgs.add15floats(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
- if (sum != 15.0f) {
- throw new Error("Passed 15 times 1.0f to jni function which didn't add them properly: " + sum);
- }
- }
-
- public static void main(String[] args) throws Exception {
- for (int i = 0; i < 200; ++i) {
- test();
- }
- }
-}
diff --git a/hotspot/test/compiler/floatingpoint/TestFloatJNIArgs.java b/hotspot/test/compiler/floatingpoint/TestFloatJNIArgs.java
new file mode 100644
index 00000000000..e84d3855c8a
--- /dev/null
+++ b/hotspot/test/compiler/floatingpoint/TestFloatJNIArgs.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015, 2016 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
+ * 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 8139258 8165673
+ * @summary Regression test for passing float args to a jni function.
+ *
+ *
+ * @run main/othervm/native -Xint compiler.floatingpoint.TestFloatJNIArgs
+ * @run main/othervm/native -XX:+TieredCompilation -Xcomp compiler.floatingpoint.TestFloatJNIArgs
+ * @run main/othervm/native -XX:-TieredCompilation -Xcomp compiler.floatingpoint.TestFloatJNIArgs
+ */
+
+package compiler.floatingpoint;
+
+public class TestFloatJNIArgs {
+ static {
+ try {
+ System.loadLibrary("TestFloatJNIArgs");
+ } catch (UnsatisfiedLinkError e) {
+ System.out.println("could not load native lib: " + e);
+ }
+ }
+
+ public static native float add15floats(
+ float f1, float f2, float f3, float f4,
+ float f5, float f6, float f7, float f8,
+ float f9, float f10, float f11, float f12,
+ float f13, float f14, float f15);
+
+ public static native float add10floats(
+ float f1, float f2, float f3, float f4,
+ float f5, float f6, float f7, float f8,
+ float f9, float f10);
+
+ public static native float addFloatsInts(
+ float f1, float f2, float f3, float f4,
+ float f5, float f6, float f7, float f8,
+ float f9, float f10, float f11, float f12,
+ float f13, float f14, float f15, int a16, int a17);
+
+ public static native double add15doubles(
+ double d1, double d2, double d3, double d4,
+ double d5, double d6, double d7, double d8,
+ double d9, double d10, double d11, double d12,
+ double d13, double d14, double d15);
+
+ static void test() throws Exception {
+ float sum = TestFloatJNIArgs.add15floats(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
+ if (sum != 15.0f) {
+ throw new Error("Passed 15 times 1.0f to jni function which didn't add them properly: " + sum);
+ }
+
+ float sum1 = TestFloatJNIArgs.add10floats(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
+ if (sum1 != 10.0f) {
+ throw new Error("Passed 10 times 1.0f to jni function which didn't add them properly: " + sum1);
+ }
+
+ float sum2 = TestFloatJNIArgs.addFloatsInts(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
+ 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1, 1);
+ if (sum2 != 17.0f) {
+ throw new Error("Passed 17 times 1 to jni function which didn't add them properly: " + sum2);
+ }
+
+ double dsum = TestFloatJNIArgs.add15doubles(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);
+ if (dsum != 15.0) {
+ throw new Error("Passed 15 times 1.0 to jni function which didn't add them properly: " + dsum);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ for (int i = 0; i < 200; ++i) {
+ test();
+ }
+ }
+}
diff --git a/hotspot/test/compiler/floatingpoint/libTestFloatJNIArgs.c b/hotspot/test/compiler/floatingpoint/libTestFloatJNIArgs.c
new file mode 100644
index 00000000000..e1971bced8f
--- /dev/null
+++ b/hotspot/test/compiler/floatingpoint/libTestFloatJNIArgs.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, 2016. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEXPORT jfloat JNICALL Java_compiler_floatingpoint_TestFloatJNIArgs_add15floats
+ (JNIEnv *env, jclass cls,
+ jfloat f1, jfloat f2, jfloat f3, jfloat f4,
+ jfloat f5, jfloat f6, jfloat f7, jfloat f8,
+ jfloat f9, jfloat f10, jfloat f11, jfloat f12,
+ jfloat f13, jfloat f14, jfloat f15) {
+ return f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13 + f14 + f15;
+}
+
+JNIEXPORT jfloat JNICALL Java_compiler_floatingpoint_TestFloatJNIArgs_add10floats
+ (JNIEnv *env, jclass cls,
+ jfloat f1, jfloat f2, jfloat f3, jfloat f4,
+ jfloat f5, jfloat f6, jfloat f7, jfloat f8,
+ jfloat f9, jfloat f10) {
+ return f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10;
+}
+
+JNIEXPORT jfloat JNICALL Java_compiler_floatingpoint_TestFloatJNIArgs_addFloatsInts
+ (JNIEnv *env, jclass cls,
+ jfloat f1, jfloat f2, jfloat f3, jfloat f4,
+ jfloat f5, jfloat f6, jfloat f7, jfloat f8,
+ jfloat f9, jfloat f10, jfloat f11, jfloat f12,
+ jfloat f13, jfloat f14, jfloat f15, jint a16, jint a17) {
+ return f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13 + f14 + f15 + a16 + a17;
+}
+
+JNIEXPORT jdouble JNICALL Java_compiler_floatingpoint_TestFloatJNIArgs_add15doubles
+ (JNIEnv *env, jclass cls,
+ jdouble f1, jdouble f2, jdouble f3, jdouble f4,
+ jdouble f5, jdouble f6, jdouble f7, jdouble f8,
+ jdouble f9, jdouble f10, jdouble f11, jdouble f12,
+ jdouble f13, jdouble f14, jdouble f15) {
+ return f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13 + f14 + f15;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/hotspot/test/compiler/gcbarriers/G1CrashTest.java b/hotspot/test/compiler/gcbarriers/G1CrashTest.java
index e98e3cfb3b4..9971cb00ecc 100644
--- a/hotspot/test/compiler/gcbarriers/G1CrashTest.java
+++ b/hotspot/test/compiler/gcbarriers/G1CrashTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java
index 7884673f148..c1f0ca73835 100644
--- a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java
+++ b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/inlining/InlineAccessors.java b/hotspot/test/compiler/inlining/InlineAccessors.java
index df2c66d197d..20ea50f014f 100644
--- a/hotspot/test/compiler/inlining/InlineAccessors.java
+++ b/hotspot/test/compiler/inlining/InlineAccessors.java
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
/**
* @test
* @bug 8140650
diff --git a/hotspot/test/compiler/interpreter/cr7116216/LargeFrame.java b/hotspot/test/compiler/interpreter/cr7116216/LargeFrame.java
index 8be37c58f81..2174d58a465 100644
--- a/hotspot/test/compiler/interpreter/cr7116216/LargeFrame.java
+++ b/hotspot/test/compiler/interpreter/cr7116216/LargeFrame.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.interpreter.cr7116216;
diff --git a/hotspot/test/compiler/interpreter/cr7116216/StackOverflow.java b/hotspot/test/compiler/interpreter/cr7116216/StackOverflow.java
index 975b1f2c8fe..e203a632d8b 100644
--- a/hotspot/test/compiler/interpreter/cr7116216/StackOverflow.java
+++ b/hotspot/test/compiler/interpreter/cr7116216/StackOverflow.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/Test6982370.java b/hotspot/test/compiler/intrinsics/Test6982370.java
index 9c1a59e0078..643af13dfbe 100644
--- a/hotspot/test/compiler/intrinsics/Test6982370.java
+++ b/hotspot/test/compiler/intrinsics/Test6982370.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bigInteger/TestMulAdd.java b/hotspot/test/compiler/intrinsics/bigInteger/TestMulAdd.java
index 0bc6a804c7f..374d9408c9a 100644
--- a/hotspot/test/compiler/intrinsics/bigInteger/TestMulAdd.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/TestMulAdd.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLen.java b/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLen.java
index 54963f50663..fd984636c14 100644
--- a/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLen.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLen.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLenReturnProfile.java b/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLenReturnProfile.java
index 693cfe5f90c..b641c44e4a7 100644
--- a/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLenReturnProfile.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/TestMultiplyToLenReturnProfile.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bigInteger/TestSquareToLen.java b/hotspot/test/compiler/intrinsics/bigInteger/TestSquareToLen.java
index 049e0af10b4..524573ee0b8 100644
--- a/hotspot/test/compiler/intrinsics/bigInteger/TestSquareToLen.java
+++ b/hotspot/test/compiler/intrinsics/bigInteger/TestSquareToLen.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java b/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java
index bda3b5e2b05..297a2f717d9 100644
--- a/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java
+++ b/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.intrinsics.bmi;
diff --git a/hotspot/test/compiler/intrinsics/bmi/Expr.java b/hotspot/test/compiler/intrinsics/bmi/Expr.java
index 46d644e8849..d925b3e7c1c 100644
--- a/hotspot/test/compiler/intrinsics/bmi/Expr.java
+++ b/hotspot/test/compiler/intrinsics/bmi/Expr.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.intrinsics.bmi;
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java
index cee9666c781..149e767cd22 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java
index 2516e144441..04f62294cc0 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java
index a7b37efc4b6..a2780234e5e 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java
index 42b358168a0..bf37347b951 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java
index 78e7e76a7ac..19d95eb891f 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java
index 657bd042420..aaa797f711b 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java
index 0f24d4a2c7b..be225b7dbf7 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java
index 592e37ec8d6..d8d2ee87eaf 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java
index d2bdada5416..7eb673addbe 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java
index c1750400de7..c8d5748c550 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java
index a679efa2fdc..7576b195647 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java
index 040d08166f0..b5ab1081e1a 100644
--- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java
+++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java
index a118de00652..3533aa9ecdb 100644
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.intrinsics.bmi.verifycode;
diff --git a/hotspot/test/compiler/intrinsics/klass/TestIsPrimitive.java b/hotspot/test/compiler/intrinsics/klass/TestIsPrimitive.java
index 5c6ac893059..16658e50d1f 100644
--- a/hotspot/test/compiler/intrinsics/klass/TestIsPrimitive.java
+++ b/hotspot/test/compiler/intrinsics/klass/TestIsPrimitive.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/intrinsics/object/TestClone.java b/hotspot/test/compiler/intrinsics/object/TestClone.java
index 8bd3e882f29..e239f55d597 100644
--- a/hotspot/test/compiler/intrinsics/object/TestClone.java
+++ b/hotspot/test/compiler/intrinsics/object/TestClone.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/intrinsics/sha/TestSHA.java b/hotspot/test/compiler/intrinsics/sha/TestSHA.java
index 155218dee9d..5ecb7a255f9 100644
--- a/hotspot/test/compiler/intrinsics/sha/TestSHA.java
+++ b/hotspot/test/compiler/intrinsics/sha/TestSHA.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java b/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java
index 98fd5a31941..388643cc9fe 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/AllocateUninitializedArray.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java
index 30e7ab0526d..ec115a90032 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java
index 7fbd7189383..eed16e7b282 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeUnalignedMismatchedAccesses.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
index 458e4053492..30b604c8dd8 100644
--- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
+++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeTwoCASLong.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java
index aa7102bcef3..f503ebde8d3 100644
--- a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java
+++ b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java b/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java
index 95123938d95..c3de55ad653 100644
--- a/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java
+++ b/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jsr292/MHInlineTest.java b/hotspot/test/compiler/jsr292/MHInlineTest.java
index df73ea9d9db..600098a92a6 100644
--- a/hotspot/test/compiler/jsr292/MHInlineTest.java
+++ b/hotspot/test/compiler/jsr292/MHInlineTest.java
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
/**
* @test
* @bug 8062280
diff --git a/hotspot/test/compiler/jsr292/Test7082949.java b/hotspot/test/compiler/jsr292/Test7082949.java
index b699ba51e60..9bf640240ce 100644
--- a/hotspot/test/compiler/jsr292/Test7082949.java
+++ b/hotspot/test/compiler/jsr292/Test7082949.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jsr292/TestArrayReturnType.java b/hotspot/test/compiler/jsr292/TestArrayReturnType.java
new file mode 100644
index 00000000000..c7c97dab2e2
--- /dev/null
+++ b/hotspot/test/compiler/jsr292/TestArrayReturnType.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8134389
+ *
+ * @run main/othervm -Xbatch compiler.jsr292.TestArrayReturnType
+ * @run main/othervm -Xbatch -XX:-Inline compiler.jsr292.TestArrayReturnType
+ * @run main/othervm -Xbatch
+ * -XX:CompileCommand=exclude,compiler.jsr292.TestArrayReturnType::testArrayReturnType
+ * compiler.jsr292.TestArrayReturnType
+ */
+
+package compiler.jsr292;
+
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
+public class TestArrayReturnType {
+
+ static final MethodHandle mh;
+ static int[] testArray = new int[1];
+ static {
+ try {
+ mh = MethodHandles.lookup().findStatic(TestArrayReturnType.class, "testArrayReturnType", MethodType.methodType(int[].class));
+ } catch (Exception e) {
+ throw new Error(e);
+ }
+ }
+
+ static int[] testArrayReturnType() {
+ return testArray;
+ }
+
+ public static void test() throws Throwable {
+ int a[] = (int[])mh.invokeExact();
+ for (int i=0; i S getProvider(Class service) {
+ if (service == JVMCICompilerFactory.class) {
+ return service.cast(new EmptyCompilerFactory());
+ }
+ if (service == HotSpotVMEventListener.class) {
+ return service.cast(new EmptyVMEventListener());
+ }
+ return null;
+ }
+
+ public static class EmptyVMEventListener implements HotSpotVMEventListener {
// just empty, using default interface methods
}
@@ -54,7 +66,7 @@ public class JVMCIHelpers {
}
}
- public static class EmptyCompilerFactory extends JVMCICompilerFactory {
+ public static class EmptyCompilerFactory implements JVMCICompilerFactory {
@Override
public String getCompilerName() {
diff --git a/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener b/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
deleted file mode 100644
index 2b70db58445..00000000000
--- a/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
+++ /dev/null
@@ -1 +0,0 @@
-compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
diff --git a/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.JVMCICompiler b/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.JVMCICompiler
deleted file mode 100644
index c1b6ffcd621..00000000000
--- a/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.JVMCICompiler
+++ /dev/null
@@ -1 +0,0 @@
-compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
diff --git a/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.services.JVMCICompilerFactory b/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.services.JVMCICompilerFactory
deleted file mode 100644
index 5a88a1f4914..00000000000
--- a/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.services.JVMCICompilerFactory
+++ /dev/null
@@ -1 +0,0 @@
-compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
diff --git a/hotspot/test/compiler/jvmci/common/testcases/TestCase.java b/hotspot/test/compiler/jvmci/common/testcases/TestCase.java
index af11b039e66..6b69b1b773b 100644
--- a/hotspot/test/compiler/jvmci/common/testcases/TestCase.java
+++ b/hotspot/test/compiler/jvmci/common/testcases/TestCase.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.jvmci.common.testcases;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java
index b6e9f7e73ca..dbf618d6bd7 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
/**
* @test
* @bug 8136421
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java
index 9fdb7c7589d..020521b99ed 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java
index 2dc47bd0fe9..38a6334af46 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.jvmci.compilerToVM;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java
index 224ff9df523..6f2ccb0f3c0 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.jvmci.compilerToVM;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
index f6158327296..e0bb9d41c8e 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
package compiler.jvmci.compilerToVM;
import compiler.jvmci.common.testcases.MultipleAbstractImplementer;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java
index ef514c355b5..f5929d746a1 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java
index e9e1622a3da..d0213562250 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DummyAbstractClass.java b/hotspot/test/compiler/jvmci/compilerToVM/DummyAbstractClass.java
index 5e6a25d348c..bda67911dfc 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/DummyAbstractClass.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DummyAbstractClass.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.jvmci.compilerToVM;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DummyClass.java b/hotspot/test/compiler/jvmci/compilerToVM/DummyClass.java
index c31fa22c4da..8a4f51d8fac 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/DummyClass.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DummyClass.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.jvmci.compilerToVM;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DummyInterface.java b/hotspot/test/compiler/jvmci/compilerToVM/DummyInterface.java
index 72e34cf24f4..1a733e30c33 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/DummyInterface.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DummyInterface.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.jvmci.compilerToVM;
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java
index ecfdc11bd1c..0c820103073 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java
index 3d8ab325044..98937f9eb85 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java
index a479ba4401f..fdfe329812c 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java
index e86d2ab7675..e27e85f96d1 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java
index 5c551360ca7..503145a39dd 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java
index 6f647dc06fe..1961de54953 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java
index 91c12f6b733..6f7f2c22f00 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java
index 946cf639bc5..c16e0205b5b 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java
index 91645ac6304..c6b63be07f2 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
index 645871fad70..b619ae040b7 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
index 5b47f4f51dc..e3e719797a4 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
index bf6e66e946a..5c8a8cb3593 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
index d88031530db..8c395e3a66b 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
index de25e244060..6262c85f67b 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
index 9eba654e77c..9807fbf5046 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java
index 41579035464..aa5c55a55ea 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java
index 70f9d5fe259..3a731c5f3cd 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
index ca82575fe96..dc06f68ff99 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
index 202eaa003c0..b6294b9a1e8 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
index 45c32d93c0c..e78322f7e3d 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
index 3f7b85745a2..02b288bea04 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java
index 61b702902a2..80d1c354015 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.config b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.config
index 483de30ceab..19cd01ec1e1 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.config
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.config
@@ -1 +1,2 @@
compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
+compiler.jvmci.common.JVMCIHelpers
diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java
index 276ca0a9975..fdd7a00f211 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java
@@ -37,9 +37,8 @@
*
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build compiler.jvmci.common.JVMCIHelpers
- * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
* @run driver jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config
- * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
+ * ./META-INF/services/jdk.vm.ci.services.JVMCIServiceLocator
* @run driver ClassFileInstaller
* compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
@@ -60,9 +59,10 @@
package compiler.jvmci.events;
import jdk.test.lib.Asserts;
-import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
+import jdk.vm.ci.services.JVMCIServiceLocator;
+import jdk.vm.ci.hotspot.HotSpotVMEventListener;
-public class JvmciNotifyBootstrapFinishedEventTest extends HotSpotVMEventListener {
+public class JvmciNotifyBootstrapFinishedEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener {
private static final boolean BOOTSTRAP = Boolean
.getBoolean("compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap");
private static volatile int gotBoostrapNotification = 0;
@@ -75,6 +75,14 @@ public class JvmciNotifyBootstrapFinishedEventTest extends HotSpotVMEventListene
}
}
+ @Override
+ public S getProvider(Class service) {
+ if (service == HotSpotVMEventListener.class) {
+ return service.cast(this);
+ }
+ return null;
+ }
+
@Override
public void notifyBootstrapFinished() {
gotBoostrapNotification++;
diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.config b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.config
index 70e33b3d74d..9e2866167c1 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.config
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.config
@@ -1 +1,2 @@
compiler.jvmci.events.JvmciNotifyInstallEventTest
+compiler.jvmci.common.JVMCIHelpers
diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java
index 59ea3637691..bec53e675ee 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java
@@ -38,9 +38,8 @@
*
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build compiler.jvmci.common.JVMCIHelpers
- * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
* @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config
- * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
+ * ./META-INF/services/jdk.vm.ci.services.JVMCIServiceLocator
* @run driver ClassFileInstaller
* compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
@@ -73,6 +72,7 @@ import compiler.jvmci.common.CTVMUtilities;
import compiler.jvmci.common.testcases.SimpleClass;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
+import jdk.vm.ci.services.JVMCIServiceLocator;
import jdk.vm.ci.code.CompiledCode;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.code.site.DataPatch;
@@ -82,13 +82,13 @@ import jdk.vm.ci.hotspot.HotSpotCompiledCode;
import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
+import jdk.vm.ci.hotspot.HotSpotVMEventListener;
import jdk.vm.ci.meta.Assumptions.Assumption;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import java.lang.reflect.Method;
-public class JvmciNotifyInstallEventTest extends HotSpotVMEventListener {
+public class JvmciNotifyInstallEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener {
private static final String METHOD_NAME = "testMethod";
private static final boolean FAIL_ON_INIT = !Boolean.getBoolean(
"compiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit");
@@ -98,6 +98,14 @@ public class JvmciNotifyInstallEventTest extends HotSpotVMEventListener {
new JvmciNotifyInstallEventTest().runTest();
}
+ @Override
+ public S getProvider(Class service) {
+ if (service == HotSpotVMEventListener.class) {
+ return service.cast(this);
+ }
+ return null;
+ }
+
private void runTest() {
if (gotInstallNotification != 0) {
throw new Error("Got install notification before test actions");
diff --git a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventListener.java b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventListener.java
index 5ddc9e126ae..f72c4600e51 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventListener.java
+++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventListener.java
@@ -23,10 +23,11 @@
package compiler.jvmci.events;
+import jdk.vm.ci.services.JVMCIServiceLocator;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
-import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
+import jdk.vm.ci.hotspot.HotSpotVMEventListener;
-public class JvmciShutdownEventListener extends HotSpotVMEventListener {
+public class JvmciShutdownEventListener extends JVMCIServiceLocator implements HotSpotVMEventListener {
public static final String MESSAGE = "Shutdown notified";
public static final String GOT_INTERNAL_ERROR = "Got internal error";
@@ -38,6 +39,14 @@ public class JvmciShutdownEventListener extends HotSpotVMEventListener {
}
}
+ @Override
+ public S getProvider(Class service) {
+ if (service == HotSpotVMEventListener.class) {
+ return service.cast(this);
+ }
+ return null;
+ }
+
@Override
public void notifyShutdown() {
System.out.println(MESSAGE);
diff --git a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.config b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.config
index 8faad5ebaf6..5931551e083 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.config
+++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.config
@@ -1 +1,2 @@
compiler.jvmci.events.JvmciShutdownEventListener
+compiler.jvmci.common.JVMCIHelpers
diff --git a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java
index da60be0f3ff..dc0973664e9 100644
--- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java
+++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java
@@ -34,9 +34,8 @@
*
* @build compiler.jvmci.common.JVMCIHelpers
* compiler.jvmci.events.JvmciShutdownEventListener
- * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
* @run driver jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.config
- * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
+ * ./META-INF/services/jdk.vm.ci.services.JVMCIServiceLocator
* @run driver ClassFileInstaller
* compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c
index 55572e60f97..085fff1cf27 100644
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/libNativeCallTest.c
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
#include
diff --git a/hotspot/test/compiler/linkage/LinkageErrors.java b/hotspot/test/compiler/linkage/LinkageErrors.java
index 0334604e542..df2cc8d99c3 100644
--- a/hotspot/test/compiler/linkage/LinkageErrors.java
+++ b/hotspot/test/compiler/linkage/LinkageErrors.java
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
/*
* @test
* @bug 8132879
diff --git a/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java b/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java
index 36c13ec398a..53b4845519c 100644
--- a/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java
+++ b/hotspot/test/compiler/loopopts/BadPredicateAfterPartialPeel.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/ConstFPVectorization.java b/hotspot/test/compiler/loopopts/ConstFPVectorization.java
index dfb10c74601..b59acc19f7d 100644
--- a/hotspot/test/compiler/loopopts/ConstFPVectorization.java
+++ b/hotspot/test/compiler/loopopts/ConstFPVectorization.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/CountedLoopProblem.java b/hotspot/test/compiler/loopopts/CountedLoopProblem.java
index be23ae85c7b..d0b3a6330b9 100644
--- a/hotspot/test/compiler/loopopts/CountedLoopProblem.java
+++ b/hotspot/test/compiler/loopopts/CountedLoopProblem.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/Test6659207.java b/hotspot/test/compiler/loopopts/Test6659207.java
index 1ad8576864a..f47b66c26b6 100644
--- a/hotspot/test/compiler/loopopts/Test6659207.java
+++ b/hotspot/test/compiler/loopopts/Test6659207.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/loopopts/Test7044738.java b/hotspot/test/compiler/loopopts/Test7044738.java
index b7e64d33ce6..5908239c43a 100644
--- a/hotspot/test/compiler/loopopts/Test7044738.java
+++ b/hotspot/test/compiler/loopopts/Test7044738.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/Test7052494.java b/hotspot/test/compiler/loopopts/Test7052494.java
index 1729a16002b..5746549bb19 100644
--- a/hotspot/test/compiler/loopopts/Test7052494.java
+++ b/hotspot/test/compiler/loopopts/Test7052494.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java b/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java
index 1f9ce25dec7..8007077fb00 100644
--- a/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java
+++ b/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
index bb0c35af95e..ce0c0976abc 100644
--- a/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
+++ b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
index e3deae85e1a..ddabeef4b54 100644
--- a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
+++ b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/TestImpossibleIV.java b/hotspot/test/compiler/loopopts/TestImpossibleIV.java
new file mode 100644
index 00000000000..e4af508d1e5
--- /dev/null
+++ b/hotspot/test/compiler/loopopts/TestImpossibleIV.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2016 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 8166742
+ * @summary C2 IV elimination throws FPE
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation TestImpossibleIV
+ * @author Chuck Rasbold rasbold@google.com
+ */
+
+/*
+ * Use -XX:-TieredCompilation to get C2 only.
+ * Use -XX:-BackgroundCompilation to wait for compilation before test exit.
+ */
+
+public class TestImpossibleIV {
+
+ static private void testMethod() {
+ int sum = 0;
+ // A unit count-down loop which has an induction variable with
+ // MIN_VALUE stride.
+ for (int i = 100000; i >= 0; i--) {
+ sum += Integer.MIN_VALUE;
+ }
+ }
+
+ public static void main(String[] args) {
+ testMethod();
+ }
+}
diff --git a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
index ea70d700da9..ed86d36c338 100644
--- a/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
+++ b/hotspot/test/compiler/loopopts/TestMoveStoresOutOfLoops.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java b/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java
index 666bc379772..803e2b67280 100644
--- a/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java
+++ b/hotspot/test/compiler/loopopts/TestPredicateLostDependency.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java b/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java
index 38979a36625..f4c49929ba4 100644
--- a/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java
+++ b/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java b/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java
index b2789435fc8..a6b5b790e69 100644
--- a/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java
+++ b/hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java
index d60e6c219c7..787ddd89e45 100644
--- a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java
+++ b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.loopopts;
diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java
index d225ecc3d48..2e3e2717a65 100644
--- a/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java
+++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Double.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java
index d6702ec1d77..0e06a9e4327 100644
--- a/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java
+++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Float.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java b/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java
index 423cdfa5752..c3cdbf37464 100644
--- a/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java
+++ b/hotspot/test/compiler/loopopts/superword/ProdRed_Int.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/ReductionPerf.java b/hotspot/test/compiler/loopopts/superword/ReductionPerf.java
index 0496b9a1e0a..d33bd411f16 100644
--- a/hotspot/test/compiler/loopopts/superword/ReductionPerf.java
+++ b/hotspot/test/compiler/loopopts/superword/ReductionPerf.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java
index 807be10aab6..992fa4b5161 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Double.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java
index d108e105bb7..ea7d97e5961 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRedAbsNeg_Float.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java b/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java
index b13efa83ccd..6603dd224ef 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRedSqrt_Double.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Double.java b/hotspot/test/compiler/loopopts/superword/SumRed_Double.java
index f9e6f9e0fd8..d9a0c988004 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRed_Double.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRed_Double.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Float.java b/hotspot/test/compiler/loopopts/superword/SumRed_Float.java
index 22afdbaf85f..722db95aed3 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRed_Float.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRed_Float.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Int.java b/hotspot/test/compiler/loopopts/superword/SumRed_Int.java
index a5676653d4d..f58f21feb23 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRed_Int.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRed_Int.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/SumRed_Long.java b/hotspot/test/compiler/loopopts/superword/SumRed_Long.java
index b841d7fa3cc..2425cf9b6d4 100644
--- a/hotspot/test/compiler/loopopts/superword/SumRed_Long.java
+++ b/hotspot/test/compiler/loopopts/superword/SumRed_Long.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
index cdc7254df22..c941df83e2f 100644
--- a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
+++ b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java b/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java
index 09057c20d24..9a910682e10 100644
--- a/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java
+++ b/hotspot/test/compiler/memoryinitialization/ZeroTLABTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java b/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java
index 531a0755aca..6f9b3689e5f 100644
--- a/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java
+++ b/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java
index d5b3be7027f..2c1b5e99bbf 100644
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java
index fe2636da902..fcd4484beaf 100644
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java b/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java
index c737e39ef3c..07e5a8e518f 100644
--- a/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java
+++ b/hotspot/test/compiler/regalloc/TestVectorRegAlloc.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
index 7fa09b885f8..4758317c319 100644
--- a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
+++ b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.rtm.cli;
diff --git a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
index f435c7dbb49..454ee3304e5 100644
--- a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
+++ b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.rtm.cli;
diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
index b1dbafe95d4..4449951f0d2 100644
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.rtm.cli;
diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
index 21773e4737f..839db82483b 100644
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java
index 27cea60ae3d..f26f4d8f3fc 100644
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java
index 3a1e2ccc8da..eef4355a1af 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java
index f3a7a94e912..71a81d1ba90 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java
index 10b87c2d9ad..281cd128b6f 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java
index 161573a2076..d3e61bfd8dc 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java
index dab87dca926..3cc51d337cb 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java
index 50b200a870b..84f03ef9d88 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java
index f8e0e64e470..a5978a5db10 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java
index 60336331cb5..2c9754d7a59 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java
index 2a26f2531cd..24db436245d 100644
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
index 80268cdb25e..46a19ceb1da 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
index 91d55ffee90..ad841ce55bc 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
index eae736f70aa..f4623485e1f 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
index 2bf21de4fb5..dfc6c8499ad 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
index dac760c2e05..660ddb4c661 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
index 3df10408910..66409bfa484 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
index 510ede5c934..27f6702f2ae 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
index 992f58210b9..3a66068c1bf 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java
index ec8f3fec04a..f2bccba6e48 100644
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java
index c99a20274a3..ce5f43bf4b3 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java
index 0f3c855c3fc..2a6c6558413 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
index 1c8d3d53727..e359fae02c2 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
index a8dd7c86d0e..65200760bbf 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
index 6330ed272de..beb9cdff545 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java
index 06a7ec66f85..6bdeafb23f4 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java
index d8bbda017ec..a42bc22c72c 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java
index 4c9ae84275b..f53c0b38441 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java
index 73753b2ac82..65353879757 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
index df98916596d..9e89b87e533 100644
--- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
+++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
index 911793fefd3..cb2c6ca5e2d 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java
index 4e6bfbf7bef..274e57db59a 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java
index 43fdeee0832..2a533acfd66 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java
index 50fd873af60..6e9778bb7c4 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java
index 12c52263800..c63faf586ee 100644
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java
index bb4e6cad5b1..a923f8277a6 100644
--- a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java
+++ b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java
index 31ef8ab09ab..168fc9bd241 100644
--- a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java
+++ b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java
index 29ec33fd7b2..4ca4c135f7a 100644
--- a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java
+++ b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/runtime/StackOverflowBug.java b/hotspot/test/compiler/runtime/StackOverflowBug.java
index a4ee2671c0c..d7b7cf57888 100644
--- a/hotspot/test/compiler/runtime/StackOverflowBug.java
+++ b/hotspot/test/compiler/runtime/StackOverflowBug.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/runtime/Test6778657.java b/hotspot/test/compiler/runtime/Test6778657.java
index 37787d2ff88..d075eb065b4 100644
--- a/hotspot/test/compiler/runtime/Test6778657.java
+++ b/hotspot/test/compiler/runtime/Test6778657.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/runtime/Test6826736.java b/hotspot/test/compiler/runtime/Test6826736.java
index 1fb8dd625c7..2f078506e55 100644
--- a/hotspot/test/compiler/runtime/Test6826736.java
+++ b/hotspot/test/compiler/runtime/Test6826736.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/runtime/Test6859338.java b/hotspot/test/compiler/runtime/Test6859338.java
index b7db7141ac4..232313c3f02 100644
--- a/hotspot/test/compiler/runtime/Test6859338.java
+++ b/hotspot/test/compiler/runtime/Test6859338.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/runtime/Test6892265.java b/hotspot/test/compiler/runtime/Test6892265.java
index 2f6df9153f1..b9bc3052f80 100644
--- a/hotspot/test/compiler/runtime/Test6892265.java
+++ b/hotspot/test/compiler/runtime/Test6892265.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/runtime/Test7088020.java b/hotspot/test/compiler/runtime/Test7088020.java
index fa11ec6a54e..088256072ae 100644
--- a/hotspot/test/compiler/runtime/Test7088020.java
+++ b/hotspot/test/compiler/runtime/Test7088020.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/runtime/Test7196199.java b/hotspot/test/compiler/runtime/Test7196199.java
index 1a83660577a..d0611bcd433 100644
--- a/hotspot/test/compiler/runtime/Test7196199.java
+++ b/hotspot/test/compiler/runtime/Test7196199.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/runtime/cr6891750/Test6891750.java b/hotspot/test/compiler/runtime/cr6891750/Test6891750.java
index a375639d107..54c87f464d6 100644
--- a/hotspot/test/compiler/runtime/cr6891750/Test6891750.java
+++ b/hotspot/test/compiler/runtime/cr6891750/Test6891750.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java b/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java
index 07b15422324..034a0380d43 100644
--- a/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java
+++ b/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java
@@ -19,10 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
-
/**
* @test
* @bug 8148490
diff --git a/hotspot/test/compiler/stable/TestStableMismatched.java b/hotspot/test/compiler/stable/TestStableMismatched.java
index 57578fc55cf..be783627173 100644
--- a/hotspot/test/compiler/stable/TestStableMismatched.java
+++ b/hotspot/test/compiler/stable/TestStableMismatched.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java
index 37b7ff67b43..2d9411e94d0 100644
--- a/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java
+++ b/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/AbortType.java b/hotspot/test/compiler/testlibrary/rtm/AbortType.java
index b37d8b83b74..dd439111afa 100644
--- a/hotspot/test/compiler/testlibrary/rtm/AbortType.java
+++ b/hotspot/test/compiler/testlibrary/rtm/AbortType.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/BufferOverflowProvoker.java b/hotspot/test/compiler/testlibrary/rtm/BufferOverflowProvoker.java
index 568f20810d7..6a3ab4e35aa 100644
--- a/hotspot/test/compiler/testlibrary/rtm/BufferOverflowProvoker.java
+++ b/hotspot/test/compiler/testlibrary/rtm/BufferOverflowProvoker.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/BusyLock.java b/hotspot/test/compiler/testlibrary/rtm/BusyLock.java
index 3cba0ae1135..79120a64136 100644
--- a/hotspot/test/compiler/testlibrary/rtm/BusyLock.java
+++ b/hotspot/test/compiler/testlibrary/rtm/BusyLock.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/CompilableTest.java b/hotspot/test/compiler/testlibrary/rtm/CompilableTest.java
index 1b97c2eb795..da701fa30a6 100644
--- a/hotspot/test/compiler/testlibrary/rtm/CompilableTest.java
+++ b/hotspot/test/compiler/testlibrary/rtm/CompilableTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java b/hotspot/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java
index 5fafe8f8c9d..7926c9e23b4 100644
--- a/hotspot/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java
+++ b/hotspot/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/NestedAbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/NestedAbortProvoker.java
index 9fb6e8da61b..7123f2d562f 100644
--- a/hotspot/test/compiler/testlibrary/rtm/NestedAbortProvoker.java
+++ b/hotspot/test/compiler/testlibrary/rtm/NestedAbortProvoker.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java b/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java
index a5584920e93..edd01f7474d 100644
--- a/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java
+++ b/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java
index 643f3bebcad..494f12126a4 100644
--- a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java
+++ b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java
index c62f7043f83..961ff33eeca 100644
--- a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java
+++ b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm;
diff --git a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java
index d634727691c..eab1f977723 100644
--- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java
+++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm.predicate;
diff --git a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java
index 5f2c0028c54..f4958a607c2 100644
--- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java
+++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package compiler.testlibrary.rtm.predicate;
diff --git a/hotspot/test/compiler/types/TestPhiElimination.java b/hotspot/test/compiler/types/TestPhiElimination.java
index d6e89586a16..31e5f1cbc91 100644
--- a/hotspot/test/compiler/types/TestPhiElimination.java
+++ b/hotspot/test/compiler/types/TestPhiElimination.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java b/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java
index d286d804cf5..5a4916a9724 100644
--- a/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java
+++ b/hotspot/test/compiler/uncommontrap/UncommonTrapStackBang.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/**
diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
index def44007470..0f323a8c52e 100644
--- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
index 04ac558d9f5..8fe5b47ed39 100644
--- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
+++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
index 305c888b7da..2f8e24e4ae8 100644
--- a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
+++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java
index 91d8cb7342d..a95f87b000a 100644
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/gc/TestCardTablePageCommits.java b/hotspot/test/gc/TestCardTablePageCommits.java
index e3d70b38533..52fc31a1035 100644
--- a/hotspot/test/gc/TestCardTablePageCommits.java
+++ b/hotspot/test/gc/TestCardTablePageCommits.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.process.ProcessTools;
diff --git a/hotspot/test/gc/TestHumongousReferenceObject.java b/hotspot/test/gc/TestHumongousReferenceObject.java
index 7e09abfe274..3ef0181c4b9 100644
--- a/hotspot/test/gc/TestHumongousReferenceObject.java
+++ b/hotspot/test/gc/TestHumongousReferenceObject.java
@@ -3,16 +3,16 @@
* 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 License version 2 only, as
+ * 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 License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
- * You should have received a copy of the GNU General License version
+ * 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.
*
diff --git a/hotspot/test/gc/TestSystemGC.java b/hotspot/test/gc/TestSystemGC.java
index 275ee24c304..a3830130ac2 100644
--- a/hotspot/test/gc/TestSystemGC.java
+++ b/hotspot/test/gc/TestSystemGC.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestSystemGC
diff --git a/hotspot/test/gc/arguments/AllocationHelper.java b/hotspot/test/gc/arguments/AllocationHelper.java
index bd4a77111be..f804be915ef 100644
--- a/hotspot/test/gc/arguments/AllocationHelper.java
+++ b/hotspot/test/gc/arguments/AllocationHelper.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * 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.util.LinkedList;
import java.util.concurrent.Callable;
diff --git a/hotspot/test/gc/arguments/FlagsValue.java b/hotspot/test/gc/arguments/FlagsValue.java
index 1dbd4a3cbbf..10e555eec6e 100644
--- a/hotspot/test/gc/arguments/FlagsValue.java
+++ b/hotspot/test/gc/arguments/FlagsValue.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
import java.util.regex.*;
diff --git a/hotspot/test/gc/arguments/GCTypes.java b/hotspot/test/gc/arguments/GCTypes.java
index 1a5821357a9..f39aa440114 100644
--- a/hotspot/test/gc/arguments/GCTypes.java
+++ b/hotspot/test/gc/arguments/GCTypes.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
diff --git a/hotspot/test/gc/arguments/HeapRegionUsageTool.java b/hotspot/test/gc/arguments/HeapRegionUsageTool.java
index 1030012cf1a..11bd975f02c 100644
--- a/hotspot/test/gc/arguments/HeapRegionUsageTool.java
+++ b/hotspot/test/gc/arguments/HeapRegionUsageTool.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
diff --git a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java
index 50782ab3725..dc6225d5496 100644
--- a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java
+++ b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestCMSHeapSizeFlags
diff --git a/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java b/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java
index 65536d5880f..dc468b4fd14 100644
--- a/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java
+++ b/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * 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 TestG1ConcMarkStepDurationMillis
diff --git a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java
index 523994bccf5..57a0c9a9233 100644
--- a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java
+++ b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestG1ConcRefinementThreads
diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
index d69c2f066b7..124e4183512 100644
--- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
+++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestG1HeapRegionSize
diff --git a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java
index 73e600e5cf1..d0f9c8441d0 100644
--- a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java
+++ b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestG1HeapSizeFlags
diff --git a/hotspot/test/gc/arguments/TestG1PercentageOptions.java b/hotspot/test/gc/arguments/TestG1PercentageOptions.java
index 3314e42e998..07303822e99 100644
--- a/hotspot/test/gc/arguments/TestG1PercentageOptions.java
+++ b/hotspot/test/gc/arguments/TestG1PercentageOptions.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestG1PercentageOptions
diff --git a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java
index 6fc2246488b..83d5908e952 100644
--- a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java
+++ b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestInitialTenuringThreshold
diff --git a/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java b/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java
index 98768c09469..df88b15f81a 100644
--- a/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java
+++ b/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.util.regex.Matcher;
import java.util.regex.Pattern;
diff --git a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java
index 714674b853d..f2818af72f8 100644
--- a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java
+++ b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestMaxMinHeapFreeRatioFlags
diff --git a/hotspot/test/gc/arguments/TestMaxNewSize.java b/hotspot/test/gc/arguments/TestMaxNewSize.java
index 1a5bd980f4b..c78867f30a7 100644
--- a/hotspot/test/gc/arguments/TestMaxNewSize.java
+++ b/hotspot/test/gc/arguments/TestMaxNewSize.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestMaxNewSize
diff --git a/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java b/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java
index 892426a29cd..f73f30170fa 100644
--- a/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java
+++ b/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestMinAndInitialSurvivorRatioFlags
diff --git a/hotspot/test/gc/arguments/TestMinInitialErgonomics.java b/hotspot/test/gc/arguments/TestMinInitialErgonomics.java
index ca354ba91a2..4e409217067 100644
--- a/hotspot/test/gc/arguments/TestMinInitialErgonomics.java
+++ b/hotspot/test/gc/arguments/TestMinInitialErgonomics.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestMinInitialErgonomics
diff --git a/hotspot/test/gc/arguments/TestNewRatioFlag.java b/hotspot/test/gc/arguments/TestNewRatioFlag.java
index d95374a328c..9b58cc83507 100644
--- a/hotspot/test/gc/arguments/TestNewRatioFlag.java
+++ b/hotspot/test/gc/arguments/TestNewRatioFlag.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestNewRatioFlag
diff --git a/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java b/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java
index fc487c2dd94..deb5b6f5097 100644
--- a/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java
+++ b/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * 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 TestNewSizeThreadIncrease
diff --git a/hotspot/test/gc/arguments/TestObjectTenuringFlags.java b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java
index ed25dd8f6b9..ee52c10017c 100644
--- a/hotspot/test/gc/arguments/TestObjectTenuringFlags.java
+++ b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestObjectTenuringFlags
diff --git a/hotspot/test/gc/arguments/TestParallelGCThreads.java b/hotspot/test/gc/arguments/TestParallelGCThreads.java
index f18aa43a8b2..7c56a3be4a7 100644
--- a/hotspot/test/gc/arguments/TestParallelGCThreads.java
+++ b/hotspot/test/gc/arguments/TestParallelGCThreads.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestParallelGCThreads
diff --git a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java
index f9e4816ace2..b30ce186f3b 100644
--- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java
+++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestParallelHeapSizeFlags
diff --git a/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java b/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java
index 32533afd609..4aa2dac2e07 100644
--- a/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java
+++ b/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestSerialHeapSizeFlags
diff --git a/hotspot/test/gc/arguments/TestShrinkHeapInSteps.java b/hotspot/test/gc/arguments/TestShrinkHeapInSteps.java
index de75055a560..001a1621b31 100644
--- a/hotspot/test/gc/arguments/TestShrinkHeapInSteps.java
+++ b/hotspot/test/gc/arguments/TestShrinkHeapInSteps.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestShrinkHeapInSteps
diff --git a/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java b/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java
index d33d7733b68..b7af84b4b06 100644
--- a/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java
+++ b/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestSurvivorRatioFlag
diff --git a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java
index 60eef56287c..864ad46a000 100644
--- a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java
+++ b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test TestTargetSurvivorRatioFlag
diff --git a/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java
index f10bd70c465..3d19dcb2c65 100644
--- a/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java
+++ b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestUnrecognizedVMOptionsHandling
diff --git a/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java b/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java
index 218ee051c6c..d7f2ed0ac57 100644
--- a/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java
+++ b/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestUseCompressedOopsErgo
diff --git a/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java b/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java
index d599fe3ce7e..267a755b589 100644
--- a/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java
+++ b/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2015,Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.VMOption;
diff --git a/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java b/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java
index db2be6d6468..1258fae516d 100644
--- a/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java
+++ b/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * 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 TestVerifyBeforeAndAfterGCFlags
diff --git a/hotspot/test/gc/cms/DisableResizePLAB.java b/hotspot/test/gc/cms/DisableResizePLAB.java
index c5509811262..a8d9861464e 100644
--- a/hotspot/test/gc/cms/DisableResizePLAB.java
+++ b/hotspot/test/gc/cms/DisableResizePLAB.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License version 2 only, as
-* published by the Free Software Foundation.
-*
-* This code is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-* version 2 for more details (a copy is included in the LICENSE file that
-* accompanied this code).
-*
-* You should have received a copy of the GNU General Public License version
-* 2 along with this work; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-*
-* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-* or visit www.oracle.com if you need additional information or have any
-* questions.
-*/
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test DisableResizePLAB
diff --git a/hotspot/test/gc/cms/TestCMSScavengeBeforeRemark.java b/hotspot/test/gc/cms/TestCMSScavengeBeforeRemark.java
index 515a97a7f2e..f97eeb5a863 100644
--- a/hotspot/test/gc/cms/TestCMSScavengeBeforeRemark.java
+++ b/hotspot/test/gc/cms/TestCMSScavengeBeforeRemark.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * 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 TestCMSScavengeBeforeRemark
diff --git a/hotspot/test/gc/g1/humongousObjects/ClassLoaderGenerator.java b/hotspot/test/gc/g1/humongousObjects/ClassLoaderGenerator.java
index 6767e4b3d23..25510063b55 100644
--- a/hotspot/test/gc/g1/humongousObjects/ClassLoaderGenerator.java
+++ b/hotspot/test/gc/g1/humongousObjects/ClassLoaderGenerator.java
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
package gc.g1.humongousObjects;
import gc.testlibrary.Helpers;
diff --git a/hotspot/test/gc/g1/humongousObjects/G1SampleClass.java b/hotspot/test/gc/g1/humongousObjects/G1SampleClass.java
index 62892c2c88b..a11ccb781c0 100644
--- a/hotspot/test/gc/g1/humongousObjects/G1SampleClass.java
+++ b/hotspot/test/gc/g1/humongousObjects/G1SampleClass.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects;
diff --git a/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java b/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java
index 86405e1c738..ee06d59a4e2 100644
--- a/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java
+++ b/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects;
diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java
index 1db6259f8ca..8d0f676d455 100644
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects;
diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java
index 755516c92bc..41f708299f0 100644
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects;
diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java
index 2abcf4883e9..c890ed0afbf 100644
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects;
diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java
index 76b35ab0055..f98aea7e0a7 100644
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015,2016 Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects;
diff --git a/hotspot/test/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java b/hotspot/test/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java
index 893b895a8f5..bd83dba3a85 100644
--- a/hotspot/test/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java
+++ b/hotspot/test/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects;
diff --git a/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java b/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java
index 10ffe50f28f..cb4408081d5 100644
--- a/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java
+++ b/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects;
diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java
index be721f54fd5..b07bdddfb36 100644
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects.objectGraphTest;
diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GCTokens.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GCTokens.java
index e8a52001d65..1e428c4cc61 100644
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GCTokens.java
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GCTokens.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects.objectGraphTest;
diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ObjectGraph.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ObjectGraph.java
index 48ca3d3fdcc..8bffda16a1c 100644
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ObjectGraph.java
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ObjectGraph.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects.objectGraphTest;
diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ReferenceInfo.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ReferenceInfo.java
index 98e249a2c7b..2eb02b8b217 100644
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ReferenceInfo.java
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ReferenceInfo.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects.objectGraphTest;
diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java
index bb7f3d29a60..7e51d2e99eb 100644
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects.objectGraphTest;
diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestcaseData.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestcaseData.java
index 022934683a6..1e20a205068 100644
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestcaseData.java
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestcaseData.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.g1.humongousObjects.objectGraphTest;
diff --git a/hotspot/test/gc/logging/TestPrintReferences.java b/hotspot/test/gc/logging/TestPrintReferences.java
index 193263493be..82adb871b5e 100644
--- a/hotspot/test/gc/logging/TestPrintReferences.java
+++ b/hotspot/test/gc/logging/TestPrintReferences.java
@@ -41,7 +41,7 @@ public class TestPrintReferences {
OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start());
String countRegex = "[0-9]+ refs";
- String timeRegex = "\\([0-9]+[.,][0-9]+s, [0-9]+[.,][0-9]+s\\) [0-9]+[.,][0-9]+ms";
+ String timeRegex = "[0-9]+[.,][0-9]+ms";
output.shouldMatch(".* GC\\([0-9]+\\) SoftReference " + timeRegex + "\n" +
".* GC\\([0-9]+\\) WeakReference " + timeRegex + "\n" +
diff --git a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java
index 4c7838ec277..f2e8cf66d6c 100644
--- a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java
+++ b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.logging;
diff --git a/hotspot/test/gc/startup_warnings/TestCMS.java b/hotspot/test/gc/startup_warnings/TestCMS.java
index 6ea63dabcaf..d51a3ded1c0 100644
--- a/hotspot/test/gc/startup_warnings/TestCMS.java
+++ b/hotspot/test/gc/startup_warnings/TestCMS.java
@@ -1,31 +1,31 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestCMS
* @key gc
-* @bug 8006398
-* @summary Test that CMS does not print a warning message
+* @bug 8006398 8155948
+* @summary Test that CMS prints a warning message only for a commercial build
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
@@ -33,16 +33,27 @@
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
-
+import jdk.test.lib.BuildHelper;
public class TestCMS {
- public static void main(String args[]) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-version");
+ public static void runTest(String[] args) throws Exception {
+ boolean isCommercial = BuildHelper.isCommercialBuild();
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("deprecated");
+ if (isCommercial) {
+ output.shouldContain("deprecated");
+ } else {
+ output.shouldNotContain("deprecated");
+ }
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
+ public static void main(String args[]) throws Exception {
+ runTest(new String[] {"-XX:+UseConcMarkSweepGC", "-version"});
+ runTest(new String[] {"-Xconcgc", "-version"});
+ runTest(new String[] {"-Xnoconcgc", "-version"});
+ }
+
}
diff --git a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
index f6aaacec0bf..f8780679733 100644
--- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
+++ b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestDefNewCMS
diff --git a/hotspot/test/gc/startup_warnings/TestG1.java b/hotspot/test/gc/startup_warnings/TestG1.java
index 253a16c0274..0c49c08f60d 100644
--- a/hotspot/test/gc/startup_warnings/TestG1.java
+++ b/hotspot/test/gc/startup_warnings/TestG1.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestG1
diff --git a/hotspot/test/gc/startup_warnings/TestParNewCMS.java b/hotspot/test/gc/startup_warnings/TestParNewCMS.java
index 82830abdc8d..75dbe4bf7b3 100644
--- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java
+++ b/hotspot/test/gc/startup_warnings/TestParNewCMS.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestParNewCMS
diff --git a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
index 30843bf389a..a4c8d5c31e1 100644
--- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
+++ b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestParNewSerialOld
diff --git a/hotspot/test/gc/startup_warnings/TestParallelGC.java b/hotspot/test/gc/startup_warnings/TestParallelGC.java
index 0a31ca9d1c1..c9b5d629a6e 100644
--- a/hotspot/test/gc/startup_warnings/TestParallelGC.java
+++ b/hotspot/test/gc/startup_warnings/TestParallelGC.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestParallelGC
diff --git a/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java b/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java
index 9e404d1c36f..3fb992caece 100644
--- a/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java
+++ b/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestParallelScavengeSerialOld
diff --git a/hotspot/test/gc/startup_warnings/TestSerialGC.java b/hotspot/test/gc/startup_warnings/TestSerialGC.java
index 35f69813c42..fa6d033d965 100644
--- a/hotspot/test/gc/startup_warnings/TestSerialGC.java
+++ b/hotspot/test/gc/startup_warnings/TestSerialGC.java
@@ -1,25 +1,25 @@
/*
-* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* This code is free software; you can redistribute it and/or modify it
-* 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.
-*/
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 TestSerialGC
diff --git a/hotspot/test/gc/startup_warnings/TestUseAutoGCSelectPolicy.java b/hotspot/test/gc/startup_warnings/TestUseAutoGCSelectPolicy.java
new file mode 100644
index 00000000000..360e5e05970
--- /dev/null
+++ b/hotspot/test/gc/startup_warnings/TestUseAutoGCSelectPolicy.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestUseAutoGCSelectPolicy
+ * @key gc
+ * @bug 8166461 8167494
+ * @summary Test that UseAutoGCSelectPolicy and AutoGCSelectPauseMillis do print a warning message
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ */
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class TestUseAutoGCSelectPolicy {
+
+ public static void main(String args[]) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseAutoGCSelectPolicy", "-XX:AutoGCSelectPauseMillis=3000", "-version");
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain("UseAutoGCSelectPolicy was deprecated in version 9.0");
+ output.shouldContain("AutoGCSelectPauseMillis was deprecated in version 9.0");
+ output.shouldNotContain("error");
+ output.shouldHaveExitValue(0);
+ }
+}
diff --git a/hotspot/test/gc/stress/TestGCOld.java b/hotspot/test/gc/stress/TestGCOld.java
index 3d74aa210b8..b6c60cb59b8 100644
--- a/hotspot/test/gc/stress/TestGCOld.java
+++ b/hotspot/test/gc/stress/TestGCOld.java
@@ -1,25 +1,25 @@
/*
-* 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.
-*
-* 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.
-*/
+ * 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.
+ *
+ * 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 TestGCOld
diff --git a/hotspot/test/gc/testlibrary/Helpers.java b/hotspot/test/gc/testlibrary/Helpers.java
index e326308e5d1..e18640fe39a 100644
--- a/hotspot/test/gc/testlibrary/Helpers.java
+++ b/hotspot/test/gc/testlibrary/Helpers.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package gc.testlibrary;
diff --git a/hotspot/test/native/GTestWrapper.java b/hotspot/test/native/GTestWrapper.java
index da90f816855..b5c5eba88e1 100644
--- a/hotspot/test/native/GTestWrapper.java
+++ b/hotspot/test/native/GTestWrapper.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/* @test
diff --git a/hotspot/test/native/classfile/test_symbolTable.cpp b/hotspot/test/native/classfile/test_symbolTable.cpp
index 04e382c448e..2bb7e35d63c 100644
--- a/hotspot/test/native/classfile/test_symbolTable.cpp
+++ b/hotspot/test/native/classfile/test_symbolTable.cpp
@@ -26,7 +26,7 @@
#include "classfile/symbolTable.hpp"
#include "unittest.hpp"
-TEST(SymbolTable, temp_new_symbol) {
+TEST_VM(SymbolTable, temp_new_symbol) {
// Assert messages assume these symbols are unique, and the refcounts start at
// one, but code does not rely on this.
JavaThread* THREAD = JavaThread::current();
diff --git a/hotspot/test/native/gc/g1/test_g1BiasedArray.cpp b/hotspot/test/native/gc/g1/test_g1BiasedArray.cpp
new file mode 100644
index 00000000000..7a67fe0da8c
--- /dev/null
+++ b/hotspot/test/native/gc/g1/test_g1BiasedArray.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "gc/g1/g1BiasedArray.hpp"
+#include "unittest.hpp"
+
+class TestMappedArray : public G1BiasedMappedArray {
+public:
+ virtual int default_value() const {
+ return 0xBAADBABE;
+ }
+ int* my_address_mapped_to(HeapWord* address) {
+ return address_mapped_to(address);
+ }
+};
+
+TEST_VM(G1BiasedArray, simple) {
+ const size_t REGION_SIZE_IN_WORDS = 512;
+ const size_t NUM_REGIONS = 20;
+ // Any value that is non-zero
+ HeapWord* fake_heap =
+ (HeapWord*) LP64_ONLY(0xBAAA00000) NOT_LP64(0xBA000000);
+
+ TestMappedArray array;
+ array.initialize(fake_heap, fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS,
+ REGION_SIZE_IN_WORDS * HeapWordSize);
+ const int DEFAULT_VALUE = array.default_value();
+
+ // Check address calculation (bounds)
+ ASSERT_EQ(fake_heap, array.bottom_address_mapped())
+ << "bottom mapped address should be "
+ << p2i(array.bottom_address_mapped())
+ << ", but is "
+ << p2i(fake_heap);
+ ASSERT_EQ(fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS,
+ array.end_address_mapped());
+
+ int* bottom = array.my_address_mapped_to(fake_heap);
+ ASSERT_EQ((void*) bottom, (void*) array.base());
+ int* end = array.my_address_mapped_to(fake_heap +
+ REGION_SIZE_IN_WORDS * NUM_REGIONS);
+ ASSERT_EQ((void*) end, (void*) (array.base() + array.length()));
+ // The entire array should contain default value elements
+ for (int* current = bottom; current < end; current++) {
+ ASSERT_EQ(DEFAULT_VALUE, *current);
+ }
+
+ // Test setting values in the table
+ HeapWord* region_start_address =
+ fake_heap + REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2);
+ HeapWord* region_end_address =
+ fake_heap + (REGION_SIZE_IN_WORDS * (NUM_REGIONS / 2) +
+ REGION_SIZE_IN_WORDS - 1);
+
+ // Set/get by address tests: invert some value; first retrieve one
+ int actual_value = array.get_by_index(NUM_REGIONS / 2);
+ array.set_by_index(NUM_REGIONS / 2, ~actual_value);
+ // Get the same value by address, should correspond to the start of the "region"
+ int value = array.get_by_address(region_start_address);
+ ASSERT_EQ(value, ~actual_value);
+ // Get the same value by address, at one HeapWord before the start
+ value = array.get_by_address(region_start_address - 1);
+ ASSERT_EQ(DEFAULT_VALUE, value);
+ // Get the same value by address, at the end of the "region"
+ value = array.get_by_address(region_end_address);
+ ASSERT_EQ(value, ~actual_value);
+ // Make sure the next value maps to another index
+ value = array.get_by_address(region_end_address + 1);
+ ASSERT_EQ(DEFAULT_VALUE, value);
+
+ // Reset the value in the array
+ array.set_by_address(region_start_address +
+ (region_end_address - region_start_address) / 2,
+ actual_value);
+
+ // The entire array should have the default value again
+ for (int* current = bottom; current < end; current++) {
+ ASSERT_EQ(DEFAULT_VALUE, *current);
+ }
+
+ // Set/get by index tests: invert some value
+ size_t index = NUM_REGIONS / 2;
+ actual_value = array.get_by_index(index);
+ array.set_by_index(index, ~actual_value);
+
+ value = array.get_by_index(index);
+ ASSERT_EQ(~actual_value, value);
+
+ value = array.get_by_index(index - 1);
+ ASSERT_EQ(DEFAULT_VALUE, value);
+
+ value = array.get_by_index(index + 1);
+ ASSERT_EQ(DEFAULT_VALUE, value);
+
+ array.set_by_index(0, 0);
+ value = array.get_by_index(0);
+ ASSERT_EQ(0, value);
+
+ array.set_by_index(array.length() - 1, 0);
+ value = array.get_by_index(array.length() - 1);
+ ASSERT_EQ(0, value);
+
+ array.set_by_index(index, 0);
+
+ // The array should have three zeros, and default values otherwise
+ size_t num_zeros = 0;
+ for (int* current = bottom; current < end; current++) {
+ ASSERT_TRUE(*current == DEFAULT_VALUE || *current == 0);
+ if (*current == 0) {
+ num_zeros++;
+ }
+ }
+ ASSERT_EQ((size_t) 3, num_zeros);
+}
+
diff --git a/hotspot/test/native/gtestLauncher.cpp b/hotspot/test/native/gtestLauncher.cpp
index d25a0f9b14f..dc94c7998ca 100644
--- a/hotspot/test/native/gtestLauncher.cpp
+++ b/hotspot/test/native/gtestLauncher.cpp
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
#include "prims/jni.h"
diff --git a/hotspot/test/native/gtestMain.cpp b/hotspot/test/native/gtestMain.cpp
index 3c48e80d752..09804b571ac 100644
--- a/hotspot/test/native/gtestMain.cpp
+++ b/hotspot/test/native/gtestMain.cpp
@@ -34,20 +34,34 @@
extern "C" {
-static int init_jvm(int argc, char **argv, bool is_executing_death_test) {
+static bool is_prefix(const char* prefix, const char* str) {
+ return strncmp(str, prefix, strlen(prefix)) == 0;
+}
+
+static bool is_suffix(const char* suffix, const char* str) {
+ size_t suffix_len = strlen(suffix);
+ size_t str_len = strlen(str);
+ if (str_len < suffix_len) {
+ return false;
+ }
+ return strncmp(str + (str_len - suffix_len), suffix, suffix_len) == 0;
+}
+
+
+static int init_jvm(int argc, char **argv, bool disable_error_handling) {
// don't care about the program name
argc--;
argv++;
- int extra_jvm_args = is_executing_death_test ? 4 : 2;
+ int extra_jvm_args = disable_error_handling ? 4 : 2;
int num_jvm_options = argc + extra_jvm_args;
JavaVMOption* options = new JavaVMOption[num_jvm_options];
options[0].optionString = (char*) "-Dsun.java.launcher.is_altjvm=true";
options[1].optionString = (char*) "-XX:+ExecutingUnitTests";
- if (is_executing_death_test) {
- // don't create core files or hs_err files when executing death tests
+ if (disable_error_handling) {
+ // don't create core files or hs_err files executing assert tests
options[2].optionString = (char*) "-XX:+SuppressFatalErrorMessage";
options[3].optionString = (char*) "-XX:-CreateCoredumpOnCrash";
}
@@ -83,17 +97,14 @@ class JVMInitializerListener : public ::testing::EmptyTestEventListener {
virtual void OnTestStart(const ::testing::TestInfo& test_info) {
const char* name = test_info.name();
- if (strstr(name, "_test_vm") != NULL && !_is_initialized) {
- ASSERT_EQ(init_jvm(_argc, _argv, false), 0) << "Could not initialize the JVM";
+ if (!_is_initialized && is_suffix("_test_vm", name)) {
+ // we want to have hs_err and core files when we execute regular tests
+ ASSERT_EQ(0, init_jvm(_argc, _argv, false)) << "Could not initialize the JVM";
_is_initialized = true;
}
}
};
-static bool is_prefix(const char* prefix, const char* str) {
- return strncmp(str, prefix, strlen(prefix)) == 0;
-}
-
static char* get_java_home_arg(int argc, char** argv) {
for (int i = 0; i < argc; i++) {
if (strncmp(argv[i], "-jdk", strlen(argv[i])) == 0) {
@@ -144,19 +155,23 @@ static char** remove_test_runner_arguments(int* argcp, char **argv) {
}
JNIEXPORT void JNICALL runUnitTests(int argc, char** argv) {
- // Must look at googletest options before initializing googletest, since
- // InitGoogleTest removes googletest options from argv.
- bool is_executing_death_test = true;
- for (int i = 0; i < argc; i++) {
- const char* death_test_flag = "--gtest_internal_run_death_test";
- if (is_prefix(death_test_flag, argv[i])) {
- is_executing_death_test = true;
- }
- }
-
::testing::InitGoogleTest(&argc, argv);
::testing::GTEST_FLAG(death_test_style) = "threadsafe";
-// ::testing::GTEST_FLAG(death_test_output_prefix) = "Other VM";
+
+ bool is_vmassert_test = false;
+ bool is_othervm_test = false;
+ // death tests facility is used for both regular death tests, other vm and vmassert tests
+ if (::testing::internal::GTEST_FLAG(internal_run_death_test).length() > 0) {
+ // when we execute death test, filter value equals to test name
+ const char* test_name = ::testing::GTEST_FLAG(filter).c_str();
+ const char* const othervm_suffix = "_other_vm_test"; // TEST_OTHER_VM
+ const char* const vmassert_suffix = "_vm_assert_test"; // TEST_VM_ASSERT(_MSG)
+ if (is_suffix(othervm_suffix, test_name)) {
+ is_othervm_test = true;
+ } else if (is_suffix(vmassert_suffix, test_name)) {
+ is_vmassert_test = true;
+ }
+ }
char* java_home = get_java_home_arg(argc, argv);
if (java_home == NULL) {
@@ -184,8 +199,10 @@ JNIEXPORT void JNICALL runUnitTests(int argc, char** argv) {
#endif // _WIN32
argv = remove_test_runner_arguments(&argc, argv);
- if (is_executing_death_test) {
- if (init_jvm(argc, argv, true) != 0) {
+ if (is_vmassert_test || is_othervm_test) {
+ // both vmassert and other vm tests require inited jvm
+ // but only vmassert tests disable hs_err and core file generation
+ if (init_jvm(argc, argv, is_vmassert_test) != 0) {
abort();
}
} else {
diff --git a/hotspot/test/native/logging/logTestFixture.cpp b/hotspot/test/native/logging/logTestFixture.cpp
index d22a6f74d92..23a215dbb5c 100644
--- a/hotspot/test/native/logging/logTestFixture.cpp
+++ b/hotspot/test/native/logging/logTestFixture.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logTestFixture.hpp"
#include "logTestUtils.inline.hpp"
diff --git a/hotspot/test/native/logging/logTestFixture.hpp b/hotspot/test/native/logging/logTestFixture.hpp
index d9c1c8b02df..dfdcee00213 100644
--- a/hotspot/test/native/logging/logTestFixture.hpp
+++ b/hotspot/test/native/logging/logTestFixture.hpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "unittest.hpp"
#include "utilities/globalDefinitions.hpp"
diff --git a/hotspot/test/native/logging/logTestUtils.inline.hpp b/hotspot/test/native/logging/logTestUtils.inline.hpp
index bf39dfdbd9e..03209aea484 100644
--- a/hotspot/test/native/logging/logTestUtils.inline.hpp
+++ b/hotspot/test/native/logging/logTestUtils.inline.hpp
@@ -19,8 +19,12 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
+#include "logging/log.hpp"
+#include "logging/logConfiguration.hpp"
+#include "logging/logStream.hpp"
+#include "memory/resourceArea.hpp"
#include "runtime/os.hpp"
#include "unittest.hpp"
@@ -43,3 +47,74 @@ static inline void delete_file(const char* filename) {
EXPECT_TRUE(ret == 0 || errno == ENOENT) << "failed to remove file '" << filename << "': "
<< os::strerror(errno) << " (" << errno << ")";
}
+
+static inline void create_directory(const char* name) {
+ assert(!file_exists(name), "can't create directory: %s already exists", name);
+ bool failed;
+#ifdef _WINDOWS
+ failed = !CreateDirectory(name, NULL);
+#else
+ failed = mkdir(name, 0777);
+#endif
+ assert(!failed, "failed to create directory %s", name);
+}
+
+static inline void init_log_file(const char* filename, const char* options = "") {
+ LogStreamHandle(Error, logging) stream;
+ bool success = LogConfiguration::parse_log_arguments(filename, "logging=trace", "", options, &stream);
+ guarantee(success, "Failed to initialize log file '%s' with options '%s'", filename, options);
+ log_debug(logging)("%s", LOG_TEST_STRING_LITERAL);
+ success = LogConfiguration::parse_log_arguments(filename, "all=off", "", "", &stream);
+ guarantee(success, "Failed to disable logging to file '%s'", filename);
+}
+
+// Read a complete line from fp and return it as a resource allocated string.
+// Returns NULL on EOF.
+static inline char* read_line(FILE* fp) {
+ assert(fp != NULL, "invalid fp");
+ int buflen = 512;
+ char* buf = NEW_RESOURCE_ARRAY(char, buflen);
+ long pos = ftell(fp);
+
+ char* ret = fgets(buf, buflen, fp);
+ while (ret != NULL && buf[strlen(buf) - 1] != '\n' && !feof(fp)) {
+ // retry with a larger buffer
+ buf = REALLOC_RESOURCE_ARRAY(char, buf, buflen, buflen * 2);
+ buflen *= 2;
+ // rewind to beginning of line
+ fseek(fp, pos, SEEK_SET);
+ // retry read with new buffer
+ ret = fgets(buf, buflen, fp);
+ }
+ return ret;
+}
+
+static bool file_contains_substrings_in_order(const char* filename, const char* substrs[]) {
+ FILE* fp = fopen(filename, "r");
+ assert(fp != NULL, "error opening file %s: %s", filename, strerror(errno));
+
+ size_t idx = 0;
+ while (substrs[idx] != NULL) {
+ ResourceMark rm;
+ char* line = read_line(fp);
+ if (line == NULL) {
+ break;
+ }
+ for (char* match = strstr(line, substrs[idx]); match != NULL;) {
+ size_t match_len = strlen(substrs[idx]);
+ idx++;
+ if (substrs[idx] == NULL) {
+ break;
+ }
+ match = strstr(match + match_len, substrs[idx]);
+ }
+ }
+
+ fclose(fp);
+ return substrs[idx] == NULL;
+}
+
+static inline bool file_contains_substring(const char* filename, const char* substr) {
+ const char* strs[] = {substr, NULL};
+ return file_contains_substrings_in_order(filename, strs);
+}
diff --git a/hotspot/test/native/logging/test_gcTraceTime.cpp b/hotspot/test/native/logging/test_gcTraceTime.cpp
new file mode 100644
index 00000000000..05763d59e22
--- /dev/null
+++ b/hotspot/test/native/logging/test_gcTraceTime.cpp
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "gc/shared/gcTraceTime.inline.hpp"
+#include "logTestFixture.hpp"
+#include "logTestUtils.inline.hpp"
+#include "logging/log.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "unittest.hpp"
+
+class GCTraceTimeTest : public LogTestFixture {
+};
+
+TEST_VM_F(GCTraceTimeTest, full) {
+ set_log_config(TestLogFileName, "gc=debug,gc+start=debug");
+
+ LogTarget(Debug, gc) gc_debug;
+ LogTarget(Debug, gc, start) gc_start_debug;
+
+ EXPECT_TRUE(gc_debug.is_enabled());
+ EXPECT_TRUE(gc_start_debug.is_enabled());
+
+ {
+ ThreadInVMfromNative tvn(JavaThread::current());
+ MutexLocker lock(Heap_lock); // Needed to read heap usage
+ GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_allocation_failure, true);
+ }
+
+ const char* expected[] = {
+ "[gc,start", "] Test GC (Allocation Failure)",
+ "[gc", "] Test GC (Allocation Failure) ", "M) ", "ms",
+ NULL
+ };
+ EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected));
+}
+
+TEST_VM_F(GCTraceTimeTest, full_multitag) {
+ set_log_config(TestLogFileName, "gc+ref=debug,gc+ref+start=debug");
+
+ LogTarget(Debug, gc, ref) gc_debug;
+ LogTarget(Debug, gc, ref, start) gc_start_debug;
+
+ EXPECT_TRUE(gc_debug.is_enabled());
+ EXPECT_TRUE(gc_start_debug.is_enabled());
+
+ {
+ ThreadInVMfromNative tvn(JavaThread::current());
+ MutexLocker lock(Heap_lock); // Needed to read heap usage
+ GCTraceTime(Debug, gc, ref) timer("Test GC", NULL, GCCause::_allocation_failure, true);
+ }
+
+ const char* expected[] = {
+ "[gc,ref,start", "] Test GC (Allocation Failure)",
+ "[gc,ref", "] Test GC (Allocation Failure) ", "M) ", "ms",
+ NULL
+ };
+ EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected));
+}
+
+TEST_VM_F(GCTraceTimeTest, no_heap) {
+ set_log_config(TestLogFileName, "gc=debug,gc+start=debug");
+
+ LogTarget(Debug, gc) gc_debug;
+ LogTarget(Debug, gc, start) gc_start_debug;
+
+ EXPECT_TRUE(gc_debug.is_enabled());
+ EXPECT_TRUE(gc_start_debug.is_enabled());
+
+ {
+ GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_allocation_failure, false);
+ }
+
+ const char* expected[] = {
+ // [2.975s][debug][gc,start] Test GC (Allocation Failure)
+ "[gc,start", "] Test GC (Allocation Failure)",
+ // [2.975s][debug][gc ] Test GC (Allocation Failure) 0.026ms
+ "[gc", "] Test GC (Allocation Failure) ", "ms",
+ NULL
+ };
+ EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected));
+
+ const char* not_expected[] = {
+ // [2.975s][debug][gc ] Test GC 59M->59M(502M) 0.026ms
+ "[gc", "] Test GC ", "M) ", "ms",
+ };
+ EXPECT_FALSE(file_contains_substrings_in_order(TestLogFileName, not_expected));
+}
+
+TEST_VM_F(GCTraceTimeTest, no_cause) {
+ set_log_config(TestLogFileName, "gc=debug,gc+start=debug");
+
+ LogTarget(Debug, gc) gc_debug;
+ LogTarget(Debug, gc, start) gc_start_debug;
+
+ EXPECT_TRUE(gc_debug.is_enabled());
+ EXPECT_TRUE(gc_start_debug.is_enabled());
+
+ {
+ ThreadInVMfromNative tvn(JavaThread::current());
+ MutexLocker lock(Heap_lock); // Needed to read heap usage
+ GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_no_gc, true);
+ }
+
+ const char* expected[] = {
+ // [2.975s][debug][gc,start] Test GC
+ "[gc,start", "] Test GC",
+ // [2.975s][debug][gc ] Test GC 59M->59M(502M) 0.026ms
+ "[gc", "] Test GC ", "M) ", "ms",
+ NULL
+ };
+ EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected));
+}
+
+TEST_VM_F(GCTraceTimeTest, no_heap_no_cause) {
+ set_log_config(TestLogFileName, "gc=debug,gc+start=debug");
+
+ LogTarget(Debug, gc) gc_debug;
+ LogTarget(Debug, gc, start) gc_start_debug;
+
+ EXPECT_TRUE(gc_debug.is_enabled());
+ EXPECT_TRUE(gc_start_debug.is_enabled());
+
+ {
+ GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_no_gc, false);
+ }
+
+ const char* expected[] = {
+ // [2.975s][debug][gc,start] Test GC
+ "[gc,start", "] Test GC",
+ // [2.975s][debug][gc ] Test GC 0.026ms
+ "[gc", "] Test GC ", "ms",
+ NULL
+ };
+ EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected));
+
+ const char* not_expected[] = {
+ // [2.975s][debug][gc ] Test GC 59M->59M(502M) 0.026ms
+ "[gc", "] Test GC ", "M) ", "ms",
+ };
+ EXPECT_FALSE(file_contains_substrings_in_order(TestLogFileName, not_expected));
+}
diff --git a/hotspot/test/native/logging/test_log.cpp b/hotspot/test/native/logging/test_log.cpp
new file mode 100644
index 00000000000..50a5c9ce724
--- /dev/null
+++ b/hotspot/test/native/logging/test_log.cpp
@@ -0,0 +1,158 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "gc/shared/gcTraceTime.inline.hpp"
+#include "logTestFixture.hpp"
+#include "logTestUtils.inline.hpp"
+#include "logging/log.hpp"
+#include "unittest.hpp"
+
+class LogTest : public LogTestFixture {
+};
+
+#define LOG_PREFIX_STR "THE_PREFIX "
+#define LOG_LINE_STR "a log line"
+
+size_t Test_log_prefix_prefixer(char* buf, size_t len) {
+ int ret = jio_snprintf(buf, len, LOG_PREFIX_STR);
+ assert(ret > 0, "Failed to print prefix. Log buffer too small?");
+ return (size_t) ret;
+}
+
+#ifdef ASSERT // 'test' tag is debug only
+TEST_F(LogTest, prefix) {
+ set_log_config(TestLogFileName, "logging+test=trace");
+ log_trace(logging, test)(LOG_LINE_STR);
+ EXPECT_TRUE(file_contains_substring(TestLogFileName, LOG_PREFIX_STR LOG_LINE_STR));
+}
+#endif
+
+TEST_F(LogTest, large_message) {
+ char big_msg[4096] = {0};
+ char Xchar = '~';
+
+ set_log_config(TestLogFileName, "logging=trace");
+
+ memset(big_msg, Xchar, sizeof(big_msg) - 1);
+ log_trace(logging)("%s", big_msg);
+
+ ResourceMark rm;
+ FILE* fp = fopen(TestLogFileName, "r");
+ ASSERT_NE((void*)NULL, fp);
+ char* output = read_line(fp);
+ fclose(fp);
+
+ size_t count = 0;
+ for (size_t ps = 0 ; output[ps + count] != '\0'; output[ps + count] == Xchar ? count++ : ps++);
+ EXPECT_EQ(sizeof(big_msg) - 1, count);
+}
+
+TEST_F(LogTest, enabled_logtarget) {
+ set_log_config(TestLogFileName, "gc=debug");
+
+ LogTarget(Debug, gc) log;
+ EXPECT_TRUE(log.is_enabled());
+
+ // Log the line and expect it to be available in the output file.
+ log.print(LOG_TEST_STRING_LITERAL);
+
+ EXPECT_TRUE(file_contains_substring(TestLogFileName, LOG_TEST_STRING_LITERAL));
+}
+
+TEST_F(LogTest, disabled_logtarget) {
+ set_log_config(TestLogFileName, "gc=info");
+
+ LogTarget(Debug, gc) log;
+ EXPECT_FALSE(log.is_enabled());
+
+ // Try to log, but expect this to be filtered out.
+ log.print(LOG_TEST_STRING_LITERAL);
+
+ // Log a dummy line so that fgets doesn't return NULL because the file is empty.
+ log_info(gc)("Dummy line");
+
+ EXPECT_FALSE(file_contains_substring(TestLogFileName, LOG_TEST_STRING_LITERAL));
+}
+
+TEST_F(LogTest, enabled_loghandle) {
+ set_log_config(TestLogFileName, "gc=debug");
+
+ Log(gc) log;
+ LogHandle log_handle(log);
+
+ EXPECT_TRUE(log_handle.is_debug());
+
+ // Try to log through a LogHandle.
+ log_handle.debug("%d workers", 3);
+
+ EXPECT_TRUE(file_contains_substring(TestLogFileName, "3 workers"));
+}
+
+TEST_F(LogTest, disabled_loghandle) {
+ set_log_config(TestLogFileName, "gc=info");
+
+ Log(gc) log;
+ LogHandle log_handle(log);
+
+ EXPECT_FALSE(log_handle.is_debug());
+
+ // Try to log through a LogHandle.
+ log_handle.debug("%d workers", 3);
+
+ // Log a dummy line so that fgets doesn't return NULL because the file is empty.
+ log_info(gc)("Dummy line");
+
+ EXPECT_FALSE(file_contains_substring(TestLogFileName, "3 workers"));
+}
+
+TEST_F(LogTest, enabled_logtargethandle) {
+ set_log_config(TestLogFileName, "gc=debug");
+
+ LogTarget(Debug, gc) log;
+ LogTargetHandle log_handle(log);
+
+ EXPECT_TRUE(log_handle.is_enabled());
+
+ // Try to log through a LogHandle.
+ log_handle.print("%d workers", 3);
+
+ EXPECT_TRUE(file_contains_substring(TestLogFileName, "3 workers"));
+}
+
+TEST_F(LogTest, disabled_logtargethandle) {
+ set_log_config(TestLogFileName, "gc=info");
+
+ LogTarget(Debug, gc) log;
+ LogTargetHandle log_handle(log);
+
+ EXPECT_FALSE(log_handle.is_enabled());
+
+ // Try to log through a LogHandle.
+ log_handle.print("%d workers", 3);
+
+ // Log a dummy line so that fgets doesn't return NULL because the file is empty.
+ log_info(gc)("Dummy line");
+
+ EXPECT_FALSE(file_contains_substring(TestLogFileName, "3 workers"));
+}
diff --git a/hotspot/test/native/logging/test_logConfiguration.cpp b/hotspot/test/native/logging/test_logConfiguration.cpp
index a5e52ca80ca..cba192a6d3e 100644
--- a/hotspot/test/native/logging/test_logConfiguration.cpp
+++ b/hotspot/test/native/logging/test_logConfiguration.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logTestFixture.hpp"
#include "logTestUtils.inline.hpp"
@@ -61,7 +61,7 @@ static bool is_described(const char* text) {
return string_contains_substring(ss.as_string(), text);
}
-TEST_F(LogConfigurationTest, describe) {
+TEST_VM_F(LogConfigurationTest, describe) {
ResourceMark rm;
stringStream ss;
LogConfiguration::describe(&ss);
@@ -115,7 +115,7 @@ TEST_F(LogConfigurationTest, describe) {
}
// Test updating an existing log output
-TEST_F(LogConfigurationTest, update_output) {
+TEST_VM_F(LogConfigurationTest, update_output) {
// Update stdout twice, first using it's name, and the second time its index #
const char* test_outputs[] = { "stdout", "#0" };
for (size_t i = 0; i < ARRAY_SIZE(test_outputs); i++) {
@@ -144,7 +144,7 @@ TEST_F(LogConfigurationTest, update_output) {
}
// Test adding a new output to the configuration
-TEST_F(LogConfigurationTest, add_new_output) {
+TEST_VM_F(LogConfigurationTest, add_new_output) {
const char* what = "all=trace";
ASSERT_FALSE(is_described(TestLogFileName));
@@ -160,7 +160,7 @@ TEST_F(LogConfigurationTest, add_new_output) {
}
}
-TEST_F(LogConfigurationTest, disable_logging) {
+TEST_VM_F(LogConfigurationTest, disable_logging) {
// Add TestLogFileName as an output
set_log_config(TestLogFileName, "logging=info");
@@ -185,7 +185,7 @@ TEST_F(LogConfigurationTest, disable_logging) {
}
// Test disabling a particular output
-TEST_F(LogConfigurationTest, disable_output) {
+TEST_VM_F(LogConfigurationTest, disable_output) {
// Disable the default configuration for stdout
set_log_config("stdout", "all=off");
@@ -213,7 +213,7 @@ TEST_F(LogConfigurationTest, disable_output) {
}
// Test reconfiguration of the selected decorators for an output
-TEST_F(LogConfigurationTest, reconfigure_decorators) {
+TEST_VM_F(LogConfigurationTest, reconfigure_decorators) {
// Configure stderr with all decorators
set_log_config("stderr", "all=off", _all_decorators);
char buf[256];
@@ -227,7 +227,7 @@ TEST_F(LogConfigurationTest, reconfigure_decorators) {
}
// Test that invalid options cause configuration errors
-TEST_F(LogConfigurationTest, invalid_configure_options) {
+TEST_VM_F(LogConfigurationTest, invalid_configure_options) {
LogConfiguration::disable_logging();
const char* invalid_outputs[] = { "#2", "invalidtype=123", ":invalid/path}to*file?" };
for (size_t i = 0; i < ARRAY_SIZE(invalid_outputs); i++) {
@@ -240,7 +240,7 @@ TEST_F(LogConfigurationTest, invalid_configure_options) {
}
// Test empty configuration options
-TEST_F(LogConfigurationTest, parse_empty_command_line_arguments) {
+TEST_VM_F(LogConfigurationTest, parse_empty_command_line_arguments) {
const char* empty_variations[] = { "", ":", "::", ":::", "::::" };
for (size_t i = 0; i < ARRAY_SIZE(empty_variations); i++) {
const char* cmdline = empty_variations[i];
@@ -253,7 +253,7 @@ TEST_F(LogConfigurationTest, parse_empty_command_line_arguments) {
}
// Test basic command line parsing & configuration
-TEST_F(LogConfigurationTest, parse_command_line_arguments) {
+TEST_VM_F(LogConfigurationTest, parse_command_line_arguments) {
// Prepare a command line for logging*=debug on stderr with all decorators
int ret;
char buf[256];
@@ -273,7 +273,7 @@ TEST_F(LogConfigurationTest, parse_command_line_arguments) {
}
// Test split up log configuration arguments
-TEST_F(LogConfigurationTest, parse_log_arguments) {
+TEST_VM_F(LogConfigurationTest, parse_log_arguments) {
ResourceMark rm;
stringStream ss;
// Verify that it's possible to configure each individual tag
@@ -296,7 +296,82 @@ TEST_F(LogConfigurationTest, parse_log_arguments) {
}
}
-TEST_F(LogConfigurationTest, parse_invalid_tagset) {
+TEST_F(LogConfigurationTest, configure_stdout) {
+ // Start out with all logging disabled
+ LogConfiguration::disable_logging();
+
+ // Enable 'logging=info', verifying it has been set
+ LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(logging));
+ EXPECT_TRUE(log_is_enabled(Info, logging));
+ EXPECT_FALSE(log_is_enabled(Debug, logging));
+ EXPECT_FALSE(log_is_enabled(Info, gc));
+ LogTagSet* logging_ts = &LogTagSetMapping::tagset();
+ EXPECT_EQ(LogLevel::Info, logging_ts->level_for(LogOutput::Stdout));
+
+ // Enable 'gc=debug' (no wildcard), verifying no other tags are enabled
+ LogConfiguration::configure_stdout(LogLevel::Debug, true, LOG_TAGS(gc));
+ EXPECT_TRUE(log_is_enabled(Debug, gc));
+ EXPECT_TRUE(log_is_enabled(Info, logging));
+ EXPECT_FALSE(log_is_enabled(Debug, gc, heap));
+ for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+ if (ts->contains(PREFIX_LOG_TAG(gc))) {
+ if (ts->ntags() == 1) {
+ EXPECT_EQ(LogLevel::Debug, ts->level_for(LogOutput::Stdout));
+ } else {
+ EXPECT_EQ(LogLevel::Off, ts->level_for(LogOutput::Stdout));
+ }
+ }
+ }
+
+ // Enable 'gc*=trace' (with wildcard), verifying that all tag combinations with gc are enabled (gc+...)
+ LogConfiguration::configure_stdout(LogLevel::Trace, false, LOG_TAGS(gc));
+ EXPECT_TRUE(log_is_enabled(Trace, gc));
+ EXPECT_TRUE(log_is_enabled(Trace, gc, heap));
+ for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+ if (ts->contains(PREFIX_LOG_TAG(gc))) {
+ EXPECT_EQ(LogLevel::Trace, ts->level_for(LogOutput::Stdout));
+ } else if (ts == logging_ts) {
+ // Previous setting for 'logging' should remain
+ EXPECT_EQ(LogLevel::Info, ts->level_for(LogOutput::Stdout));
+ } else {
+ EXPECT_EQ(LogLevel::Off, ts->level_for(LogOutput::Stdout));
+ }
+ }
+
+ // Disable 'gc*' and 'logging', verifying all logging is properly disabled
+ LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(logging));
+ EXPECT_FALSE(log_is_enabled(Error, logging));
+ LogConfiguration::configure_stdout(LogLevel::Off, false, LOG_TAGS(gc));
+ EXPECT_FALSE(log_is_enabled(Error, gc));
+ EXPECT_FALSE(log_is_enabled(Error, gc, heap));
+ for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+ EXPECT_EQ(LogLevel::Off, ts->level_for(LogOutput::Stdout));
+ }
+}
+
+static int Test_logconfiguration_subscribe_triggered = 0;
+static void Test_logconfiguration_subscribe_helper() {
+ Test_logconfiguration_subscribe_triggered++;
+}
+
+TEST_F(LogConfigurationTest, subscribe) {
+ ResourceMark rm;
+ Log(logging) log;
+ set_log_config("stdout", "logging*=trace");
+
+ LogConfiguration::register_update_listener(&Test_logconfiguration_subscribe_helper);
+
+ LogConfiguration::parse_log_arguments("stdout", "logging=trace", NULL, NULL, log.error_stream());
+ ASSERT_EQ(1, Test_logconfiguration_subscribe_triggered);
+
+ LogConfiguration::configure_stdout(LogLevel::Debug, true, LOG_TAGS(gc));
+ ASSERT_EQ(2, Test_logconfiguration_subscribe_triggered);
+
+ LogConfiguration::disable_logging();
+ ASSERT_EQ(3, Test_logconfiguration_subscribe_triggered);
+}
+
+TEST_VM_F(LogConfigurationTest, parse_invalid_tagset) {
static const char* invalid_tagset = "logging+start+exit+safepoint+gc"; // Must not exist for test to function.
// Make sure warning is produced if one or more configured tagsets are invalid
@@ -309,7 +384,7 @@ TEST_F(LogConfigurationTest, parse_invalid_tagset) {
EXPECT_TRUE(string_contains_substring(msg, invalid_tagset));
}
-TEST_F(LogConfigurationTest, output_name_normalization) {
+TEST_VM_F(LogConfigurationTest, output_name_normalization) {
const char* patterns[] = { "%s", "file=%s", "\"%s\"", "file=\"%s\"" };
char buf[1 * K];
for (size_t i = 0; i < ARRAY_SIZE(patterns); i++) {
diff --git a/hotspot/test/native/logging/test_logDecorations.cpp b/hotspot/test/native/logging/test_logDecorations.cpp
index c23fb1b8227..3894c655412 100644
--- a/hotspot/test/native/logging/test_logDecorations.cpp
+++ b/hotspot/test/native/logging/test_logDecorations.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logging/logDecorations.hpp"
#include "logging/logTagSet.hpp"
@@ -31,7 +31,7 @@
static const LogTagSet& tagset = LogTagSetMapping::tagset();
static const LogDecorators default_decorators;
-TEST(LogDecorations, level) {
+TEST_VM(LogDecorations, level) {
for (uint l = LogLevel::First; l <= LogLevel::Last; l++) {
LogLevelType level = static_cast(l);
// Create a decorations object for the current level
@@ -52,7 +52,7 @@ TEST(LogDecorations, level) {
}
}
-TEST(LogDecorations, uptime) {
+TEST_VM(LogDecorations, uptime) {
// Verify the format of the decoration
int a, b;
char decimal_point;
@@ -73,7 +73,7 @@ TEST(LogDecorations, uptime) {
}
}
-TEST(LogDecorations, tags) {
+TEST_VM(LogDecorations, tags) {
char expected_tags[1 * K];
tagset.label(expected_tags, sizeof(expected_tags));
// Verify that the expected tags are included in the tags decoration
@@ -82,7 +82,7 @@ TEST(LogDecorations, tags) {
}
// Test each variation of the different timestamp decorations (ms, ns, uptime ms, uptime ns)
-TEST(LogDecorations, timestamps) {
+TEST_VM(LogDecorations, timestamps) {
struct {
const LogDecorators::Decorator decorator;
const char* suffix;
diff --git a/hotspot/test/native/logging/test_logDecorators.cpp b/hotspot/test/native/logging/test_logDecorators.cpp
index beaa925e320..3d392225857 100644
--- a/hotspot/test/native/logging/test_logDecorators.cpp
+++ b/hotspot/test/native/logging/test_logDecorators.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logging/logDecorators.hpp"
#include "unittest.hpp"
diff --git a/hotspot/test/native/logging/test_logFileOutput.cpp b/hotspot/test/native/logging/test_logFileOutput.cpp
index b561048e7a5..f3e8937157b 100644
--- a/hotspot/test/native/logging/test_logFileOutput.cpp
+++ b/hotspot/test/native/logging/test_logFileOutput.cpp
@@ -19,9 +19,10 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
+#include "logTestUtils.inline.hpp"
#include "logging/logFileOutput.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/os.hpp"
@@ -32,7 +33,7 @@
static const char* name = "file=testlog.pid%p.%t.log";
// Test parsing a bunch of valid file output options
-TEST(LogFileOutput, parse_valid) {
+TEST_VM(LogFileOutput, parse_valid) {
const char* valid_options[] = {
"", "filecount=10", "filesize=512",
"filecount=11,filesize=256",
@@ -64,7 +65,7 @@ TEST(LogFileOutput, parse_valid) {
}
// Test parsing a bunch of invalid file output options
-TEST(LogFileOutput, parse_invalid) {
+TEST_VM(LogFileOutput, parse_invalid) {
const char* invalid_options[] = {
"invalidopt", "filecount=",
"filesize=,filecount=10",
@@ -91,7 +92,7 @@ TEST(LogFileOutput, parse_invalid) {
}
// Test for overflows with filesize
-TEST(LogFileOutput, filesize_overflow) {
+TEST_VM(LogFileOutput, filesize_overflow) {
char buf[256];
int ret = jio_snprintf(buf, sizeof(buf), "filesize=" SIZE_FORMAT "K", SIZE_MAX);
ASSERT_GT(ret, 0) << "Buffer too small";
@@ -101,3 +102,82 @@ TEST(LogFileOutput, filesize_overflow) {
LogFileOutput fo(name);
EXPECT_FALSE(fo.initialize(buf, &ss)) << "Accepted filesize that overflows";
}
+
+TEST(LogFileOutput, startup_rotation) {
+ const size_t rotations = 5;
+ const char* filename = "start-rotate-test";
+ char* rotated_file[rotations];
+
+ ResourceMark rm;
+ for (size_t i = 0; i < rotations; i++) {
+ size_t len = strlen(filename) + 3;
+ rotated_file[i] = NEW_RESOURCE_ARRAY(char, len);
+ int ret = jio_snprintf(rotated_file[i], len, "%s." SIZE_FORMAT, filename, i);
+ ASSERT_NE(-1, ret);
+ delete_file(rotated_file[i]);
+ }
+
+ delete_file(filename);
+ init_log_file(filename);
+ ASSERT_TRUE(file_exists(filename))
+ << "configured logging to file '" << filename << "' but file was not found";
+
+ // Initialize the same file a bunch more times to trigger rotations
+ for (size_t i = 0; i < rotations; i++) {
+ init_log_file(filename);
+ EXPECT_TRUE(file_exists(rotated_file[i]));
+ }
+
+ // Remove a file and expect its slot to be re-used
+ delete_file(rotated_file[1]);
+ init_log_file(filename);
+ EXPECT_TRUE(file_exists(rotated_file[1]));
+
+ // Clean up after test
+ delete_file(filename);
+ for (size_t i = 0; i < rotations; i++) {
+ delete_file(rotated_file[i]);
+ }
+}
+
+TEST(LogFileOutput, startup_truncation) {
+ const char* filename = "start-truncate-test";
+ const char* archived_filename = "start-truncate-test.0";
+
+ delete_file(filename);
+ delete_file(archived_filename);
+
+ // Use the same log file twice and expect it to be overwritten/truncated
+ init_log_file(filename, "filecount=0");
+ ASSERT_TRUE(file_exists(filename))
+ << "configured logging to file '" << filename << "' but file was not found";
+
+ init_log_file(filename, "filecount=0");
+ ASSERT_TRUE(file_exists(filename))
+ << "configured logging to file '" << filename << "' but file was not found";
+ EXPECT_FALSE(file_exists(archived_filename))
+ << "existing log file was not properly truncated when filecount was 0";
+
+ // Verify that the file was really truncated and not just appended
+ EXPECT_TRUE(file_contains_substring(filename, LOG_TEST_STRING_LITERAL));
+ const char* repeated[] = { LOG_TEST_STRING_LITERAL, LOG_TEST_STRING_LITERAL };
+ EXPECT_FALSE(file_contains_substrings_in_order(filename, repeated))
+ << "log file " << filename << " appended rather than truncated";
+
+ delete_file(filename);
+ delete_file(archived_filename);
+}
+
+TEST(LogFileOutput, invalid_file) {
+ ResourceMark rm;
+ stringStream ss;
+
+ // Attempt to log to a directory (existing log not a regular file)
+ create_directory("tmplogdir");
+ LogFileOutput bad_file("file=tmplogdir");
+ EXPECT_FALSE(bad_file.initialize("", &ss))
+ << "file was initialized when there was an existing directory with the same name";
+ EXPECT_TRUE(string_contains_substring(ss.as_string(), "tmplogdir is not a regular file"))
+ << "missing expected error message, received msg: %s" << ss.as_string();
+ remove("tmplogdir");
+}
diff --git a/hotspot/test/native/logging/test_logLevel.cpp b/hotspot/test/native/logging/test_logLevel.cpp
index 00004bb334d..07f0a398e8c 100644
--- a/hotspot/test/native/logging/test_logLevel.cpp
+++ b/hotspot/test/native/logging/test_logLevel.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logging/logLevel.hpp"
#include "unittest.hpp"
diff --git a/hotspot/test/native/logging/test_logMessageTest.cpp b/hotspot/test/native/logging/test_logMessageTest.cpp
new file mode 100644
index 00000000000..cf7c4ce51bd
--- /dev/null
+++ b/hotspot/test/native/logging/test_logMessageTest.cpp
@@ -0,0 +1,252 @@
+/*
+ * 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.
+ *
+ * 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
+ * ac_heapanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logTestFixture.hpp"
+#include "logTestUtils.inline.hpp"
+#include "logging/log.hpp"
+#include "logging/logMessage.hpp"
+#include "unittest.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+class LogMessageTest : public LogTestFixture {
+protected:
+ static Log(logging) _log;
+ static const char* _level_filename[];
+ LogMessageTest();
+ ~LogMessageTest();
+};
+
+const char* LogMessageTest::_level_filename[] = {
+ NULL, // LogLevel::Off
+#define LOG_LEVEL(name, printname) "multiline-" #printname ".log",
+ LOG_LEVEL_LIST
+#undef LOG_LEVEL
+};
+
+LogMessageTest::LogMessageTest() {
+ for (int i = 0; i < LogLevel::Count; i++) {
+ char buf[32];
+ // Attempt to remove possibly pre-existing log files
+ remove(_level_filename[i]);
+
+ jio_snprintf(buf, sizeof(buf), "logging=%s", LogLevel::name(static_cast(i)));
+ set_log_config(_level_filename[i], buf);
+ }
+}
+
+LogMessageTest::~LogMessageTest() {
+ // Stop logging to the files and remove them.
+ for (int i = 0; i < LogLevel::Count; i++) {
+ set_log_config(_level_filename[i], "all=off");
+ remove(_level_filename[i]);
+ }
+}
+
+// Verify that messages with multiple levels are written
+// to outputs configured for all the corresponding levels
+TEST_F(LogMessageTest, level_inclusion) {
+ const size_t message_count = 10;
+ LogMessageBuffer msg[message_count];
+
+ struct {
+ int message_number;
+ LogLevelType level;
+ } lines[] = {
+ { 0, LogLevel::Error },
+ { 1, LogLevel::Info },
+ { 2, LogLevel::Info }, { 2, LogLevel::Debug },
+ { 3, LogLevel::Info }, { 3, LogLevel::Warning },
+ { 4, LogLevel::Debug }, { 4, LogLevel::Warning },
+ { 5, LogLevel::Trace }, { 5, LogLevel::Debug },
+ { 6, LogLevel::Warning }, { 6, LogLevel::Error },
+ { 7, LogLevel::Trace }, { 7, LogLevel::Info }, { 7, LogLevel::Debug },
+ { 8, LogLevel::Trace }, { 8, LogLevel::Debug }, { 8, LogLevel::Info },
+ { 8, LogLevel::Warning }, { 8, LogLevel::Error},
+ { 9, LogLevel::Trace }
+ };
+
+ // Fill in messages with the above lines
+ for (size_t i = 0; i < ARRAY_SIZE(lines); i++) {
+ switch (lines[i].level) {
+#define LOG_LEVEL(name, printname) \
+ case LogLevel::name: \
+ msg[lines[i].message_number].printname("msg[%d]: " #printname, lines[i].message_number); \
+ break;
+LOG_LEVEL_LIST
+#undef LOG_LEVEL
+ }
+ }
+
+ for (size_t i = 0; i < message_count; i++) {
+ _log.write(msg[i]);
+ }
+
+ // Verify that lines are written to the expected log files
+ for (size_t i = 0; i < ARRAY_SIZE(lines); i++) {
+ char expected[256];
+ jio_snprintf(expected, sizeof(expected), "msg[%d]: %s",
+ lines[i].message_number, LogLevel::name(lines[i].level));
+ for (int level = lines[i].level; level > 0; level--) {
+ EXPECT_TRUE(file_contains_substring(_level_filename[level], expected))
+ << "line #" << i << " missing from log file " << _level_filename[level];
+ }
+ for (int level = lines[i].level + 1; level < LogLevel::Count; level++) {
+ EXPECT_FALSE(file_contains_substring(_level_filename[level], expected))
+ << "line #" << i << " erroneously included in log file " << _level_filename[level];
+ }
+ }
+}
+
+// Verify that messages are logged in the order they are added to the log message
+TEST_F(LogMessageTest, line_order) {
+ LogMessageBuffer msg;
+ msg.info("info line").error("error line").trace("trace line")
+ .error("another error").warning("warning line").debug("debug line");
+ _log.write(msg);
+
+ const char* expected[] = { "info line", "error line", "trace line",
+ "another error", "warning line", "debug line", NULL };
+ EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected))
+ << "output missing or in incorrect order";
+}
+
+TEST_F(LogMessageTest, long_message) {
+ // Write 10K bytes worth of log data
+ LogMessageBuffer msg;
+ const size_t size = 10 * K;
+ const char* start_marker = "#start#";
+ const char* end_marker = "#the end#";
+ char* data = NEW_C_HEAP_ARRAY(char, size, mtLogging);
+
+ // fill buffer with start_marker...some data...end_marker
+ sprintf(data, "%s", start_marker);
+ for (size_t i = strlen(start_marker); i < size; i++) {
+ data[i] = '0' + (i % 10);
+ }
+ sprintf(data + size - strlen(end_marker) - 1, "%s", end_marker);
+
+ msg.trace("%s", data); // Adds a newline, making the message exactly 10K in length.
+ _log.write(msg);
+
+ const char* expected[] = { start_marker, "0123456789", end_marker, NULL };
+ EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected))
+ << "unable to print long line";
+ FREE_C_HEAP_ARRAY(char, data);
+}
+
+TEST_F(LogMessageTest, message_with_many_lines) {
+ const size_t lines = 100;
+ const size_t line_length = 16;
+
+ LogMessageBuffer msg;
+ for (size_t i = 0; i < lines; i++) {
+ msg.info("Line #" SIZE_FORMAT, i);
+ }
+ _log.write(msg);
+
+ char expected_lines_data[lines][line_length];
+ const char* expected_lines[lines + 1];
+ for (size_t i = 0; i < lines; i++) {
+ jio_snprintf(&expected_lines_data[i][0], line_length, "Line #" SIZE_FORMAT, i);
+ expected_lines[i] = expected_lines_data[i];
+ }
+ expected_lines[lines] = NULL;
+
+ EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected_lines))
+ << "couldn't find all lines in multiline message";
+}
+
+static size_t dummy_prefixer(char* buf, size_t len) {
+ static int i = 0;
+ const char* prefix = "some prefix: ";
+ const size_t prefix_len = strlen(prefix);
+ if (len < prefix_len) {
+ return prefix_len;
+ }
+ jio_snprintf(buf, len, "%s", prefix);
+ return prefix_len;
+}
+
+TEST_F(LogMessageTest, prefixing) {
+ LogMessageBuffer msg;
+ msg.set_prefix(dummy_prefixer);
+ for (int i = 0; i < 3; i++) {
+ msg.info("test %d", i);
+ }
+ msg.set_prefix(NULL);
+ msg.info("test 3");
+ _log.write(msg);
+
+ const char* expected[] = {
+ "] some prefix: test 0",
+ "] some prefix: test 1",
+ "] some prefix: test 2",
+ "] test 3",
+ NULL
+ };
+ EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected))
+ << "error in prefixed output";
+}
+
+TEST_F(LogMessageTest, scoped_messages) {
+ {
+ LogMessage(logging) msg;
+ msg.info("scoped info");
+ msg.warning("scoped warn");
+ EXPECT_FALSE(file_contains_substring(_level_filename[LogLevel::Info], "scoped info"))
+ << "scoped log message written prematurely";
+ }
+ EXPECT_TRUE(file_contains_substring(_level_filename[LogLevel::Info], "scoped info"))
+ << "missing output from scoped log message";
+ EXPECT_TRUE(file_contains_substring(_level_filename[LogLevel::Warning], "scoped warn"))
+ << "missing output from scoped log message";
+}
+
+TEST_F(LogMessageTest, scoped_flushing) {
+ {
+ LogMessage(logging) msg;
+ msg.info("manual flush info");
+ msg.flush();
+ EXPECT_TRUE(file_contains_substring(_level_filename[LogLevel::Info], "manual flush info"))
+ << "missing output from manually flushed scoped log message";
+ }
+ const char* tmp[] = {"manual flush info", "manual flush info", NULL};
+ EXPECT_FALSE(file_contains_substrings_in_order(_level_filename[LogLevel::Info], tmp))
+ << "log file contains duplicate lines from single scoped log message";
+}
+
+TEST_F(LogMessageTest, scoped_reset) {
+ {
+ LogMessage(logging) msg, partial;
+ msg.info("%s", "info reset msg");
+ msg.reset();
+ partial.info("%s", "info reset msg");
+ partial.reset();
+ partial.trace("%s", "trace reset msg");
+ }
+ EXPECT_FALSE(file_contains_substring(_level_filename[LogLevel::Info], "info reset msg"))
+ << "reset message written anyway";
+ EXPECT_TRUE(file_contains_substring(_level_filename[LogLevel::Trace], "trace reset msg"))
+ << "missing message from partially reset scoped log message";
+}
diff --git a/hotspot/test/native/logging/test_logOutputList.cpp b/hotspot/test/native/logging/test_logOutputList.cpp
index d5853526d89..75ba599e3f8 100644
--- a/hotspot/test/native/logging/test_logOutputList.cpp
+++ b/hotspot/test/native/logging/test_logOutputList.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logging/logLevel.hpp"
#include "logging/logOutput.hpp"
diff --git a/hotspot/test/native/logging/test_logStream.cpp b/hotspot/test/native/logging/test_logStream.cpp
new file mode 100644
index 00000000000..b02839c7ff9
--- /dev/null
+++ b/hotspot/test/native/logging/test_logStream.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logTestFixture.hpp"
+#include "logTestUtils.inline.hpp"
+#include "logging/log.hpp"
+#include "logging/logStream.hpp"
+#include "unittest.hpp"
+
+class LogStreamTest : public LogTestFixture {
+ protected:
+ void verify_stream(outputStream* stream);
+};
+
+void LogStreamTest::verify_stream(outputStream* stream) {
+ set_log_config(TestLogFileName, "gc=debug");
+ stream->print("%d ", 3);
+ stream->print("workers");
+ stream->cr();
+ EXPECT_TRUE(file_contains_substring(TestLogFileName, "3 workers\n"));
+}
+
+TEST_F(LogStreamTest, from_log) {
+ Log(gc) log;
+ LogStream stream(log.debug());
+
+ verify_stream(&stream);
+}
+
+TEST_F(LogStreamTest, from_logtarget) {
+ LogTarget(Debug, gc) log;
+ LogStream stream(log);
+
+ verify_stream(&stream);
+}
+
+TEST_F(LogStreamTest, handle) {
+ LogStreamHandle(Debug, gc) stream;
+
+ verify_stream(&stream);
+}
+
+TEST_F(LogStreamTest, no_rm) {
+ ResourceMark rm;
+ outputStream* stream = LogTarget(Debug, gc)::stream();
+
+ verify_stream(stream);
+}
+
+TEST_F(LogStreamTest, c_heap_stream) {
+ Log(gc) log;
+ LogStreamCHeap stream(log.debug());
+
+ verify_stream(&stream);
+}
+
+TEST_F(LogStreamTest, c_heap_stream_target) {
+ LogTarget(Debug, gc) log;
+ LogStreamCHeap stream(log);
+
+ verify_stream(&stream);
+}
diff --git a/hotspot/test/native/logging/test_logTag.cpp b/hotspot/test/native/logging/test_logTag.cpp
index 3017a2da4fb..0acfbb24ef9 100644
--- a/hotspot/test/native/logging/test_logTag.cpp
+++ b/hotspot/test/native/logging/test_logTag.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logging/logTag.hpp"
#include "unittest.hpp"
diff --git a/hotspot/test/native/logging/test_logTagLevelExpression.cpp b/hotspot/test/native/logging/test_logTagLevelExpression.cpp
index 870c6af42db..72f649cc9c9 100644
--- a/hotspot/test/native/logging/test_logTagLevelExpression.cpp
+++ b/hotspot/test/native/logging/test_logTagLevelExpression.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logging/logLevel.hpp"
#include "logging/logTagLevelExpression.hpp"
@@ -28,6 +28,12 @@
#include "unittest.hpp"
#include "utilities/globalDefinitions.hpp"
+TEST(LogTagLevelExpression, combination_limit) {
+ size_t max_combinations = LogTagLevelExpression::MaxCombinations;
+ EXPECT_GT(max_combinations, LogTagSet::ntagsets())
+ << "Combination limit not sufficient for configuring all available tag sets";
+}
+
TEST(LogTagLevelExpression, parse) {
char buf[256];
const char* invalid_substr[] = {
diff --git a/hotspot/test/native/logging/test_logTagSet.cpp b/hotspot/test/native/logging/test_logTagSet.cpp
index 327a0afc9b2..b92ba93fcc0 100644
--- a/hotspot/test/native/logging/test_logTagSet.cpp
+++ b/hotspot/test/native/logging/test_logTagSet.cpp
@@ -10,7 +10,7 @@
* 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
- * ac_heapanied this code).
+ * 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,
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "logging/logLevel.hpp"
#include "logging/logOutput.hpp"
@@ -128,3 +128,46 @@ TEST(LogTagSet, label) {
ASSERT_NE(-1, ts2.label(buf, sizeof(buf)));
EXPECT_STREQ("logging", buf);
}
+
+TEST(LogTagSet, duplicates) {
+ for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+ char ts_name[512];
+ ts->label(ts_name, sizeof(ts_name), ",");
+
+ // verify that NO_TAG is never followed by a real tag
+ for (size_t i = 0; i < LogTag::MaxTags; i++) {
+ if (ts->tag(i) == LogTag::__NO_TAG) {
+ for (i++; i < LogTag::MaxTags; i++) {
+ EXPECT_EQ(LogTag::__NO_TAG, ts->tag(i))
+ << "NO_TAG was followed by a real tag (" << LogTag::name(ts->tag(i)) << ") in tagset " << ts_name;
+ }
+ }
+ }
+
+ // verify that there are no duplicate tagsets (same tags in different order)
+ for (LogTagSet* other = ts->next(); other != NULL; other = other->next()) {
+ if (ts->ntags() != other->ntags()) {
+ continue;
+ }
+ bool equal = true;
+ for (size_t i = 0; i < ts->ntags(); i++) {
+ LogTagType tag = ts->tag(i);
+ if (!other->contains(tag)) {
+ equal = false;
+ break;
+ }
+ }
+ // Since tagsets are implemented using template arguments, using both of
+ // the (logically equivalent) tagsets (t1, t2) and (t2, t1) somewhere will
+ // instantiate two different LogTagSetMappings. This causes multiple
+ // tagset instances to be created for the same logical set. We want to
+ // avoid this to save time, memory and prevent any confusion around it.
+ if (equal) {
+ char other_name[512];
+ other->label(other_name, sizeof(other_name), ",");
+ FAIL() << "duplicate LogTagSets found: '" << ts_name << "' vs '" << other_name << "' "
+ << "(tags must always be specified in the same order for each tagset)";
+ }
+ }
+ }
+}
diff --git a/hotspot/test/native/logging/test_logTagSetDescriptions.cpp b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp
new file mode 100644
index 00000000000..1669f86c34a
--- /dev/null
+++ b/hotspot/test/native/logging/test_logTagSetDescriptions.cpp
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ * 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
+ * ac_heapanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+#include "precompiled.hpp"
+#include "logTestUtils.inline.hpp"
+#include "logging/logConfiguration.hpp"
+#include "logging/logTagSet.hpp"
+#include "logging/logTagSetDescriptions.hpp"
+#include "memory/resourceArea.hpp"
+#include "unittest.hpp"
+#include "utilities/ostream.hpp"
+
+TEST(LogTagSetDescriptions, describe) {
+ for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
+ char expected[1 * K];
+ d->tagset->label(expected, sizeof(expected), "+");
+ jio_snprintf(expected + strlen(expected),
+ sizeof(expected) - strlen(expected),
+ ": %s", d->descr);
+
+ ResourceMark rm;
+ stringStream stream;
+ LogConfiguration::describe(&stream);
+ EXPECT_PRED2(string_contains_substring, stream.as_string(), expected)
+ << "missing log tag set descriptions in LogConfiguration::describe";
+ }
+}
+
+TEST(LogTagSetDescriptions, command_line_help) {
+ const char* filename = "logtagset_descriptions";
+ FILE* fp = fopen(filename, "w+");
+ ASSERT_NE((void*)NULL, fp);
+ LogConfiguration::print_command_line_help(fp);
+ fclose(fp);
+
+ for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
+ char expected[1 * K];
+ d->tagset->label(expected, sizeof(expected), "+");
+ jio_snprintf(expected + strlen(expected),
+ sizeof(expected) - strlen(expected),
+ ": %s", d->descr);
+
+ EXPECT_TRUE(file_contains_substring(filename, expected)) << "missing log tag set descriptions in -Xlog:help output";
+ }
+ delete_file(filename);
+}
diff --git a/hotspot/test/native/oops/test_arrayOop.cpp b/hotspot/test/native/oops/test_arrayOop.cpp
index 915ff34380f..84063813be3 100644
--- a/hotspot/test/native/oops/test_arrayOop.cpp
+++ b/hotspot/test/native/oops/test_arrayOop.cpp
@@ -43,47 +43,47 @@ static bool check_max_length_overflow(BasicType type) {
return (julong) (size_t) bytes == bytes;
}
-TEST(arrayOopDesc, boolean) {
+TEST_VM(arrayOopDesc, boolean) {
ASSERT_PRED1(check_max_length_overflow, T_BOOLEAN);
}
-TEST(arrayOopDesc, char) {
+TEST_VM(arrayOopDesc, char) {
ASSERT_PRED1(check_max_length_overflow, T_CHAR);
}
-TEST(arrayOopDesc, float) {
+TEST_VM(arrayOopDesc, float) {
ASSERT_PRED1(check_max_length_overflow, T_FLOAT);
}
-TEST(arrayOopDesc, double) {
+TEST_VM(arrayOopDesc, double) {
ASSERT_PRED1(check_max_length_overflow, T_DOUBLE);
}
-TEST(arrayOopDesc, byte) {
+TEST_VM(arrayOopDesc, byte) {
ASSERT_PRED1(check_max_length_overflow, T_BYTE);
}
-TEST(arrayOopDesc, short) {
+TEST_VM(arrayOopDesc, short) {
ASSERT_PRED1(check_max_length_overflow, T_SHORT);
}
-TEST(arrayOopDesc, int) {
+TEST_VM(arrayOopDesc, int) {
ASSERT_PRED1(check_max_length_overflow, T_INT);
}
-TEST(arrayOopDesc, long) {
+TEST_VM(arrayOopDesc, long) {
ASSERT_PRED1(check_max_length_overflow, T_LONG);
}
-TEST(arrayOopDesc, object) {
+TEST_VM(arrayOopDesc, object) {
ASSERT_PRED1(check_max_length_overflow, T_OBJECT);
}
-TEST(arrayOopDesc, array) {
+TEST_VM(arrayOopDesc, array) {
ASSERT_PRED1(check_max_length_overflow, T_ARRAY);
}
-TEST(arrayOopDesc, narrowOop) {
+TEST_VM(arrayOopDesc, narrowOop) {
ASSERT_PRED1(check_max_length_overflow, T_NARROWOOP);
}
// T_VOID and T_ADDRESS are not supported by max_array_length()
diff --git a/hotspot/test/native/runtime/test_arguments.cpp b/hotspot/test/native/runtime/test_arguments.cpp
index f4327f3498d..bd00e2bf331 100644
--- a/hotspot/test/native/runtime/test_arguments.cpp
+++ b/hotspot/test/native/runtime/test_arguments.cpp
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
+
#include "precompiled.hpp"
#include "runtime/arguments.hpp"
#include "unittest.hpp"
diff --git a/hotspot/test/native/runtime/test_classLoader.cpp b/hotspot/test/native/runtime/test_classLoader.cpp
index de37e59dbf5..630b43cbad9 100644
--- a/hotspot/test/native/runtime/test_classLoader.cpp
+++ b/hotspot/test/native/runtime/test_classLoader.cpp
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
#include "precompiled.hpp"
diff --git a/hotspot/test/native/runtime/test_globals.cpp b/hotspot/test/native/runtime/test_globals.cpp
index 3741b8edd8c..2b6a99771d2 100644
--- a/hotspot/test/native/runtime/test_globals.cpp
+++ b/hotspot/test/native/runtime/test_globals.cpp
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
#include "precompiled.hpp"
diff --git a/hotspot/test/native/runtime/test_os.cpp b/hotspot/test/native/runtime/test_os.cpp
index d73879f3d5d..94180b5e189 100644
--- a/hotspot/test/native/runtime/test_os.cpp
+++ b/hotspot/test/native/runtime/test_os.cpp
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
#include "precompiled.hpp"
diff --git a/hotspot/test/native/unittest.hpp b/hotspot/test/native/unittest.hpp
index 95ae7b9bb40..0494a0e2408 100644
--- a/hotspot/test/native/unittest.hpp
+++ b/hotspot/test/native/unittest.hpp
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
#ifndef UNITTEST_HPP
diff --git a/hotspot/test/native/utilities/test_bitMap_setops.cpp b/hotspot/test/native/utilities/test_bitMap_setops.cpp
index 45b6d79a444..d7448bbf3b9 100644
--- a/hotspot/test/native/utilities/test_bitMap_setops.cpp
+++ b/hotspot/test/native/utilities/test_bitMap_setops.cpp
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
#include "precompiled.hpp"
diff --git a/hotspot/test/native/utilities/test_json.cpp b/hotspot/test/native/utilities/test_json.cpp
index 6eb9c31696c..758ea8a8992 100644
--- a/hotspot/test/native/utilities/test_json.cpp
+++ b/hotspot/test/native/utilities/test_json.cpp
@@ -54,322 +54,322 @@ JSON_GTest::JSON_GTest(const char* text) : JSON(text, false, tty) {
parse();
}
-TEST(utilities, json_curly_braces) {
+TEST_VM(utilities, json_curly_braces) {
JSON_GTest::test("{}", true);
}
-TEST(utilities, json_brackets) {
+TEST_VM(utilities, json_brackets) {
JSON_GTest::test("[]", true);
}
-TEST(utilities, json_space_braces) {
+TEST_VM(utilities, json_space_braces) {
JSON_GTest::test(" { } ", true);
}
-TEST(utilities, json_space_bracketes) {
+TEST_VM(utilities, json_space_bracketes) {
JSON_GTest::test(" [ ] ", true);
}
-TEST(utilities, json_quoted_error) {
+TEST_VM(utilities, json_quoted_error) {
JSON_GTest::test("\"error\"", false);
}
-TEST(utilities, json_error_string) {
+TEST_VM(utilities, json_error_string) {
JSON_GTest::test("error", false);
}
-TEST(utilities, json_simple_integer) {
+TEST_VM(utilities, json_simple_integer) {
JSON_GTest::test("1", false);
}
-TEST(utilities, json_siple_float) {
+TEST_VM(utilities, json_siple_float) {
JSON_GTest::test("1.2", false);
}
-TEST(utilities, json_simple_boolean_true) {
+TEST_VM(utilities, json_simple_boolean_true) {
JSON_GTest::test("true", false);
}
-TEST(utilities, json_simple_boolean_false) {
+TEST_VM(utilities, json_simple_boolean_false) {
JSON_GTest::test("false", false);
}
-TEST(utilities, json_simple_null) {
+TEST_VM(utilities, json_simple_null) {
JSON_GTest::test("null", false);
}
-TEST(utilities, json_one_element_int_array) {
+TEST_VM(utilities, json_one_element_int_array) {
JSON_GTest::test("[ 1 ]", true);
}
-TEST(utilities, json_int_array) {
+TEST_VM(utilities, json_int_array) {
JSON_GTest::test("[ 1, ]", true);
}
-TEST(utilities, json_one_element_bool_array) {
+TEST_VM(utilities, json_one_element_bool_array) {
JSON_GTest::test("[ true ]", true);
}
-TEST(utilities, json_bool_array) {
+TEST_VM(utilities, json_bool_array) {
JSON_GTest::test("[ true, ]", true);
}
-TEST(utilities, json_one_element_false_array) {
+TEST_VM(utilities, json_one_element_false_array) {
JSON_GTest::test("[ false ]", true);
}
-TEST(utilities, json_false_bool_array) {
+TEST_VM(utilities, json_false_bool_array) {
JSON_GTest::test("[ false, ]", true);
}
-TEST(utilities, json_one_null_array) {
+TEST_VM(utilities, json_one_null_array) {
JSON_GTest::test("[ null ]", true);
}
-TEST(utilities, json_null_array) {
+TEST_VM(utilities, json_null_array) {
JSON_GTest::test("[ null, ]", true);
}
-TEST(utilities, json_one_empty_string_array) {
+TEST_VM(utilities, json_one_empty_string_array) {
JSON_GTest::test("[ \"\" ]", true);
}
-TEST(utilities, json_empty_string_array) {
+TEST_VM(utilities, json_empty_string_array) {
JSON_GTest::test("[ \"\", ]", true);
}
-TEST(utilities, json_single_string_array) {
+TEST_VM(utilities, json_single_string_array) {
JSON_GTest::test("[ \"elem1\" ]", true);
}
-TEST(utilities, json_string_comma_arrray) {
+TEST_VM(utilities, json_string_comma_arrray) {
JSON_GTest::test("[ \"elem1\", ]", true);
}
-TEST(utilities, json_two_strings_array) {
+TEST_VM(utilities, json_two_strings_array) {
JSON_GTest::test("[ \"elem1\", \"elem2\" ]", true);
}
-TEST(utilities, json_two_strings_comma_array) {
+TEST_VM(utilities, json_two_strings_comma_array) {
JSON_GTest::test("[ \"elem1\", \"elem2\", ]", true);
}
-TEST(utilities, json_curly_braces_outside) {
+TEST_VM(utilities, json_curly_braces_outside) {
JSON_GTest::test("[ \"elem1\" ] { }", false);
}
-TEST(utilities, json_element_in_array) {
+TEST_VM(utilities, json_element_in_array) {
JSON_GTest::test("[ elem1, \"elem2\" ]", false);
}
-TEST(utilities, json_incorrect_end_array) {
+TEST_VM(utilities, json_incorrect_end_array) {
JSON_GTest::test("[ \"elem1\"", false);
}
-TEST(utilities, json_incorrect_string_end) {
+TEST_VM(utilities, json_incorrect_string_end) {
JSON_GTest::test("[ \"elem1 ]", false);
}
-TEST(utilities, json_incorrect_end_of_two_elements_array) {
+TEST_VM(utilities, json_incorrect_end_of_two_elements_array) {
JSON_GTest::test("[ \"elem1\", \"elem2\"", false);
}
-TEST(utilities, json_incorrect_bool_true_array) {
+TEST_VM(utilities, json_incorrect_bool_true_array) {
JSON_GTest::test("[ truefoo ]", false);
}
-TEST(utilities, json_incorrect_bool_false_array) {
+TEST_VM(utilities, json_incorrect_bool_false_array) {
JSON_GTest::test("[ falsefoo ]", false);
}
-TEST(utilities, json_incorrect_null_array) {
+TEST_VM(utilities, json_incorrect_null_array) {
JSON_GTest::test("[ nullfoo ]", false);
}
-TEST(utilities, json_key_pair) {
+TEST_VM(utilities, json_key_pair) {
JSON_GTest::test("{ key : 1 }", true);
}
-TEST(utilities, json_key_pair_comma) {
+TEST_VM(utilities, json_key_pair_comma) {
JSON_GTest::test("{ key : 1, }", true);
}
-TEST(utilities, json_bool_true_key) {
+TEST_VM(utilities, json_bool_true_key) {
JSON_GTest::test("{ key : true }", true);
}
-TEST(utilities, json_bool_true_key_comma) {
+TEST_VM(utilities, json_bool_true_key_comma) {
JSON_GTest::test("{ key : true, }", true);
}
-TEST(utilities, json_bool_false_key) {
+TEST_VM(utilities, json_bool_false_key) {
JSON_GTest::test("{ key : false }", true);
}
-TEST(utilities, json_bool_false_key_comma) {
+TEST_VM(utilities, json_bool_false_key_comma) {
JSON_GTest::test("{ key : false, }", true);
}
-TEST(utilities, json_null_key) {
+TEST_VM(utilities, json_null_key) {
JSON_GTest::test("{ key : null }", true);
}
-TEST(utilities, json_null_key_comma) {
+TEST_VM(utilities, json_null_key_comma) {
JSON_GTest::test("{ key : null, }", true);
}
-TEST(utilities, json_pair_of_empty_strings) {
+TEST_VM(utilities, json_pair_of_empty_strings) {
JSON_GTest::test("{ \"\" : \"\" }", true);
}
-TEST(utilities, json_pair_of_empty_strings_comma) {
+TEST_VM(utilities, json_pair_of_empty_strings_comma) {
JSON_GTest::test("{ \"\" : \"\", }", true);
}
-TEST(utilities, json_pair_of_strings) {
+TEST_VM(utilities, json_pair_of_strings) {
JSON_GTest::test("{ \"key1\" : \"val1\" }", true);
}
-TEST(utilities, json_pair_of_strings_comma) {
+TEST_VM(utilities, json_pair_of_strings_comma) {
JSON_GTest::test("{ \"key1\" : \"val1\", }", true);
}
-TEST(utilities, json_two_pairs_of_strings) {
+TEST_VM(utilities, json_two_pairs_of_strings) {
JSON_GTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\" }", true);
}
-TEST(utilities, json_two_pairs_of_strings_comma) {
+TEST_VM(utilities, json_two_pairs_of_strings_comma) {
JSON_GTest::test("{ \"key1\" : \"val1\", \"key2\" : \"val2\", }", true);
}
-TEST(utilities, json_array_outside) {
+TEST_VM(utilities, json_array_outside) {
JSON_GTest::test("{ \"key\" : \"val\" } [ \"error\" ]", false);
}
-TEST(utilities, json_incorrect_object_end) {
+TEST_VM(utilities, json_incorrect_object_end) {
JSON_GTest::test("{ \"key\" : \"val\" ", false);
}
-TEST(utilities, json_empty_comment) {
+TEST_VM(utilities, json_empty_comment) {
JSON_GTest::test("/**/ { }", true);
}
-TEST(utilities, json_space_comment) {
+TEST_VM(utilities, json_space_comment) {
JSON_GTest::test("/* */ { }", true);
}
-TEST(utilities, json_comment) {
+TEST_VM(utilities, json_comment) {
JSON_GTest::test("/*foo*/ { }", true);
}
-TEST(utilities, json_star_comment) {
+TEST_VM(utilities, json_star_comment) {
JSON_GTest::test("/* *foo */ { }", true);
}
-TEST(utilities, json_stars_comment) {
+TEST_VM(utilities, json_stars_comment) {
JSON_GTest::test("/* *foo* */ { }", true);
}
-TEST(utilities, json_special_comment) {
+TEST_VM(utilities, json_special_comment) {
JSON_GTest::test("/* /*foo */ { }", true);
}
-TEST(utilities, json_comment_after) {
+TEST_VM(utilities, json_comment_after) {
JSON_GTest::test("{ } /* foo */", true);
}
-TEST(utilities, json_comment_after_and_space) {
+TEST_VM(utilities, json_comment_after_and_space) {
JSON_GTest::test("{ } /* foo */ ", true);
}
-TEST(utilities, json_one_line_empty_comment_after) {
+TEST_VM(utilities, json_one_line_empty_comment_after) {
JSON_GTest::test("{ } //", true);
}
-TEST(utilities, json_one_line_space_comment_after) {
+TEST_VM(utilities, json_one_line_space_comment_after) {
JSON_GTest::test("{ } // ", true);
}
-TEST(utilities, json_one_line_comment_after) {
+TEST_VM(utilities, json_one_line_comment_after) {
JSON_GTest::test("{ } // foo", true);
}
-TEST(utilities, json_incorrect_multiline_comment) {
+TEST_VM(utilities, json_incorrect_multiline_comment) {
JSON_GTest::test("/* * / { }", false);
}
-TEST(utilities, json_incorrect_multiline_comment_begin) {
+TEST_VM(utilities, json_incorrect_multiline_comment_begin) {
JSON_GTest::test("/ * */ { }", false);
}
-TEST(utilities, json_oneline_comment_only) {
+TEST_VM(utilities, json_oneline_comment_only) {
JSON_GTest::test("// { }", false);
}
-TEST(utilities, json_multiline_comment_only) {
+TEST_VM(utilities, json_multiline_comment_only) {
JSON_GTest::test("/* { } */", false);
}
-TEST(utilities, json_multiline_comment_2) {
+TEST_VM(utilities, json_multiline_comment_2) {
JSON_GTest::test("/* { } */ ", false);
}
-TEST(utilities, json_incorrectly_commented_object) {
+TEST_VM(utilities, json_incorrectly_commented_object) {
JSON_GTest::test("/* { } ", false);
}
-TEST(utilities, json_missing_multiline_end) {
+TEST_VM(utilities, json_missing_multiline_end) {
JSON_GTest::test("{ } /* ", false);
}
-TEST(utilities, json_missing_multiline_slash) {
+TEST_VM(utilities, json_missing_multiline_slash) {
JSON_GTest::test("/* { } *", false);
}
-TEST(utilities, json_commented_object_end) {
+TEST_VM(utilities, json_commented_object_end) {
JSON_GTest::test("{ /* } */", false);
}
-TEST(utilities, json_commented_array_end) {
+TEST_VM(utilities, json_commented_array_end) {
JSON_GTest::test("[ /* ] */", false);
}
-TEST(utilities, json_missing_object_end) {
+TEST_VM(utilities, json_missing_object_end) {
JSON_GTest::test("{ key : \"val\", /* } */", false);
}
-TEST(utilities, json_missing_array_end) {
+TEST_VM(utilities, json_missing_array_end) {
JSON_GTest::test("[ \"val\", /* ] */", false);
}
-TEST(utilities, json_key_values_1) {
+TEST_VM(utilities, json_key_values_1) {
JSON_GTest::test("/* comment */{ key1 : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
"{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
" : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}
-TEST(utilities, json_key_values_2) {
+TEST_VM(utilities, json_key_values_2) {
JSON_GTest::test("/* comment */ { \"key1\" : { \"key2\" : { \"key3\" : [ \"elem1\", \"elem2\","
"{ \"key4\" : null }, 3 , 2 , 1 , 0 , -1 , -2 , -3 , true, false, null, ] }, \"key5\""
" : true }, \"key6\" : [ \"☃\" ], key7 : \"val\",}", true);
}
-TEST(utilities, json_quoted_symbols) {
+TEST_VM(utilities, json_quoted_symbols) {
JSON_GTest::test("/*comment*/{\"ff1 fsd\":{\"☃\":{\"☃\":[\"☃\",\"☃\"]},"
"\"☃\":true},\"☃\":[\"☃\"],\"foo\":\"☃\",}", true);
}
-TEST(utilities, json_incorrect_key) {
+TEST_VM(utilities, json_incorrect_key) {
JSON_GTest::test("/* comment */ { key1 error : { \"☃\" : { \"☃\" : [ \"☃\","
" \"☃\" ] }, \"☃\" : true }, \"baz\" : [ \"☃\" ], foo : \"☃\",}",
false); // first key needs to be quoted since it contains a space
}
-TEST(utilities, json_array_with_newline) {
+TEST_VM(utilities, json_array_with_newline) {
JSON_GTest::test("[\n]", true);
}
-TEST(utilities, json_directives_file) {
+TEST_VM(utilities, json_directives_file) {
JSON_GTest::test(
"[" "\n"
" {"
diff --git a/hotspot/test/native/utilities/test_quicksort.cpp b/hotspot/test/native/utilities/test_quicksort.cpp
index 323bbd968b0..5ff4d0aaf44 100644
--- a/hotspot/test/native/utilities/test_quicksort.cpp
+++ b/hotspot/test/native/utilities/test_quicksort.cpp
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
#include "precompiled.hpp"
diff --git a/hotspot/test/native/utilities/test_resourceHash.cpp b/hotspot/test/native/utilities/test_resourceHash.cpp
new file mode 100644
index 00000000000..bca28ea0754
--- /dev/null
+++ b/hotspot/test/native/utilities/test_resourceHash.cpp
@@ -0,0 +1,226 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "memory/allocation.hpp"
+#include "memory/resourceArea.hpp"
+#include "unittest.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/resourceHash.hpp"
+
+class CommonResourceHashtableTest : public ::testing::Test {
+ protected:
+ typedef void* K;
+ typedef int V;
+ const static MEMFLAGS MEM_TYPE = mtInternal;
+
+ static unsigned identity_hash(const K& k) {
+ return (unsigned) (uintptr_t) k;
+ }
+
+ static unsigned bad_hash(const K& k) {
+ return 1;
+ }
+
+ static void* as_K(uintptr_t val) {
+ return (void*) val;
+ }
+
+ class EqualityTestIter {
+ public:
+
+ bool do_entry(K const& k, V const& v) {
+ if ((uintptr_t) k != (uintptr_t) v) {
+ EXPECT_EQ((uintptr_t) k, (uintptr_t) v);
+ return false;
+ } else {
+ return true; // continue iteration
+ }
+ }
+ };
+};
+
+class SmallResourceHashtableTest : public CommonResourceHashtableTest {
+ protected:
+
+ template<
+ unsigned (*HASH) (K const&) = primitive_hash,
+ bool (*EQUALS)(K const&, K const&) = primitive_equals,
+ unsigned SIZE = 256,
+ ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA
+ >
+ class Runner : public AllStatic {
+ public:
+
+ static void test(V step) {
+ EqualityTestIter et;
+ ResourceHashtable rh;
+
+ ASSERT_FALSE(rh.contains(as_K(step)));
+
+ ASSERT_TRUE(rh.put(as_K(step), step));
+ ASSERT_TRUE(rh.contains(as_K(step)));
+
+ ASSERT_FALSE(rh.put(as_K(step), step));
+
+ ASSERT_TRUE(rh.put(as_K(2 * step), 2 * step));
+ ASSERT_TRUE(rh.put(as_K(3 * step), 3 * step));
+ ASSERT_TRUE(rh.put(as_K(4 * step), 4 * step));
+ ASSERT_TRUE(rh.put(as_K(5 * step), 5 * step));
+
+ ASSERT_FALSE(rh.remove(as_K(0x0)));
+
+ rh.iterate(&et);
+ if (::testing::Test::HasFailure()) {
+ return;
+ }
+
+ ASSERT_TRUE(rh.remove(as_K(step)));
+ rh.iterate(&et);
+ }
+ };
+};
+
+TEST_VM_F(SmallResourceHashtableTest, default) {
+ ResourceMark rm;
+ Runner<>::test(0x1);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, default_shifted) {
+ ResourceMark rm;
+ Runner<>::test(0x10);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, bad_hash) {
+ ResourceMark rm;
+ Runner::test(0x1);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, bad_hash_shifted) {
+ ResourceMark rm;
+ Runner::test(0x10);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, identity_hash) {
+ ResourceMark rm;
+ Runner::test(0x1);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, identity_hash_shifted) {
+ ResourceMark rm;
+ Runner::test(0x10);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, primitive_hash_no_rm) {
+ Runner, primitive_equals, 512, ResourceObj::C_HEAP>::test(0x1);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, primitive_hash_no_rm_shifted) {
+ Runner, primitive_equals, 512, ResourceObj::C_HEAP>::test(0x10);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, bad_hash_no_rm) {
+ Runner, 512, ResourceObj::C_HEAP>::test(0x1);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, bad_hash_no_rm_shifted) {
+ Runner, 512, ResourceObj::C_HEAP>::test(0x10);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, identity_hash_no_rm) {
+ Runner, 1, ResourceObj::C_HEAP>::test(0x1);
+}
+
+TEST_VM_F(SmallResourceHashtableTest, identity_hash_no_rm_shifted) {
+ Runner, 1, ResourceObj::C_HEAP>::test(0x10);
+}
+
+class GenericResourceHashtableTest : public CommonResourceHashtableTest {
+ protected:
+
+ template<
+ unsigned (*HASH) (K const&) = primitive_hash,
+ bool (*EQUALS)(K const&, K const&) = primitive_equals,
+ unsigned SIZE = 256,
+ ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA
+ >
+ class Runner : public AllStatic {
+ public:
+
+ static void test(unsigned num_elements = SIZE) {
+ EqualityTestIter et;
+ ResourceHashtable rh;
+
+ for (uintptr_t i = 0; i < num_elements; ++i) {
+ ASSERT_TRUE(rh.put(as_K(i), i));
+ }
+
+ rh.iterate(&et);
+ if (::testing::Test::HasFailure()) {
+ return;
+ }
+
+ for (uintptr_t i = num_elements; i > 0; --i) {
+ uintptr_t index = i - 1;
+ ASSERT_TRUE((rh.remove(as_K(index))));
+ }
+
+ rh.iterate(&et);
+ if (::testing::Test::HasFailure()) {
+ return;
+ }
+ for (uintptr_t i = num_elements; i > 0; --i) {
+ uintptr_t index = i - 1;
+ ASSERT_FALSE(rh.remove(as_K(index)));
+ }
+ rh.iterate(&et);
+ }
+ };
+};
+
+TEST_VM_F(GenericResourceHashtableTest, default) {
+ ResourceMark rm;
+ Runner<>::test();
+}
+
+TEST_VM_F(GenericResourceHashtableTest, bad_hash) {
+ ResourceMark rm;
+ Runner::test();
+}
+
+TEST_VM_F(GenericResourceHashtableTest, identity_hash) {
+ ResourceMark rm;
+ Runner::test();
+}
+
+TEST_VM_F(GenericResourceHashtableTest, primitive_hash_no_rm) {
+ Runner, primitive_equals, 512, ResourceObj::C_HEAP>::test();
+}
+
+TEST_VM_F(GenericResourceHashtableTest, bad_hash_no_rm) {
+ Runner, 512, ResourceObj::C_HEAP>::test();
+}
+
+TEST_VM_F(GenericResourceHashtableTest, identity_hash_no_rm) {
+ Runner, 1, ResourceObj::C_HEAP>::test(512);
+}
diff --git a/hotspot/test/runtime/7116786/Test7116786.java b/hotspot/test/runtime/7116786/Test7116786.java
index 48eaf440b86..c47834b23b2 100644
--- a/hotspot/test/runtime/7116786/Test7116786.java
+++ b/hotspot/test/runtime/7116786/Test7116786.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/7167069/PrintAsFlag.java b/hotspot/test/runtime/7167069/PrintAsFlag.java
index bf8747ec59d..4d0d7414870 100644
--- a/hotspot/test/runtime/7167069/PrintAsFlag.java
+++ b/hotspot/test/runtime/7167069/PrintAsFlag.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppend.java b/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppend.java
index a463f492d8b..1bd6ddd012e 100644
--- a/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppend.java
+++ b/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppend.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/test/runtime/BootClassAppendProp/SunBootClassPath.java b/hotspot/test/runtime/BootClassAppendProp/SunBootClassPath.java
index e18b2853d9f..e802fcb5d1b 100644
--- a/hotspot/test/runtime/BootClassAppendProp/SunBootClassPath.java
+++ b/hotspot/test/runtime/BootClassAppendProp/SunBootClassPath.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
index 0362f0a8c8f..31d8b47a2ba 100644
--- a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
+++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
+ * 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
diff --git a/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java b/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java
index c9d348abab1..3ee8ff649eb 100644
--- a/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java
+++ b/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/Final/TestPutMain.java b/hotspot/test/runtime/Final/TestPutMain.java
index bfdfdda94e6..2396fc34d4e 100644
--- a/hotspot/test/runtime/Final/TestPutMain.java
+++ b/hotspot/test/runtime/Final/TestPutMain.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java b/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java
index 0ea4f2c7a7a..b367b1be825 100644
--- a/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java
+++ b/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/MirrorFrame/Asmator.java b/hotspot/test/runtime/MirrorFrame/Asmator.java
index 3d9a5ca1321..9ca3262c14c 100644
--- a/hotspot/test/runtime/MirrorFrame/Asmator.java
+++ b/hotspot/test/runtime/MirrorFrame/Asmator.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
import jdk.internal.org.objectweb.asm.*;
diff --git a/hotspot/test/runtime/MirrorFrame/Test8003720.java b/hotspot/test/runtime/MirrorFrame/Test8003720.java
index 4abe0f807c1..9d0b4149691 100644
--- a/hotspot/test/runtime/MirrorFrame/Test8003720.java
+++ b/hotspot/test/runtime/MirrorFrame/Test8003720.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/MirrorFrame/Victim.java b/hotspot/test/runtime/MirrorFrame/Victim.java
index c671e60304c..e81895388cb 100644
--- a/hotspot/test/runtime/MirrorFrame/Victim.java
+++ b/hotspot/test/runtime/MirrorFrame/Victim.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
public class Victim implements Test8003720.CallMe {
diff --git a/hotspot/test/runtime/MirrorFrame/VictimClassLoader.java b/hotspot/test/runtime/MirrorFrame/VictimClassLoader.java
index c43c61431be..b8af7d9ad2e 100644
--- a/hotspot/test/runtime/MirrorFrame/VictimClassLoader.java
+++ b/hotspot/test/runtime/MirrorFrame/VictimClassLoader.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
public class VictimClassLoader extends ClassLoader {
diff --git a/hotspot/test/runtime/RedefineTests/RedefineInterfaceMethods.java b/hotspot/test/runtime/RedefineTests/RedefineInterfaceMethods.java
new file mode 100644
index 00000000000..dd3b2da44e5
--- /dev/null
+++ b/hotspot/test/runtime/RedefineTests/RedefineInterfaceMethods.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8081800
+ * @summary Redefine private and default interface methods
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @modules java.compiler
+ * java.instrument
+ * jdk.jartool/sun.tools.jar
+ * @run main RedefineClassHelper
+ * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class*=trace RedefineInterfaceMethods
+ */
+public class RedefineInterfaceMethods {
+
+ static final int RET = -2;
+
+ static interface B {
+ int ORIGINAL_RETURN = 1;
+ int NEW_RETURN = 2;
+ private int privateMethod() {
+ return ORIGINAL_RETURN;
+ }
+ public default int defaultMethod() {
+ return privateMethod();
+ }
+ }
+
+ public static String redefinedPrivateMethod =
+ "interface RedefineInterfaceMethods$B {" +
+ " int ORIGINAL_RETURN = 1;" +
+ " int NEW_RETURN = 2;" +
+ " private int privateMethod() {" +
+ " return NEW_RETURN;" +
+ " }" +
+ " public default int defaultMethod() {" +
+ " return privateMethod();" +
+ " }" +
+ "}";
+
+ public static String redefinedDefaultMethod =
+ "interface RedefineInterfaceMethods$B {" +
+ " int ORIGINAL_RETURN = 1;" +
+ " int NEW_RETURN = 2;" +
+ " private int privateMethod() {" +
+ " return ORIGINAL_RETURN;" +
+ " }" +
+ " public default int defaultMethod() {" +
+ " return RedefineInterfaceMethods.RET;" +
+ " }" +
+ "}";
+
+ static class Impl implements B {
+ }
+
+
+ public static void main(String[] args) throws Exception {
+
+ Impl impl = new Impl();
+
+ int res = impl.defaultMethod();
+ if (res != B.ORIGINAL_RETURN)
+ throw new Error("defaultMethod returned " + res +
+ " expected " + B.ORIGINAL_RETURN);
+
+ RedefineClassHelper.redefineClass(B.class, redefinedPrivateMethod);
+
+ res = impl.defaultMethod();
+ if (res != B.NEW_RETURN)
+ throw new Error("defaultMethod returned " + res +
+ " expected " + B.NEW_RETURN);
+
+ System.gc();
+
+ RedefineClassHelper.redefineClass(B.class, redefinedDefaultMethod);
+
+ res = impl.defaultMethod();
+ if (res != RET)
+ throw new Error("defaultMethod returned " + res +
+ " expected " + RET);
+ }
+}
diff --git a/hotspot/test/runtime/RedefineTests/RedefineLeak.java b/hotspot/test/runtime/RedefineTests/RedefineLeak.java
new file mode 100644
index 00000000000..cc69b203cc3
--- /dev/null
+++ b/hotspot/test/runtime/RedefineTests/RedefineLeak.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /test/lib
+ * @summary Test that redefinition reuses metaspace blocks that are freed
+ * @modules java.base/jdk.internal.misc
+ * @modules java.instrument
+ * jdk.jartool/sun.tools.jar
+ * @run main RedefineLeak buildagent
+ * @run main/othervm/timeout=6000 RedefineLeak runtest
+ */
+
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.lang.RuntimeException;
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.Instrumentation;
+import java.security.ProtectionDomain;
+import java.lang.instrument.IllegalClassFormatException;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class RedefineLeak {
+ static class Tester {}
+
+ static class LoggingTransformer implements ClassFileTransformer {
+ static int transformCount = 0;
+
+ public LoggingTransformer() {}
+
+ public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined,
+ ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
+
+ transformCount++;
+ if (transformCount % 1000 == 0) System.out.println("transformCount:" + transformCount);
+ return null;
+ }
+ }
+
+ public static void premain(String agentArgs, Instrumentation inst) throws Exception {
+ LoggingTransformer t = new LoggingTransformer();
+ inst.addTransformer(t, true);
+ {
+ Class demoClass = Class.forName("RedefineLeak$Tester");
+
+ for (int i = 0; i < 10000; i++) {
+ inst.retransformClasses(demoClass);
+ }
+ }
+ System.gc();
+ }
+ private static void buildAgent() {
+ try {
+ ClassFileInstaller.main("RedefineLeak");
+ } catch (Exception e) {
+ throw new RuntimeException("Could not write agent classfile", e);
+ }
+
+ try {
+ PrintWriter pw = new PrintWriter("MANIFEST.MF");
+ pw.println("Premain-Class: RedefineLeak");
+ pw.println("Agent-Class: RedefineLeak");
+ pw.println("Can-Redefine-Classes: true");
+ pw.println("Can-Retransform-Classes: true");
+ pw.close();
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException("Could not write manifest file for the agent", e);
+ }
+
+ sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
+ if (!jarTool.run(new String[] { "-cmf", "MANIFEST.MF", "redefineagent.jar", "RedefineLeak.class" })) {
+ throw new RuntimeException("Could not write the agent jar file");
+ }
+ }
+ public static void main(String argv[]) throws Exception {
+ if (argv.length == 1 && argv[0].equals("buildagent")) {
+ buildAgent();
+ return;
+ }
+ if (argv.length == 1 && argv[0].equals("runtest")) {
+ // run outside of jtreg to not OOM on jtreg classes that are loaded after metaspace is full
+ String[] javaArgs1 = { "-XX:MetaspaceSize=12m", "-XX:MaxMetaspaceSize=12m",
+ "-javaagent:redefineagent.jar", "RedefineLeak"};
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(javaArgs1);
+
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain("transformCount:10000");
+ }
+ }
+}
diff --git a/hotspot/test/runtime/SelectionResolution/AbstractMethodErrorTest.java b/hotspot/test/runtime/SelectionResolution/AbstractMethodErrorTest.java
index 02b292d4287..93aadf9a7c7 100644
--- a/hotspot/test/runtime/SelectionResolution/AbstractMethodErrorTest.java
+++ b/hotspot/test/runtime/SelectionResolution/AbstractMethodErrorTest.java
@@ -15,7 +15,7 @@
* 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.
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Builder.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Builder.java
index dbaebf7a9f0..feba6cf0d0e 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Builder.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Builder.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ByteCodeClassLoader.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ByteCodeClassLoader.java
index 15c0fd3d735..d7397d9677b 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ByteCodeClassLoader.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ByteCodeClassLoader.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ClassBuilder.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ClassBuilder.java
index 817b04fc1b1..445a137e0f4 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ClassBuilder.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ClassBuilder.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ClassConstruct.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ClassConstruct.java
index 240c0f3223c..c23e5ddb554 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ClassConstruct.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/ClassConstruct.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Clazz.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Clazz.java
index 1b6e8afc803..45c2d6d1b92 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Clazz.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Clazz.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/HierarchyShape.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/HierarchyShape.java
index 0689c89e649..6209cf638ce 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/HierarchyShape.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/HierarchyShape.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Interface.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Interface.java
index ef3b51626c1..371919f2da6 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Interface.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Interface.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Method.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Method.java
index 428475dfd8a..71631e6c356 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Method.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/Method.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/MethodData.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/MethodData.java
index bc65931920b..14e57781439 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/MethodData.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/MethodData.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/TestBuilder.java b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/TestBuilder.java
index 894d053e0cc..8fdf98bfe45 100644
--- a/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/TestBuilder.java
+++ b/hotspot/test/runtime/SelectionResolution/classes/selectionresolution/TestBuilder.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
package selectionresolution;
diff --git a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java
index 83ecda87901..b4ef5c323c9 100644
--- a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java
+++ b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java
@@ -12,8 +12,7 @@
* 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
+ * 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.
*
@@ -21,6 +20,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
* @test
* @bug 8059510
diff --git a/hotspot/test/runtime/StackGuardPages/exeinvoke.c b/hotspot/test/runtime/StackGuardPages/exeinvoke.c
index da77e42ba7b..a841ecc24f3 100644
--- a/hotspot/test/runtime/StackGuardPages/exeinvoke.c
+++ b/hotspot/test/runtime/StackGuardPages/exeinvoke.c
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/* This code tests the fact that we actually remove stack guard page when calling
diff --git a/hotspot/test/runtime/Throwable/StackTraceLogging.java b/hotspot/test/runtime/Throwable/StackTraceLogging.java
index da2244cd57a..c9aa912b6ad 100644
--- a/hotspot/test/runtime/Throwable/StackTraceLogging.java
+++ b/hotspot/test/runtime/Throwable/StackTraceLogging.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java b/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java
index ceeca290382..e3eecb42d7a 100644
--- a/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java
+++ b/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/classFileParserBug/AnnotationTag.java b/hotspot/test/runtime/classFileParserBug/AnnotationTag.java
index 50cc04147ee..a14228b39bf 100644
--- a/hotspot/test/runtime/classFileParserBug/AnnotationTag.java
+++ b/hotspot/test/runtime/classFileParserBug/AnnotationTag.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/classFileParserBug/BadInitMethod.java b/hotspot/test/runtime/classFileParserBug/BadInitMethod.java
index d0238bdf057..bd1392994d1 100644
--- a/hotspot/test/runtime/classFileParserBug/BadInitMethod.java
+++ b/hotspot/test/runtime/classFileParserBug/BadInitMethod.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/classFileParserBug/BadNameAndType.java b/hotspot/test/runtime/classFileParserBug/BadNameAndType.java
index 03efc1c7d38..48730166d60 100644
--- a/hotspot/test/runtime/classFileParserBug/BadNameAndType.java
+++ b/hotspot/test/runtime/classFileParserBug/BadNameAndType.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/classFileParserBug/EnclosingMethod.java b/hotspot/test/runtime/classFileParserBug/EnclosingMethod.java
index fbdffcc62ed..92f72fd1e1c 100644
--- a/hotspot/test/runtime/classFileParserBug/EnclosingMethod.java
+++ b/hotspot/test/runtime/classFileParserBug/EnclosingMethod.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/classFileParserBug/InitInInterface.java b/hotspot/test/runtime/classFileParserBug/InitInInterface.java
index 4010b97b0dc..2444913090e 100644
--- a/hotspot/test/runtime/classFileParserBug/InitInInterface.java
+++ b/hotspot/test/runtime/classFileParserBug/InitInInterface.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/classFileParserBug/TestBadClassName.java b/hotspot/test/runtime/classFileParserBug/TestBadClassName.java
index d742711b7f1..970d4a54eb6 100644
--- a/hotspot/test/runtime/classFileParserBug/TestBadClassName.java
+++ b/hotspot/test/runtime/classFileParserBug/TestBadClassName.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/jni/PrivateInterfaceMethods/PrivateInterfaceMethods.java b/hotspot/test/runtime/jni/PrivateInterfaceMethods/PrivateInterfaceMethods.java
new file mode 100644
index 00000000000..ee6c0825d8a
--- /dev/null
+++ b/hotspot/test/runtime/jni/PrivateInterfaceMethods/PrivateInterfaceMethods.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8081800 8165827
+ * @summary Add JNI invocation tests for private interface methods
+ * @run main/native PrivateInterfaceMethods
+ */
+
+public class PrivateInterfaceMethods {
+
+ static {
+ System.loadLibrary("PrivateInterfaceMethods");
+ }
+
+ static native int callIntVoid(Object target, String definingClassName, String methodName, boolean virtual);
+ static native void lookupIntVoid(String definingClassName, String methodName);
+
+ static interface A {
+ static final int AmResult = 1;
+ private int m() { return AmResult; }
+ private int onlyA() { return 0; }
+ }
+
+ static interface B extends A {
+ // No m() here
+ private int onlyB() { return 0; }
+ }
+
+ static interface C extends B {
+ static final int CmResult = 2;
+ private int m() { return CmResult; } // unrelated to A.m
+ private int onlyC() { return 0; }
+ }
+
+ public static class Impl implements C {
+ static final int ImplmResult = 3;
+ private int m() { return ImplmResult; } // unrelated to A.m or C.m
+ }
+
+ // We found that itable/vtable construction was affected by whether or not the
+ // implementation class declared a method with the same signature as the
+ // private interface method, so we test both variants.
+
+ public static class Impl2 implements C {
+ }
+
+ public static void main(String[] args) {
+
+ // JNI getMethodID only works for methods declared in or inherited by a type.
+ // Private interface methods are not inherited and so should only be found
+ // in the declaring interface.
+
+ lookup(A.class.getName(), "onlyA", null); // should succeed
+ lookup(B.class.getName(), "onlyA", NoSuchMethodError.class); // should fail
+ lookup(C.class.getName(), "onlyA", NoSuchMethodError.class); // should fail
+ lookup(Impl.class.getName(), "onlyA", NoSuchMethodError.class); // should fail
+ lookup(Impl2.class.getName(), "onlyA", NoSuchMethodError.class); // should fail
+
+ lookup(B.class.getName(), "onlyB", null); // should succeed
+ lookup(A.class.getName(), "onlyB", NoSuchMethodError.class); // should fail
+ lookup(C.class.getName(), "onlyB", NoSuchMethodError.class); // should fail
+ lookup(Impl.class.getName(), "onlyB", NoSuchMethodError.class); // should fail
+ lookup(Impl2.class.getName(), "onlyB", NoSuchMethodError.class); // should fail
+
+ lookup(C.class.getName(), "onlyC", null); // should succeed
+ lookup(A.class.getName(), "onlyC", NoSuchMethodError.class); // should fail
+ lookup(B.class.getName(), "onlyC", NoSuchMethodError.class); // should fail
+ lookup(Impl.class.getName(), "onlyC", NoSuchMethodError.class); // should fail
+ lookup(Impl2.class.getName(), "onlyC", NoSuchMethodError.class); // should fail
+
+ Impl impl = new Impl();
+
+ // Note: JNI doesn't enforce access control so we can make
+ // private calls not possible in Java code.
+ // Also it doesn't check that the receiver is a type that
+ // defines the method!
+
+ // test: ((A)impl).m() - should succeed
+ test(impl, A.class.getName(), "m", A.AmResult, true, null);
+ test(impl, A.class.getName(), "m", A.AmResult, false, null);
+
+ // test: ((B)impl).m() - should fail: NoSuchMethodError
+ test(impl, B.class.getName(), "m", -1, true, NoSuchMethodError.class);
+ test(impl, B.class.getName(), "m", -1, false, NoSuchMethodError.class);
+
+ // test: ((C)impl).m() - should succeed
+ test(impl, C.class.getName(), "m", C.CmResult, true, null);
+ test(impl, C.class.getName(), "m", C.CmResult, false, null);
+
+ // test: impl.m() - should succeed
+ test(impl, Impl.class.getName(), "m", Impl.ImplmResult, true, null);
+ test(impl, Impl.class.getName(), "m", Impl.ImplmResult, false, null);
+
+ // ---
+
+ Impl2 impl2 = new Impl2();
+
+ // test: ((A)impl2).m() - should succeed
+ test(impl2, A.class.getName(), "m", A.AmResult, true, null);
+ test(impl2, A.class.getName(), "m", A.AmResult, false, null);
+
+ // test: ((B)impl2).m() - should fail: NoSuchMethodError
+ test(impl2, B.class.getName(), "m", -1, true, NoSuchMethodError.class);
+ test(impl2, B.class.getName(), "m", -1, false, NoSuchMethodError.class);
+
+ // test: ((C)impl2).m() - should succeed
+ test(impl2, C.class.getName(), "m", C.CmResult, true, null);
+ test(impl2, C.class.getName(), "m", C.CmResult, false, null);
+
+ // test: impl2.m() - should fail: NoSuchMethodError
+ test(impl2, Impl2.class.getName(), "m", -1, true, NoSuchMethodError.class);
+ test(impl2, Impl2.class.getName(), "m", -1, false, NoSuchMethodError.class);
+ }
+
+ static void lookup(String definingClass, String method, Class> expectedException) {
+
+ String desc = "Lookup of " + definingClass + "." + method;
+ try {
+ lookupIntVoid(definingClass, method);
+ if (expectedException != null)
+ throw new Error(desc + " succeeded - but expected exception "
+ + expectedException.getSimpleName());
+ System.out.println(desc + " - passed");
+ }
+ catch (Throwable t) {
+ if (t.getClass() != expectedException)
+ throw new Error(desc + " failed: got exception " + t + " but expected exception "
+ + expectedException.getSimpleName());
+ else
+ System.out.println(desc + " threw " + expectedException.getSimpleName() + " as expected");
+ }
+ }
+
+ static void test(Object target, String definingClass, String method,
+ int expected, boolean virtual, Class> expectedException) {
+
+ String desc = (virtual ? "Virtual" : "Nonvirtual") + " Invocation of " +
+ definingClass + "." + method + " on instance of class " +
+ target.getClass().getName();
+ try {
+ int res = callIntVoid(target, definingClass, method, virtual);
+ if (expectedException != null)
+ throw new Error(desc + " succeeded - but expected exception "
+ + expectedException.getSimpleName());
+ if (res != expected)
+ throw new Error(desc + " got wrong result: " + res + " instead of " + expected);
+ System.out.println(desc + " - passed");
+ }
+ catch (Throwable t) {
+ if (t.getClass() != expectedException)
+ throw new Error(desc + " failed: got exception " + t + " but expected exception "
+ + expectedException.getSimpleName());
+ else
+ System.out.println(desc + " threw " + expectedException.getSimpleName() + " as expected");
+ }
+ }
+
+}
diff --git a/hotspot/test/runtime/jni/PrivateInterfaceMethods/libPrivateInterfaceMethods.c b/hotspot/test/runtime/jni/PrivateInterfaceMethods/libPrivateInterfaceMethods.c
new file mode 100644
index 00000000000..ddd3d6a0656
--- /dev/null
+++ b/hotspot/test/runtime/jni/PrivateInterfaceMethods/libPrivateInterfaceMethods.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include
+
+// Private interface methods call test
+JNIEXPORT jint JNICALL
+Java_PrivateInterfaceMethods_callIntVoid(JNIEnv *env, jclass unused, jobject impl, jstring defining_class_name,
+ jstring method_name, jboolean virtual) {
+
+ // Lookup int method_name() in defining_class_name, and if it exists call impl.method_name()
+ // using a virtual or non-virtual invocation as indicated
+
+ jmethodID m_id = NULL;
+ jclass clazz = NULL;
+ const char* name = NULL;
+
+ name = (*env)->GetStringUTFChars(env, defining_class_name, NULL);
+ if (name == NULL) return -1;
+ clazz = (*env)->FindClass(env, name);
+ (*env)->ReleaseStringUTFChars(env, defining_class_name, name);
+ if ((*env)->ExceptionCheck(env)) return -1;
+
+ name = (*env)->GetStringUTFChars(env, method_name, NULL);
+ if (name == NULL) return -1;
+ m_id = (*env)->GetMethodID(env, clazz, name, "()I");
+ (*env)->ReleaseStringUTFChars(env, method_name, name);
+ if ((*env)->ExceptionCheck(env)) return -1;
+
+ if (!virtual)
+ return (*env)->CallNonvirtualIntMethod(env, impl, clazz, m_id);
+ else
+ return (*env)->CallIntMethod(env, impl, m_id);
+}
+
+// Private interface methods lookup test
+JNIEXPORT void JNICALL
+Java_PrivateInterfaceMethods_lookupIntVoid(JNIEnv *env, jclass unused,
+ jstring defining_class_name, jstring method_name) {
+
+ // Lookup int method_name() in defining_class_name
+
+ jmethodID m_id = NULL;
+ jclass clazz = NULL;
+ const char* name = NULL;
+
+ name = (*env)->GetStringUTFChars(env, defining_class_name, NULL);
+ if (name == NULL) return;
+ clazz = (*env)->FindClass(env, name);
+ (*env)->ReleaseStringUTFChars(env, defining_class_name, name);
+ if ((*env)->ExceptionCheck(env)) return;
+
+ name = (*env)->GetStringUTFChars(env, method_name, NULL);
+ if (name == NULL) return;
+ m_id = (*env)->GetMethodID(env, clazz, name, "()I");
+ (*env)->ReleaseStringUTFChars(env, method_name, name);
+}
+
diff --git a/hotspot/test/runtime/lambda-features/InvokespecialInterface.java b/hotspot/test/runtime/lambda-features/InvokespecialInterface.java
index 3b32dd7e552..31ccc8e1874 100644
--- a/hotspot/test/runtime/lambda-features/InvokespecialInterface.java
+++ b/hotspot/test/runtime/lambda-features/InvokespecialInterface.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/lambda-features/PublicStaticInterfaceMethodHandling.java b/hotspot/test/runtime/lambda-features/PublicStaticInterfaceMethodHandling.java
index 076a4764ad6..3d8db7f6111 100644
--- a/hotspot/test/runtime/lambda-features/PublicStaticInterfaceMethodHandling.java
+++ b/hotspot/test/runtime/lambda-features/PublicStaticInterfaceMethodHandling.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java b/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java
index 646a0945d7b..748db8dc697 100644
--- a/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java
+++ b/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/lambda-features/TestInterfaceInit.java b/hotspot/test/runtime/lambda-features/TestInterfaceInit.java
index f3d8e8aacd5..1ae95ae8bdc 100644
--- a/hotspot/test/runtime/lambda-features/TestInterfaceInit.java
+++ b/hotspot/test/runtime/lambda-features/TestInterfaceInit.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/lambda-features/TestInterfaceOrder.java b/hotspot/test/runtime/lambda-features/TestInterfaceOrder.java
index 245742ece14..fb135cc1c35 100644
--- a/hotspot/test/runtime/lambda-features/TestInterfaceOrder.java
+++ b/hotspot/test/runtime/lambda-features/TestInterfaceOrder.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/lambda-features/TestStaticandInstance.java b/hotspot/test/runtime/lambda-features/TestStaticandInstance.java
index 328f252e771..0bb42e8013b 100644
--- a/hotspot/test/runtime/lambda-features/TestStaticandInstance.java
+++ b/hotspot/test/runtime/lambda-features/TestStaticandInstance.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/logging/BiasedLockingTest.java b/hotspot/test/runtime/logging/BiasedLockingTest.java
index 75ea90b352b..5afbd49ce25 100644
--- a/hotspot/test/runtime/logging/BiasedLockingTest.java
+++ b/hotspot/test/runtime/logging/BiasedLockingTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/CompressedOopsTest.java b/hotspot/test/runtime/logging/CompressedOopsTest.java
index aa5bcf9b95f..f3eb5d225c1 100644
--- a/hotspot/test/runtime/logging/CompressedOopsTest.java
+++ b/hotspot/test/runtime/logging/CompressedOopsTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/DefaultMethodsTest.java b/hotspot/test/runtime/logging/DefaultMethodsTest.java
index 3790689f9bf..757d3478b35 100644
--- a/hotspot/test/runtime/logging/DefaultMethodsTest.java
+++ b/hotspot/test/runtime/logging/DefaultMethodsTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/ExceptionsTest.java b/hotspot/test/runtime/logging/ExceptionsTest.java
index 27a12c8e930..db2cf0a5bdb 100644
--- a/hotspot/test/runtime/logging/ExceptionsTest.java
+++ b/hotspot/test/runtime/logging/ExceptionsTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/ItablesTest.java b/hotspot/test/runtime/logging/ItablesTest.java
index 48ed3963570..2209fb0e53d 100644
--- a/hotspot/test/runtime/logging/ItablesTest.java
+++ b/hotspot/test/runtime/logging/ItablesTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
@@ -47,7 +47,7 @@ public class ItablesTest {
output.shouldContain(": Initializing itable indices for interface ");
output.shouldContain("itable index ");
output.shouldContain("target: ClassB.Method1()V, method_holder: ClassB target_method flags: public");
- output.shouldContain("invokeinterface resolved method: caller-class");
+ output.shouldContain("invokeinterface resolved interface method: caller-class");
output.shouldContain("invokespecial resolved method: caller-class:ClassB");
output.shouldContain("invokespecial selected method: resolved-class:ClassB");
output.shouldContain("invokeinterface selected method: receiver-class");
diff --git a/hotspot/test/runtime/logging/ModulesTest.java b/hotspot/test/runtime/logging/ModulesTest.java
index 13d4ed171a8..58b94cc3579 100644
--- a/hotspot/test/runtime/logging/ModulesTest.java
+++ b/hotspot/test/runtime/logging/ModulesTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/MonitorInflationTest.java b/hotspot/test/runtime/logging/MonitorInflationTest.java
index ab927b4474c..226ee71e08e 100644
--- a/hotspot/test/runtime/logging/MonitorInflationTest.java
+++ b/hotspot/test/runtime/logging/MonitorInflationTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/OsCpuLoggingTest.java b/hotspot/test/runtime/logging/OsCpuLoggingTest.java
index 93ed049f6bf..3a29b66e3c0 100644
--- a/hotspot/test/runtime/logging/OsCpuLoggingTest.java
+++ b/hotspot/test/runtime/logging/OsCpuLoggingTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/SafepointCleanupTest.java b/hotspot/test/runtime/logging/SafepointCleanupTest.java
index 1f52daca0c7..4e7bd6ed179 100644
--- a/hotspot/test/runtime/logging/SafepointCleanupTest.java
+++ b/hotspot/test/runtime/logging/SafepointCleanupTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/SafepointTest.java b/hotspot/test/runtime/logging/SafepointTest.java
index 161302fdb36..2509133742b 100644
--- a/hotspot/test/runtime/logging/SafepointTest.java
+++ b/hotspot/test/runtime/logging/SafepointTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/StackWalkTest.java b/hotspot/test/runtime/logging/StackWalkTest.java
new file mode 100644
index 00000000000..0b6721a7f50
--- /dev/null
+++ b/hotspot/test/runtime/logging/StackWalkTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test StackWalkTest
+ * @bug 8160064
+ * @summary -Xlog:stackwalk should produce logging from the source code
+ * @library /test/lib
+ * @run driver StackWalkTest
+ */
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class StackWalkTest {
+ static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain("Start walking");
+ output.shouldContain("fill_in_frames");
+ output.shouldHaveExitValue(0);
+ }
+
+ static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldNotContain("[stackwalk]");
+ output.shouldHaveExitValue(0);
+ }
+
+ public static void main(String... args) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:stackwalk=debug",
+ InnerClass.class.getName());
+ analyzeOutputOn(pb);
+
+ pb = ProcessTools.createJavaProcessBuilder("-Xlog:stackwalk=off",
+ InnerClass.class.getName());
+ analyzeOutputOff(pb);
+ }
+
+ public static class InnerClass {
+ public static void main(String[] args) throws Exception {
+ System.out.println("Testing stackwalk.");
+ StackWalker sw = StackWalker.getInstance();
+ sw.forEach(System.out::println);
+ }
+ }
+}
diff --git a/hotspot/test/runtime/logging/StartupTimeTest.java b/hotspot/test/runtime/logging/StartupTimeTest.java
index dfd3514be4a..4448caeac07 100644
--- a/hotspot/test/runtime/logging/StartupTimeTest.java
+++ b/hotspot/test/runtime/logging/StartupTimeTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/VMOperationTest.java b/hotspot/test/runtime/logging/VMOperationTest.java
index b72410bf497..6daa91f00ca 100644
--- a/hotspot/test/runtime/logging/VMOperationTest.java
+++ b/hotspot/test/runtime/logging/VMOperationTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/VerificationTest.java b/hotspot/test/runtime/logging/VerificationTest.java
index de64713cbd8..a20bd37c715 100644
--- a/hotspot/test/runtime/logging/VerificationTest.java
+++ b/hotspot/test/runtime/logging/VerificationTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/VtablesTest.java b/hotspot/test/runtime/logging/VtablesTest.java
index e5bd5be3c4a..2941416e26e 100644
--- a/hotspot/test/runtime/logging/VtablesTest.java
+++ b/hotspot/test/runtime/logging/VtablesTest.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/p1/A.java b/hotspot/test/runtime/logging/p1/A.java
index 57d2ca57cf8..e1d152f9577 100644
--- a/hotspot/test/runtime/logging/p1/A.java
+++ b/hotspot/test/runtime/logging/p1/A.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/p1/C.java b/hotspot/test/runtime/logging/p1/C.java
index 5624726aa7e..94b4d5bad3f 100644
--- a/hotspot/test/runtime/logging/p1/C.java
+++ b/hotspot/test/runtime/logging/p1/C.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/logging/p2/D.java b/hotspot/test/runtime/logging/p2/D.java
index 05f366fabfc..528dde95497 100644
--- a/hotspot/test/runtime/logging/p2/D.java
+++ b/hotspot/test/runtime/logging/p2/D.java
@@ -8,7 +8,7 @@
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleClassList.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleClassList.java
new file mode 100644
index 00000000000..e590e63a3fc
--- /dev/null
+++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleClassList.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary classes which are not useable during run time should not be included in the classlist
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * jdk.jartool/sun.tools.jar
+ * @build PatchModuleMain
+ * @run main PatchModuleClassList
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import jdk.test.lib.InMemoryJavaCompiler;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class PatchModuleClassList {
+ private static final String BOOT_CLASS = "javax/naming/spi/NamingManager";
+ private static final String PLATFORM_CLASS = "javax/transaction/InvalidTransactionException";
+
+ public static void main(String args[]) throws Throwable {
+ // Case 1. A class to be loaded by the boot class loader
+
+ // Create a class file in the module java.naming. This class file
+ // will be put in the javanaming.jar file.
+ String source = "package javax.naming.spi; " +
+ "public class NamingManager { " +
+ " static { " +
+ " System.out.println(\"I pass!\"); " +
+ " } " +
+ "}";
+
+ ClassFileInstaller.writeClassToDisk(BOOT_CLASS,
+ InMemoryJavaCompiler.compile(BOOT_CLASS.replace('/', '.'), source, "-Xmodule:java.naming"),
+ System.getProperty("test.classes"));
+
+ // Build the jar file that will be used for the module "java.naming".
+ BasicJarBuilder.build("javanaming", BOOT_CLASS);
+ String moduleJar = BasicJarBuilder.getTestJar("javanaming.jar");
+
+ String classList = "javanaming.list";
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ true,
+ "-XX:DumpLoadedClassList=" + classList,
+ "--patch-module=java.naming=" + moduleJar,
+ "PatchModuleMain", BOOT_CLASS.replace('/', '.'));
+ new OutputAnalyzer(pb.start()).shouldHaveExitValue(0);
+
+ // check the generated classlist file
+ String content = new String(Files.readAllBytes(Paths.get(classList)));
+ if (content.indexOf(BOOT_CLASS) >= 0) {
+ throw new RuntimeException(BOOT_CLASS + " should not be in the classlist");
+ }
+
+ // Case 2. A class to be loaded by the platform class loader
+
+ // Create a class file in the module java.transaction. This class file
+ // will be put in the javatransaction.jar file.
+ source = "package javax.transaction; " +
+ "public class InvalidTransactionException { " +
+ " static { " +
+ " System.out.println(\"I pass!\"); " +
+ " } " +
+ "}";
+
+ ClassFileInstaller.writeClassToDisk(PLATFORM_CLASS,
+ InMemoryJavaCompiler.compile(PLATFORM_CLASS.replace('/', '.'), source, "-Xmodule:java.transaction"),
+ System.getProperty("test.classes"));
+
+ // Build the jar file that will be used for the module "java.transaction".
+ BasicJarBuilder.build("javatransaction", PLATFORM_CLASS);
+ moduleJar = BasicJarBuilder.getTestJar("javatransaction.jar");
+
+ classList = "javatransaction.list";
+ pb = ProcessTools.createJavaProcessBuilder(
+ true,
+ "-XX:DumpLoadedClassList=" + classList,
+ "--patch-module=java.naming=" + moduleJar,
+ "PatchModuleMain", PLATFORM_CLASS.replace('/', '.'));
+ new OutputAnalyzer(pb.start()).shouldHaveExitValue(0);
+
+ // check the generated classlist file
+ content = new String(Files.readAllBytes(Paths.get(classList)));
+ if (content.indexOf(PLATFORM_CLASS) >= 0) {
+ throw new RuntimeException(PLATFORM_CLASS + " should not be in the classlist");
+ }
+
+ // Case 3. A class to be loaded from the bootclasspath/a
+
+ // Create a simple class file
+ source = "public class Hello { " +
+ " public static void main(String args[]) { " +
+ " System.out.println(\"Hello\"); " +
+ " } " +
+ "}";
+
+ ClassFileInstaller.writeClassToDisk("Hello",
+ InMemoryJavaCompiler.compile("Hello", source),
+ System.getProperty("test.classes"));
+
+ // Build hello.jar
+ BasicJarBuilder.build("hello", "Hello");
+ moduleJar = BasicJarBuilder.getTestJar("hello.jar");
+
+ classList = "hello.list";
+ pb = ProcessTools.createJavaProcessBuilder(
+ true,
+ "-XX:DumpLoadedClassList=" + classList,
+ "-Xbootclasspath/a:" + moduleJar,
+ "Hello");
+ new OutputAnalyzer(pb.start()).shouldHaveExitValue(0);
+
+ // check the generated classlist file
+ content = new String(Files.readAllBytes(Paths.get(classList)));
+ if (content.indexOf("Hello") < 0) {
+ throw new RuntimeException("Hello should be in the classlist");
+ }
+ }
+}
diff --git a/hotspot/test/runtime/stackMapCheck/StackMapCheck.java b/hotspot/test/runtime/stackMapCheck/StackMapCheck.java
index 56d1715855b..2c3ab1a361b 100644
--- a/hotspot/test/runtime/stackMapCheck/StackMapCheck.java
+++ b/hotspot/test/runtime/stackMapCheck/StackMapCheck.java
@@ -1,26 +1,25 @@
- /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
/*
* @test
diff --git a/hotspot/test/runtime/verifier/PrimIntArray.java b/hotspot/test/runtime/verifier/PrimIntArray.java
index 35765ad639a..f6d374ee257 100644
--- a/hotspot/test/runtime/verifier/PrimIntArray.java
+++ b/hotspot/test/runtime/verifier/PrimIntArray.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/*
diff --git a/hotspot/test/runtime/verifier/TraceClassRes.java b/hotspot/test/runtime/verifier/TraceClassRes.java
index 8e6ef28f7d8..dbfe16c6f2b 100644
--- a/hotspot/test/runtime/verifier/TraceClassRes.java
+++ b/hotspot/test/runtime/verifier/TraceClassRes.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/test/sanity/ExecuteInternalVMTests.java b/hotspot/test/sanity/ExecuteInternalVMTests.java
index b3e3724f287..a672b9cdc4f 100644
--- a/hotspot/test/sanity/ExecuteInternalVMTests.java
+++ b/hotspot/test/sanity/ExecuteInternalVMTests.java
@@ -19,7 +19,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
- *
*/
/* @test ExecuteInternalVMTests
diff --git a/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java b/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java
index 5bd7a087a06..3b4cfce1b60 100644
--- a/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java
+++ b/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java
@@ -1,11 +1,3 @@
-import org.testng.annotations.Test;
-import org.testng.Assert;
-
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Platform;
-import jdk.test.lib.dcmd.CommandExecutor;
-import jdk.test.lib.dcmd.JMXExecutor;
-
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,6 +21,14 @@ import jdk.test.lib.dcmd.JMXExecutor;
* questions.
*/
+import org.testng.annotations.Test;
+import org.testng.Assert;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.Platform;
+import jdk.test.lib.dcmd.CommandExecutor;
+import jdk.test.lib.dcmd.JMXExecutor;
+
/*
* @test
* @summary Test of VM.dynlib diagnostic command via MBean
diff --git a/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java b/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java
index 9d59fc65835..5f66938b65d 100644
--- a/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java
+++ b/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java
@@ -1,4 +1,3 @@
-
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
diff --git a/hotspot/test/serviceability/logging/TestLogRotation.java b/hotspot/test/serviceability/logging/TestLogRotation.java
index f1eaf41acc2..c6f971a7af8 100644
--- a/hotspot/test/serviceability/logging/TestLogRotation.java
+++ b/hotspot/test/serviceability/logging/TestLogRotation.java
@@ -41,8 +41,8 @@ class GCLoggingGenerator {
public static void main(String[] args) throws Exception {
long sizeOfLog = Long.parseLong(args[0]);
- long lines = sizeOfLog / 80;
- // full.GC generates ad least 1-line which is not shorter then 80 chars
+ long lines = sizeOfLog / 70;
+ // full.GC generates ad least 1-line which is not shorter then 70 chars
// for some GC 2 shorter lines are generated
for (long i = 0; i < lines; i++) {
System.gc();
diff --git a/hotspot/test/serviceability/tmtools/share/common/TmTool.java b/hotspot/test/serviceability/tmtools/share/common/TmTool.java
index cdcc8f5123b..ce333e6b016 100644
--- a/hotspot/test/serviceability/tmtools/share/common/TmTool.java
+++ b/hotspot/test/serviceability/tmtools/share/common/TmTool.java
@@ -19,8 +19,8 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
-
*/
+
package common;
import java.nio.file.Path;
diff --git a/jdk/.hgtags b/jdk/.hgtags
index b1bdee32f0f..e60f6414cfa 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -384,3 +384,4 @@ e72df94364e3686e7d62059ce0d6b187b82da713 jdk-9+137
5518ac2f2ead5e594bd983f2047178136aafdfd0 jdk-9+139
e93b7ea559759f036c9f69fd2ddaf47bb4e98385 jdk-9+140
8d752af5f61d41f226adf2cda72a20faa9ad620a jdk-9+141
+6ce43dd8e954b452f330dd7a412df5107f7e1923 jdk-9+142
diff --git a/jdk/make/copy/Copy-java.base.gmk b/jdk/make/copy/Copy-java.base.gmk
index c023e8cfbed..f736866e208 100644
--- a/jdk/make/copy/Copy-java.base.gmk
+++ b/jdk/make/copy/Copy-java.base.gmk
@@ -33,7 +33,6 @@ $(eval $(call IncludeCustomExtension, jdk, copy/Copy-java.base.gmk))
#
TARGETS += \
$(INCLUDE_DST_DIR)/jni.h \
- $(INCLUDE_DST_DIR)/jvmti.h \
$(INCLUDE_DST_DIR)/jvmticmlr.h \
$(INCLUDE_DST_DIR)/classfile_constants.h \
$(INCLUDE_DST_OS_DIR)/jni_md.h \
diff --git a/jdk/make/data/tzdata/VERSION b/jdk/make/data/tzdata/VERSION
index f587cb7fca7..7009f248679 100644
--- a/jdk/make/data/tzdata/VERSION
+++ b/jdk/make/data/tzdata/VERSION
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2016g
+tzdata2016h
diff --git a/jdk/make/data/tzdata/asia b/jdk/make/data/tzdata/asia
index 65e5f944b0e..71711a946d1 100644
--- a/jdk/make/data/tzdata/asia
+++ b/jdk/make/data/tzdata/asia
@@ -2567,11 +2567,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# From Paul Eggert (2015-03-03):
# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
# says that the fall 2014 transition was Oct 23 at 24:00.
-# For future dates, guess the last Friday in March at 24:00 through
-# the first Friday on or after October 21 at 00:00. This is consistent with
-# the predictions in today's editions of the following URLs:
-# http://www.timeanddate.com/time/change/gaza-strip/gaza
-# http://www.timeanddate.com/time/change/west-bank/hebron
# From Hannah Kreitem (2016-03-09):
# http://www.palestinecabinet.gov.ps/WebSite/ar/ViewDetails?ID=31728
@@ -2581,7 +2576,21 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
#
# From Paul Eggert (2016-03-12):
# Predict spring transitions on March's last Saturday at 01:00 from now on.
-# Leave fall predictions alone for now.
+
+# From Sharef Mustafa (2016-10-19):
+# [T]he Palestinian cabinet decision (Mar 8th 2016) published on
+# http://www.palestinecabinet.gov.ps/WebSite/Upload/Decree/GOV_17/16032016134830.pdf
+# states that summer time will end on Oct 29th at 01:00.
+#
+# From Tim Parenti (2016-10-19):
+# Predict fall transitions on October's last Saturday at 01:00 from now on.
+# This is consistent with the 2016 transition as well as our spring
+# predictions.
+#
+# From Paul Eggert (2016-10-19):
+# It's also consistent with predictions in the following URLs today:
+# http://www.timeanddate.com/time/change/gaza-strip/gaza
+# http://www.timeanddate.com/time/change/west-bank/hebron
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -2610,9 +2619,10 @@ Rule Palestine 2011 only - Sep 30 0:00 0 -
Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S
Rule Palestine 2012 only - Sep 21 1:00 0 -
Rule Palestine 2013 only - Sep Fri>=21 0:00 0 -
-Rule Palestine 2014 max - Oct Fri>=21 0:00 0 -
+Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 -
Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S
Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S
+Rule Palestine 2016 max - Oct lastSat 1:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
@@ -2762,45 +2772,31 @@ Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1
# People who live in regions under Tamil control can use [TZ='Asia/Kolkata'],
# as that zone has agreed with the Tamil areas since our cutoff date of 1970.
-# From K Sethu (2006-04-25):
-# I think the abbreviation LKT originated from the world of computers at
-# the time of or subsequent to the time zone changes by SL Government
-# twice in 1996 and probably SL Government or its standardization
-# agencies never declared an abbreviation as a national standard.
+# From Sadika Sumanapala (2016-10-19):
+# According to http://www.sltime.org (maintained by Measurement Units,
+# Standards & Services Department, Sri Lanka) abbreviation for Sri Lanka
+# standard time is SLST.
#
-# I recollect before the recent change the government announcements
-# mentioning it as simply changing Sri Lanka Standard Time or Sri Lanka
-# Time and no mention was made about the abbreviation.
-#
-# If we look at Sri Lanka Department of Government's "Official News
-# Website of Sri Lanka" ... http://www.news.lk/ we can see that they
-# use SLT as abbreviation in time stamp at the beginning of each news
-# item....
-#
-# Within Sri Lanka I think LKT is well known among computer users and
-# administrators. In my opinion SLT may not be a good choice because the
-# nation's largest telcom / internet operator Sri Lanka Telcom is well
-# known by that abbreviation - simply as SLT (there IP domains are
-# slt.lk and sltnet.lk).
-#
-# But if indeed our government has adopted SLT as standard abbreviation
-# (that we have not known so far) then it is better that it be used for
-# all computers.
-
-# From Paul Eggert (2006-04-25):
-# One possibility is that we wait for a bit for the dust to settle down
-# and then see what people actually say in practice.
+# From Paul Eggert (2016-10-18):
+# "SLST" seems to be reasonably recent and rarely-used outside time
+# zone nerd sources. I searched Google News and found three uses of
+# it in the International Business Times of India in February and
+# March of this year when discussing cricket match times, but nothing
+# since then (though there has been a lot of cricket) and nothing in
+# other English-language news sources. Our old abbreviation "LKT" is
+# even worse. For now, let's use a numeric abbreviation; we can
+# switch to "SLST" if it catches on.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Colombo 5:19:24 - LMT 1880
5:19:32 - MMT 1906 # Moratuwa Mean Time
- 5:30 - IST 1942 Jan 5
- 5:30 0:30 IHST 1942 Sep
- 5:30 1:00 IST 1945 Oct 16 2:00
- 5:30 - IST 1996 May 25 0:00
- 6:30 - LKT 1996 Oct 26 0:30
- 6:00 - LKT 2006 Apr 15 0:30
- 5:30 - IST
+ 5:30 - +0530 1942 Jan 5
+ 5:30 0:30 +0530/+06 1942 Sep
+ 5:30 1:00 +0530/+0630 1945 Oct 16 2:00
+ 5:30 - +0530 1996 May 25 0:00
+ 6:30 - +0630 1996 Oct 26 0:30
+ 6:00 - +06 2006 Apr 15 0:30
+ 5:30 - +0530
# Syria
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
diff --git a/jdk/make/data/tzdata/australasia b/jdk/make/data/tzdata/australasia
index 20a40206431..23153b171fa 100644
--- a/jdk/make/data/tzdata/australasia
+++ b/jdk/make/data/tzdata/australasia
@@ -373,7 +373,13 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
# commencing at 2.00 am on Sunday 1st November, 2015 and ending at
# 3.00 am on Sunday 17th January, 2016.
-# From Paul Eggert (2015-09-01):
+# From Raymond Kumar (2016-10-04):
+# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-6th-NOVEMBER,-2016.aspx
+# "Fiji's daylight savings will begin on Sunday, 6 November 2016, when
+# clocks go forward an hour at 2am to 3am.... Daylight Saving will
+# end at 3.00am on Sunday 15th January 2017."
+
+# From Paul Eggert (2016-10-03):
# For now, guess DST from 02:00 the first Sunday in November to
# 03:00 the third Sunday in January. Although ad hoc, it matches
# transitions since late 2014 and seems more likely to match future
diff --git a/jdk/make/data/tzdata/europe b/jdk/make/data/tzdata/europe
index aededb1d253..d182dbb6ba8 100644
--- a/jdk/make/data/tzdata/europe
+++ b/jdk/make/data/tzdata/europe
@@ -1931,7 +1931,7 @@ Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15
# Amsterdam mean time.
# The data entries before 1945 are taken from
-# http://www.phys.uu.nl/~vgent/wettijd/wettijd.htm
+# http://www.staff.science.uu.nl/~gent0113/idl/idl.htm
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Neth 1916 only - May 1 0:00 1:00 NST # Netherlands Summer Time
@@ -3450,22 +3450,24 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment.
# Turkey
-# From Amar Devegowda (2007-01-03):
-# The time zone rules for Istanbul, Turkey have not been changed for years now.
-# ... The latest rules are available at:
-# http://www.timeanddate.com/worldclock/timezone.html?n=107
-# From Steffen Thorsen (2007-01-03):
-# I have been able to find press records back to 1996 which all say that
-# DST started 01:00 local time and end at 02:00 local time. I am not sure
-# what happened before that. One example for each year from 1996 to 2001:
-# http://newspot.byegm.gov.tr/arsiv/1996/21/N4.htm
-# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING97/03/97X03X25.TXT
-# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING98/03/98X03X02.HTM
-# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING99/10/99X10X26.HTM#%2016
-# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2000/03/00X03X06.HTM#%2021
-# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2001/03/23x03x01.HTM#%2027
-# From Paul Eggert (2007-01-03):
-# Prefer the above source to Shanks & Pottenger for time stamps after 1990.
+# From Kıvanç Yazan (2016-09-25):
+# 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with
+# no exceptions.
+# 2) 1994's lastSun was overridden with Mar 20 ...
+# Here are official papers:
+# http://www.resmigazete.gov.tr/arsiv/19032.pdf - page 2 for 1986
+# http://www.resmigazete.gov.tr/arsiv/19400.pdf - page 4 for 1987
+# http://www.resmigazete.gov.tr/arsiv/19752.pdf - page 15 for 1988
+# http://www.resmigazete.gov.tr/arsiv/20102.pdf - page 6 for 1989
+# http://www.resmigazete.gov.tr/arsiv/20464.pdf - page 1 for 1990 - 1992
+# http://www.resmigazete.gov.tr/arsiv/21531.pdf - page 15 for 1993 - 1995
+# http://www.resmigazete.gov.tr/arsiv/21879.pdf - page 1 for overriding 1994
+# http://www.resmigazete.gov.tr/arsiv/22588.pdf - page 1 for 1996, 1997
+# http://www.resmigazete.gov.tr/arsiv/23286.pdf - page 10 for 1998 - 2000
+# http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001
+# http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006
+# From Paul Eggert (2016-09-25):
+# Prefer the above sources to Shanks & Pottenger for time stamps after 1985.
# From Steffen Thorsen (2007-03-09):
# Starting 2007 though, it seems that they are adopting EU's 1:00 UTC
@@ -3574,10 +3576,10 @@ Rule Turkey 1983 only - Jul 31 0:00 1:00 S
Rule Turkey 1983 only - Oct 2 0:00 0 -
Rule Turkey 1985 only - Apr 20 0:00 1:00 S
Rule Turkey 1985 only - Sep 28 0:00 0 -
-Rule Turkey 1986 1990 - Mar lastSun 2:00s 1:00 S
-Rule Turkey 1986 1990 - Sep lastSun 2:00s 0 -
-Rule Turkey 1991 2006 - Mar lastSun 1:00s 1:00 S
-Rule Turkey 1991 1995 - Sep lastSun 1:00s 0 -
+Rule Turkey 1986 1993 - Mar lastSun 1:00s 1:00 S
+Rule Turkey 1986 1995 - Sep lastSun 1:00s 0 -
+Rule Turkey 1994 only - Mar 20 1:00s 1:00 S
+Rule Turkey 1995 2006 - Mar lastSun 1:00s 1:00 S
Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Istanbul 1:55:52 - LMT 1880
diff --git a/jdk/make/data/tzdata/northamerica b/jdk/make/data/tzdata/northamerica
index 8ab635d089c..56b089c8fc5 100644
--- a/jdk/make/data/tzdata/northamerica
+++ b/jdk/make/data/tzdata/northamerica
@@ -47,8 +47,32 @@
# was the result of his proposals at the Convention of Railroad Trunk Lines
# in New York City (1869-10). His 1870 proposal was based on Washington, DC,
# but in 1872-05 he moved the proposed origin to Greenwich.
-# His proposal was adopted by the railroads on 1883-11-18 at 12:00,
-# and the most of the country soon followed suit.
+
+# From Paul Eggert (2016-09-21):
+# Dowd's proposal left many details unresolved, such as where to draw
+# lines between time zones. The key individual who made time zones
+# work in the US was William Frederick Allen - railway engineer,
+# managing editor of the Travelers' Guide, and secretary of the
+# General Time Convention, a railway standardization group. Allen
+# spent months in dialogs with scientific and railway leaders,
+# developed a workable plan to institute time zones, and presented it
+# to the General Time Convention on 1883-04-11, saying that his plan
+# meant "local time would be practically abolished" - a plus for
+# railway scheduling. By the next convention on 1883-10-11 nearly all
+# railroads had agreed and it took effect on 1883-11-18 at 12:00.
+# That Sunday was called the "day of two noons", as the eastern parts
+# of the new zones observed noon twice. Allen witnessed the
+# transition in New York City, writing:
+#
+# I heard the bells of St. Paul's strike on the old time. Four
+# minutes later, obedient to the electrical signal from the Naval
+# Observatory ... the time-ball made its rapid descent, the chimes
+# of old Trinity rang twelve measured strokes, and local time was
+# abandoned, probably forever.
+#
+# Most of the US soon followed suit. See:
+# Bartky IR. The adoption of standard time. Technol Cult 1989 Jan;30(1):25-56.
+# http://dx.doi.org/10.2307/3105430
# From Paul Eggert (2005-04-16):
# That 1883 transition occurred at 12:00 new time, not at 12:00 old time.
diff --git a/jdk/make/gendata/GendataBreakIterator.gmk b/jdk/make/gendata/GendataBreakIterator.gmk
index 828e6314790..39a5dfb5efc 100644
--- a/jdk/make/gendata/GendataBreakIterator.gmk
+++ b/jdk/make/gendata/GendataBreakIterator.gmk
@@ -55,7 +55,6 @@ $(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR_BASE, \
$(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR_LD, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(JDK_TOPDIR)/src/jdk.localedata/share/classes, \
- INCLUDES := $(TEXT_PKG_LD), \
INCLUDE_FILES := \
$(TEXT_PKG_LD)/BreakIteratorRules_th.java \
$(TEXT_PKG_LD)/BreakIteratorInfo_th.java, \
diff --git a/jdk/make/mapfiles/libsplashscreen/mapfile-vers b/jdk/make/mapfiles/libsplashscreen/mapfile-vers
index b948ef474a6..088cb4d2896 100644
--- a/jdk/make/mapfiles/libsplashscreen/mapfile-vers
+++ b/jdk/make/mapfiles/libsplashscreen/mapfile-vers
@@ -44,6 +44,7 @@ SUNWprivate_1.1 {
SplashSetFileJarName;
SplashSetScaleFactor;
SplashGetScaledImageName;
+ SplashGetScaledImgNameMaxPstfixLen;
local:
*;
};
diff --git a/jdk/src/java.base/share/classes/java/io/FileInputStream.java b/jdk/src/java.base/share/classes/java/io/FileInputStream.java
index cc77e5bd7c4..713b2ad0e95 100644
--- a/jdk/src/java.base/share/classes/java/io/FileInputStream.java
+++ b/jdk/src/java.base/share/classes/java/io/FileInputStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -26,7 +26,6 @@
package java.io;
import java.nio.channels.FileChannel;
-import java.util.concurrent.atomic.AtomicBoolean;
import sun.nio.ch.FileChannelImpl;
@@ -60,7 +59,9 @@ class FileInputStream extends InputStream
private volatile FileChannel channel;
- private final AtomicBoolean closed = new AtomicBoolean(false);
+ private final Object closeLock = new Object();
+
+ private volatile boolean closed;
/**
* Creates a FileInputStream
by
@@ -313,14 +314,21 @@ class FileInputStream extends InputStream
* @spec JSR-51
*/
public void close() throws IOException {
- if (!closed.compareAndSet(false, true)) {
- // if compareAndSet() returns false closed was already true
+ if (closed) {
return;
}
+ synchronized (closeLock) {
+ if (closed) {
+ return;
+ }
+ closed = true;
+ }
FileChannel fc = channel;
if (fc != null) {
- fc.close();
+ // possible race with getChannel(), benign since
+ // FileChannel.close is final and idempotent
+ fc.close();
}
fd.closeAll(new Closeable() {
@@ -370,8 +378,10 @@ class FileInputStream extends InputStream
fc = this.channel;
if (fc == null) {
this.channel = fc = FileChannelImpl.open(fd, path, true, false, this);
- if (closed.get()) {
+ if (closed) {
try {
+ // possible race with close(), benign since
+ // FileChannel.close is final and idempotent
fc.close();
} catch (IOException ioe) {
throw new InternalError(ioe); // should not happen
diff --git a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java
index 52d1596b3c4..f6bdb1f3b5f 100644
--- a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java
+++ b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -26,7 +26,6 @@
package java.io;
import java.nio.channels.FileChannel;
-import java.util.concurrent.atomic.AtomicBoolean;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.JavaIOFileDescriptorAccess;
import sun.nio.ch.FileChannelImpl;
@@ -77,7 +76,9 @@ class FileOutputStream extends OutputStream
*/
private final String path;
- private final AtomicBoolean closed = new AtomicBoolean(false);
+ private final Object closeLock = new Object();
+
+ private volatile boolean closed;
/**
* Creates a file output stream to write to the file with the
@@ -341,14 +342,21 @@ class FileOutputStream extends OutputStream
* @spec JSR-51
*/
public void close() throws IOException {
- if (!closed.compareAndSet(false, true)) {
- // if compareAndSet() returns false closed was already true
+ if (closed) {
return;
}
+ synchronized (closeLock) {
+ if (closed) {
+ return;
+ }
+ closed = true;
+ }
FileChannel fc = channel;
if (fc != null) {
- fc.close();
+ // possible race with getChannel(), benign since
+ // FileChannel.close is final and idempotent
+ fc.close();
}
fd.closeAll(new Closeable() {
@@ -399,8 +407,10 @@ class FileOutputStream extends OutputStream
fc = this.channel;
if (fc == null) {
this.channel = fc = FileChannelImpl.open(fd, path, false, true, this);
- if (closed.get()) {
+ if (closed) {
try {
+ // possible race with close(), benign since
+ // FileChannel.close is final and idempotent
fc.close();
} catch (IOException ioe) {
throw new InternalError(ioe); // should not happen
diff --git a/jdk/src/java.base/share/classes/java/io/FilePermission.java b/jdk/src/java.base/share/classes/java/io/FilePermission.java
index f81018f3a79..0c5c0ac2e8b 100644
--- a/jdk/src/java.base/share/classes/java/io/FilePermission.java
+++ b/jdk/src/java.base/share/classes/java/io/FilePermission.java
@@ -173,6 +173,7 @@ public final class FilePermission extends Permission implements Serializable {
private transient Path npath; // normalized dir path.
private transient Path npath2; // alternative normalized dir path.
private transient boolean allFiles; // whether this is <>
+ private transient boolean invalid; // whether input path is invalid
// static Strings used by init(int mask)
private static final char RECURSIVE_CHAR = '-';
@@ -218,11 +219,12 @@ public final class FilePermission extends Permission implements Serializable {
* A private constructor like a clone, only npath2 is not touched.
* @param input
*/
- private FilePermission(FilePermission input) {
- super(input.getName());
+ private FilePermission(String name, FilePermission input) {
+ super(name);
this.npath = input.npath;
this.actions = input.actions;
this.allFiles = input.allFiles;
+ this.invalid = input.invalid;
this.recursive = input.recursive;
this.directory = input.directory;
this.cpath = input.cpath;
@@ -255,7 +257,12 @@ public final class FilePermission extends Permission implements Serializable {
if (input.npath2 == null && !input.allFiles) {
Path npath2 = altPath(input.npath);
if (npath2 != null) {
- FilePermission np = new FilePermission(input);
+ // Please note the name of the new permission is
+ // different than the original so that when one is
+ // added to a FilePermissionCollection it will not
+ // be merged with the original one.
+ FilePermission np = new FilePermission(
+ input.getName()+"#plus", input);
np.npath2 = npath2;
return np;
}
@@ -266,7 +273,9 @@ public final class FilePermission extends Permission implements Serializable {
if (!input.allFiles) {
Path npath2 = altPath(input.npath);
if (npath2 != null) {
- FilePermission np = new FilePermission(input);
+ // New name, see above.
+ FilePermission np = new FilePermission(
+ input.getName()+"#using", input);
np.npath = npath2;
return np;
}
@@ -318,11 +327,12 @@ public final class FilePermission extends Permission implements Serializable {
// Windows. Some JDK codes generate such illegal names.
npath = builtInFS.getPath(new File(name).getPath())
.normalize();
+ invalid = false;
} catch (InvalidPathException ipe) {
// Still invalid. For compatibility reason, accept it
// but make this permission useless.
npath = builtInFS.getPath("-u-s-e-l-e-s-s-");
- this.mask = NONE;
+ invalid = true;
}
// lastName should always be non-null now
@@ -540,6 +550,12 @@ public final class FilePermission extends Permission implements Serializable {
*/
boolean impliesIgnoreMask(FilePermission that) {
if (FilePermCompat.nb) {
+ if (this == that) {
+ return true;
+ }
+ if (this.invalid || that.invalid) {
+ return false;
+ }
if (allFiles) {
return true;
}
@@ -687,9 +703,13 @@ public final class FilePermission extends Permission implements Serializable {
FilePermission that = (FilePermission) obj;
if (FilePermCompat.nb) {
+ if (this.invalid || that.invalid) {
+ return false;
+ }
return (this.mask == that.mask) &&
(this.allFiles == that.allFiles) &&
this.npath.equals(that.npath) &&
+ Objects.equals(npath2, that.npath2) &&
(this.directory == that.directory) &&
(this.recursive == that.recursive);
} else {
@@ -708,7 +728,8 @@ public final class FilePermission extends Permission implements Serializable {
@Override
public int hashCode() {
if (FilePermCompat.nb) {
- return Objects.hash(mask, allFiles, directory, recursive, npath);
+ return Objects.hash(
+ mask, allFiles, directory, recursive, npath, npath2, invalid);
} else {
return 0;
}
diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
index a7c093c7034..7b5a79277ed 100644
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -104,9 +104,9 @@ import sun.security.util.SecurityConstants;
* class or resource itself.
*
* Class loaders that support concurrent loading of classes are known as
- * parallel capable class loaders and are required to register
- * themselves at their class initialization time by invoking the
- * {@link
+ * {@linkplain #isParallelCapable() parallel capable} class loaders and
+ * are required to register themselves at their class initialization time by
+ * invoking the {@link
* #registerAsParallelCapable ClassLoader.registerAsParallelCapable}
* method. Note that the ClassLoader class is registered as parallel
* capable by default. However, its subclasses still need to register themselves
@@ -1437,7 +1437,7 @@ public abstract class ClassLoader {
}
/**
- * Registers the caller as parallel capable.
+ * Registers the caller as {@linkplain #isParallelCapable() parallel capable}.
* The registration succeeds if and only if all of the following
* conditions are met:
*
@@ -1448,8 +1448,10 @@ public abstract class ClassLoader {
* Note that once a class loader is registered as parallel capable, there
* is no way to change it back.
*
- * @return true if the caller is successfully registered as
- * parallel capable and false if otherwise.
+ * @return {@code true} if the caller is successfully registered as
+ * parallel capable and {@code false} if otherwise.
+ *
+ * @see #isParallelCapable()
*
* @since 1.7
*/
@@ -1460,6 +1462,22 @@ public abstract class ClassLoader {
return ParallelLoaders.register(callerClass);
}
+ /**
+ * Returns {@code true} if this class loader is
+ * {@linkplain #registerAsParallelCapable parallel capable}, otherwise
+ * {@code false}.
+ *
+ * @return {@code true} if this class loader is parallel capable,
+ * otherwise {@code false}.
+ *
+ * @see #registerAsParallelCapable()
+ *
+ * @since 9
+ */
+ public final boolean isParallelCapable() {
+ return ParallelLoaders.isRegistered(this.getClass());
+ }
+
/**
* Find a resource of the specified name from the search path used to load
* classes. This method locates the resource through the system class
@@ -1663,6 +1681,15 @@ public abstract class ClassLoader {
* this method during startup should take care not to cache the return
* value until the system is fully initialized.
*
+ * The class path used by the built-in system class loader is determined
+ * by the system property "{@code java.class.path}" during early
+ * initialization of the VM. If the system property is not defined,
+ * or its value is an empty string, then there is no class path
+ * when the initial module is a module on the application module path,
+ * i.e. a named module. If the initial module is not on
+ * the application module path then the class path defaults to
+ * the current working directory.
+ *
* @return The system ClassLoader for delegation
*
* @throws SecurityException
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 104aa220932..e1fad4d7dbb 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -5347,7 +5347,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* {@code (V T A...)} must have at least one {@code A} type, and the default iterator
* handle parameter is adjusted to accept the leading {@code A} type, as if by
* the {@link MethodHandle#asType asType} conversion method.
- * The leading {@code A} type must be {@code Iterable} or a subtype thereof, or an array type.
+ * The leading {@code A} type must be {@code Iterable} or a subtype thereof.
* This conversion step, done at loop construction time, must not throw a {@code WrongMethodTypeException}.
*
*
@@ -5374,7 +5374,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* V iteratedLoop(A... a...) {
* Iterator it = iterator(a...);
* V v = init(a...);
- * for (T t : it) {
+ * while (it.hasNext()) {
+ * T t = it.next();
* v = body(v, t, a...);
* }
* return v;
@@ -5483,49 +5484,59 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
Objects.requireNonNull(body);
MethodType bodyType = body.type();
Class> returnType = bodyType.returnType();
- List> innerList = bodyType.parameterList();
+ List> internalParamList = bodyType.parameterList();
// strip leading V value if present
int vsize = (returnType == void.class ? 0 : 1);
- if (vsize != 0 && (innerList.size() == 0 || innerList.get(0) != returnType)) {
+ if (vsize != 0 && (internalParamList.size() == 0 || internalParamList.get(0) != returnType)) {
// argument list has no "V" => error
MethodType expected = bodyType.insertParameterTypes(0, returnType);
throw misMatchedTypes("body function", bodyType, expected);
- } else if (innerList.size() <= vsize) {
+ } else if (internalParamList.size() <= vsize) {
// missing T type => error
MethodType expected = bodyType.insertParameterTypes(vsize, Object.class);
throw misMatchedTypes("body function", bodyType, expected);
}
- //Class> elementType = innerList.get(vsize); // do not need this
- List> outerList = innerList.subList(vsize + 1, innerList.size());
- if (outerList.isEmpty()) {
- // special case; take lists from iterator handle
- outerList = ((iterator != null)
- ? iterator.type().parameterList()
- : Arrays.asList(Iterable.class));
- innerList = bodyType.insertParameterTypes(vsize + 1, outerList).parameterList();
- }
+ List> externalParamList = internalParamList.subList(vsize + 1, internalParamList.size());
+ Class> iterableType = null;
if (iterator != null) {
+ // special case; if the body handle only declares V and T then
+ // the external parameter list is obtained from iterator handle
+ if (externalParamList.isEmpty()) {
+ externalParamList = iterator.type().parameterList();
+ }
MethodType itype = iterator.type();
if (!Iterator.class.isAssignableFrom(itype.returnType())) {
throw newIllegalArgumentException("iteratedLoop first argument must have Iterator return type");
}
- if (!itype.effectivelyIdenticalParameters(0, outerList)) {
- MethodType expected = methodType(itype.returnType(), outerList);
+ if (!itype.effectivelyIdenticalParameters(0, externalParamList)) {
+ MethodType expected = methodType(itype.returnType(), externalParamList);
throw misMatchedTypes("iterator parameters", itype, expected);
}
+ } else {
+ if (externalParamList.isEmpty()) {
+ // special case; if the iterator handle is null and the body handle
+ // only declares V and T then the external parameter list consists
+ // of Iterable
+ externalParamList = Arrays.asList(Iterable.class);
+ iterableType = Iterable.class;
+ } else {
+ // special case; if the iterator handle is null and the external
+ // parameter list is not empty then the first parameter must be
+ // assignable to Iterable
+ iterableType = externalParamList.get(0);
+ if (!Iterable.class.isAssignableFrom(iterableType)) {
+ throw newIllegalArgumentException(
+ "inferred first loop argument must inherit from Iterable: " + iterableType);
+ }
+ }
}
if (init != null) {
MethodType initType = init.type();
if (initType.returnType() != returnType ||
- !initType.effectivelyIdenticalParameters(0, outerList)) {
- throw misMatchedTypes("loop initializer", initType, methodType(returnType, outerList));
+ !initType.effectivelyIdenticalParameters(0, externalParamList)) {
+ throw misMatchedTypes("loop initializer", initType, methodType(returnType, externalParamList));
}
}
- Class> iterableType = outerList.isEmpty() ? null : outerList.get(0);
- if (iterableType != null && !Iterable.class.isAssignableFrom(iterableType) && !iterableType.isArray()) {
- throw newIllegalArgumentException(
- "inferred first loop argument must be an array or inherit from Iterable: " + iterableType);
- }
return iterableType; // help the caller a bit
}
diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
index e76c2f59200..60aeea6d85d 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
@@ -31,6 +31,7 @@ import java.io.PrintStream;
import java.io.UncheckedIOException;
import java.net.URI;
import java.nio.ByteBuffer;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -1997,6 +1998,13 @@ public class ModuleDescriptor
public Optional hashes(ModuleDescriptor descriptor) {
return descriptor.hashes();
}
+
+ @Override
+ public ModuleFinder newModulePath(Runtime.Version version,
+ boolean isLinkPhase,
+ Path... entries) {
+ return new ModulePath(version, isLinkPhase, entries);
+ }
});
}
diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java
index 9dd5b54c8cc..4e72a52cf22 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java
@@ -228,7 +228,7 @@ public interface ModuleFinder {
*
* If the name matches the regular expression {@code
* "-(\\d+(\\.|$))"} then the module name will be derived from the
- * subsequence proceeding the hyphen of the first occurrence. The
+ * subsequence preceding the hyphen of the first occurrence. The
* subsequence after the hyphen is parsed as a {@link
* ModuleDescriptor.Version} and ignored if it cannot be parsed as
* a {@code Version}.
@@ -248,18 +248,23 @@ public interface ModuleFinder {
* It {@link ModuleDescriptor#requires() requires} {@code
* java.base}.
*
- * All entries in the JAR file with names ending with {@code
- * .class} are assumed to be class files where the name corresponds
- * to the fully qualified name of the class. The packages of all
- * classes are {@link ModuleDescriptor#exports() exported}.
+ * The set of packages in the module is derived from the names
+ * of non-directory entries in the JAR file. A candidate package name
+ * is derived from an entry using the characters up to, but not
+ * including, the last forward slash. All remaining forward slashes are
+ * replaced with dot ({@code "."}). If the resulting string is a valid
+ * Java identifier then it is assumed to be a package name. For example,
+ * if the JAR file contains an entry "{@code p/q/Foo.class}" then the
+ * package name derived is "{@code p.q}". All packages are {@link
+ * ModuleDescriptor#exports() exported}.
*
- * The contents of all entries starting with {@code
+ *
The contents of entries starting with {@code
* META-INF/services/} are assumed to be service configuration files
- * (see {@link java.util.ServiceLoader}). The name of the file
- * (that follows {@code META-INF/services/}) is assumed to be the
- * fully-qualified binary name of a service type. The entries in the
- * file are assumed to be the fully-qualified binary names of
- * provider classes.
+ * (see {@link java.util.ServiceLoader}). If the name of a file
+ * (that follows {@code META-INF/services/}) is a legal Java identifier
+ * then it is assumed to be the fully-qualified binary name of a
+ * service type. The entries in the file are assumed to be the
+ * fully-qualified binary names of provider classes.
*
* If the JAR file has a {@code Main-Class} attribute in its
* main manifest then its value is the {@link
@@ -271,8 +276,8 @@ public interface ModuleFinder {
* {@link ModuleDescriptor.Builder ModuleDescriptor.Builder} API) for an
* automatic module then {@code FindException} is thrown. This can arise,
* for example, when a legal Java identifier name cannot be derived from
- * the file name of the JAR file or where a package name derived from an
- * entry ending with {@code .class} is not a legal Java identifier.
+ * the file name of the JAR file or where the JAR file contains a {@code
+ * .class} in the top-level directory of the JAR file.
*
* In addition to JAR files, an implementation may also support modules
* that are packaged in other implementation specific module formats. When
@@ -283,8 +288,10 @@ public interface ModuleFinder {
*
*
As with automatic modules, the contents of a packaged or exploded
* module may need to be scanned in order to determine the packages
- * in the module. If a {@code .class} file that corresponds to a class in an
- * unnamed package is encountered then {@code FindException} is thrown.
+ * in the module. If a {@code .class} file (other than {@code
+ * module-info.class}) is found in the top-level directory then it is
+ * assumed to be a class in the unnamed package and so {@code FindException}
+ * is thrown.
*
* Finders created by this method are lazy and do not eagerly check
* that the given file paths are directories or packaged modules.
@@ -341,7 +348,7 @@ public interface ModuleFinder {
* @return A {@code ModuleFinder} that composes a sequence of module finders
*/
static ModuleFinder compose(ModuleFinder... finders) {
- // copy the list, also checking for nulls
+ // copy the list and check for nulls
final List finderList = List.of(finders);
return new ModuleFinder() {
diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModulePath.java b/jdk/src/java.base/share/classes/java/lang/module/ModulePath.java
index cad2812ab64..fa40f3b7958 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/ModulePath.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModulePath.java
@@ -33,10 +33,12 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.lang.module.ModuleDescriptor.Requires;
+import java.net.URI;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Collections;
import java.util.HashMap;
@@ -52,49 +54,53 @@ import java.util.jar.Manifest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import jdk.internal.jmod.JmodFile;
import jdk.internal.jmod.JmodFile.Section;
-import jdk.internal.module.ConfigurableModuleFinder;
+import jdk.internal.module.Checks;
import jdk.internal.perf.PerfCounter;
+import jdk.internal.util.jar.VersionedStream;
/**
* A {@code ModuleFinder} that locates modules on the file system by searching
* a sequence of directories or packaged modules.
*
- * The {@code ModuleFinder} can be configured to work in either the run-time
+ * The {@code ModuleFinder} can be created to work in either the run-time
* or link-time phases. In both cases it locates modular JAR and exploded
- * modules. When configured for link-time then it additionally locates
+ * modules. When created for link-time then it additionally locates
* modules in JMOD files.
*/
-class ModulePath implements ConfigurableModuleFinder {
+class ModulePath implements ModuleFinder {
private static final String MODULE_INFO = "module-info.class";
+ // the version to use for multi-release modular JARs
+ private final Runtime.Version releaseVersion;
+
+ // true for the link phase (supports modules packaged in JMOD format)
+ private final boolean isLinkPhase;
+
// the entries on this module path
private final Path[] entries;
private int next;
- // true if in the link phase
- private boolean isLinkPhase;
-
// map of module name to module reference map for modules already located
private final Map cachedModules = new HashMap<>();
- ModulePath(Path... entries) {
+ ModulePath(Runtime.Version version, boolean isLinkPhase, Path... entries) {
+ this.releaseVersion = version;
+ this.isLinkPhase = isLinkPhase;
this.entries = entries.clone();
for (Path entry : this.entries) {
Objects.requireNonNull(entry);
}
}
- @Override
- public void configurePhase(Phase phase) {
- isLinkPhase = (phase == Phase.LINK_TIME);
+ ModulePath(Path... entries) {
+ this(JarFile.runtimeVersion(), false, entries);
}
@Override
@@ -239,9 +245,13 @@ class ModulePath implements ConfigurableModuleFinder {
if (mref != null) {
// can have at most one version of a module in the directory
String name = mref.descriptor().name();
- if (nameToReference.put(name, mref) != null) {
+ ModuleReference previous = nameToReference.put(name, mref);
+ if (previous != null) {
+ String fn1 = fileName(mref);
+ String fn2 = fileName(previous);
throw new FindException("Two versions of module "
- + name + " found in " + dir);
+ + name + " found in " + dir
+ + " (" + fn1 + " and " + fn2 + ")");
}
}
}
@@ -294,6 +304,25 @@ class ModulePath implements ConfigurableModuleFinder {
}
+ /**
+ * Returns a string with the file name of the module if possible.
+ * If the module location is not a file URI then return the URI
+ * as a string.
+ */
+ private String fileName(ModuleReference mref) {
+ URI uri = mref.location().orElse(null);
+ if (uri != null) {
+ if (uri.getScheme().equalsIgnoreCase("file")) {
+ Path file = Paths.get(uri);
+ return file.getFileName().toString();
+ } else {
+ return uri.toString();
+ }
+ } else {
+ return "";
+ }
+ }
+
// -- jmod files --
private Set jmodPackages(JmodFile jf) {
@@ -301,7 +330,7 @@ class ModulePath implements ConfigurableModuleFinder {
.filter(e -> e.section() == Section.CLASSES)
.map(JmodFile.Entry::name)
.map(this::toPackageName)
- .filter(pkg -> pkg.length() > 0) // module-info
+ .flatMap(Optional::stream)
.collect(Collectors.toSet());
}
@@ -328,8 +357,8 @@ class ModulePath implements ConfigurableModuleFinder {
private static final String SERVICES_PREFIX = "META-INF/services/";
/**
- * Returns a container with the service type corresponding to the name of
- * a services configuration file.
+ * Returns the service type corresponding to the name of a services
+ * configuration file if it is a valid Java identifier.
*
* For example, if called with "META-INF/services/p.S" then this method
* returns a container with the value "p.S".
@@ -341,7 +370,8 @@ class ModulePath implements ConfigurableModuleFinder {
String prefix = cf.substring(0, index);
if (prefix.equals(SERVICES_PREFIX)) {
String sn = cf.substring(index);
- return Optional.of(sn);
+ if (Checks.isJavaIdentifier(sn))
+ return Optional.of(sn);
}
}
return Optional.empty();
@@ -416,28 +446,28 @@ class ModulePath implements ConfigurableModuleFinder {
if (vs != null)
builder.version(vs);
- // scan the entries in the JAR file to locate the .class and service
- // configuration file
- Map> map =
- versionedStream(jf)
- .map(JarEntry::getName)
- .filter(s -> (s.endsWith(".class") ^ s.startsWith(SERVICES_PREFIX)))
- .collect(Collectors.partitioningBy(s -> s.endsWith(".class"),
- Collectors.toSet()));
- Set classFiles = map.get(Boolean.TRUE);
- Set configFiles = map.get(Boolean.FALSE);
+ // scan the names of the entries in the JAR file
+ Map> map = VersionedStream.stream(jf)
+ .filter(e -> !e.isDirectory())
+ .map(JarEntry::getName)
+ .collect(Collectors.partitioningBy(e -> e.startsWith(SERVICES_PREFIX),
+ Collectors.toSet()));
+
+ Set resources = map.get(Boolean.FALSE);
+ Set configFiles = map.get(Boolean.TRUE);
// all packages are exported
- classFiles.stream()
- .map(c -> toPackageName(c))
- .distinct()
- .forEach(builder::exports);
+ resources.stream()
+ .map(this::toPackageName)
+ .flatMap(Optional::stream)
+ .distinct()
+ .forEach(builder::exports);
// map names of service configuration files to service names
Set serviceNames = configFiles.stream()
- .map(this::toServiceName)
- .flatMap(Optional::stream)
- .collect(Collectors.toSet());
+ .map(this::toServiceName)
+ .flatMap(Optional::stream)
+ .collect(Collectors.toSet());
// parse each service configuration file
for (String sn : serviceNames) {
@@ -502,25 +532,13 @@ class ModulePath implements ConfigurableModuleFinder {
return mn;
}
- private Stream versionedStream(JarFile jf) {
- if (jf.isMultiRelease()) {
- // a stream of JarEntries whose names are base names and whose
- // contents are from the corresponding versioned entries in
- // a multi-release jar file
- return jf.stream().map(JarEntry::getName)
- .filter(name -> !name.startsWith("META-INF/versions/"))
- .map(jf::getJarEntry);
- } else {
- return jf.stream();
- }
- }
-
private Set jarPackages(JarFile jf) {
- return versionedStream(jf)
- .filter(e -> e.getName().endsWith(".class"))
- .map(e -> toPackageName(e.getName()))
- .filter(pkg -> pkg.length() > 0) // module-info
- .collect(Collectors.toSet());
+ return VersionedStream.stream(jf)
+ .filter(e -> !e.isDirectory())
+ .map(JarEntry::getName)
+ .map(this::toPackageName)
+ .flatMap(Optional::stream)
+ .collect(Collectors.toSet());
}
/**
@@ -535,7 +553,7 @@ class ModulePath implements ConfigurableModuleFinder {
try (JarFile jf = new JarFile(file.toFile(),
true, // verify
ZipFile.OPEN_READ,
- JarFile.runtimeVersion()))
+ releaseVersion))
{
ModuleDescriptor md;
JarEntry entry = jf.getJarEntry(MODULE_INFO);
@@ -565,11 +583,11 @@ class ModulePath implements ConfigurableModuleFinder {
private Set explodedPackages(Path dir) {
try {
return Files.find(dir, Integer.MAX_VALUE,
- ((path, attrs) -> attrs.isRegularFile() &&
- path.toString().endsWith(".class")))
- .map(path -> toPackageName(dir.relativize(path)))
- .filter(pkg -> pkg.length() > 0) // module-info
- .collect(Collectors.toSet());
+ ((path, attrs) -> attrs.isRegularFile()))
+ .map(path -> dir.relativize(path))
+ .map(this::toPackageName)
+ .flatMap(Optional::stream)
+ .collect(Collectors.toSet());
} catch (IOException x) {
throw new UncheckedIOException(x);
}
@@ -595,29 +613,62 @@ class ModulePath implements ConfigurableModuleFinder {
return ModuleReferences.newExplodedModule(md, dir);
}
+ /**
+ * Maps the name of an entry in a JAR or ZIP file to a package name.
+ *
+ * @throws IllegalArgumentException if the name is a class file in
+ * the top-level directory of the JAR/ZIP file (and it's
+ * not module-info.class)
+ */
+ private Optional toPackageName(String name) {
+ assert !name.endsWith("/");
- //
+ int index = name.lastIndexOf("/");
+ if (index == -1) {
+ if (name.endsWith(".class") && !name.equals(MODULE_INFO)) {
+ throw new IllegalArgumentException(name
+ + " found in top-level directory:"
+ + " (unnamed package not allowed in module)");
+ }
+ return Optional.empty();
+ }
- // p/q/T.class => p.q
- private String toPackageName(String cn) {
- assert cn.endsWith(".class");
- int start = 0;
- int index = cn.lastIndexOf("/");
- if (index > start) {
- return cn.substring(start, index).replace('/', '.');
+ String pn = name.substring(0, index).replace('/', '.');
+ if (Checks.isJavaIdentifier(pn)) {
+ return Optional.of(pn);
} else {
- return "";
+ // not a valid package name
+ return Optional.empty();
}
}
- private String toPackageName(Path path) {
- String name = path.toString();
- assert name.endsWith(".class");
- int index = name.lastIndexOf(File.separatorChar);
- if (index != -1) {
- return name.substring(0, index).replace(File.separatorChar, '.');
+ /**
+ * Maps the relative path of an entry in an exploded module to a package
+ * name.
+ *
+ * @throws IllegalArgumentException if the name is a class file in
+ * the top-level directory (and it's not module-info.class)
+ */
+ private Optional toPackageName(Path file) {
+ assert file.getRoot() == null;
+
+ Path parent = file.getParent();
+ if (parent == null) {
+ String name = file.toString();
+ if (name.endsWith(".class") && !name.equals(MODULE_INFO)) {
+ throw new IllegalArgumentException(name
+ + " found in in top-level directory"
+ + " (unnamed package not allowed in module)");
+ }
+ return Optional.empty();
+ }
+
+ String pn = parent.toString().replace(File.separatorChar, '.');
+ if (Checks.isJavaIdentifier(pn)) {
+ return Optional.of(pn);
} else {
- return "";
+ // not a valid package name
+ return Optional.empty();
}
}
diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java
index 4d3d2bf15a0..d79d210edd0 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleReader.java
@@ -32,6 +32,7 @@ import java.net.URI;
import java.nio.ByteBuffer;
import java.util.Objects;
import java.util.Optional;
+import java.util.stream.Stream;
/**
@@ -44,6 +45,11 @@ import java.util.Optional;
* module. A module reader is also intended to be used by {@code ClassLoader}
* implementations that load classes and resources from modules.
*
+ * A resource in a module is identified by a name that is a
+ * '{@code /}'-separated path string. For example, module {@code java.base} may
+ * have a resource "{@code java/lang/Object.class}" that, by convention, is the
+ * class file for {@code java.lang.Object}.
+ *
* A {@code ModuleReader} is {@linkplain ModuleReference#open open} upon
* creation and is closed by invoking the {@link #close close} method. Failure
* to close a module reader may result in a resource leak. The {@code
@@ -52,8 +58,8 @@ import java.util.Optional;
*
*
A {@code ModuleReader} implementation may require permissions to access
* resources in the module. Consequently the {@link #find find}, {@link #open
- * open} and {@link #read read} methods may throw {@code SecurityException} if
- * access is denied by the security manager.
+ * open}, {@link #read read}, and {@link #list list} methods may throw {@code
+ * SecurityException} if access is denied by the security manager.
*
* @see ModuleReference
* @since 9
@@ -84,6 +90,9 @@ public interface ModuleReader extends Closeable {
* Opens a resource, returning an input stream to read the resource in
* the module.
*
+ * The behavior of the input stream when used after the module reader
+ * is closed is implementation specific and therefore not specified.
+ *
* @implSpec The default implementation invokes the {@link #find(String)
* find} method to get a URI to the resource. If found, then it attempts
* to construct a {@link java.net.URL URL} and open a connection to the
@@ -171,18 +180,38 @@ public interface ModuleReader extends Closeable {
Objects.requireNonNull(bb);
}
+ /**
+ * Lists the contents of the module, returning a stream of elements that
+ * are the names of all resources in the module.
+ *
+ * In lazy implementations then an {@code IOException} may be thrown
+ * when using the stream to list the module contents. If this occurs then
+ * the {@code IOException} will be wrapped in an {@link
+ * java.io.UncheckedIOException} and thrown from the method that caused the
+ * access to be attempted. {@code SecurityException} may also be thrown
+ * when using the stream to list the module contents and access is denied
+ * by the security manager.
+ *
+ * The behavior of the stream when used after the module reader is
+ * closed is implementation specific and therefore not specified.
+ *
+ * @return A stream of elements that are the names of all resources
+ * in the module
+ *
+ * @throws IOException
+ * If an I/O error occurs or the module reader is closed
+ * @throws SecurityException
+ * If denied by the security manager
+ */
+ Stream list() throws IOException;
+
/**
* Closes the module reader. Once closed then subsequent calls to locate or
- * read a resource will fail by returning {@code Optional.empty()} or
- * throwing {@code IOException}.
+ * read a resource will fail by throwing {@code IOException}.
*
* A module reader is not required to be asynchronously closeable. If a
* thread is reading a resource and another thread invokes the close method,
- * then the second thread may block until the read operation is complete.
- *
- *
The behavior of {@code InputStream}s obtained using the {@link
- * #open(String) open} method and used after the module reader is closed
- * is implementation specific and therefore not specified.
+ * then the second thread may block until the read operation is complete.
*/
@Override
void close() throws IOException;
diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java
index de245656364..8393bd0f223 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java
@@ -35,6 +35,7 @@ import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.locks.Lock;
@@ -43,14 +44,17 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Supplier;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import java.util.zip.ZipFile;
+import jdk.internal.jmod.JmodFile;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.module.ModuleHashes;
import jdk.internal.module.ModuleHashes.HashSupplier;
import jdk.internal.module.ModulePatcher;
+import jdk.internal.util.jar.VersionedStream;
import sun.net.www.ParseUtil;
@@ -139,6 +143,13 @@ class ModuleReferences {
*/
abstract Optional implOpen(String name) throws IOException;
+ /**
+ * Returns a stream of the names of resources in the module. This
+ * method is invoked by the list method to do the actual work of
+ * creating the stream.
+ */
+ abstract Stream implList() throws IOException;
+
/**
* Closes the module reader. This method is invoked by close to do the
* actual work of closing the module reader.
@@ -175,7 +186,21 @@ class ModuleReferences {
}
@Override
- public void close() throws IOException {
+ public final Stream list() throws IOException {
+ readLock.lock();
+ try {
+ if (!closed) {
+ return implList();
+ } else {
+ throw new IOException("ModuleReader is closed");
+ }
+ } finally {
+ readLock.unlock();
+ }
+ }
+
+ @Override
+ public final void close() throws IOException {
writeLock.lock();
try {
if (!closed) {
@@ -240,6 +265,16 @@ class ModuleReferences {
}
}
+ @Override
+ Stream implList() throws IOException {
+ // take snapshot to avoid async close
+ List names = VersionedStream.stream(jf)
+ .filter(e -> !e.isDirectory())
+ .map(JarEntry::getName)
+ .collect(Collectors.toList());
+ return names.stream();
+ }
+
@Override
void implClose() throws IOException {
jf.close();
@@ -251,30 +286,31 @@ class ModuleReferences {
* A ModuleReader for a JMOD file.
*/
static class JModModuleReader extends SafeCloseModuleReader {
- private final ZipFile zf;
+ private final JmodFile jf;
private final URI uri;
- static ZipFile newZipFile(Path path) {
+ static JmodFile newJmodFile(Path path) {
try {
- return new ZipFile(path.toFile());
+ return new JmodFile(path);
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
}
}
JModModuleReader(Path path, URI uri) {
- this.zf = newZipFile(path);
+ this.jf = newJmodFile(path);
this.uri = uri;
}
- private ZipEntry getEntry(String name) {
- return zf.getEntry("classes/" + Objects.requireNonNull(name));
+ private JmodFile.Entry getEntry(String name) {
+ Objects.requireNonNull(name);
+ return jf.getEntry(JmodFile.Section.CLASSES, name);
}
@Override
Optional implFind(String name) {
- ZipEntry ze = getEntry(name);
- if (ze != null) {
+ JmodFile.Entry je = getEntry(name);
+ if (je != null) {
String encodedPath = ParseUtil.encodePath(name, false);
String uris = "jmod:" + uri + "!/" + encodedPath;
return Optional.of(URI.create(uris));
@@ -285,17 +321,27 @@ class ModuleReferences {
@Override
Optional implOpen(String name) throws IOException {
- ZipEntry ze = getEntry(name);
- if (ze != null) {
- return Optional.of(zf.getInputStream(ze));
+ JmodFile.Entry je = getEntry(name);
+ if (je != null) {
+ return Optional.of(jf.getInputStream(je));
} else {
return Optional.empty();
}
}
+ @Override
+ Stream implList() throws IOException {
+ // take snapshot to avoid async close
+ List names = jf.stream()
+ .filter(e -> e.section() == JmodFile.Section.CLASSES)
+ .map(JmodFile.Entry::name)
+ .collect(Collectors.toList());
+ return names.stream();
+ }
+
@Override
void implClose() throws IOException {
- zf.close();
+ jf.close();
}
}
@@ -377,6 +423,17 @@ class ModuleReferences {
}
}
+ @Override
+ public Stream list() throws IOException {
+ ensureOpen();
+ // sym links not followed
+ return Files.find(dir, Integer.MAX_VALUE,
+ (path, attrs) -> attrs.isRegularFile())
+ .map(f -> dir.relativize(f)
+ .toString()
+ .replace(File.separatorChar, '/'));
+ }
+
@Override
public void close() {
closed = true;
diff --git a/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java b/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java
index 3e49c93f132..9fae75cb382 100644
--- a/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java
+++ b/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java
@@ -32,14 +32,21 @@ import java.io.UncheckedIOException;
import java.net.URI;
import java.net.URLConnection;
import java.nio.ByteBuffer;
+import java.util.ArrayDeque;
import java.util.Collections;
+import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
+import java.util.Spliterator;
+import java.util.function.Consumer;
import java.util.function.Supplier;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
import jdk.internal.jimage.ImageLocation;
import jdk.internal.jimage.ImageReader;
@@ -62,6 +69,8 @@ import jdk.internal.perf.PerfCounter;
class SystemModuleFinder implements ModuleFinder {
+ private static final JavaNetUriAccess JNUA = SharedSecrets.getJavaNetUriAccess();
+
private static final PerfCounter initTime
= PerfCounter.newPerfCounter("jdk.module.finder.jimage.initTime");
private static final PerfCounter moduleCount
@@ -73,8 +82,6 @@ class SystemModuleFinder implements ModuleFinder {
// ImageReader used to access all modules in the image
private static final ImageReader imageReader;
- private static final JavaNetUriAccess jnua = SharedSecrets.getJavaNetUriAccess();
-
// the set of modules in the run-time image
private static final Set modules;
@@ -170,8 +177,7 @@ class SystemModuleFinder implements ModuleFinder {
HashSupplier hash)
{
String mn = md.name();
-
- URI uri = jnua.create("jrt", "/".concat(mn));
+ URI uri = JNUA.create("jrt", "/".concat(mn));
Supplier readerSupplier = new Supplier<>() {
@Override
@@ -331,6 +337,15 @@ class SystemModuleFinder implements ModuleFinder {
ImageReader.releaseByteBuffer(bb);
}
+ @Override
+ public Stream list() throws IOException {
+ if (closed)
+ throw new IOException("ModuleReader is closed");
+
+ Spliterator s = new ModuleContentSpliterator(module);
+ return StreamSupport.stream(s, false);
+ }
+
@Override
public void close() {
// nothing else to do
@@ -338,4 +353,86 @@ class SystemModuleFinder implements ModuleFinder {
}
}
+ /**
+ * A Spliterator for traversing the resources of a module linked into the
+ * run-time image.
+ */
+ static class ModuleContentSpliterator implements Spliterator {
+ final String moduleRoot;
+ final Deque stack;
+ Iterator iterator;
+
+ ModuleContentSpliterator(String module) throws IOException {
+ moduleRoot = "/modules/" + module;
+ stack = new ArrayDeque<>();
+
+ // push the root node to the stack to get started
+ ImageReader.Node dir = imageReader.findNode(moduleRoot);
+ if (dir == null || !dir.isDirectory())
+ throw new IOException(moduleRoot + " not a directory");
+ stack.push(dir);
+ iterator = Collections.emptyIterator();
+ }
+
+ /**
+ * Returns the name of the next non-directory node or {@code null} if
+ * there are no remaining nodes to visit.
+ */
+ private String next() throws IOException {
+ for (;;) {
+ while (iterator.hasNext()) {
+ ImageReader.Node node = iterator.next();
+ String name = node.getName();
+ if (node.isDirectory()) {
+ // build node
+ ImageReader.Node dir = imageReader.findNode(name);
+ assert dir.isDirectory();
+ stack.push(dir);
+ } else {
+ // strip /modules/$MODULE/ prefix
+ return name.substring(moduleRoot.length() + 1);
+ }
+ }
+
+ if (stack.isEmpty()) {
+ return null;
+ } else {
+ ImageReader.Node dir = stack.poll();
+ assert dir.isDirectory();
+ iterator = dir.getChildren().iterator();
+ }
+ }
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer super String> action) {
+ String next;
+ try {
+ next = next();
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
+ }
+ if (next != null) {
+ action.accept(next);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public Spliterator trySplit() {
+ return null;
+ }
+
+ @Override
+ public int characteristics() {
+ return Spliterator.DISTINCT + Spliterator.NONNULL + Spliterator.IMMUTABLE;
+ }
+
+ @Override
+ public long estimateSize() {
+ return Long.MAX_VALUE;
+ }
+ }
}
diff --git a/jdk/src/java.base/share/classes/java/net/InetAddress.java b/jdk/src/java.base/share/classes/java/net/InetAddress.java
index b008b35260a..84457f30066 100644
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java
@@ -201,13 +201,13 @@ class InetAddress implements java.io.Serializable {
* Specify the address family: Internet Protocol, Version 4
* @since 1.4
*/
- static final int IPv4 = 1;
+ @Native static final int IPv4 = 1;
/**
* Specify the address family: Internet Protocol, Version 6
* @since 1.4
*/
- static final int IPv6 = 2;
+ @Native static final int IPv6 = 2;
/* Specify address family preference */
static transient final int preferIPv6Address;
diff --git a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java
index 1d3c24b7361..5b3c1237b06 100644
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java
@@ -26,6 +26,7 @@
package java.security;
import java.security.spec.AlgorithmParameterSpec;
+import java.util.Objects;
/**
* The {@code AlgorithmParameterGenerator} class is used to generate a
@@ -153,16 +154,19 @@ public class AlgorithmParameterGenerator {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new AlgorithmParameterGenerator object.
+ * @return the new {@code AlgorithmParameterGenerator} object
*
- * @exception NoSuchAlgorithmException if no Provider supports an
- * AlgorithmParameterGeneratorSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports an
+ * {@code AlgorithmParameterGeneratorSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static AlgorithmParameterGenerator getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
try {
Object[] objs = Security.getImpl(algorithm,
"AlgorithmParameterGenerator",
@@ -197,17 +201,20 @@ public class AlgorithmParameterGenerator {
*
* @param provider the string name of the Provider.
*
- * @return the new AlgorithmParameterGenerator object.
+ * @return the new {@code AlgorithmParameterGenerator} object
*
- * @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if an
+ * {@code AlgorithmParameterGeneratorSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
@@ -215,6 +222,7 @@ public class AlgorithmParameterGenerator {
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException
{
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (provider == null || provider.length() == 0)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm,
@@ -241,15 +249,19 @@ public class AlgorithmParameterGenerator {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @param provider the Provider object.
+ * @param provider the {@code Provider} object.
*
- * @return the new AlgorithmParameterGenerator object.
+ * @return the new {@code AlgorithmParameterGenerator} object
*
- * @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the specified provider is
+ * {@code null}
*
- * @exception IllegalArgumentException if the specified provider is null.
+ * @throws NoSuchAlgorithmException if an
+ * {@code AlgorithmParameterGeneratorSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -259,6 +271,7 @@ public class AlgorithmParameterGenerator {
Provider provider)
throws NoSuchAlgorithmException
{
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (provider == null)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm,
diff --git a/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java b/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java
index be8a2c91abf..e03361233a5 100644
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameters.java
@@ -28,6 +28,7 @@ package java.security;
import java.io.*;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.InvalidParameterSpecException;
+import java.util.Objects;
/**
* This class is used as an opaque representation of cryptographic parameters.
@@ -140,16 +141,19 @@ public class AlgorithmParameters {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new parameter object.
+ * @return the new parameter object
*
- * @exception NoSuchAlgorithmException if no Provider supports an
- * AlgorithmParametersSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports an
+ * {@code AlgorithmParametersSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static AlgorithmParameters getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
try {
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
(String)null);
@@ -184,17 +188,19 @@ public class AlgorithmParameters {
*
* @param provider the name of the provider.
*
- * @return the new parameter object.
+ * @return the new parameter object
*
- * @exception NoSuchAlgorithmException if an AlgorithmParametersSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if an {@code AlgorithmParametersSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
@@ -202,6 +208,7 @@ public class AlgorithmParameters {
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException
{
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (provider == null || provider.length() == 0)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
@@ -231,13 +238,16 @@ public class AlgorithmParameters {
*
* @param provider the name of the provider.
*
- * @return the new parameter object.
+ * @return the new parameter object
*
- * @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the provider is {@code null}
*
- * @exception IllegalArgumentException if the provider is null.
+ * @throws NoSuchAlgorithmException if an
+ * {@code AlgorithmParameterGeneratorSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -247,6 +257,7 @@ public class AlgorithmParameters {
Provider provider)
throws NoSuchAlgorithmException
{
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (provider == null)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
diff --git a/jdk/src/java.base/share/classes/java/security/KeyFactory.java b/jdk/src/java.base/share/classes/java/security/KeyFactory.java
index 5bbce1a3b74..4d297157ebc 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyFactory.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyFactory.java
@@ -167,16 +167,19 @@ public class KeyFactory {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new KeyFactory object.
+ * @return the new {@code KeyFactory} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * KeyFactorySpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code KeyFactorySpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static KeyFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
return new KeyFactory(algorithm);
}
@@ -200,22 +203,25 @@ public class KeyFactory {
*
* @param provider the name of the provider.
*
- * @return the new KeyFactory object.
+ * @return the new {@code KeyFactory} object
*
- * @exception NoSuchAlgorithmException if a KeyFactorySpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if a {@code KeyFactorySpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static KeyFactory getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("KeyFactory",
KeyFactorySpi.class, algorithm, provider);
return new KeyFactory((KeyFactorySpi)instance.impl,
@@ -239,13 +245,16 @@ public class KeyFactory {
*
* @param provider the provider.
*
- * @return the new KeyFactory object.
+ * @return the new {@code KeyFactory} object
*
- * @exception NoSuchAlgorithmException if a KeyFactorySpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the specified provider is
+ * {@code null}
*
- * @exception IllegalArgumentException if the specified provider is null.
+ * @throws NoSuchAlgorithmException if a {@code KeyFactorySpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -253,6 +262,7 @@ public class KeyFactory {
*/
public static KeyFactory getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("KeyFactory",
KeyFactorySpi.class, algorithm, provider);
return new KeyFactory((KeyFactorySpi)instance.impl,
diff --git a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java
index 3a241787329..10d2f067f83 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java
@@ -209,16 +209,19 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new KeyPairGenerator object.
+ * @return the new {@code KeyPairGenerator} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * KeyPairGeneratorSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code KeyPairGeneratorSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static KeyPairGenerator getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
List list =
GetInstance.getServices("KeyPairGenerator", algorithm);
Iterator t = list.iterator();
@@ -267,23 +270,26 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
*
* @param provider the string name of the provider.
*
- * @return the new KeyPairGenerator object.
+ * @return the new {@code KeyPairGenerator} object
*
- * @exception NoSuchAlgorithmException if a KeyPairGeneratorSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if a {@code KeyPairGeneratorSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static KeyPairGenerator getInstance(String algorithm,
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("KeyPairGenerator",
KeyPairGeneratorSpi.class, algorithm, provider);
return getInstance(instance, algorithm);
@@ -306,13 +312,16 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
*
* @param provider the provider.
*
- * @return the new KeyPairGenerator object.
+ * @return the new {@code KeyPairGenerator} object
*
- * @exception NoSuchAlgorithmException if a KeyPairGeneratorSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the specified provider is
+ * {@code null}
*
- * @exception IllegalArgumentException if the specified provider is null.
+ * @throws NoSuchAlgorithmException if a {@code KeyPairGeneratorSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -320,6 +329,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
*/
public static KeyPairGenerator getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("KeyPairGenerator",
KeyPairGeneratorSpi.class, algorithm, provider);
return getInstance(instance, algorithm);
diff --git a/jdk/src/java.base/share/classes/java/security/KeyStore.java b/jdk/src/java.base/share/classes/java/security/KeyStore.java
index 14da8cb9d4c..811422f73e5 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java
@@ -26,7 +26,6 @@
package java.security;
import java.io.*;
-import java.net.URI;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.security.cert.CertificateException;
@@ -855,17 +854,20 @@ public class KeyStore {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard keystore types.
*
- * @return a keystore object of the specified type.
+ * @return a keystore object of the specified type
*
- * @exception KeyStoreException if no Provider supports a
- * KeyStoreSpi implementation for the
- * specified type.
+ * @throws KeyStoreException if no {@code Provider} supports a
+ * {@code KeyStoreSpi} implementation for the
+ * specified type
+ *
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see Provider
*/
public static KeyStore getInstance(String type)
throws KeyStoreException
{
+ Objects.requireNonNull(type, "null type name");
try {
Object[] objs = Security.getImpl(type, "KeyStore", (String)null);
return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
@@ -895,23 +897,26 @@ public class KeyStore {
*
* @param provider the name of the provider.
*
- * @return a keystore object of the specified type.
+ * @return a keystore object of the specified type
*
- * @exception KeyStoreException if a KeyStoreSpi
- * implementation for the specified type is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws KeyStoreException if a {@code KeyStoreSpi}
+ * implementation for the specified type is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see Provider
*/
public static KeyStore getInstance(String type, String provider)
throws KeyStoreException, NoSuchProviderException
{
+ Objects.requireNonNull(type, "null type name");
if (provider == null || provider.length() == 0)
throw new IllegalArgumentException("missing provider");
try {
@@ -938,13 +943,16 @@ public class KeyStore {
*
* @param provider the provider.
*
- * @return a keystore object of the specified type.
+ * @return a keystore object of the specified type
*
- * @exception KeyStoreException if KeyStoreSpi
- * implementation for the specified type is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the specified provider is
+ * {@code null}
*
- * @exception IllegalArgumentException if the specified provider is null.
+ * @throws KeyStoreException if {@code KeyStoreSpi}
+ * implementation for the specified type is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see Provider
*
@@ -953,6 +961,7 @@ public class KeyStore {
public static KeyStore getInstance(String type, Provider provider)
throws KeyStoreException
{
+ Objects.requireNonNull(type, "null type name");
if (provider == null)
throw new IllegalArgumentException("missing provider");
try {
diff --git a/jdk/src/java.base/share/classes/java/security/MessageDigest.java b/jdk/src/java.base/share/classes/java/security/MessageDigest.java
index b6959f5db4f..dac789f1ab1 100644
--- a/jdk/src/java.base/share/classes/java/security/MessageDigest.java
+++ b/jdk/src/java.base/share/classes/java/security/MessageDigest.java
@@ -26,13 +26,8 @@
package java.security;
import java.util.*;
-import java.lang.*;
-import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.security.InvalidKeyException;
import java.nio.ByteBuffer;
import sun.security.util.Debug;
@@ -163,16 +158,20 @@ public abstract class MessageDigest extends MessageDigestSpi {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return a Message Digest object that implements the specified algorithm.
+ * @return a {@code MessageDigest} object that implements the
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * MessageDigestSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code MessageDigestSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static MessageDigest getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
try {
MessageDigest md;
Object[] objs = Security.getImpl(algorithm, "MessageDigest",
@@ -216,23 +215,27 @@ public abstract class MessageDigest extends MessageDigestSpi {
*
* @param provider the name of the provider.
*
- * @return a MessageDigest object that implements the specified algorithm.
+ * @return a {@code MessageDigest} object that implements the
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if a MessageDigestSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if a {@code MessageDigestSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static MessageDigest getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException
{
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (provider == null || provider.length() == 0)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider);
@@ -265,13 +268,17 @@ public abstract class MessageDigest extends MessageDigestSpi {
*
* @param provider the provider.
*
- * @return a MessageDigest object that implements the specified algorithm.
+ * @return a {@code MessageDigest} object that implements the
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if a MessageDigestSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the specified provider is
+ * {@code null}
*
- * @exception IllegalArgumentException if the specified provider is null.
+ * @throws NoSuchAlgorithmException if a {@code MessageDigestSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -281,6 +288,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
Provider provider)
throws NoSuchAlgorithmException
{
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (provider == null)
throw new IllegalArgumentException("missing provider");
Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider);
diff --git a/jdk/src/java.base/share/classes/java/security/Policy.java b/jdk/src/java.base/share/classes/java/security/Policy.java
index 33f766f3082..a0f22382a1c 100644
--- a/jdk/src/java.base/share/classes/java/security/Policy.java
+++ b/jdk/src/java.base/share/classes/java/security/Policy.java
@@ -29,6 +29,7 @@ package java.security;
import java.util.Enumeration;
import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.Objects;
import sun.security.jca.GetInstance;
import sun.security.util.Debug;
import sun.security.util.SecurityConstants;
@@ -372,26 +373,26 @@ public abstract class Policy {
*
* @param params parameters for the Policy, which may be null.
*
- * @return the new Policy object.
+ * @return the new {@code Policy} object
*
- * @exception SecurityException if the caller does not have permission
- * to get a Policy instance for the specified type.
+ * @throws IllegalArgumentException if the specified parameters
+ * are not understood by the {@code PolicySpi} implementation
+ * from the selected {@code Provider}
*
- * @exception NullPointerException if the specified type is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports
+ * a {@code PolicySpi} implementation for the specified type
*
- * @exception IllegalArgumentException if the specified parameters
- * are not understood by the PolicySpi implementation
- * from the selected Provider.
+ * @throws NullPointerException if {@code type} is {@code null}
*
- * @exception NoSuchAlgorithmException if no Provider supports a PolicySpi
- * implementation for the specified type.
+ * @throws SecurityException if the caller does not have permission
+ * to get a {@code Policy} instance for the specified type.
*
* @see Provider
* @since 1.6
*/
public static Policy getInstance(String type, Policy.Parameters params)
throws NoSuchAlgorithmException {
-
+ Objects.requireNonNull(type, "null type name");
checkPermission(type);
try {
GetInstance.Instance instance = GetInstance.getInstance("Policy",
@@ -428,23 +429,24 @@ public abstract class Policy {
*
* @param provider the provider.
*
- * @return the new Policy object.
+ * @return the new {@code Policy} object
*
- * @exception SecurityException if the caller does not have permission
- * to get a Policy instance for the specified type.
+ * @throws IllegalArgumentException if the specified provider
+ * is {@code null} or empty, or if the specified parameters are
+ * not understood by the {@code PolicySpi} implementation from
+ * the specified provider
*
- * @exception NullPointerException if the specified type is null.
+ * @throws NoSuchAlgorithmException if the specified provider does not
+ * support a {@code PolicySpi} implementation for the specified
+ * type
*
- * @exception IllegalArgumentException if the specified provider
- * is null or empty,
- * or if the specified parameters are not understood by
- * the PolicySpi implementation from the specified provider.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NullPointerException if {@code type} is {@code null}
*
- * @exception NoSuchAlgorithmException if the specified provider does not
- * support a PolicySpi implementation for the specified type.
+ * @throws SecurityException if the caller does not have permission
+ * to get a {@code Policy} instance for the specified type
*
* @see Provider
* @since 1.6
@@ -454,6 +456,7 @@ public abstract class Policy {
String provider)
throws NoSuchProviderException, NoSuchAlgorithmException {
+ Objects.requireNonNull(type, "null type name");
if (provider == null || provider.length() == 0) {
throw new IllegalArgumentException("missing provider");
}
@@ -492,19 +495,21 @@ public abstract class Policy {
*
* @param provider the Provider.
*
- * @return the new Policy object.
+ * @return the new {@code Policy} object
*
- * @exception SecurityException if the caller does not have permission
- * to get a Policy instance for the specified type.
+ * @throws IllegalArgumentException if the specified {@code Provider}
+ * is {@code null}, or if the specified parameters are not
+ * understood by the {@code PolicySpi} implementation from the
+ * specified {@code Provider}
*
- * @exception NullPointerException if the specified type is null.
+ * @throws NoSuchAlgorithmException if the specified {@code Provider}
+ * does not support a {@code PolicySpi} implementation for
+ * the specified type
*
- * @exception IllegalArgumentException if the specified Provider is null,
- * or if the specified parameters are not understood by
- * the PolicySpi implementation from the specified Provider.
+ * @throws NullPointerException if {@code type} is {@code null}
*
- * @exception NoSuchAlgorithmException if the specified Provider does not
- * support a PolicySpi implementation for the specified type.
+ * @throws SecurityException if the caller does not have permission
+ * to get a {@code Policy} instance for the specified type
*
* @see Provider
* @since 1.6
@@ -514,6 +519,7 @@ public abstract class Policy {
Provider provider)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(type, "null type name");
if (provider == null) {
throw new IllegalArgumentException("missing provider");
}
diff --git a/jdk/src/java.base/share/classes/java/security/SecureRandom.java b/jdk/src/java.base/share/classes/java/security/SecureRandom.java
index f8832f049ce..8449613ba66 100644
--- a/jdk/src/java.base/share/classes/java/security/SecureRandom.java
+++ b/jdk/src/java.base/share/classes/java/security/SecureRandom.java
@@ -303,11 +303,13 @@ public class SecureRandom extends java.util.Random {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard RNG algorithm names.
*
- * @return the new {@code SecureRandom} object.
+ * @return the new {@code SecureRandom} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * {@code SecureRandomSpi} implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code SecureRandomSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -315,6 +317,7 @@ public class SecureRandom extends java.util.Random {
*/
public static SecureRandom getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("SecureRandom",
SecureRandomSpi.class, algorithm);
return new SecureRandom((SecureRandomSpi)instance.impl,
@@ -341,17 +344,19 @@ public class SecureRandom extends java.util.Random {
*
* @param provider the name of the provider.
*
- * @return the new {@code SecureRandom} object.
+ * @return the new {@code SecureRandom} object
+ *
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
* @throws NoSuchAlgorithmException if a {@code SecureRandomSpi}
* implementation for the specified algorithm is not
- * available from the specified provider.
+ * available from the specified provider
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @throws IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -359,6 +364,7 @@ public class SecureRandom extends java.util.Random {
*/
public static SecureRandom getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("SecureRandom",
SecureRandomSpi.class, algorithm, provider);
return new SecureRandom((SecureRandomSpi)instance.impl,
@@ -382,13 +388,16 @@ public class SecureRandom extends java.util.Random {
*
* @param provider the provider.
*
- * @return the new {@code SecureRandom} object.
+ * @return the new {@code SecureRandom} object
+ *
+ * @throws IllegalArgumentException if the specified provider is
+ * {@code null}
*
* @throws NoSuchAlgorithmException if a {@code SecureRandomSpi}
* implementation for the specified algorithm is not available
- * from the specified {@code Provider} object.
+ * from the specified {@code Provider} object
*
- * @throws IllegalArgumentException if the specified provider is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -396,6 +405,7 @@ public class SecureRandom extends java.util.Random {
*/
public static SecureRandom getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("SecureRandom",
SecureRandomSpi.class, algorithm, provider);
return new SecureRandom((SecureRandomSpi)instance.impl,
@@ -433,13 +443,16 @@ public class SecureRandom extends java.util.Random {
* @param params the {@code SecureRandomParameters}
* the newly created {@code SecureRandom} object must support.
*
- * @return the new {@code SecureRandom} object.
+ * @return the new {@code SecureRandom} object
+ *
+ * @throws IllegalArgumentException if the specified params is
+ * {@code null}
*
* @throws NoSuchAlgorithmException if no Provider supports a
* {@code SecureRandomSpi} implementation for the specified
- * algorithm and parameters.
+ * algorithm and parameters
*
- * @throws IllegalArgumentException if the specified params is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -448,6 +461,7 @@ public class SecureRandom extends java.util.Random {
public static SecureRandom getInstance(
String algorithm, SecureRandomParameters params)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (params == null) {
throw new IllegalArgumentException("params cannot be null");
}
@@ -481,17 +495,19 @@ public class SecureRandom extends java.util.Random {
*
* @param provider the name of the provider.
*
- * @return the new {@code SecureRandom} object.
+ * @return the new {@code SecureRandom} object
+ *
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty, or params is {@code null}
*
* @throws NoSuchAlgorithmException if the specified provider does not
* support a {@code SecureRandomSpi} implementation for the
- * specified algorithm and parameters.
+ * specified algorithm and parameters
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @throws IllegalArgumentException if the provider name is null
- * or empty, or params is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -500,6 +516,7 @@ public class SecureRandom extends java.util.Random {
public static SecureRandom getInstance(String algorithm,
SecureRandomParameters params, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (params == null) {
throw new IllegalArgumentException("params cannot be null");
}
@@ -531,14 +548,16 @@ public class SecureRandom extends java.util.Random {
*
* @param provider the provider.
*
- * @return the new {@code SecureRandom} object.
+ * @return the new {@code SecureRandom} object
+ *
+ * @throws IllegalArgumentException if the specified provider or params
+ * is {@code null}
*
* @throws NoSuchAlgorithmException if the specified provider does not
* support a {@code SecureRandomSpi} implementation for the
- * specified algorithm and parameters.
+ * specified algorithm and parameters
*
- * @throws IllegalArgumentException if the specified provider or params
- * is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -547,6 +566,7 @@ public class SecureRandom extends java.util.Random {
public static SecureRandom getInstance(String algorithm,
SecureRandomParameters params, Provider provider)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (params == null) {
throw new IllegalArgumentException("params cannot be null");
}
diff --git a/jdk/src/java.base/share/classes/java/security/Signature.java b/jdk/src/java.base/share/classes/java/security/Signature.java
index 9bfe4667df6..df326f4a280 100644
--- a/jdk/src/java.base/share/classes/java/security/Signature.java
+++ b/jdk/src/java.base/share/classes/java/security/Signature.java
@@ -213,16 +213,19 @@ public abstract class Signature extends SignatureSpi {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new Signature object.
+ * @return the new {@code Signature} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * Signature implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code Signature} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static Signature getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
List list;
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
list = GetInstance.getServices(rsaIds);
@@ -335,22 +338,25 @@ public abstract class Signature extends SignatureSpi {
*
* @param provider the name of the provider.
*
- * @return the new Signature object.
+ * @return the new {@code Signature} object
*
- * @exception NoSuchAlgorithmException if a SignatureSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if a {@code SignatureSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*/
public static Signature getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
// exception compatibility with existing code
if ((provider == null) || (provider.length() == 0)) {
@@ -385,13 +391,15 @@ public abstract class Signature extends SignatureSpi {
*
* @param provider the provider.
*
- * @return the new Signature object.
+ * @return the new {@code Signature} object
*
- * @exception NoSuchAlgorithmException if a SignatureSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the provider is {@code null}
*
- * @exception IllegalArgumentException if the provider is null.
+ * @throws NoSuchAlgorithmException if a {@code SignatureSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see Provider
*
@@ -399,6 +407,7 @@ public abstract class Signature extends SignatureSpi {
*/
public static Signature getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
// exception compatibility with existing code
if (provider == null) {
diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java b/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java
index b9100826c09..12f608816be 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java
@@ -32,7 +32,7 @@ import java.security.NoSuchProviderException;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
-import sun.security.util.Debug;
+import java.util.Objects;
import sun.security.jca.*;
import sun.security.jca.GetInstance.Instance;
@@ -157,16 +157,19 @@ public class CertPathBuilder {
* for information about standard algorithm names.
*
* @return a {@code CertPathBuilder} object that implements the
- * specified algorithm.
+ * specified algorithm
*
- * @throws NoSuchAlgorithmException if no Provider supports a
- * CertPathBuilderSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code CertPathBuilderSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static CertPathBuilder getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("CertPathBuilder",
CertPathBuilderSpi.class, algorithm);
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
@@ -194,22 +197,25 @@ public class CertPathBuilder {
* @param provider the name of the provider.
*
* @return a {@code CertPathBuilder} object that implements the
- * specified algorithm.
+ * specified algorithm
*
- * @throws NoSuchAlgorithmException if a CertPathBuilderSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the {@code provider} is
+ * {@code null} or empty
+ *
+ * @throws NoSuchAlgorithmException if a {@code CertPathBuilderSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @exception IllegalArgumentException if the {@code provider} is
- * null or empty.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static CertPathBuilder getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("CertPathBuilder",
CertPathBuilderSpi.class, algorithm, provider);
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
@@ -234,19 +240,22 @@ public class CertPathBuilder {
* @param provider the provider.
*
* @return a {@code CertPathBuilder} object that implements the
- * specified algorithm.
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if a CertPathBuilderSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the {@code provider} is
+ * {@code null}
*
- * @exception IllegalArgumentException if the {@code provider} is
- * null.
+ * @throws NoSuchAlgorithmException if a {@code CertPathBuilderSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static CertPathBuilder getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("CertPathBuilder",
CertPathBuilderSpi.class, algorithm, provider);
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java b/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java
index be5bd77fd96..298923d84a2 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java
@@ -32,7 +32,7 @@ import java.security.NoSuchProviderException;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
-import sun.security.util.Debug;
+import java.util.Objects;
import sun.security.jca.*;
import sun.security.jca.GetInstance.Instance;
@@ -158,16 +158,19 @@ public class CertPathValidator {
* for information about standard algorithm names.
*
* @return a {@code CertPathValidator} object that implements the
- * specified algorithm.
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * CertPathValidatorSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code CertPathValidatorSpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static CertPathValidator getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("CertPathValidator",
CertPathValidatorSpi.class, algorithm);
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
@@ -195,23 +198,26 @@ public class CertPathValidator {
* @param provider the name of the provider.
*
* @return a {@code CertPathValidator} object that implements the
- * specified algorithm.
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if a CertPathValidatorSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the {@code provider} is
+ * {@code null} or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if a {@code CertPathValidatorSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the {@code provider} is
- * null or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static CertPathValidator getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("CertPathValidator",
CertPathValidatorSpi.class, algorithm, provider);
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
@@ -236,19 +242,22 @@ public class CertPathValidator {
* @param provider the provider.
*
* @return a {@code CertPathValidator} object that implements the
- * specified algorithm.
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if a CertPathValidatorSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the {@code provider} is
+ * {@code null}
*
- * @exception IllegalArgumentException if the {@code provider} is
- * null.
+ * @throws NoSuchAlgorithmException if a {@code CertPathValidatorSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified Provider object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static CertPathValidator getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = GetInstance.getInstance("CertPathValidator",
CertPathValidatorSpi.class, algorithm, provider);
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertStore.java b/jdk/src/java.base/share/classes/java/security/cert/CertStore.java
index dcf7b922471..e62d39f27b0 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/CertStore.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertStore.java
@@ -33,6 +33,7 @@ import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import java.util.Collection;
+import java.util.Objects;
import sun.security.jca.*;
import sun.security.jca.GetInstance.Instance;
@@ -218,20 +219,23 @@ public class CertStore {
* @param params the initialization parameters (may be {@code null}).
*
* @return a {@code CertStore} object that implements the specified
- * {@code CertStore} type.
- *
- * @throws NoSuchAlgorithmException if no Provider supports a
- * CertStoreSpi implementation for the specified type.
+ * {@code CertStore} type
*
* @throws InvalidAlgorithmParameterException if the specified
- * initialization parameters are inappropriate for this
- * {@code CertStore}.
+ * initialization parameters are inappropriate for this
+ * {@code CertStore}
+ *
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code CertStoreSpi} implementation for the specified type
+ *
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see java.security.Provider
*/
public static CertStore getInstance(String type, CertStoreParameters params)
throws InvalidAlgorithmParameterException,
NoSuchAlgorithmException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params);
@@ -243,7 +247,8 @@ public class CertStore {
}
private static CertStore handleException(NoSuchAlgorithmException e)
- throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
+ throws NoSuchAlgorithmException,
+ InvalidAlgorithmParameterException {
Throwable cause = e.getCause();
if (cause instanceof InvalidAlgorithmParameterException) {
throw (InvalidAlgorithmParameterException)cause;
@@ -280,21 +285,23 @@ public class CertStore {
* @param provider the name of the provider.
*
* @return a {@code CertStore} object that implements the
- * specified type.
+ * specified type
*
- * @throws NoSuchAlgorithmException if a CertStoreSpi
- * implementation for the specified type is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the {@code provider} is
+ * {@code null} or empty
*
* @throws InvalidAlgorithmParameterException if the specified
- * initialization parameters are inappropriate for this
- * {@code CertStore}.
+ * initialization parameters are inappropriate for this
+ * {@code CertStore}
+ *
+ * @throws NoSuchAlgorithmException if a {@code CertStoreSpi}
+ * implementation for the specified type is not
+ * available from the specified provider
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @exception IllegalArgumentException if the {@code provider} is
- * null or empty.
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see java.security.Provider
*/
@@ -302,6 +309,7 @@ public class CertStore {
CertStoreParameters params, String provider)
throws InvalidAlgorithmParameterException,
NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params, provider);
@@ -338,24 +346,27 @@ public class CertStore {
* @param provider the provider.
*
* @return a {@code CertStore} object that implements the
- * specified type.
+ * specified type
*
- * @exception NoSuchAlgorithmException if a CertStoreSpi
- * implementation for the specified type is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the {@code provider} is
+ * null
*
* @throws InvalidAlgorithmParameterException if the specified
- * initialization parameters are inappropriate for this
- * {@code CertStore}
+ * initialization parameters are inappropriate for this
+ * {@code CertStore}
*
- * @exception IllegalArgumentException if the {@code provider} is
- * null.
+ * @throws NoSuchAlgorithmException if a {@code CertStoreSpi}
+ * implementation for the specified type is not available
+ * from the specified Provider object
+ *
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see java.security.Provider
*/
public static CertStore getInstance(String type, CertStoreParameters params,
Provider provider) throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertStore",
CertStoreSpi.class, type, params, provider);
diff --git a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java
index e2680e90c30..e63c3b403d4 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertificateFactory.java
@@ -29,10 +29,9 @@ import java.io.InputStream;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Objects;
import java.security.Provider;
import java.security.Security;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
@@ -177,16 +176,19 @@ public class CertificateFactory {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard certificate types.
*
- * @return a certificate factory object for the specified type.
+ * @return a certificate factory object for the specified type
*
- * @exception CertificateException if no Provider supports a
- * CertificateFactorySpi implementation for the
- * specified type.
+ * @throws CertificateException if no {@code Provider} supports a
+ * {@code CertificateFactorySpi} implementation for the
+ * specified type
+ *
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see java.security.Provider
*/
public static final CertificateFactory getInstance(String type)
throws CertificateException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertificateFactory",
CertificateFactorySpi.class, type);
@@ -217,23 +219,26 @@ public class CertificateFactory {
*
* @param provider the name of the provider.
*
- * @return a certificate factory object for the specified type.
+ * @return a certificate factory object for the specified type
*
- * @exception CertificateException if a CertificateFactorySpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws CertificateException if a {@code CertificateFactorySpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
*
- * @exception IllegalArgumentException if the provider name is null
- * or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see java.security.Provider
*/
public static final CertificateFactory getInstance(String type,
String provider) throws CertificateException,
NoSuchProviderException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertificateFactory",
CertificateFactorySpi.class, type, provider);
@@ -260,14 +265,16 @@ public class CertificateFactory {
* for information about standard certificate types.
* @param provider the provider.
*
- * @return a certificate factory object for the specified type.
+ * @return a certificate factory object for the specified type
*
- * @exception CertificateException if a CertificateFactorySpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws CertificateException if a {@code CertificateFactorySpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
*
- * @exception IllegalArgumentException if the {@code provider} is
- * null.
+ * @throws IllegalArgumentException if the {@code provider} is
+ * {@code null}
+ *
+ * @throws NullPointerException if {@code type} is {@code null}
*
* @see java.security.Provider
*
@@ -275,6 +282,7 @@ public class CertificateFactory {
*/
public static final CertificateFactory getInstance(String type,
Provider provider) throws CertificateException {
+ Objects.requireNonNull(type, "null type name");
try {
Instance instance = GetInstance.getInstance("CertificateFactory",
CertificateFactorySpi.class, type, provider);
diff --git a/jdk/src/java.base/share/classes/java/util/Scanner.java b/jdk/src/java.base/share/classes/java/util/Scanner.java
index a6b3d8cb56f..df075844364 100644
--- a/jdk/src/java.base/share/classes/java/util/Scanner.java
+++ b/jdk/src/java.base/share/classes/java/util/Scanner.java
@@ -1267,6 +1267,9 @@ public final class Scanner implements Iterator, Closeable {
// The next operation should occur in the specified radix but
// the default is left untouched.
private void setRadix(int radix) {
+ if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX))
+ throw new IllegalArgumentException("radix:"+radix);
+
if (this.radix != radix) {
// Force rebuilding and recompilation of radix dependent patterns
integerPattern = null;
@@ -1811,10 +1814,15 @@ public final class Scanner implements Iterator, Closeable {
* interpreted as a byte value in the specified radix using the
* {@link #nextByte} method. The scanner does not advance past any input.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as a byte value
* @return true if and only if this scanner's next token is a valid
* byte value
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public boolean hasNextByte(int radix) {
setRadix(radix);
@@ -1869,6 +1877,10 @@ public final class Scanner implements Iterator, Closeable {
* {@link Byte#parseByte(String, int) Byte.parseByte} with the
* specified radix.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as a byte value
* @return the {@code byte} scanned from the input
* @throws InputMismatchException
@@ -1876,6 +1888,7 @@ public final class Scanner implements Iterator, Closeable {
* regular expression, or is out of range
* @throws NoSuchElementException if input is exhausted
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public byte nextByte(int radix) {
// Check cached result
@@ -1917,10 +1930,15 @@ public final class Scanner implements Iterator, Closeable {
* interpreted as a short value in the specified radix using the
* {@link #nextShort} method. The scanner does not advance past any input.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as a short value
* @return true if and only if this scanner's next token is a valid
* short value in the specified radix
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public boolean hasNextShort(int radix) {
setRadix(radix);
@@ -1975,6 +1993,10 @@ public final class Scanner implements Iterator, Closeable {
* {@link Short#parseShort(String, int) Short.parseShort} with the
* specified radix.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as a short value
* @return the {@code short} scanned from the input
* @throws InputMismatchException
@@ -1982,6 +2004,7 @@ public final class Scanner implements Iterator, Closeable {
* regular expression, or is out of range
* @throws NoSuchElementException if input is exhausted
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public short nextShort(int radix) {
// Check cached result
@@ -2023,10 +2046,15 @@ public final class Scanner implements Iterator, Closeable {
* interpreted as an int value in the specified radix using the
* {@link #nextInt} method. The scanner does not advance past any input.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as an int value
* @return true if and only if this scanner's next token is a valid
* int value
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public boolean hasNextInt(int radix) {
setRadix(radix);
@@ -2105,6 +2133,10 @@ public final class Scanner implements Iterator, Closeable {
* {@link Integer#parseInt(String, int) Integer.parseInt} with the
* specified radix.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as an int value
* @return the {@code int} scanned from the input
* @throws InputMismatchException
@@ -2112,6 +2144,7 @@ public final class Scanner implements Iterator, Closeable {
* regular expression, or is out of range
* @throws NoSuchElementException if input is exhausted
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public int nextInt(int radix) {
// Check cached result
@@ -2153,10 +2186,15 @@ public final class Scanner implements Iterator, Closeable {
* interpreted as a long value in the specified radix using the
* {@link #nextLong} method. The scanner does not advance past any input.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as a long value
* @return true if and only if this scanner's next token is a valid
* long value
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public boolean hasNextLong(int radix) {
setRadix(radix);
@@ -2211,6 +2249,10 @@ public final class Scanner implements Iterator, Closeable {
* {@link Long#parseLong(String, int) Long.parseLong} with the
* specified radix.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as an int value
* @return the {@code long} scanned from the input
* @throws InputMismatchException
@@ -2218,6 +2260,7 @@ public final class Scanner implements Iterator, Closeable {
* regular expression, or is out of range
* @throws NoSuchElementException if input is exhausted
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public long nextLong(int radix) {
// Check cached result
@@ -2450,10 +2493,15 @@ public final class Scanner implements Iterator, Closeable {
* the {@link #nextBigInteger} method. The scanner does not advance past
* any input.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token as an integer
* @return true if and only if this scanner's next token is a valid
* {@code BigInteger}
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public boolean hasNextBigInteger(int radix) {
setRadix(radix);
@@ -2504,6 +2552,10 @@ public final class Scanner implements Iterator, Closeable {
* java.math.BigInteger#BigInteger(java.lang.String)
* BigInteger(String, int)} constructor with the specified radix.
*
+ * If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
+ * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
+ * {@code IllegalArgumentException} is thrown.
+ *
* @param radix the radix used to interpret the token
* @return the {@code BigInteger} scanned from the input
* @throws InputMismatchException
@@ -2511,6 +2563,7 @@ public final class Scanner implements Iterator, Closeable {
* regular expression, or is out of range
* @throws NoSuchElementException if the input is exhausted
* @throws IllegalStateException if this scanner is closed
+ * @throws IllegalArgumentException if the radix is out of range
*/
public BigInteger nextBigInteger(int radix) {
// Check cached result
diff --git a/jdk/src/java.base/share/classes/java/util/stream/Collectors.java b/jdk/src/java.base/share/classes/java/util/stream/Collectors.java
index fd7b0a477fa..aaa8c465966 100644
--- a/jdk/src/java.base/share/classes/java/util/stream/Collectors.java
+++ b/jdk/src/java.base/share/classes/java/util/stream/Collectors.java
@@ -508,7 +508,7 @@ public final class Collectors {
* transformation. For example, one could adapt the {@link #toList()}
* collector to always produce an immutable list with:
* {@code
- * List people
+ * List list
* = people.stream().collect(collectingAndThen(toList(), Collections::unmodifiableList));
* }
*
diff --git a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
index 497069cd7fc..4c3ba78f676 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
@@ -493,21 +493,24 @@ public class Cipher {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard transformation names.
*
- * @return a cipher that implements the requested transformation.
+ * @return a cipher that implements the requested transformation
*
- * @exception NoSuchAlgorithmException if {@code transformation}
- * is null, empty, in an invalid format,
- * or if no Provider supports a CipherSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if {@code transformation}
+ * is {@code null}, empty, in an invalid format,
+ * or if no {@code Provider} supports a {@code CipherSpi}
+ * implementation for the specified algorithm
*
- * @exception NoSuchPaddingException if {@code transformation}
- * contains a padding scheme that is not available.
+ * @throws NoSuchPaddingException if {@code transformation}
+ * contains a padding scheme that is not available
*
* @see java.security.Provider
*/
public static final Cipher getInstance(String transformation)
throws NoSuchAlgorithmException, NoSuchPaddingException
{
+ if ((transformation == null) || transformation.equals("")) {
+ throw new NoSuchAlgorithmException("Null or empty transformation");
+ }
List transforms = getTransforms(transformation);
List cipherServices = new ArrayList<>(transforms.size());
for (Transform transform : transforms) {
@@ -570,21 +573,22 @@ public class Cipher {
*
* @param provider the name of the provider.
*
- * @return a cipher that implements the requested transformation.
+ * @return a cipher that implements the requested transformation
*
- * @exception NoSuchAlgorithmException if {@code transformation}
- * is null, empty, in an invalid format,
- * or if a CipherSpi implementation for the specified algorithm
- * is not available from the specified provider.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null} or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if {@code transformation}
+ * is {@code null}, empty, in an invalid format,
+ * or if a {@code CipherSpi} implementation for the
+ * specified algorithm is not available from the specified
+ * provider
*
- * @exception NoSuchPaddingException if {@code transformation}
- * contains a padding scheme that is not available.
+ * @throws NoSuchPaddingException if {@code transformation}
+ * contains a padding scheme that is not available
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
*
* @see java.security.Provider
*/
@@ -593,6 +597,9 @@ public class Cipher {
throws NoSuchAlgorithmException, NoSuchProviderException,
NoSuchPaddingException
{
+ if ((transformation == null) || transformation.equals("")) {
+ throw new NoSuchAlgorithmException("Null or empty transformation");
+ }
if ((provider == null) || (provider.length() == 0)) {
throw new IllegalArgumentException("Missing provider");
}
@@ -622,18 +629,19 @@ public class Cipher {
*
* @param provider the provider.
*
- * @return a cipher that implements the requested transformation.
+ * @return a cipher that implements the requested transformation
*
- * @exception NoSuchAlgorithmException if {@code transformation}
- * is null, empty, in an invalid format,
- * or if a CipherSpi implementation for the specified algorithm
- * is not available from the specified Provider object.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null}
*
- * @exception NoSuchPaddingException if {@code transformation}
- * contains a padding scheme that is not available.
+ * @throws NoSuchAlgorithmException if {@code transformation}
+ * is {@code null}, empty, in an invalid format,
+ * or if a {@code CipherSpi} implementation for the
+ * specified algorithm is not available from the specified
+ * {@code Provider} object
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null.
+ * @throws NoSuchPaddingException if {@code transformation}
+ * contains a padding scheme that is not available
*
* @see java.security.Provider
*/
@@ -641,6 +649,9 @@ public class Cipher {
Provider provider)
throws NoSuchAlgorithmException, NoSuchPaddingException
{
+ if ((transformation == null) || transformation.equals("")) {
+ throw new NoSuchAlgorithmException("Null or empty transformation");
+ }
if (provider == null) {
throw new IllegalArgumentException("Missing provider");
}
diff --git a/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java b/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java
index 45d14027200..cf19807f2dc 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/ExemptionMechanism.java
@@ -34,6 +34,7 @@ import java.security.NoSuchProviderException;
import java.security.InvalidKeyException;
import java.security.InvalidAlgorithmParameterException;
import java.security.spec.AlgorithmParameterSpec;
+import java.util.Objects;
import sun.security.jca.GetInstance.Instance;
@@ -128,19 +129,19 @@ public class ExemptionMechanism {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard exemption mechanism names.
*
- * @return the new ExemptionMechanism
object.
+ * @return the new {@code ExemptionMechanism} object
*
- * @exception NullPointerException if algorithm
- * is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports an
+ * {@code ExemptionMechanismSpi} implementation for the
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if no Provider supports an
- * ExemptionMechanismSpi implementation for the
- * specified algorithm.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final ExemptionMechanism getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
ExemptionMechanismSpi.class, algorithm);
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
@@ -169,26 +170,26 @@ public class ExemptionMechanism {
*
* @param provider the name of the provider.
*
- * @return the new ExemptionMechanism
object.
+ * @return the new {@code ExemptionMechanism} object
*
- * @exception NullPointerException if algorithm
- * is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null} or empty
*
- * @exception NoSuchAlgorithmException if an ExemptionMechanismSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
*
- * @exception IllegalArgumentException if the provider
- * is null or empty.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final ExemptionMechanism getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
ExemptionMechanismSpi.class, algorithm, provider);
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
@@ -213,22 +214,22 @@ public class ExemptionMechanism {
*
* @param provider the provider.
*
- * @return the new ExemptionMechanism
object.
+ * @return the new {@code ExemptionMechanism} object
*
- * @exception NullPointerException if algorithm
- * is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is null
*
- * @exception NoSuchAlgorithmException if an ExemptionMechanismSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider object}
*
- * @exception IllegalArgumentException if the provider
- * is null.
+ * @exception NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final ExemptionMechanism getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
ExemptionMechanismSpi.class, algorithm, provider);
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
diff --git a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java
index dd8057ab485..be333ff1eb7 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java
@@ -165,19 +165,19 @@ public class KeyAgreement {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new {@code KeyAgreement} object.
+ * @return the new {@code KeyAgreement} object
*
- * @exception NullPointerException if the specified algorithm
- * is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code KeyAgreementSpi} implementation for the
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * KeyAgreementSpi implementation for the
- * specified algorithm.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
List services =
GetInstance.getServices("KeyAgreement", algorithm);
// make sure there is at least one service from a signed provider
@@ -214,26 +214,26 @@ public class KeyAgreement {
*
* @param provider the name of the provider.
*
- * @return the new {@code KeyAgreement} object.
+ * @return the new {@code KeyAgreement} object
*
- * @exception NullPointerException if the specified algorithm
- * is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null} or empty
*
- * @exception NoSuchAlgorithmException if a KeyAgreementSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws NoSuchAlgorithmException if a {@code KeyAgreementSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null or empty.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
return new KeyAgreement((KeyAgreementSpi)instance.impl,
@@ -258,22 +258,22 @@ public class KeyAgreement {
*
* @param provider the provider.
*
- * @return the new {@code KeyAgreement} object.
+ * @return the new {@code KeyAgreement} object
*
- * @exception NullPointerException if the specified algorithm
- * is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null}
*
- * @exception NoSuchAlgorithmException if a KeyAgreementSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws NoSuchAlgorithmException if a {@code KeyAgreementSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified Provider object
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
return new KeyAgreement((KeyAgreementSpi)instance.impl,
diff --git a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java
index 0719699d6f8..a5277d8bb6f 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java
@@ -216,18 +216,19 @@ public class KeyGenerator {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new {@code KeyGenerator} object.
+ * @return the new {@code KeyGenerator} object
*
- * @exception NullPointerException if the specified algorithm is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code KeyGeneratorSpi} implementation for the
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * KeyGeneratorSpi implementation for the
- * specified algorithm.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyGenerator getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
return new KeyGenerator(algorithm);
}
@@ -251,25 +252,26 @@ public class KeyGenerator {
*
* @param provider the name of the provider.
*
- * @return the new {@code KeyGenerator} object.
+ * @return the new {@code KeyGenerator} object
*
- * @exception NullPointerException if the specified algorithm is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null} or empty
*
- * @exception NoSuchAlgorithmException if a KeyGeneratorSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws NoSuchAlgorithmException if a {@code KeyGeneratorSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null or empty.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyGenerator getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance("KeyGenerator",
KeyGeneratorSpi.class, algorithm, provider);
return new KeyGenerator((KeyGeneratorSpi)instance.impl,
@@ -293,21 +295,22 @@ public class KeyGenerator {
*
* @param provider the provider.
*
- * @return the new {@code KeyGenerator} object.
+ * @return the new {@code KeyGenerator} object
*
- * @exception NullPointerException if the specified algorithm is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null}
*
- * @exception NoSuchAlgorithmException if a KeyGeneratorSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws NoSuchAlgorithmException if a {@code KeyGeneratorSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyGenerator getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance("KeyGenerator",
KeyGeneratorSpi.class, algorithm, provider);
return new KeyGenerator((KeyGeneratorSpi)instance.impl,
diff --git a/jdk/src/java.base/share/classes/javax/crypto/Mac.java b/jdk/src/java.base/share/classes/javax/crypto/Mac.java
index 2d793ca45d7..97cd19a197a 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/Mac.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/Mac.java
@@ -166,16 +166,18 @@ public class Mac implements Cloneable {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new {@code Mac} object.
+ * @return the new {@code Mac} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * MacSpi implementation for the
- * specified algorithm.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code MacSpi} implementation for the specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final Mac getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
List services = GetInstance.getServices("Mac", algorithm);
// make sure there is at least one service from a signed provider
Iterator t = services.iterator();
@@ -210,22 +212,25 @@ public class Mac implements Cloneable {
*
* @param provider the name of the provider.
*
- * @return the new {@code Mac} object.
+ * @return the new {@code Mac} object
*
- * @exception NoSuchAlgorithmException if a MacSpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null} or empty
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NoSuchAlgorithmException if a {@code MacSpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null or empty.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final Mac getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance
("Mac", MacSpi.class, algorithm, provider);
return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
@@ -248,19 +253,22 @@ public class Mac implements Cloneable {
*
* @param provider the provider.
*
- * @return the new {@code Mac} object.
+ * @return the new {@code Mac} object
*
- * @exception NoSuchAlgorithmException if a MacSpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the {@code provider} is
+ * {@code null}
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null.
+ * @throws NoSuchAlgorithmException if a {@code MacSpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final Mac getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance
("Mac", MacSpi.class, algorithm, provider);
return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
diff --git a/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java b/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java
index 091e08ac025..cadf2302d20 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/SecretKeyFactory.java
@@ -152,19 +152,19 @@ public class SecretKeyFactory {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
*
- * @return the new {@code SecretKeyFactory} object.
+ * @return the new {@code SecretKeyFactory} object
*
- * @exception NullPointerException if the specified algorithm
- * is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code SecretKeyFactorySpi} implementation for the
+ * specified algorithm
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * SecretKeyFactorySpi implementation for the
- * specified algorithm.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final SecretKeyFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
return new SecretKeyFactory(algorithm);
}
@@ -189,26 +189,26 @@ public class SecretKeyFactory {
*
* @param provider the name of the provider.
*
- * @return the new {@code SecretKeyFactory} object.
+ * @return the new {@code SecretKeyFactory} object
*
- * @exception NoSuchAlgorithmException if a SecretKeyFactorySpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null} or empty
*
- * @exception NullPointerException if the specified algorithm
- * is null.
+ * @throws NoSuchAlgorithmException if a {@code SecretKeyFactorySpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null or empty.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final SecretKeyFactory getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance("SecretKeyFactory",
SecretKeyFactorySpi.class, algorithm, provider);
return new SecretKeyFactory((SecretKeyFactorySpi)instance.impl,
@@ -233,22 +233,22 @@ public class SecretKeyFactory {
*
* @param provider the provider.
*
- * @return the new {@code SecretKeyFactory} object.
+ * @return the new {@code SecretKeyFactory} object
*
- * @exception NullPointerException if the specified algorithm
- * is null.
+ * @throws IllegalArgumentException if the {@code provider}
+ * is {@code null}
*
- * @exception NoSuchAlgorithmException if a SecretKeyFactorySpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws NoSuchAlgorithmException if a {@code SecretKeyFactorySpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
*
- * @exception IllegalArgumentException if the {@code provider}
- * is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final SecretKeyFactory getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance("SecretKeyFactory",
SecretKeyFactorySpi.class, algorithm, provider);
return new SecretKeyFactory((SecretKeyFactorySpi)instance.impl,
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java b/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java
index 271974f90d9..443e704dde3 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java
@@ -27,6 +27,7 @@ package javax.net.ssl;
import java.security.Security;
import java.security.*;
+import java.util.Objects;
import sun.security.jca.GetInstance;
@@ -130,17 +131,19 @@ public class KeyManagerFactory {
* Java Secure Socket Extension Reference Guide
* for information about standard algorithm names.
*
- * @return the new KeyManagerFactory
object.
+ * @return the new {@code KeyManagerFactory} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * KeyManagerFactorySpi implementation for the
- * specified algorithm.
- * @exception NullPointerException if algorithm
is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code KeyManagerFactorySpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyManagerFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("KeyManagerFactory", KeyManagerFactorySpi.class,
algorithm);
@@ -168,23 +171,26 @@ public class KeyManagerFactory {
*
* @param provider the name of the provider.
*
- * @return the new KeyManagerFactory
object.
+ * @return the new {@code KeyManagerFactory} object
*
- * @throws NoSuchAlgorithmException if a KeyManagerFactorySpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is {@code null}
+ * or empty
+ *
+ * @throws NoSuchAlgorithmException if a {@code KeyManagerFactorySpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @throws IllegalArgumentException if the provider name is null or empty.
- * @throws NullPointerException if algorithm
is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyManagerFactory getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("KeyManagerFactory", KeyManagerFactorySpi.class,
algorithm, provider);
@@ -209,19 +215,21 @@ public class KeyManagerFactory {
*
* @param provider an instance of the provider.
*
- * @return the new KeyManagerFactory
object.
+ * @return the new {@code KeyManagerFactory} object
*
- * @throws NoSuchAlgorithmException if a KeyManagerFactorySpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if provider is {@code null}
*
- * @throws IllegalArgumentException if provider is null.
- * @throws NullPointerException if algorithm
is null.
+ * @throws NoSuchAlgorithmException if a {@code @KeyManagerFactorySpi}
+ * implementation for the specified algorithm is not available
+ * from the specified Provider object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyManagerFactory getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("KeyManagerFactory", KeyManagerFactorySpi.class,
algorithm, provider);
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java
index 598696b3427..2f2a0928a15 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java
@@ -26,6 +26,7 @@
package javax.net.ssl;
import java.security.*;
+import java.util.Objects;
import sun.security.jca.GetInstance;
@@ -151,17 +152,19 @@ public class SSLContext {
* Documentation
* for information about standard protocol names.
*
- * @return the new {@code SSLContext} object.
+ * @return the new {@code SSLContext} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * SSLContextSpi implementation for the
- * specified protocol.
- * @exception NullPointerException if protocol is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code SSLContextSpi} implementation for the
+ * specified protocol
+ *
+ * @throws NullPointerException if {@code protocol} is {@code null}
*
* @see java.security.Provider
*/
public static SSLContext getInstance(String protocol)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(protocol, "null protocol name");
GetInstance.Instance instance = GetInstance.getInstance
("SSLContext", SSLContextSpi.class, protocol);
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
@@ -189,22 +192,25 @@ public class SSLContext {
*
* @param provider the name of the provider.
*
- * @return the new {@code SSLContext} object.
+ * @return the new {@code SSLContext} object
*
- * @throws NoSuchAlgorithmException if a SSLContextSpi
- * implementation for the specified protocol is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is
+ * {@code null} or empty
+ *
+ * @throws NoSuchAlgorithmException if a {@code SSLContextSpi}
+ * implementation for the specified protocol is not
+ * available from the specified provider
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @throws IllegalArgumentException if the provider name is null or empty.
- * @throws NullPointerException if protocol is null.
+ * @throws NullPointerException if {@code protocol} is {@code null}
*
* @see java.security.Provider
*/
public static SSLContext getInstance(String protocol, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
+ Objects.requireNonNull(protocol, "null protocol name");
GetInstance.Instance instance = GetInstance.getInstance
("SSLContext", SSLContextSpi.class, protocol, provider);
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
@@ -229,19 +235,21 @@ public class SSLContext {
*
* @param provider an instance of the provider.
*
- * @return the new {@code SSLContext} object.
+ * @return the new {@code SSLContext} object
*
- * @throws NoSuchAlgorithmException if a SSLContextSpi
- * implementation for the specified protocol is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the provider is {@code null}
*
- * @throws IllegalArgumentException if the provider is null.
- * @throws NullPointerException if protocol is null.
+ * @throws NoSuchAlgorithmException if a {@code SSLContextSpi}
+ * implementation for the specified protocol is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code protocol} is {@code null}
*
* @see java.security.Provider
*/
public static SSLContext getInstance(String protocol, Provider provider)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(protocol, "null protocol name");
GetInstance.Instance instance = GetInstance.getInstance
("SSLContext", SSLContextSpi.class, protocol, provider);
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
index dd5ce10d5bd..0f999e8d0aa 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
@@ -27,6 +27,7 @@ package javax.net.ssl;
import java.security.Security;
import java.security.*;
+import java.util.Objects;
import sun.security.jca.GetInstance;
@@ -144,17 +145,19 @@ public class TrustManagerFactory {
* Java Secure Socket Extension Reference Guide
* for information about standard algorithm names.
*
- * @return the new TrustManagerFactory
object.
+ * @return the new {@code TrustManagerFactory} object
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * TrustManagerFactorySpi implementation for the
- * specified algorithm.
- * @exception NullPointerException if algorithm is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code TrustManagerFactorySpi} implementation for the
+ * specified algorithm
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final TrustManagerFactory getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("TrustManagerFactory", TrustManagerFactorySpi.class,
algorithm);
@@ -182,23 +185,26 @@ public class TrustManagerFactory {
*
* @param provider the name of the provider.
*
- * @return the new TrustManagerFactory
object
+ * @return the new {@code TrustManagerFactory} object
*
- * @throws NoSuchAlgorithmException if a TrustManagerFactorySpi
- * implementation for the specified algorithm is not
- * available from the specified provider.
+ * @throws IllegalArgumentException if the provider name is
+ * {@code null} or empty
+ *
+ * @throws NoSuchAlgorithmException if a {@code TrustManagerFactorySpi}
+ * implementation for the specified algorithm is not
+ * available from the specified provider
*
* @throws NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * registered in the security provider list
*
- * @throws IllegalArgumentException if the provider name is null or empty.
- * @throws NullPointerException if algorithm is null.
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final TrustManagerFactory getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("TrustManagerFactory", TrustManagerFactorySpi.class,
algorithm, provider);
@@ -223,19 +229,21 @@ public class TrustManagerFactory {
*
* @param provider an instance of the provider.
*
- * @return the new TrustManagerFactory
object.
+ * @return the new {@code TrustManagerFactory} object
*
- * @throws NoSuchAlgorithmException if a TrustManagerFactorySpi
- * implementation for the specified algorithm is not available
- * from the specified Provider object.
+ * @throws IllegalArgumentException if the provider is {@code null}
*
- * @throws IllegalArgumentException if the provider is null.
- * @throws NullPointerException if algorithm is null.
+ * @throws NoSuchAlgorithmException if a {@code TrustManagerFactorySpi}
+ * implementation for the specified algorithm is not available
+ * from the specified {@code Provider} object
+ *
+ * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final TrustManagerFactory getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
GetInstance.Instance instance = GetInstance.getInstance
("TrustManagerFactory", TrustManagerFactorySpi.class,
algorithm, provider);
diff --git a/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java b/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java
index c1844d523eb..29d42df6855 100644
--- a/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java
+++ b/jdk/src/java.base/share/classes/javax/security/auth/login/Configuration.java
@@ -329,27 +329,29 @@ public abstract class Configuration {
*
* @param params parameters for the Configuration, which may be null.
*
- * @return the new Configuration object.
+ * @return the new {@code Configuration} object
*
- * @exception SecurityException if the caller does not have permission
- * to get a Configuration instance for the specified type.
+ * @throws IllegalArgumentException if the specified parameters
+ * are not understood by the {@code ConfigurationSpi}
+ * implementation from the selected {@code Provider}
*
- * @exception NullPointerException if the specified type is null.
+ * @throws NoSuchAlgorithmException if no {@code Provider} supports a
+ * {@code ConfigurationSpi} implementation for the specified type
*
- * @exception IllegalArgumentException if the specified parameters
- * are not understood by the ConfigurationSpi implementation
- * from the selected Provider.
+ * @throws NullPointerException if {@code type} is {@code null}
*
- * @exception NoSuchAlgorithmException if no Provider supports a
- * ConfigurationSpi implementation for the specified type.
+ * @throws SecurityException if the caller does not have permission
+ * to get a {@code Configuration} instance for the specified type
*
* @see Provider
+ *
* @since 1.6
*/
public static Configuration getInstance(String type,
Configuration.Parameters params)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(type, "null type name");
checkPermission(type);
try {
GetInstance.Instance instance = GetInstance.getInstance
@@ -387,24 +389,24 @@ public abstract class Configuration {
*
* @param provider the provider.
*
- * @return the new Configuration object.
+ * @return the new {@code Configuration} object
*
- * @exception SecurityException if the caller does not have permission
- * to get a Configuration instance for the specified type.
+ * @throws IllegalArgumentException if the specified provider
+ * is {@code null} or empty, or if the specified parameters
+ * are not understood by the {@code ConfigurationSpi}
+ * implementation from the specified provider
*
- * @exception NullPointerException if the specified type is null.
+ * @throws NoSuchProviderException if the specified provider is not
+ * registered in the security provider list
*
- * @exception IllegalArgumentException if the specified provider
- * is null or empty,
- * or if the specified parameters are not understood by
- * the ConfigurationSpi implementation from the specified provider.
+ * @throws NoSuchAlgorithmException if the specified provider does not
+ * support a {@code ConfigurationSpi} implementation for the
+ * specified type
*
- * @exception NoSuchProviderException if the specified provider is not
- * registered in the security provider list.
+ * @throws NullPointerException if {@code type} is {@code null}
*
- * @exception NoSuchAlgorithmException if the specified provider does not
- * support a ConfigurationSpi implementation for the specified
- * type.
+ * @throws SecurityException if the caller does not have permission
+ * to get a {@code Configuration} instance for the specified type
*
* @see Provider
* @since 1.6
@@ -414,6 +416,7 @@ public abstract class Configuration {
String provider)
throws NoSuchProviderException, NoSuchAlgorithmException {
+ Objects.requireNonNull(type, "null type name");
if (provider == null || provider.length() == 0) {
throw new IllegalArgumentException("missing provider");
}
@@ -453,20 +456,21 @@ public abstract class Configuration {
*
* @param provider the Provider.
*
- * @return the new Configuration object.
+ * @return the new {@code Configuration} object
*
- * @exception SecurityException if the caller does not have permission
- * to get a Configuration instance for the specified type.
+ * @throws IllegalArgumentException if the specified {@code Provider}
+ * is {@code null}, or if the specified parameters are not
+ * understood by the {@code ConfigurationSpi} implementation
+ * from the specified Provider
*
- * @exception NullPointerException if the specified type is null.
+ * @throws NoSuchAlgorithmException if the specified {@code Provider}
+ * does not support a {@code ConfigurationSpi} implementation
+ * for the specified type
*
- * @exception IllegalArgumentException if the specified Provider is null,
- * or if the specified parameters are not understood by
- * the ConfigurationSpi implementation from the specified Provider.
+ * @throws NullPointerException if {@code type} is {@code null}
*
- * @exception NoSuchAlgorithmException if the specified Provider does not
- * support a ConfigurationSpi implementation for the specified
- * type.
+ * @throws SecurityException if the caller does not have permission
+ * to get a {@code Configuration} instance for the specified type
*
* @see Provider
* @since 1.6
@@ -476,6 +480,7 @@ public abstract class Configuration {
Provider provider)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(type, "null type name");
if (provider == null) {
throw new IllegalArgumentException("missing provider");
}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jmod/JmodFile.java b/jdk/src/java.base/share/classes/jdk/internal/jmod/JmodFile.java
index f64ccf2aa4a..df6724bec7b 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/jmod/JmodFile.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/jmod/JmodFile.java
@@ -175,6 +175,16 @@ public class JmodFile implements AutoCloseable {
this.zipfile = new ZipFile(file.toFile());
}
+ /**
+ * Returns the {@code Entry} for a resource in a JMOD file section
+ * or {@code null} if not found.
+ */
+ public Entry getEntry(Section section, String name) {
+ String entry = section.jmodDir() + "/" + name;
+ ZipEntry ze = zipfile.getEntry(entry);
+ return (ze != null) ? new Entry(ze) : null;
+ }
+
/**
* Opens an {@code InputStream} for reading the named entry of the given
* section in this jmod file.
@@ -185,7 +195,6 @@ public class JmodFile implements AutoCloseable {
public InputStream getInputStream(Section section, String name)
throws IOException
{
-
String entry = section.jmodDir() + "/" + name;
ZipEntry e = zipfile.getEntry(entry);
if (e == null) {
@@ -194,6 +203,15 @@ public class JmodFile implements AutoCloseable {
return zipfile.getInputStream(e);
}
+ /**
+ * Opens an {@code InputStream} for reading an entry in the JMOD file.
+ *
+ * @throws IOException if an I/O error occurs
+ */
+ public InputStream getInputStream(Entry entry) throws IOException {
+ return zipfile.getInputStream(entry.zipEntry());
+ }
+
/**
* Returns a stream of non-directory entries in this jmod file.
*/
diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java b/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java
index b6e58fb932b..75d509606d2 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java
@@ -53,6 +53,7 @@ import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
+import java.util.stream.Stream;
import jdk.internal.module.ModulePatcher.PatchedModuleReader;
import jdk.internal.misc.VM;
@@ -749,6 +750,10 @@ public class BuiltinClassLoader
return Optional.empty();
}
@Override
+ public Stream list() {
+ return Stream.empty();
+ }
+ @Override
public void close() {
throw new InternalError("Should not get here");
}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java
index deaf34c41c2..428b6fc06a8 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java
@@ -69,16 +69,17 @@ public class ClassLoaders {
bcp = toURLClassPath(s);
// we have a class path if -cp is specified or -m is not specified.
- // If neither is specified then default to -cp .
+ // If neither is specified then default to -cp
+ // If -cp is not specified and -m is specified, the value of
+ // java.class.path is an empty string, then no class path.
URLClassPath ucp = null;
String mainMid = System.getProperty("jdk.module.main");
String cp = System.getProperty("java.class.path");
- if (mainMid == null && cp == null)
+ if (cp == null)
cp = "";
- if (cp != null)
+ if (mainMid == null || cp.length() > 0)
ucp = toURLClassPath(cp);
-
// create the class loaders
BOOT_LOADER = new BootClassLoader(bcp);
PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);
diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java
index 21900b5731e..8b2e257d7b8 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/loader/Loader.java
@@ -53,6 +53,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Stream;
/**
@@ -534,6 +535,10 @@ public final class Loader extends SecureClassLoader {
return Optional.empty();
}
@Override
+ public Stream list() {
+ return Stream.empty();
+ }
+ @Override
public void close() {
throw new InternalError("Should not get here");
}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java b/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java
index e24fcad2bd4..397ddba5432 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/DefaultLoggerFinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -137,13 +137,20 @@ public class DefaultLoggerFinder extends LoggerFinder {
}
public static boolean isSystem(Module m) {
- ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<>() {
+ return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
- public ClassLoader run() {
- return m.getClassLoader();
+ public Boolean run() {
+ final ClassLoader moduleCL = m.getClassLoader();
+ if (moduleCL == null) return true;
+ ClassLoader cl = ClassLoader.getPlatformClassLoader();
+ while (cl != null && moduleCL != cl) {
+ cl = cl.getParent();
+ }
+ // returns true if moduleCL is the platform class loader
+ // or one of its ancestors.
+ return moduleCL == cl;
}
});
- return cl == null;
}
@Override
diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangModuleAccess.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangModuleAccess.java
index cf0e8f797d9..d19579212dd 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangModuleAccess.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangModuleAccess.java
@@ -39,6 +39,7 @@ import java.util.Collection;
import java.lang.module.ModuleReader;
import java.lang.module.ModuleReference;
import java.net.URI;
+import java.nio.file.Path;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@@ -102,6 +103,11 @@ public interface JavaLangModuleAccess {
Set packages,
ModuleHashes hashes);
+ /**
+ * Returns the object with the hashes of other modules
+ */
+ Optional hashes(ModuleDescriptor descriptor);
+
/**
* Resolves a collection of root modules, with service binding
* and the empty configuration as the parent. The post resolution
@@ -120,8 +126,10 @@ public interface JavaLangModuleAccess {
Supplier readerSupplier);
/**
- * Returns the object with the hashes of other modules
+ * Creates a ModuleFinder for a module path.
*/
- Optional hashes(ModuleDescriptor descriptor);
+ ModuleFinder newModulePath(Runtime.Version version,
+ boolean isLinkPhase,
+ Path... entries);
}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java
index c86416e1dab..a8dda9b8d57 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java
@@ -57,7 +57,15 @@ public final class ModuleInfoWriter {
cw.visit(Opcodes.V1_9, ACC_MODULE, name, null, null, null);
cw.visitAttribute(new ModuleAttribute(md));
- cw.visitAttribute(new ConcealedPackagesAttribute(md.conceals()));
+
+ // for tests: write the ConcealedPackages attribute when there are non-exported packages
+ long nExportedPackages = md.exports().stream()
+ .map(ModuleDescriptor.Exports::source)
+ .distinct()
+ .count();
+ if (md.packages().size() > nExportedPackages)
+ cw.visitAttribute(new ConcealedPackagesAttribute(md.packages()));
+
md.version().ifPresent(v -> cw.visitAttribute(new VersionAttribute(v)));
md.mainClass().ifPresent(mc -> cw.visitAttribute(new MainClassAttribute(mc)));
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java
index ebc7d85a5e8..afee8bf3c36 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModulePatcher.java
@@ -50,6 +50,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.stream.Stream;
import jdk.internal.loader.Resource;
import jdk.internal.misc.JavaLangModuleAccess;
@@ -159,21 +160,19 @@ public final class ModulePatcher {
// is not supported by the boot class loader
try (JarFile jf = new JarFile(file.toFile())) {
jf.stream()
- .filter(e -> e.getName().endsWith(".class"))
.map(e -> toPackageName(file, e))
- .filter(pn -> pn.length() > 0)
+ .filter(Checks::isJavaIdentifier)
.forEach(packages::add);
}
} else if (Files.isDirectory(file)) {
- // exploded directory
+ // exploded directory without following sym links
Path top = file;
Files.find(top, Integer.MAX_VALUE,
- ((path, attrs) -> attrs.isRegularFile() &&
- path.toString().endsWith(".class")))
+ ((path, attrs) -> attrs.isRegularFile()))
.map(path -> toPackageName(top, path))
- .filter(pn -> pn.length() > 0)
+ .filter(Checks::isJavaIdentifier)
.forEach(packages::add);
}
@@ -380,6 +379,15 @@ public final class ModulePatcher {
}
}
+ @Override
+ public Stream list() throws IOException {
+ Stream s = delegate().list();
+ for (ResourceFinder finder : finders) {
+ s = Stream.concat(s, finder.list());
+ }
+ return s.distinct();
+ }
+
@Override
public void close() throws IOException {
closeAll(finders);
@@ -393,6 +401,7 @@ public final class ModulePatcher {
*/
private static interface ResourceFinder extends Closeable {
Resource find(String name) throws IOException;
+ Stream list() throws IOException;
}
@@ -453,6 +462,13 @@ public final class ModulePatcher {
}
};
}
+
+ @Override
+ public Stream list() throws IOException {
+ return jf.stream()
+ .filter(e -> !e.isDirectory())
+ .map(JarEntry::getName);
+ }
}
@@ -527,6 +543,15 @@ public final class ModulePatcher {
}
};
}
+
+ @Override
+ public Stream list() throws IOException {
+ return Files.find(dir, Integer.MAX_VALUE,
+ (path, attrs) -> attrs.isRegularFile())
+ .map(f -> dir.relativize(f)
+ .toString()
+ .replace(File.separatorChar, '/'));
+ }
}
@@ -537,7 +562,7 @@ public final class ModulePatcher {
Path entry = top.relativize(file);
Path parent = entry.getParent();
if (parent == null) {
- return warnUnnamedPackage(top, entry.toString());
+ return warnIfModuleInfo(top, entry.toString());
} else {
return parent.toString().replace(File.separatorChar, '.');
}
@@ -557,14 +582,15 @@ public final class ModulePatcher {
String name = entry.getName();
int index = name.lastIndexOf("/");
if (index == -1) {
- return warnUnnamedPackage(file, name);
+ return warnIfModuleInfo(file, name);
} else {
return name.substring(0, index).replace('/', '.');
}
}
- private static String warnUnnamedPackage(Path file, String e) {
- System.err.println("WARNING: " + e + " not allowed in patch: " + file);
+ private static String warnIfModuleInfo(Path file, String e) {
+ if (e.equals("module-info.class"))
+ System.err.println("WARNING: " + e + " ignored in patch: " + file);
return "";
}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
index 4b98f4c91bf..c6777c37827 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java
@@ -364,6 +364,16 @@ public class ReflectionFactory {
}
}
+ public final Constructor> newConstructorForSerialization(Class> cl,
+ Constructor> constructorToCall)
+ {
+ if (constructorToCall.getDeclaringClass() == cl) {
+ constructorToCall.setAccessible(true);
+ return constructorToCall;
+ }
+ return generateConstructor(cl, constructorToCall);
+ }
+
public final Constructor> newConstructorForSerialization(Class> cl) {
Class> initCl = cl;
while (Serializable.class.isAssignableFrom(initCl)) {
@@ -383,6 +393,12 @@ public class ReflectionFactory {
} catch (NoSuchMethodException ex) {
return null;
}
+ return generateConstructor(cl, constructorToCall);
+ }
+
+ private final Constructor> generateConstructor(Class> cl,
+ Constructor> constructorToCall) {
+
ConstructorAccessor acc = new MethodAccessorGenerator().
generateSerializationConstructor(cl,
diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java
index 7b76d703cc4..0e4c0354ee2 100644
--- a/jdk/src/java.base/share/classes/module-info.java
+++ b/jdk/src/java.base/share/classes/module-info.java
@@ -196,7 +196,8 @@ module java.base {
jdk.vm.ci;
exports jdk.internal.util.jar to
jdk.jartool,
- jdk.jdeps;
+ jdk.jdeps,
+ jdk.jlink;
exports jdk.internal.vm to
java.management,
jdk.jvmstat;
diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
index b68e6a6a448..3801d542fcc 100644
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 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
@@ -31,7 +31,7 @@ java.launcher.opt.header = Usage: {0} [options] class [args...]\n\
\ (to execute the main class in a module)\n\
where options include:\n
-java.launcher.opt.datamodel =\ -d{0}\t use a {0}-bit data model if available\n
+java.launcher.opt.datamodel =\ -d{0}\t Deprecated, will be removed in a future release\n
java.launcher.opt.vmselect =\ {0}\t to select the "{1}" VM\n
java.launcher.opt.hotspot =\ {0}\t is a synonym for the "{1}" VM [deprecated]\n
@@ -95,6 +95,12 @@ java.launcher.opt.footer =\ -cp \n\
\ show splash screen with specified image\n\
+\ HiDPI scaled images are automatically supported and used\n\
+\ if available. The unscaled image filename, e.g. image.ext,\n\
+\ should always be passed as the argument to the -splash option.\n\
+\ The most appropriate scaled image provided will be picked up\n\
+\ automatically.\n\
+\ See the SplashScreen API documentation for more information.\n\
\ @ read options from the specified file\n\
\To specify an argument for a long option, you can use --= or\n\
\-- .\n\
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java b/jdk/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java
index 9b77ebb1aca..fa680715874 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -42,10 +42,6 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
private DTLSReassembler reassembler = null;
- // Cache the session identifier for the detection of session-resuming
- // handshake.
- byte[] prevSessionID = new byte[0];
-
int readEpoch;
int prevReadEpoch;
@@ -114,13 +110,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
@Override
Plaintext acquirePlaintext() {
if (reassembler != null) {
- Plaintext plaintext = reassembler.acquirePlaintext();
- if (reassembler.finished()) {
- // discard all buffered unused message.
- reassembler = null;
- }
-
- return plaintext;
+ return reassembler.acquirePlaintext();
}
return null;
@@ -149,40 +139,54 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
packet.get(recordEnS);
int recordEpoch = ((recordEnS[0] & 0xFF) << 8) |
(recordEnS[1] & 0xFF); // pos: 3, 4
- long recordSeq = Authenticator.toLong(recordEnS);
+ long recordSeq = ((recordEnS[2] & 0xFFL) << 40) |
+ ((recordEnS[3] & 0xFFL) << 32) |
+ ((recordEnS[4] & 0xFFL) << 24) |
+ ((recordEnS[5] & 0xFFL) << 16) |
+ ((recordEnS[6] & 0xFFL) << 8) |
+ (recordEnS[7] & 0xFFL); // pos: 5-10
+
int contentLen = ((packet.get() & 0xFF) << 8) |
- (packet.get() & 0xFF); // pos: 11, 12
+ (packet.get() & 0xFF); // pos: 11, 12
if (debug != null && Debug.isOn("record")) {
- System.out.println(Thread.currentThread().getName() +
- ", READ: " +
+ Debug.log("READ: " +
ProtocolVersion.valueOf(majorVersion, minorVersion) +
" " + Record.contentName(contentType) + ", length = " +
contentLen);
}
int recLim = srcPos + DTLSRecord.headerSize + contentLen;
- if (this.readEpoch > recordEpoch) {
- // Discard old records delivered before this epoch.
+ if (this.prevReadEpoch > recordEpoch) {
// Reset the position of the packet buffer.
packet.position(recLim);
+ if (debug != null && Debug.isOn("record")) {
+ Debug.printHex("READ: discard this old record", recordEnS);
+ }
return null;
}
+ // Buffer next epoch message if necessary.
if (this.readEpoch < recordEpoch) {
- if (contentType != Record.ct_handshake) {
- // just discard it if not a handshake message
+ // Discard the record younger than the current epcoh if:
+ // 1. it is not a handshake message, or
+ // 2. it is not of next epoch.
+ if (((contentType != Record.ct_handshake) &&
+ (contentType != Record.ct_change_cipher_spec)) ||
+ (this.readEpoch < (recordEpoch - 1))) {
+
packet.position(recLim);
+
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Premature record (epoch), discard it.");
+ }
+
return null;
}
- // Not ready to decrypt this record, may be encrypted Finished
+ // Not ready to decrypt this record, may be an encrypted Finished
// message, need to buffer it.
- if (reassembler == null) {
- reassembler = new DTLSReassembler();
- }
-
byte[] fragment = new byte[contentLen];
packet.get(fragment); // copy the fragment
RecordFragment buffered = new RecordFragment(fragment, contentType,
@@ -194,94 +198,130 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
// consume the full record in the packet buffer.
packet.position(recLim);
- Plaintext plaintext = reassembler.acquirePlaintext();
- if (reassembler.finished()) {
- // discard all buffered unused message.
+ return reassembler.acquirePlaintext();
+ }
+
+ //
+ // Now, the message is of this epoch or the previous epoch.
+ //
+ Authenticator decodeAuthenticator;
+ CipherBox decodeCipher;
+ if (this.readEpoch == recordEpoch) {
+ decodeAuthenticator = readAuthenticator;
+ decodeCipher = readCipher;
+ } else { // prevReadEpoch == recordEpoch
+ decodeAuthenticator = prevReadAuthenticator;
+ decodeCipher = prevReadCipher;
+ }
+
+ // decrypt the fragment
+ packet.limit(recLim);
+ packet.position(srcPos + DTLSRecord.headerSize);
+
+ ByteBuffer plaintextFragment;
+ try {
+ plaintextFragment = decrypt(decodeAuthenticator,
+ decodeCipher, contentType, packet, recordEnS);
+ } catch (BadPaddingException bpe) {
+ if (debug != null && Debug.isOn("ssl")) {
+ Debug.log("Discard invalid record: " + bpe);
+ }
+
+ // invalid, discard this record [section 4.1.2.7, RFC 6347]
+ return null;
+ } finally {
+ // comsume a complete record
+ packet.limit(srcLim);
+ packet.position(recLim);
+ }
+
+ if (contentType != Record.ct_change_cipher_spec &&
+ contentType != Record.ct_handshake) { // app data or alert
+ // no retransmission
+ // Cleanup the handshake reassembler if necessary.
+ if ((reassembler != null) &&
+ (reassembler.handshakeEpoch < recordEpoch)) {
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Cleanup the handshake reassembler");
+ }
+
reassembler = null;
}
- return plaintext;
+ return new Plaintext(contentType, majorVersion, minorVersion,
+ recordEpoch, Authenticator.toLong(recordEnS),
+ plaintextFragment);
}
- if (this.readEpoch == recordEpoch) {
- // decrypt the fragment
- packet.limit(recLim);
- packet.position(srcPos + DTLSRecord.headerSize);
-
- ByteBuffer plaintextFragment;
- try {
- plaintextFragment = decrypt(readAuthenticator,
- readCipher, contentType, packet, recordEnS);
- } catch (BadPaddingException bpe) {
- if (debug != null && Debug.isOn("ssl")) {
- System.out.println(Thread.currentThread().getName() +
- " discard invalid record: " + bpe);
- }
-
- // invalid, discard this record [section 4.1.2.7, RFC 6347]
- return null;
- } finally {
- // comsume a complete record
- packet.limit(srcLim);
- packet.position(recLim);
- }
-
- if (contentType != Record.ct_change_cipher_spec &&
- contentType != Record.ct_handshake) { // app data or alert
- // no retransmission
- return new Plaintext(contentType, majorVersion, minorVersion,
- recordEpoch, recordSeq, plaintextFragment);
- }
-
- if (contentType == Record.ct_change_cipher_spec) {
- if (reassembler == null) {
+ if (contentType == Record.ct_change_cipher_spec) {
+ if (reassembler == null) {
+ if (this.readEpoch != recordEpoch) {
// handshake has not started, should be an
// old handshake message, discard it.
+
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "Lagging behind ChangeCipherSpec, discard it.");
+ }
+
return null;
}
- reassembler.queueUpFragment(
- new RecordFragment(plaintextFragment, contentType,
- majorVersion, minorVersion,
- recordEnS, recordEpoch, recordSeq, false));
- } else { // handshake record
- // One record may contain 1+ more handshake messages.
- while (plaintextFragment.remaining() > 0) {
+ reassembler = new DTLSReassembler(recordEpoch);
+ }
- HandshakeFragment hsFrag = parseHandshakeMessage(
- contentType, majorVersion, minorVersion,
- recordEnS, recordEpoch, recordSeq, plaintextFragment);
+ reassembler.queueUpChangeCipherSpec(
+ new RecordFragment(plaintextFragment, contentType,
+ majorVersion, minorVersion,
+ recordEnS, recordEpoch, recordSeq, false));
+ } else { // handshake record
+ // One record may contain 1+ more handshake messages.
+ while (plaintextFragment.remaining() > 0) {
+
+ HandshakeFragment hsFrag = parseHandshakeMessage(
+ contentType, majorVersion, minorVersion,
+ recordEnS, recordEpoch, recordSeq, plaintextFragment);
+
+ if (hsFrag == null) {
+ // invalid, discard this record
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Invalid handshake message, discard it.");
+ }
+
+ return null;
+ }
+
+ if (reassembler == null) {
+ if (this.readEpoch != recordEpoch) {
+ // handshake has not started, should be an
+ // old handshake message, discard it.
+
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "Lagging behind handshake record, discard it.");
+ }
- if (hsFrag == null) {
- // invalid, discard this record
return null;
}
- if ((reassembler == null) &&
- isKickstart(hsFrag.handshakeType)) {
- reassembler = new DTLSReassembler();
- }
-
- if (reassembler != null) {
- reassembler.queueUpHandshake(hsFrag);
- } // else, just ignore the message.
- }
- }
-
- // Completed the read of the full record. Acquire the reassembled
- // messages.
- if (reassembler != null) {
- Plaintext plaintext = reassembler.acquirePlaintext();
- if (reassembler.finished()) {
- // discard all buffered unused message.
- reassembler = null;
+ reassembler = new DTLSReassembler(recordEpoch);
}
- return plaintext;
+ reassembler.queueUpHandshake(hsFrag);
}
}
- return null; // make the complier happy
+ // Completed the read of the full record. Acquire the reassembled
+ // messages.
+ if (reassembler != null) {
+ return reassembler.acquirePlaintext();
+ }
+
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("The reassembler is not initialized yet.");
+ }
+
+ return null;
}
@Override
@@ -330,12 +370,6 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
}
}
- private static boolean isKickstart(byte handshakeType) {
- return (handshakeType == HandshakeMessage.ht_client_hello) ||
- (handshakeType == HandshakeMessage.ht_hello_request) ||
- (handshakeType == HandshakeMessage.ht_hello_verify_request);
- }
-
private static HandshakeFragment parseHandshakeMessage(
byte contentType, byte majorVersion, byte minorVersion,
byte[] recordEnS, int recordEpoch, long recordSeq,
@@ -344,9 +378,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
int remaining = plaintextFragment.remaining();
if (remaining < handshakeHeaderSize) {
if (debug != null && Debug.isOn("ssl")) {
- System.out.println(
- Thread.currentThread().getName() +
- " discard invalid record: " +
+ Debug.log("Discard invalid record: " +
"too small record to hold a handshake fragment");
}
@@ -372,9 +404,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
(plaintextFragment.get() & 0xFF); // pos: 9-11
if ((remaining - handshakeHeaderSize) < fragmentLength) {
if (debug != null && Debug.isOn("ssl")) {
- System.out.println(
- Thread.currentThread().getName() +
- " discard invalid record: " +
+ Debug.log("Discard invalid record: " +
"not a complete handshake fragment in the record");
}
@@ -431,7 +461,39 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
@Override
public int compareTo(RecordFragment o) {
- return Long.compareUnsigned(this.recordSeq, o.recordSeq);
+ if (this.contentType == Record.ct_change_cipher_spec) {
+ if (o.contentType == Record.ct_change_cipher_spec) {
+ // Only one incoming ChangeCipherSpec message for an epoch.
+ //
+ // Ignore duplicated ChangeCipherSpec messages.
+ return Integer.compare(this.recordEpoch, o.recordEpoch);
+ } else if ((this.recordEpoch == o.recordEpoch) &&
+ (o.contentType == Record.ct_handshake)) {
+ // ChangeCipherSpec is the latest message of an epoch.
+ return 1;
+ }
+ } else if (o.contentType == Record.ct_change_cipher_spec) {
+ if ((this.recordEpoch == o.recordEpoch) &&
+ (this.contentType == Record.ct_handshake)) {
+ // ChangeCipherSpec is the latest message of an epoch.
+ return -1;
+ } else {
+ // different epoch or this is not a handshake message
+ return compareToSequence(o.recordEpoch, o.recordSeq);
+ }
+ }
+
+ return compareToSequence(o.recordEpoch, o.recordSeq);
+ }
+
+ int compareToSequence(int epoch, long seq) {
+ if (this.recordEpoch > epoch) {
+ return 1;
+ } else if (this.recordEpoch == epoch) {
+ return Long.compare(this.recordSeq, seq);
+ } else {
+ return -1;
+ }
}
}
@@ -465,12 +527,24 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
if (o instanceof HandshakeFragment) {
HandshakeFragment other = (HandshakeFragment)o;
if (this.messageSeq != other.messageSeq) {
- // keep the insertion order for the same message
+ // keep the insertion order of handshake messages
return this.messageSeq - other.messageSeq;
+ } else if (this.fragmentOffset != other.fragmentOffset) {
+ // small fragment offset was transmitted first
+ return this.fragmentOffset - other.fragmentOffset;
+ } else if (this.fragmentLength == other.fragmentLength) {
+ // retransmissions, ignore duplicated messages.
+ return 0;
}
+
+ // Should be repacked for suitable fragment length.
+ //
+ // Note that the acquiring processes will reassemble the
+ // the fragments later.
+ return compareToSequence(o.recordEpoch, o.recordSeq);
}
- return Long.compareUnsigned(this.recordSeq, o.recordSeq);
+ return super.compareTo(o);
}
}
@@ -484,24 +558,72 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
}
}
+ private static final class HandshakeFlight implements Cloneable {
+ static final byte HF_UNKNOWN = HandshakeMessage.ht_not_applicable;
+
+ byte handshakeType; // handshake type
+ int flightEpoch; // the epoch of the first message
+ int minMessageSeq; // minimal message sequence
+
+ int maxMessageSeq; // maximum message sequence
+ int maxRecordEpoch; // maximum record sequence number
+ long maxRecordSeq; // maximum record sequence number
+
+ HashMap> holesMap;
+
+ HandshakeFlight() {
+ this.handshakeType = HF_UNKNOWN;
+ this.flightEpoch = 0;
+ this.minMessageSeq = 0;
+
+ this.maxMessageSeq = 0;
+ this.maxRecordEpoch = 0;
+ this.maxRecordSeq = -1;
+
+ this.holesMap = new HashMap<>(5);
+ }
+
+ boolean isRetransmitOf(HandshakeFlight hs) {
+ return (hs != null) &&
+ (this.handshakeType == hs.handshakeType) &&
+ (this.minMessageSeq == hs.minMessageSeq);
+ }
+
+ @Override
+ public Object clone() {
+ HandshakeFlight hf = new HandshakeFlight();
+
+ hf.handshakeType = this.handshakeType;
+ hf.flightEpoch = this.flightEpoch;
+ hf.minMessageSeq = this.minMessageSeq;
+
+ hf.maxMessageSeq = this.maxMessageSeq;
+ hf.maxRecordEpoch = this.maxRecordEpoch;
+ hf.maxRecordSeq = this.maxRecordSeq;
+
+ hf.holesMap = new HashMap<>(this.holesMap);
+
+ return hf;
+ }
+ }
+
final class DTLSReassembler {
+ // The handshake epoch.
+ final int handshakeEpoch;
+
+ // The buffered fragments.
TreeSet bufferedFragments = new TreeSet<>();
- HashMap> holesMap = new HashMap<>(5);
+ // The handshake flight in progress.
+ HandshakeFlight handshakeFlight = new HandshakeFlight();
- // Epoch, sequence number and handshake message sequence of the
- // beginning message of a flight.
- byte flightType = (byte)0xFF;
-
- int flightTopEpoch = 0;
- long flightTopRecordSeq = -1;
- int flightTopMessageSeq = 0;
+ // The preceding handshake flight.
+ HandshakeFlight precedingFlight = null;
// Epoch, sequence number and handshake message sequence of the
// next message acquisition of a flight.
- int nextRecordEpoch = 0; // next record epoch
+ int nextRecordEpoch; // next record epoch
long nextRecordSeq = 0; // next record sequence number
- int nextMessageSeq = 0; // next handshake message number
// Expect ChangeCipherSpec and Finished messages for the final flight.
boolean expectCCSFlight = false;
@@ -510,65 +632,66 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
boolean flightIsReady = false;
boolean needToCheckFlight = false;
- // Is it a session-resuming abbreviated handshake.?
- boolean isAbbreviatedHandshake = false;
+ DTLSReassembler(int handshakeEpoch) {
+ this.handshakeEpoch = handshakeEpoch;
+ this.nextRecordEpoch = handshakeEpoch;
- // The handshke fragment with the biggest record sequence number
- // in a flight, not counting the Finished message.
- HandshakeFragment lastHandshakeFragment = null;
-
- // Is handshake (intput) finished?
- boolean handshakeFinished = false;
-
- DTLSReassembler() {
- // blank
- }
-
- boolean finished() {
- return handshakeFinished;
+ this.handshakeFlight.flightEpoch = handshakeEpoch;
}
void expectingFinishFlight() {
expectCCSFlight = true;
}
+ // Queue up a handshake message.
void queueUpHandshake(HandshakeFragment hsf) {
-
- if ((nextRecordEpoch > hsf.recordEpoch) ||
- (nextRecordSeq > hsf.recordSeq) ||
- (nextMessageSeq > hsf.messageSeq)) {
- // too old, discard this record
+ if (!isDesirable(hsf)) {
+ // Not a dedired record, discard it.
return;
}
+ // Clean up the retransmission messages if necessary.
+ cleanUpRetransmit(hsf);
+
// Is it the first message of next flight?
- if ((flightTopMessageSeq == hsf.messageSeq) &&
- (hsf.fragmentOffset == 0) && (flightTopRecordSeq == -1)) {
+ //
+ // Note: the Finished message is handled in the final CCS flight.
+ boolean isMinimalFlightMessage = false;
+ if (handshakeFlight.minMessageSeq == hsf.messageSeq) {
+ isMinimalFlightMessage = true;
+ } else if ((precedingFlight != null) &&
+ (precedingFlight.minMessageSeq == hsf.messageSeq)) {
+ isMinimalFlightMessage = true;
+ }
- flightType = hsf.handshakeType;
- flightTopEpoch = hsf.recordEpoch;
- flightTopRecordSeq = hsf.recordSeq;
+ if (isMinimalFlightMessage && (hsf.fragmentOffset == 0) &&
+ (hsf.handshakeType != HandshakeMessage.ht_finished)) {
- if (hsf.handshakeType == HandshakeMessage.ht_server_hello) {
- // Is it a session-resuming handshake?
- try {
- isAbbreviatedHandshake =
- isSessionResuming(hsf.fragment, prevSessionID);
- } catch (SSLException ssle) {
- if (debug != null && Debug.isOn("ssl")) {
- System.out.println(
- Thread.currentThread().getName() +
- " discard invalid record: " + ssle);
- }
+ // reset the handshake flight
+ handshakeFlight.handshakeType = hsf.handshakeType;
+ handshakeFlight.flightEpoch = hsf.recordEpoch;
+ handshakeFlight.minMessageSeq = hsf.messageSeq;
+ }
- // invalid, discard it [section 4.1.2.7, RFC 6347]
- return;
- }
-
- if (!isAbbreviatedHandshake) {
- prevSessionID = getSessionID(hsf.fragment);
- }
+ if (hsf.handshakeType == HandshakeMessage.ht_finished) {
+ handshakeFlight.maxMessageSeq = hsf.messageSeq;
+ handshakeFlight.maxRecordEpoch = hsf.recordEpoch;
+ handshakeFlight.maxRecordSeq = hsf.recordSeq;
+ } else {
+ if (handshakeFlight.maxMessageSeq < hsf.messageSeq) {
+ handshakeFlight.maxMessageSeq = hsf.messageSeq;
}
+
+ int n = (hsf.recordEpoch - handshakeFlight.maxRecordEpoch);
+ if (n > 0) {
+ handshakeFlight.maxRecordEpoch = hsf.recordEpoch;
+ handshakeFlight.maxRecordSeq = hsf.recordSeq;
+ } else if (n == 0) {
+ // the same epoch
+ if (handshakeFlight.maxRecordSeq < hsf.recordSeq) {
+ handshakeFlight.maxRecordSeq = hsf.recordSeq;
+ }
+ } // Otherwise, it is unlikely to happen.
}
boolean fragmented = false;
@@ -578,7 +701,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
fragmented = true;
}
- List holes = holesMap.get(hsf.handshakeType);
+ List holes =
+ handshakeFlight.holesMap.get(hsf.handshakeType);
if (holes == null) {
if (!fragmented) {
holes = Collections.emptyList();
@@ -586,7 +710,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
holes = new LinkedList();
holes.add(new HoleDescriptor(0, hsf.messageLength));
}
- holesMap.put(hsf.handshakeType, holes);
+ handshakeFlight.holesMap.put(hsf.handshakeType, holes);
} else if (holes.isEmpty()) {
// Have got the full handshake message. This record may be
// a handshake message retransmission. Discard this record.
@@ -594,20 +718,11 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
// It's OK to discard retransmission as the handshake hash
// is computed as if each handshake message had been sent
// as a single fragment.
- //
- // Note that ClientHello messages are delivered twice in
- // DTLS handshaking.
- if ((hsf.handshakeType != HandshakeMessage.ht_client_hello &&
- hsf.handshakeType != ht_hello_verify_request) ||
- (nextMessageSeq != hsf.messageSeq)) {
- return;
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Have got the full message, discard it.");
}
- if (fragmented) {
- holes = new LinkedList();
- holes.add(new HoleDescriptor(0, hsf.messageLength));
- }
- holesMap.put(hsf.handshakeType, holes);
+ return;
}
if (fragmented) {
@@ -628,9 +743,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
(hole.limit < fragmentLimit))) {
if (debug != null && Debug.isOn("ssl")) {
- System.out.println(
- Thread.currentThread().getName() +
- " discard invalid record: " +
+ Debug.log("Discard invalid record: " +
"handshake fragment ranges are overlapping");
}
@@ -659,48 +772,205 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
}
}
- // append this fragment
- bufferedFragments.add(hsf);
-
- if ((lastHandshakeFragment == null) ||
- (lastHandshakeFragment.compareTo(hsf) < 0)) {
-
- lastHandshakeFragment = hsf;
+ // buffer this fragment
+ if (hsf.handshakeType == HandshakeMessage.ht_finished) {
+ // Need no status update.
+ bufferedFragments.add(hsf);
+ } else {
+ bufferFragment(hsf);
}
-
- if (flightIsReady) {
- flightIsReady = false;
- }
- needToCheckFlight = true;
}
- // queue up change_cipher_spec or encrypted message
- void queueUpFragment(RecordFragment rf) {
- if ((nextRecordEpoch > rf.recordEpoch) ||
- (nextRecordSeq > rf.recordSeq)) {
- // too old, discard this record
+ // Queue up a ChangeCipherSpec message
+ void queueUpChangeCipherSpec(RecordFragment rf) {
+ if (!isDesirable(rf)) {
+ // Not a dedired record, discard it.
return;
}
- // Is it the first message of next flight?
- if (expectCCSFlight &&
- (rf.contentType == Record.ct_change_cipher_spec)) {
+ // Clean up the retransmission messages if necessary.
+ cleanUpRetransmit(rf);
- flightType = (byte)0xFE;
- flightTopEpoch = rf.recordEpoch;
- flightTopRecordSeq = rf.recordSeq;
+ // Is it the first message of this flight?
+ //
+ // Note: the first message of the final flight is ChangeCipherSpec.
+ if (expectCCSFlight) {
+ handshakeFlight.handshakeType = HandshakeFlight.HF_UNKNOWN;
+ handshakeFlight.flightEpoch = rf.recordEpoch;
}
+ // The epoch should be the same as the first message of the flight.
+ if (handshakeFlight.maxRecordSeq < rf.recordSeq) {
+ handshakeFlight.maxRecordSeq = rf.recordSeq;
+ }
+
+ // buffer this fragment
+ bufferFragment(rf);
+ }
+
+ // Queue up a ciphertext message.
+ //
+ // Note: not yet be able to decrypt the message.
+ void queueUpFragment(RecordFragment rf) {
+ if (!isDesirable(rf)) {
+ // Not a dedired record, discard it.
+ return;
+ }
+
+ // Clean up the retransmission messages if necessary.
+ cleanUpRetransmit(rf);
+
+ // buffer this fragment
+ bufferFragment(rf);
+ }
+
+ private void bufferFragment(RecordFragment rf) {
// append this fragment
bufferedFragments.add(rf);
if (flightIsReady) {
flightIsReady = false;
}
- needToCheckFlight = true;
+
+ if (!needToCheckFlight) {
+ needToCheckFlight = true;
+ }
}
- boolean isEmpty() {
+ private void cleanUpRetransmit(RecordFragment rf) {
+ // Does the next flight start?
+ boolean isNewFlight = false;
+ if (precedingFlight != null) {
+ if (precedingFlight.flightEpoch < rf.recordEpoch) {
+ isNewFlight = true;
+ } else {
+ if (rf instanceof HandshakeFragment) {
+ HandshakeFragment hsf = (HandshakeFragment)rf;
+ if (precedingFlight.maxMessageSeq < hsf.messageSeq) {
+ isNewFlight = true;
+ }
+ } else if (rf.contentType != Record.ct_change_cipher_spec) {
+ // ciphertext
+ if (precedingFlight.maxRecordEpoch < rf.recordEpoch) {
+ isNewFlight = true;
+ }
+ }
+ }
+ }
+
+ if (!isNewFlight) {
+ // Need no cleanup.
+ return;
+ }
+
+ // clean up the buffer
+ for (Iterator it = bufferedFragments.iterator();
+ it.hasNext();) {
+
+ RecordFragment frag = it.next();
+ boolean isOld = false;
+ if (frag.recordEpoch < precedingFlight.maxRecordEpoch) {
+ isOld = true;
+ } else if (frag.recordEpoch == precedingFlight.maxRecordEpoch) {
+ if (frag.recordSeq <= precedingFlight.maxRecordSeq) {
+ isOld = true;
+ }
+ }
+
+ if (!isOld && (frag instanceof HandshakeFragment)) {
+ HandshakeFragment hsf = (HandshakeFragment)frag;
+ isOld = (hsf.messageSeq <= precedingFlight.maxMessageSeq);
+ }
+
+ if (isOld) {
+ it.remove();
+ } else {
+ // Safe to break as items in the buffer are ordered.
+ break;
+ }
+ }
+
+ // discard retransmissions of the previous flight if any.
+ precedingFlight = null;
+ }
+
+ // Is a desired record?
+ //
+ // Check for retransmission and lost records.
+ private boolean isDesirable(RecordFragment rf) {
+ //
+ // Discard records old than the previous epoch.
+ //
+ int previousEpoch = nextRecordEpoch - 1;
+ if (rf.recordEpoch < previousEpoch) {
+ // Too old to use, discard this record.
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Too old epoch to use this record, discard it.");
+ }
+
+ return false;
+ }
+
+ //
+ // Allow retransmission of last flight of the previous epoch
+ //
+ // For example, the last server delivered flight for session
+ // resuming abbreviated handshaking consist three messages:
+ // ServerHello
+ // [ChangeCipherSpec]
+ // Finished
+ //
+ // The epoch number is incremented and the sequence number is reset
+ // if the ChangeCipherSpec is sent.
+ if (rf.recordEpoch == previousEpoch) {
+ boolean isDesired = true;
+ if (precedingFlight == null) {
+ isDesired = false;
+ } else {
+ if (rf instanceof HandshakeFragment) {
+ HandshakeFragment hsf = (HandshakeFragment)rf;
+ if (precedingFlight.minMessageSeq > hsf.messageSeq) {
+ isDesired = false;
+ }
+ } else if (rf.contentType == Record.ct_change_cipher_spec) {
+ // ChangeCipherSpec
+ if (precedingFlight.flightEpoch != rf.recordEpoch) {
+ isDesired = false;
+ }
+ } else { // ciphertext
+ if ((rf.recordEpoch < precedingFlight.maxRecordEpoch) ||
+ (rf.recordEpoch == precedingFlight.maxRecordEpoch &&
+ rf.recordSeq <= precedingFlight.maxRecordSeq)) {
+ isDesired = false;
+ }
+ }
+ }
+
+ if (!isDesired) {
+ // Too old to use, discard this retransmitted record
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Too old retransmission to use, discard it.");
+ }
+
+ return false;
+ }
+ } else if ((rf.recordEpoch == nextRecordEpoch) &&
+ (nextRecordSeq > rf.recordSeq)) {
+
+ // Previously disordered record for the current epoch.
+ //
+ // Should has been retransmitted. Discard this record.
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Lagging behind record (sequence), discard it.");
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean isEmpty() {
return (bufferedFragments.isEmpty() ||
(!flightIsReady && !needToCheckFlight) ||
(needToCheckFlight && !flightIsReady()));
@@ -708,12 +978,9 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
Plaintext acquirePlaintext() {
if (bufferedFragments.isEmpty()) {
- // reset the flight
- if (flightIsReady) {
- flightIsReady = false;
- needToCheckFlight = false;
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("No received handshake messages");
}
-
return null;
}
@@ -721,27 +988,103 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
// check the fligth status
flightIsReady = flightIsReady();
- // set for next flight
+ // Reset if this flight is ready.
if (flightIsReady) {
- flightTopMessageSeq = lastHandshakeFragment.messageSeq + 1;
- flightTopRecordSeq = -1;
+ // Retransmitted handshake messages are not needed for
+ // further handshaking processing.
+ if (handshakeFlight.isRetransmitOf(precedingFlight)) {
+ // cleanup
+ bufferedFragments.clear();
+
+ // Reset the next handshake flight.
+ resetHandshakeFlight(precedingFlight);
+
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Received a retransmission flight.");
+ }
+
+ return Plaintext.PLAINTEXT_NULL;
+ }
}
needToCheckFlight = false;
}
if (!flightIsReady) {
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("The handshake flight is not ready to use: " +
+ handshakeFlight.handshakeType);
+ }
return null;
}
RecordFragment rFrag = bufferedFragments.first();
+ Plaintext plaintext;
if (!rFrag.isCiphertext) {
// handshake message, or ChangeCipherSpec message
- return acquireHandshakeMessage();
+ plaintext = acquireHandshakeMessage();
+
+ // Reset the handshake flight.
+ if (bufferedFragments.isEmpty()) {
+ // Need not to backup the holes map. Clear up it at first.
+ handshakeFlight.holesMap.clear(); // cleanup holes map
+
+ // Update the preceding flight.
+ precedingFlight = (HandshakeFlight)handshakeFlight.clone();
+
+ // Reset the next handshake flight.
+ resetHandshakeFlight(precedingFlight);
+
+ if (expectCCSFlight &&
+ (precedingFlight.flightEpoch ==
+ HandshakeFlight.HF_UNKNOWN)) {
+ expectCCSFlight = false;
+ }
+ }
} else {
// a Finished message or other ciphertexts
- return acquireCachedMessage();
+ plaintext = acquireCachedMessage();
}
+
+ return plaintext;
+ }
+
+ //
+ // Reset the handshake flight from a previous one.
+ //
+ private void resetHandshakeFlight(HandshakeFlight prev) {
+ // Reset the next handshake flight.
+ handshakeFlight.handshakeType = HandshakeFlight.HF_UNKNOWN;
+ handshakeFlight.flightEpoch = prev.maxRecordEpoch;
+ if (prev.flightEpoch != prev.maxRecordEpoch) {
+ // a new epoch starts
+ handshakeFlight.minMessageSeq = 0;
+ } else {
+ // stay at the same epoch
+ //
+ // The minimal message sequence number will get updated if
+ // a flight retransmission happens.
+ handshakeFlight.minMessageSeq = prev.maxMessageSeq + 1;
+ }
+
+ // cleanup the maximum sequence number and epoch number.
+ //
+ // Note: actually, we need to do nothing because the reassembler
+ // of handshake messages will reset them properly even for
+ // retransmissions.
+ //
+ handshakeFlight.maxMessageSeq = 0;
+ handshakeFlight.maxRecordEpoch = handshakeFlight.flightEpoch;
+
+ // Record sequence number cannot wrap even for retransmissions.
+ handshakeFlight.maxRecordSeq = prev.maxRecordSeq + 1;
+
+ // cleanup holes map
+ handshakeFlight.holesMap.clear();
+
+ // Ready to accept new input record.
+ flightIsReady = false;
+ needToCheckFlight = false;
}
private Plaintext acquireCachedMessage() {
@@ -750,6 +1093,9 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
if (readEpoch != rFrag.recordEpoch) {
if (readEpoch > rFrag.recordEpoch) {
// discard old records
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Discard old buffered ciphertext fragments.");
+ }
bufferedFragments.remove(rFrag); // popup the fragment
}
@@ -757,6 +1103,10 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
if (flightIsReady) {
flightIsReady = false;
}
+
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Not yet ready to decrypt the cached fragments.");
+ }
return null;
}
@@ -768,9 +1118,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
plaintextFragment = decrypt(readAuthenticator, readCipher,
rFrag.contentType, fragment, rFrag.recordEnS);
} catch (BadPaddingException bpe) {
- if (debug != null && Debug.isOn("ssl")) {
- System.out.println(Thread.currentThread().getName() +
- " discard invalid record: " + bpe);
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Discard invalid record: " + bpe);
}
// invalid, discard this record [section 4.1.2.7, RFC 6347]
@@ -782,7 +1131,6 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
// beginning of the next flight) message. Need not to check
// any ChangeCipherSpec message.
if (rFrag.contentType == Record.ct_handshake) {
- HandshakeFragment finFrag = null;
while (plaintextFragment.remaining() > 0) {
HandshakeFragment hsFrag = parseHandshakeMessage(
rFrag.contentType,
@@ -792,66 +1140,31 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
if (hsFrag == null) {
// invalid, discard this record
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.printHex(
+ "Invalid handshake fragment, discard it",
+ plaintextFragment);
+ }
return null;
}
- if (hsFrag.handshakeType == HandshakeMessage.ht_finished) {
- finFrag = hsFrag;
-
- // reset for the next flight
- this.flightType = (byte)0xFF;
- this.flightTopEpoch = rFrag.recordEpoch;
- this.flightTopMessageSeq = hsFrag.messageSeq + 1;
- this.flightTopRecordSeq = -1;
- } else {
- // reset the flight
- if (flightIsReady) {
- flightIsReady = false;
- }
- queueUpHandshake(hsFrag);
+ queueUpHandshake(hsFrag);
+ // The flight ready status (flightIsReady) should have
+ // been checked and updated for the Finished handshake
+ // message before the decryption. Please don't update
+ // flightIsReady for Finished messages.
+ if (hsFrag.handshakeType != HandshakeMessage.ht_finished) {
+ flightIsReady = false;
+ needToCheckFlight = true;
}
}
- this.nextRecordSeq = rFrag.recordSeq + 1;
- this.nextMessageSeq = 0;
-
- if (finFrag != null) {
- this.nextRecordEpoch = finFrag.recordEpoch;
- this.nextRecordSeq = finFrag.recordSeq + 1;
- this.nextMessageSeq = finFrag.messageSeq + 1;
-
- // Finished message does not fragment.
- byte[] recordFrag = new byte[finFrag.messageLength + 4];
- Plaintext plaintext = new Plaintext(finFrag.contentType,
- finFrag.majorVersion, finFrag.minorVersion,
- finFrag.recordEpoch, finFrag.recordSeq,
- ByteBuffer.wrap(recordFrag));
-
- // fill the handshake fragment of the record
- recordFrag[0] = finFrag.handshakeType;
- recordFrag[1] =
- (byte)((finFrag.messageLength >>> 16) & 0xFF);
- recordFrag[2] =
- (byte)((finFrag.messageLength >>> 8) & 0xFF);
- recordFrag[3] = (byte)(finFrag.messageLength & 0xFF);
-
- System.arraycopy(finFrag.fragment, 0,
- recordFrag, 4, finFrag.fragmentLength);
-
- // handshake hashing
- handshakeHashing(finFrag, plaintext);
-
- // input handshake finished
- handshakeFinished = true;
-
- return plaintext;
- } else {
- return acquirePlaintext();
- }
+ return acquirePlaintext();
} else {
return new Plaintext(rFrag.contentType,
rFrag.majorVersion, rFrag.minorVersion,
- rFrag.recordEpoch, rFrag.recordSeq,
+ rFrag.recordEpoch,
+ Authenticator.toLong(rFrag.recordEnS),
plaintextFragment);
}
}
@@ -861,17 +1174,23 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
RecordFragment rFrag = bufferedFragments.first();
if (rFrag.contentType == Record.ct_change_cipher_spec) {
this.nextRecordEpoch = rFrag.recordEpoch + 1;
- this.nextRecordSeq = 0;
- // no change on next handshake message sequence number
- bufferedFragments.remove(rFrag); // popup the fragment
+ // For retransmissions, the next record sequence number is a
+ // positive value. Don't worry about it as the acquiring of
+ // the immediately followed Finished handshake message will
+ // reset the next record sequence number correctly.
+ this.nextRecordSeq = 0;
+
+ // Popup the fragment.
+ bufferedFragments.remove(rFrag);
// Reload if this message has been reserved for handshake hash.
handshakeHash.reload();
return new Plaintext(rFrag.contentType,
rFrag.majorVersion, rFrag.minorVersion,
- rFrag.recordEpoch, rFrag.recordSeq,
+ rFrag.recordEpoch,
+ Authenticator.toLong(rFrag.recordEnS),
ByteBuffer.wrap(rFrag.fragment));
} else { // rFrag.contentType == Record.ct_handshake
HandshakeFragment hsFrag = (HandshakeFragment)rFrag;
@@ -882,13 +1201,13 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
// this.nextRecordEpoch = hsFrag.recordEpoch;
this.nextRecordSeq = hsFrag.recordSeq + 1;
- this.nextMessageSeq = hsFrag.messageSeq + 1;
// Note: may try to avoid byte array copy in the future.
byte[] recordFrag = new byte[hsFrag.messageLength + 4];
Plaintext plaintext = new Plaintext(hsFrag.contentType,
hsFrag.majorVersion, hsFrag.minorVersion,
- hsFrag.recordEpoch, hsFrag.recordSeq,
+ hsFrag.recordEpoch,
+ Authenticator.toLong(hsFrag.recordEnS),
ByteBuffer.wrap(recordFrag));
// fill the handshake fragment of the record
@@ -913,7 +1232,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
byte[] recordFrag = new byte[hsFrag.messageLength + 4];
Plaintext plaintext = new Plaintext(hsFrag.contentType,
hsFrag.majorVersion, hsFrag.minorVersion,
- hsFrag.recordEpoch, hsFrag.recordSeq,
+ hsFrag.recordEpoch,
+ Authenticator.toLong(hsFrag.recordEnS),
ByteBuffer.wrap(recordFrag));
// fill the handshake fragment of the record
@@ -957,7 +1277,6 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
handshakeHashing(hsFrag, plaintext);
this.nextRecordSeq = maxRecodeSN + 1;
- this.nextMessageSeq = msgSeq + 1;
return plaintext;
}
@@ -966,15 +1285,26 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
boolean flightIsReady() {
- //
- // the ChangeCipherSpec/Finished flight
- //
- if (expectCCSFlight) {
- // Have the ChangeCipherSpec/Finished messages been received?
- return hasFinisedMessage(bufferedFragments);
- }
+ byte flightType = handshakeFlight.handshakeType;
+ if (flightType == HandshakeFlight.HF_UNKNOWN) {
+ //
+ // the ChangeCipherSpec/Finished flight
+ //
+ if (expectCCSFlight) {
+ // Have the ChangeCipherSpec/Finished flight been received?
+ boolean isReady = hasFinishedMessage(bufferedFragments);
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "Has the final flight been received? " + isReady);
+ }
+
+ return isReady;
+ }
+
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("No flight is received yet.");
+ }
- if (flightType == (byte)0xFF) {
return false;
}
@@ -983,7 +1313,12 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
(flightType == HandshakeMessage.ht_hello_verify_request)) {
// single handshake message flight
- return hasCompleted(holesMap.get(flightType));
+ boolean isReady = hasCompleted(flightType);
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Is the handshake message completed? " + isReady);
+ }
+
+ return isReady;
}
//
@@ -991,31 +1326,52 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
//
if (flightType == HandshakeMessage.ht_server_hello) {
// Firstly, check the first flight handshake message.
- if (!hasCompleted(holesMap.get(flightType))) {
+ if (!hasCompleted(flightType)) {
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "The ServerHello message is not completed yet.");
+ }
+
return false;
}
//
// an abbreviated handshake
//
- if (isAbbreviatedHandshake) {
- // Ready to use the flight if received the
- // ChangeCipherSpec and Finished messages.
- return hasFinisedMessage(bufferedFragments);
+ if (hasFinishedMessage(bufferedFragments)) {
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("It's an abbreviated handshake.");
+ }
+
+ return true;
}
//
// a full handshake
//
- if (lastHandshakeFragment.handshakeType !=
- HandshakeMessage.ht_server_hello_done) {
+ List holes = handshakeFlight.holesMap.get(
+ HandshakeMessage.ht_server_hello_done);
+ if ((holes == null) || !holes.isEmpty()) {
// Not yet got the final message of the flight.
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Not yet got the ServerHelloDone message");
+ }
+
return false;
}
// Have all handshake message been received?
- return hasCompleted(bufferedFragments,
- flightTopMessageSeq, lastHandshakeFragment.messageSeq);
+ boolean isReady = hasCompleted(bufferedFragments,
+ handshakeFlight.minMessageSeq,
+ handshakeFlight.maxMessageSeq);
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Is the ServerHello flight (message " +
+ handshakeFlight.minMessageSeq + "-" +
+ handshakeFlight.maxMessageSeq +
+ ") completed? " + isReady);
+ }
+
+ return isReady;
}
//
@@ -1029,92 +1385,65 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
(flightType == HandshakeMessage.ht_client_key_exchange)) {
// Firstly, check the first flight handshake message.
- if (!hasCompleted(holesMap.get(flightType))) {
+ if (!hasCompleted(flightType)) {
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "The ClientKeyExchange or client Certificate " +
+ "message is not completed yet.");
+ }
+
return false;
}
- if (!hasFinisedMessage(bufferedFragments)) {
- // not yet got the ChangeCipherSpec/Finished messages
- return false;
+ // Is client CertificateVerify a mandatory message?
+ if (flightType == HandshakeMessage.ht_certificate) {
+ if (needClientVerify(bufferedFragments) &&
+ !hasCompleted(ht_certificate_verify)) {
+
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "Not yet have the CertificateVerify message");
+ }
+
+ return false;
+ }
}
- if (flightType == HandshakeMessage.ht_client_key_exchange) {
- // single handshake message flight
- return true;
- }
+ if (!hasFinishedMessage(bufferedFragments)) {
+ // not yet have the ChangeCipherSpec/Finished messages
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "Not yet have the ChangeCipherSpec and " +
+ "Finished messages");
+ }
- //
- // flightType == HandshakeMessage.ht_certificate
- //
- // We don't support certificates containing fixed
- // Diffie-Hellman parameters. Therefore, CertificateVerify
- // message is required if client Certificate message presents.
- //
- if (lastHandshakeFragment.handshakeType !=
- HandshakeMessage.ht_certificate_verify) {
- // Not yet got the final message of the flight.
return false;
}
// Have all handshake message been received?
- return hasCompleted(bufferedFragments,
- flightTopMessageSeq, lastHandshakeFragment.messageSeq);
+ boolean isReady = hasCompleted(bufferedFragments,
+ handshakeFlight.minMessageSeq,
+ handshakeFlight.maxMessageSeq);
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Is the ClientKeyExchange flight (message " +
+ handshakeFlight.minMessageSeq + "-" +
+ handshakeFlight.maxMessageSeq +
+ ") completed? " + isReady);
+ }
+
+ return isReady;
}
//
// Otherwise, need to receive more handshake messages.
//
- return false;
- }
-
- private boolean isSessionResuming(
- byte[] fragment, byte[] prevSid) throws SSLException {
-
- // As the first fragment of ServerHello should be big enough
- // to hold the session_id field, need not to worry about the
- // fragmentation here.
- if ((fragment == null) || (fragment.length < 38)) {
- // 38: the minimal ServerHello body length
- throw new SSLException(
- "Invalid ServerHello message: no sufficient data");
- }
-
- int sidLen = fragment[34]; // 34: the length field
- if (sidLen > 32) { // opaque SessionID<0..32>
- throw new SSLException(
- "Invalid ServerHello message: invalid session id");
- }
-
- if (fragment.length < 38 + sidLen) {
- throw new SSLException(
- "Invalid ServerHello message: no sufficient data");
- }
-
- if (sidLen != 0 && (prevSid.length == sidLen)) {
- // may be a session-resuming handshake
- for (int i = 0; i < sidLen; i++) {
- if (prevSid[i] != fragment[35 + i]) {
- // 35: the session identifier
- return false;
- }
- }
-
- return true;
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log("Need to receive more handshake messages");
}
return false;
}
- private byte[] getSessionID(byte[] fragment) {
- // The validity has been checked in the call to isSessionResuming().
- int sidLen = fragment[34]; // 34: the sessionID length field
-
- byte[] temporary = new byte[sidLen];
- System.arraycopy(fragment, 35, temporary, 0, sidLen);
-
- return temporary;
- }
-
// Looking for the ChangeCipherSpec and Finished messages.
//
// As the cached Finished message should be a ciphertext, we don't
@@ -1122,8 +1451,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
// to the spec of TLS/DTLS handshaking, a Finished message is always
// sent immediately after a ChangeCipherSpec message. The first
// ciphertext handshake message should be the expected Finished message.
- private boolean hasFinisedMessage(
- Set fragments) {
+ private boolean hasFinishedMessage(Set fragments) {
boolean hasCCS = false;
boolean hasFin = false;
@@ -1147,7 +1475,35 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
return hasFin && hasCCS;
}
- private boolean hasCompleted(List holes) {
+ // Is client CertificateVerify a mandatory message?
+ //
+ // In the current implementation, client CertificateVerify is a
+ // mandatory message if the client Certificate is not empty.
+ private boolean needClientVerify(Set fragments) {
+
+ // The caller should have checked the completion of the first
+ // present handshake message. Need not to check it again.
+ for (RecordFragment rFrag : fragments) {
+ if ((rFrag.contentType != Record.ct_handshake) ||
+ rFrag.isCiphertext) {
+ break;
+ }
+
+ HandshakeFragment hsFrag = (HandshakeFragment)rFrag;
+ if (hsFrag.handshakeType != HandshakeMessage.ht_certificate) {
+ continue;
+ }
+
+ return (rFrag.fragment != null) &&
+ (rFrag.fragment.length > DTLSRecord.minCertPlaintextSize);
+ }
+
+ return false;
+ }
+
+ private boolean hasCompleted(byte handshakeType) {
+ List holes =
+ handshakeFlight.holesMap.get(handshakeType);
if (holes == null) {
// not yet received this kind of handshake message
return false;
@@ -1173,7 +1529,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord {
continue;
} else if (hsFrag.messageSeq == (presentMsgSeq + 1)) {
// check the completion of the handshake message
- if (!hasCompleted(holesMap.get(hsFrag.handshakeType))) {
+ if (!hasCompleted(hsFrag.handshakeType)) {
return false;
}
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java b/jdk/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java
index 0381a0dc504..88ffa1611aa 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -279,6 +279,16 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord {
fragmenter = null;
}
+ @Override
+ void launchRetransmission() {
+ // Note: Please don't retransmit if there are handshake messages
+ // or alerts waiting in the queue.
+ if (((alertMemos == null) || alertMemos.isEmpty()) &&
+ (fragmenter != null) && fragmenter.isRetransmittable()) {
+ fragmenter.setRetransmission();
+ }
+ }
+
// buffered record fragment
private static class RecordMemo {
byte contentType;
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/DTLSRecord.java b/jdk/src/java.base/share/classes/sun/security/ssl/DTLSRecord.java
index 30598e0148c..f8bbb3183be 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/DTLSRecord.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/DTLSRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -84,4 +84,18 @@ interface DTLSRecord extends Record {
+ maxPadding // padding
+ maxMacSize; // MAC
+ /*
+ * Minimum record size of Certificate handshake message.
+ * Client sends a certificate message containing no certificates if no
+ * suitable certificate is available. That is, the certificate_list
+ * structure has a length of zero.
+ *
+ * struct {
+ * ASN.1Cert certificate_list<0..2^24-1>;
+ * } Certificate;
+ */
+ static final int minCertPlaintextSize =
+ headerSize // record header
+ + handshakeHeaderSize // handshake header
+ + 3; // cert list length
}
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/Debug.java b/jdk/src/java.base/share/classes/sun/security/ssl/Debug.java
index 4748330e4d6..48f6bb72bb5 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Debug.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Debug.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -144,6 +144,13 @@ public class Debug {
System.err.println(prefix + ": "+message);
}
+ /**
+ * Print a message to stdout.
+ */
+ static void log(String message) {
+ System.out.println(Thread.currentThread().getName() + ": " + message);
+ }
+
/**
* print a blank line to stderr that is prefixed with the prefix.
*/
@@ -156,7 +163,6 @@ public class Debug {
/**
* print a message to stderr that is prefixed with the prefix.
*/
-
public static void println(String prefix, String message)
{
System.err.println(prefix + ": "+message);
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/OutputRecord.java b/jdk/src/java.base/share/classes/sun/security/ssl/OutputRecord.java
index 7980ea77017..bffb1116337 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/OutputRecord.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/OutputRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -194,6 +194,11 @@ abstract class OutputRecord extends ByteArrayOutputStream
// blank
}
+ // apply to DTLS SSLEngine
+ void launchRetransmission() {
+ // blank
+ }
+
@Override
public synchronized void close() throws IOException {
if (!isClosed) {
@@ -224,6 +229,9 @@ abstract class OutputRecord extends ByteArrayOutputStream
sequenceNumber = authenticator.sequenceNumber();
}
+ // The sequence number may be shared for different purpose.
+ boolean sharedSequenceNumber = false;
+
// "flip" but skip over header again, add MAC & encrypt
if (authenticator instanceof MAC) {
MAC signer = (MAC)authenticator;
@@ -243,6 +251,11 @@ abstract class OutputRecord extends ByteArrayOutputStream
// reset the position and limit
destination.limit(destination.position());
destination.position(dstContent);
+
+ // The signer has used and increased the sequence number.
+ if (isDTLS) {
+ sharedSequenceNumber = true;
+ }
}
}
@@ -261,6 +274,11 @@ abstract class OutputRecord extends ByteArrayOutputStream
// Encrypt may pad, so again the limit may be changed.
encCipher.encrypt(destination, dstLim);
+
+ // The cipher has used and increased the sequence number.
+ if (isDTLS && encCipher.isAEADMode()) {
+ sharedSequenceNumber = true;
+ }
} else {
destination.position(destination.limit());
}
@@ -290,8 +308,10 @@ abstract class OutputRecord extends ByteArrayOutputStream
destination.put(headerOffset + 11, (byte)(fragLen >> 8));
destination.put(headerOffset + 12, (byte)fragLen);
- // Increase the sequence number for next use.
- authenticator.increaseSequenceNumber();
+ // Increase the sequence number for next use if it is not shared.
+ if (!sharedSequenceNumber) {
+ authenticator.increaseSequenceNumber();
+ }
}
// Update destination position to reflect the amount of data produced.
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/Plaintext.java b/jdk/src/java.base/share/classes/sun/security/ssl/Plaintext.java
index ab80abe8738..24918a453f3 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Plaintext.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Plaintext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -38,7 +38,7 @@ final class Plaintext {
byte majorVersion;
byte minorVersion;
int recordEpoch; // incremented on every cipher state change
- long recordSN;
+ long recordSN; // contains epcoh number (epoch | sequence)
ByteBuffer fragment; // null if need to be reassembled
HandshakeStatus handshakeStatus; // null if not used or not handshaking
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java b/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java
index e7cd2acf126..e967cb9fa35 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -994,7 +994,22 @@ public final class SSLEngineImpl extends SSLEngine {
// plainText should never be null for TLS protocols
HandshakeStatus hsStatus = null;
- if (!isDTLS || plainText != null) {
+ if (plainText == Plaintext.PLAINTEXT_NULL) {
+ // Only happens for DTLS protocols.
+ //
+ // Received a retransmitted flight, and need to retransmit the
+ // previous delivered handshake flight messages.
+ if (enableRetransmissions) {
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "Retransmit the previous handshake flight messages.");
+ }
+
+ synchronized (this) {
+ outputRecord.launchRetransmission();
+ }
+ } // Otherwise, discard the retransmitted flight.
+ } else if (!isDTLS || plainText != null) {
hsStatus = processInputRecord(plainText, appData, offset, length);
}
@@ -1003,7 +1018,7 @@ public final class SSLEngineImpl extends SSLEngine {
}
if (plainText == null) {
- plainText = new Plaintext();
+ plainText = Plaintext.PLAINTEXT_NULL;
}
plainText.handshakeStatus = hsStatus;
@@ -1378,7 +1393,8 @@ public final class SSLEngineImpl extends SSLEngine {
// Acquire the buffered to-be-delivered records or retransmissions.
//
// May have buffered records, or need retransmission if handshaking.
- if (!outputRecord.isEmpty() || (handshaker != null)) {
+ if (!outputRecord.isEmpty() ||
+ (enableRetransmissions && handshaker != null)) {
ciphertext = outputRecord.acquireCiphertext(netData);
}
@@ -1403,13 +1419,36 @@ public final class SSLEngineImpl extends SSLEngine {
HandshakeStatus hsStatus = null;
Ciphertext.RecordType recordType = ciphertext.recordType;
- if ((handshaker != null) &&
- (recordType.contentType == Record.ct_handshake) &&
- (recordType.handshakeType == HandshakeMessage.ht_finished) &&
- handshaker.isDone() && outputRecord.isEmpty()) {
+ if ((recordType.contentType == Record.ct_handshake) &&
+ (recordType.handshakeType == HandshakeMessage.ht_finished) &&
+ outputRecord.isEmpty()) {
- hsStatus = finishHandshake();
- connectionState = cs_DATA;
+ if (handshaker == null) {
+ hsStatus = HandshakeStatus.FINISHED;
+ } else if (handshaker.isDone()) {
+ hsStatus = finishHandshake();
+ connectionState = cs_DATA;
+
+ // Retransmit the last flight twice.
+ //
+ // The application data transactions may begin immediately
+ // after the last flight. If the last flight get lost, the
+ // application data may be discarded accordingly. As could
+ // be an issue for some applications. This impact can be
+ // mitigated by sending the last fligth twice.
+ if (isDTLS && enableRetransmissions) {
+ if (debug != null && Debug.isOn("verbose")) {
+ Debug.log(
+ "Retransmit the last flight messages.");
+ }
+
+ synchronized (this) {
+ outputRecord.launchRetransmission();
+ }
+
+ hsStatus = HandshakeStatus.NEED_WRAP;
+ }
+ }
} // Otherwise, the followed call to getHSStatus() will help.
/*
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java
index a8870960ca6..17777825f3f 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java
@@ -558,73 +558,6 @@ final class ServerHandshaker extends Handshaker {
applicationProtocol = "";
}
- // cookie exchange
- if (isDTLS) {
- HelloCookieManager hcMgr = sslContext.getHelloCookieManager();
- if ((mesg.cookie == null) || (mesg.cookie.length == 0) ||
- (!hcMgr.isValid(mesg))) {
-
- //
- // Perform cookie exchange for DTLS handshaking if no cookie
- // or the cookie is invalid in the ClientHello message.
- //
- HelloVerifyRequest m0 = new HelloVerifyRequest(hcMgr, mesg);
-
- if (debug != null && Debug.isOn("handshake")) {
- m0.print(System.out);
- }
-
- m0.write(output);
- handshakeState.update(m0, resumingSession);
- output.flush();
-
- return;
- }
- }
-
- /*
- * FIRST, construct the ServerHello using the options and priorities
- * from the ClientHello. Update the (pending) cipher spec as we do
- * so, and save the client's version to protect against rollback
- * attacks.
- *
- * There are a bunch of minor tasks here, and one major one: deciding
- * if the short or the full handshake sequence will be used.
- */
- ServerHello m1 = new ServerHello();
-
- clientRequestedVersion = mesg.protocolVersion;
-
- // select a proper protocol version.
- ProtocolVersion selectedVersion =
- selectProtocolVersion(clientRequestedVersion);
- if (selectedVersion == null ||
- selectedVersion.v == ProtocolVersion.SSL20Hello.v) {
- fatalSE(Alerts.alert_handshake_failure,
- "Client requested protocol " + clientRequestedVersion +
- " not enabled or not supported");
- }
-
- handshakeHash.protocolDetermined(selectedVersion);
- setVersion(selectedVersion);
-
- m1.protocolVersion = protocolVersion;
-
- //
- // random ... save client and server values for later use
- // in computing the master secret (from pre-master secret)
- // and thence the other crypto keys.
- //
- // NOTE: this use of three inputs to generating _each_ set
- // of ciphers slows things down, but it does increase the
- // security since each connection in the session can hold
- // its own authenticated (and strong) keys. One could make
- // creation of a session a rare thing...
- //
- clnt_random = mesg.clnt_random;
- svr_random = new RandomCookie(sslContext.getSecureRandom());
- m1.svr_random = svr_random;
-
session = null; // forget about the current session
//
// Here we go down either of two paths: (a) the fast one, where
@@ -732,6 +665,73 @@ final class ServerHandshaker extends Handshaker {
}
} // else client did not try to resume
+ // cookie exchange
+ if (isDTLS && !resumingSession) {
+ HelloCookieManager hcMgr = sslContext.getHelloCookieManager();
+ if ((mesg.cookie == null) || (mesg.cookie.length == 0) ||
+ (!hcMgr.isValid(mesg))) {
+
+ //
+ // Perform cookie exchange for DTLS handshaking if no cookie
+ // or the cookie is invalid in the ClientHello message.
+ //
+ HelloVerifyRequest m0 = new HelloVerifyRequest(hcMgr, mesg);
+
+ if (debug != null && Debug.isOn("handshake")) {
+ m0.print(System.out);
+ }
+
+ m0.write(output);
+ handshakeState.update(m0, resumingSession);
+ output.flush();
+
+ return;
+ }
+ }
+
+ /*
+ * FIRST, construct the ServerHello using the options and priorities
+ * from the ClientHello. Update the (pending) cipher spec as we do
+ * so, and save the client's version to protect against rollback
+ * attacks.
+ *
+ * There are a bunch of minor tasks here, and one major one: deciding
+ * if the short or the full handshake sequence will be used.
+ */
+ ServerHello m1 = new ServerHello();
+
+ clientRequestedVersion = mesg.protocolVersion;
+
+ // select a proper protocol version.
+ ProtocolVersion selectedVersion =
+ selectProtocolVersion(clientRequestedVersion);
+ if (selectedVersion == null ||
+ selectedVersion.v == ProtocolVersion.SSL20Hello.v) {
+ fatalSE(Alerts.alert_handshake_failure,
+ "Client requested protocol " + clientRequestedVersion +
+ " not enabled or not supported");
+ }
+
+ handshakeHash.protocolDetermined(selectedVersion);
+ setVersion(selectedVersion);
+
+ m1.protocolVersion = protocolVersion;
+
+ //
+ // random ... save client and server values for later use
+ // in computing the master secret (from pre-master secret)
+ // and thence the other crypto keys.
+ //
+ // NOTE: this use of three inputs to generating _each_ set
+ // of ciphers slows things down, but it does increase the
+ // security since each connection in the session can hold
+ // its own authenticated (and strong) keys. One could make
+ // creation of a session a rare thing...
+ //
+ clnt_random = mesg.clnt_random;
+ svr_random = new RandomCookie(sslContext.getSecureRandom());
+ m1.svr_random = svr_random;
+
//
// If client hasn't specified a session we can resume, start a
// new one and choose its cipher suite and compression options.
diff --git a/jdk/src/java.base/share/classes/sun/util/locale/provider/BreakDictionary.java b/jdk/src/java.base/share/classes/sun/text/BreakDictionary.java
similarity index 70%
rename from jdk/src/java.base/share/classes/sun/util/locale/provider/BreakDictionary.java
rename to jdk/src/java.base/share/classes/sun/text/BreakDictionary.java
index 4be1363b58f..ae2aba1e7c2 100644
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/BreakDictionary.java
+++ b/jdk/src/java.base/share/classes/sun/text/BreakDictionary.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,15 +37,10 @@
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*/
-package sun.util.locale.provider;
+package sun.text;
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.lang.reflect.Module;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
import java.util.MissingResourceException;
import sun.text.CompactByteArray;
import sun.text.SupplementaryCharacterData;
@@ -137,131 +132,90 @@ class BreakDictionary {
// deserialization
//=========================================================================
- BreakDictionary(Module module, String dictionaryName)
- throws IOException, MissingResourceException {
-
- readDictionaryFile(module, dictionaryName);
+ BreakDictionary(String dictionaryName, byte[] dictionaryData) {
+ try {
+ setupDictionary(dictionaryName, dictionaryData);
+ } catch (BufferUnderflowException bue) {
+ MissingResourceException e;
+ e = new MissingResourceException("Corrupted dictionary data",
+ dictionaryName, "");
+ e.initCause(bue);
+ throw e;
+ }
}
- private void readDictionaryFile(final Module module, final String dictionaryName)
- throws IOException, MissingResourceException {
-
- BufferedInputStream in;
- try {
- PrivilegedExceptionAction pa = () -> {
- String pathName = "jdk.localedata".equals(module.getName()) ?
- "sun/text/resources/ext/" :
- "sun/text/resources/";
- InputStream is = module.getResourceAsStream(pathName + dictionaryName);
- if (is == null) {
- // Try to load the file with "java.base" module instance. Assumption
- // here is that the fall back data files to be read should reside in
- // java.base.
- is = BreakDictionary.class.getModule().getResourceAsStream("sun/text/resources/" + dictionaryName);
- }
-
- return new BufferedInputStream(is);
- };
- in = AccessController.doPrivileged(pa);
- }
- catch (PrivilegedActionException e) {
- throw new InternalError(e.toString(), e);
- }
-
- byte[] buf = new byte[8];
- if (in.read(buf) != 8) {
- throw new MissingResourceException("Wrong data length",
- dictionaryName, "");
- }
+ private void setupDictionary(String dictionaryName, byte[] dictionaryData) {
+ ByteBuffer bb = ByteBuffer.wrap(dictionaryData);
// check version
- int version = RuleBasedBreakIterator.getInt(buf, 0);
+ int version = bb.getInt();
if (version != supportedVersion) {
throw new MissingResourceException("Dictionary version(" + version + ") is unsupported",
- dictionaryName, "");
- }
-
- // get data size
- int len = RuleBasedBreakIterator.getInt(buf, 4);
- buf = new byte[len];
- if (in.read(buf) != len) {
- throw new MissingResourceException("Wrong data length",
dictionaryName, "");
}
- // close the stream
- in.close();
-
- int l;
- int offset = 0;
+ // Check data size
+ int len = bb.getInt();
+ if (bb.position() + len != bb.limit()) {
+ throw new MissingResourceException("Dictionary size is wrong: " + bb.limit(),
+ dictionaryName, "");
+ }
// read in the column map for BMP characteres (this is serialized in
// its internal form: an index array followed by a data array)
- l = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- short[] temp = new short[l];
- for (int i = 0; i < l; i++, offset+=2) {
- temp[i] = RuleBasedBreakIterator.getShort(buf, offset);
- }
- l = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- byte[] temp2 = new byte[l];
- for (int i = 0; i < l; i++, offset++) {
- temp2[i] = buf[offset];
+ len = bb.getInt();
+ short[] temp = new short[len];
+ for (int i = 0; i < len; i++) {
+ temp[i] = bb.getShort();
}
+ len = bb.getInt();
+ byte[] temp2 = new byte[len];
+ bb.get(temp2);
columnMap = new CompactByteArray(temp, temp2);
// read in numCols and numColGroups
- numCols = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- numColGroups = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
+ numCols = bb.getInt();
+ numColGroups = bb.getInt();
// read in the row-number index
- l = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- rowIndex = new short[l];
- for (int i = 0; i < l; i++, offset+=2) {
- rowIndex[i] = RuleBasedBreakIterator.getShort(buf, offset);
+ len = bb.getInt();
+ rowIndex = new short[len];
+ for (int i = 0; i < len; i++) {
+ rowIndex[i] = bb.getShort();
}
// load in the populated-cells bitmap: index first, then bitmap list
- l = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- rowIndexFlagsIndex = new short[l];
- for (int i = 0; i < l; i++, offset+=2) {
- rowIndexFlagsIndex[i] = RuleBasedBreakIterator.getShort(buf, offset);
+ len = bb.getInt();
+ rowIndexFlagsIndex = new short[len];
+ for (int i = 0; i < len; i++) {
+ rowIndexFlagsIndex[i] = bb.getShort();
}
- l = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- rowIndexFlags = new int[l];
- for (int i = 0; i < l; i++, offset+=4) {
- rowIndexFlags[i] = RuleBasedBreakIterator.getInt(buf, offset);
+ len = bb.getInt();
+ rowIndexFlags = new int[len];
+ for (int i = 0; i < len; i++) {
+ rowIndexFlags[i] = bb.getInt();
}
// load in the row-shift index
- l = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- rowIndexShifts = new byte[l];
- for (int i = 0; i < l; i++, offset++) {
- rowIndexShifts[i] = buf[offset];
- }
+ len = bb.getInt();
+ rowIndexShifts = new byte[len];
+ bb.get(rowIndexShifts);
// load in the actual state table
- l = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- table = new short[l];
- for (int i = 0; i < l; i++, offset+=2) {
- table[i] = RuleBasedBreakIterator.getShort(buf, offset);
+ len = bb.getInt();
+ table = new short[len];
+ for (int i = 0; i < len; i++) {
+ table[i] = bb.getShort();
}
// finally, prepare the column map for supplementary characters
- l = RuleBasedBreakIterator.getInt(buf, offset);
- offset += 4;
- int[] temp3 = new int[l];
- for (int i = 0; i < l; i++, offset+=4) {
- temp3[i] = RuleBasedBreakIterator.getInt(buf, offset);
+ len = bb.getInt();
+ int[] temp3 = new int[len];
+ for (int i = 0; i < len; i++) {
+ temp3[i] = bb.getInt();
}
+ assert bb.position() == bb.limit();
+
supplementaryCharColumnMap = new SupplementaryCharacterData(temp3);
}
diff --git a/jdk/src/java.base/share/classes/sun/util/locale/provider/DictionaryBasedBreakIterator.java b/jdk/src/java.base/share/classes/sun/text/DictionaryBasedBreakIterator.java
similarity index 96%
rename from jdk/src/java.base/share/classes/sun/util/locale/provider/DictionaryBasedBreakIterator.java
rename to jdk/src/java.base/share/classes/sun/text/DictionaryBasedBreakIterator.java
index f7eff4e80cf..bd47872bec1 100644
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/DictionaryBasedBreakIterator.java
+++ b/jdk/src/java.base/share/classes/sun/text/DictionaryBasedBreakIterator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,10 +38,8 @@
* Taligent is a registered trademark of Taligent, Inc.
*/
-package sun.util.locale.provider;
+package sun.text;
-import java.io.IOException;
-import java.lang.reflect.Module;
import java.text.CharacterIterator;
import java.util.ArrayList;
import java.util.List;
@@ -72,7 +70,7 @@ import java.util.Stack;
* slow) BuildDictionaryFile utility for creating dictionary files, but aren't
* currently making it public. Contact us for help.
*/
-class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
+public class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
/**
* a list of known words that is used to divide up contiguous ranges of letters,
@@ -109,18 +107,22 @@ class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
/**
* Constructs a DictionaryBasedBreakIterator.
- * @param module The module where the dictionary file resides
- * @param dictionaryFilename The filename of the dictionary file to use
+ *
+ * @param ruleFile the name of the rule data file
+ * @param ruleData the rule data loaded from the rule data file
+ * @param dictionaryFile the name of the dictionary file
+ * @param dictionartData the dictionary data loaded from the dictionary file
+ * @throws MissingResourceException if rule data or dictionary initialization failed
*/
- DictionaryBasedBreakIterator(Module module, String dataFile, String dictionaryFile)
- throws IOException {
- super(module, dataFile);
+ public DictionaryBasedBreakIterator(String ruleFile, byte[] ruleData,
+ String dictionaryFile, byte[] dictionaryData) {
+ super(ruleFile, ruleData);
byte[] tmp = super.getAdditionalData();
if (tmp != null) {
prepareCategoryFlags(tmp);
super.setAdditionalData(null);
}
- dictionary = new BreakDictionary(module, dictionaryFile);
+ dictionary = new BreakDictionary(dictionaryFile, dictionaryData);
}
private void prepareCategoryFlags(byte[] data) {
diff --git a/jdk/src/java.base/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java b/jdk/src/java.base/share/classes/sun/text/RuleBasedBreakIterator.java
similarity index 88%
rename from jdk/src/java.base/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java
rename to jdk/src/java.base/share/classes/sun/text/RuleBasedBreakIterator.java
index ebf6ba1956e..b3abf812f29 100644
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java
+++ b/jdk/src/java.base/share/classes/sun/text/RuleBasedBreakIterator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,15 +38,10 @@
* Taligent is a registered trademark of Taligent, Inc.
*/
-package sun.util.locale.provider;
+package sun.text;
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.lang.reflect.Module;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
import java.text.BreakIterator;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
@@ -218,7 +213,7 @@ import sun.text.SupplementaryCharacterData;
*
* @author Richard Gillam
*/
-class RuleBasedBreakIterator extends BreakIterator {
+public class RuleBasedBreakIterator extends BreakIterator {
/**
* A token used as a character-category value to identify ignore characters
@@ -249,11 +244,6 @@ class RuleBasedBreakIterator extends BreakIterator {
*/
static final byte supportedVersion = 1;
- /**
- * Header size in byte count
- */
- private static final int HEADER_LENGTH = 36;
-
/**
* An array length of indices for BMP characters
*/
@@ -315,16 +305,26 @@ class RuleBasedBreakIterator extends BreakIterator {
//=======================================================================
/**
- * Constructs a RuleBasedBreakIterator according to the module and the datafile
- * provided.
+ * Constructs a RuleBasedBreakIterator using the given rule data.
+ *
+ * @throws MissingResourceException if the rule data is invalid or corrupted
*/
- RuleBasedBreakIterator(Module module, String datafile)
- throws IOException, MissingResourceException {
- readTables(module, datafile);
+ public RuleBasedBreakIterator(String ruleFile, byte[] ruleData) {
+ ByteBuffer bb = ByteBuffer.wrap(ruleData);
+ try {
+ validateRuleData(ruleFile, bb);
+ setupTables(ruleFile, bb);
+ } catch (BufferUnderflowException bue) {
+ MissingResourceException e;
+ e = new MissingResourceException("Corrupted rule data file", ruleFile, "");
+ e.initCause(bue);
+ throw e;
+ }
}
/**
- * Read datafile. The datafile's format is as follows:
+ * Initializes the fields with the given rule data.
+ * The data format is as follows:
*
* BreakIteratorData {
* u1 magic[7];
@@ -370,133 +370,101 @@ class RuleBasedBreakIterator extends BreakIterator {
* u1 additionalData[additionalDataLength];
* }
*
+ *
+ * @throws BufferUnderflowException if the end-of-data is reached before
+ * setting up all the tables
*/
- protected final void readTables(Module module, String datafile)
- throws IOException, MissingResourceException {
-
- byte[] buffer = readFile(module, datafile);
-
+ private void setupTables(String ruleFile, ByteBuffer bb) {
/* Read header_info. */
- int stateTableLength = getInt(buffer, 0);
- int backwardsStateTableLength = getInt(buffer, 4);
- int endStatesLength = getInt(buffer, 8);
- int lookaheadStatesLength = getInt(buffer, 12);
- int BMPdataLength = getInt(buffer, 16);
- int nonBMPdataLength = getInt(buffer, 20);
- int additionalDataLength = getInt(buffer, 24);
- checksum = getLong(buffer, 28);
+ int stateTableLength = bb.getInt();
+ int backwardsStateTableLength = bb.getInt();
+ int endStatesLength = bb.getInt();
+ int lookaheadStatesLength = bb.getInt();
+ int BMPdataLength = bb.getInt();
+ int nonBMPdataLength = bb.getInt();
+ int additionalDataLength = bb.getInt();
+ checksum = bb.getLong();
/* Read stateTable[numCategories * numRows] */
stateTable = new short[stateTableLength];
- int offset = HEADER_LENGTH;
- for (int i = 0; i < stateTableLength; i++, offset+=2) {
- stateTable[i] = getShort(buffer, offset);
+ for (int i = 0; i < stateTableLength; i++) {
+ stateTable[i] = bb.getShort();
}
/* Read backwardsStateTable[numCategories * numRows] */
backwardsStateTable = new short[backwardsStateTableLength];
- for (int i = 0; i < backwardsStateTableLength; i++, offset+=2) {
- backwardsStateTable[i] = getShort(buffer, offset);
+ for (int i = 0; i < backwardsStateTableLength; i++) {
+ backwardsStateTable[i] = bb.getShort();
}
/* Read endStates[numRows] */
endStates = new boolean[endStatesLength];
- for (int i = 0; i < endStatesLength; i++, offset++) {
- endStates[i] = buffer[offset] == 1;
+ for (int i = 0; i < endStatesLength; i++) {
+ endStates[i] = bb.get() == 1;
}
/* Read lookaheadStates[numRows] */
lookaheadStates = new boolean[lookaheadStatesLength];
- for (int i = 0; i < lookaheadStatesLength; i++, offset++) {
- lookaheadStates[i] = buffer[offset] == 1;
+ for (int i = 0; i < lookaheadStatesLength; i++) {
+ lookaheadStates[i] = bb.get() == 1;
}
/* Read a category table and indices for BMP characters. */
short[] temp1 = new short[BMP_INDICES_LENGTH]; // BMPindices
- for (int i = 0; i < BMP_INDICES_LENGTH; i++, offset+=2) {
- temp1[i] = getShort(buffer, offset);
+ for (int i = 0; i < BMP_INDICES_LENGTH; i++) {
+ temp1[i] = bb.getShort();
}
byte[] temp2 = new byte[BMPdataLength]; // BMPdata
- System.arraycopy(buffer, offset, temp2, 0, BMPdataLength);
- offset += BMPdataLength;
+ bb.get(temp2);
charCategoryTable = new CompactByteArray(temp1, temp2);
/* Read a category table for non-BMP characters. */
int[] temp3 = new int[nonBMPdataLength];
- for (int i = 0; i < nonBMPdataLength; i++, offset+=4) {
- temp3[i] = getInt(buffer, offset);
+ for (int i = 0; i < nonBMPdataLength; i++) {
+ temp3[i] = bb.getInt();
}
supplementaryCharCategoryTable = new SupplementaryCharacterData(temp3);
/* Read additional data */
if (additionalDataLength > 0) {
additionalData = new byte[additionalDataLength];
- System.arraycopy(buffer, offset, additionalData, 0, additionalDataLength);
+ bb.get(additionalData);
}
+ assert bb.position() == bb.limit();
/* Set numCategories */
numCategories = stateTable.length / endStates.length;
}
- protected byte[] readFile(final Module module, final String datafile)
- throws IOException, MissingResourceException {
-
- BufferedInputStream is;
- try {
- PrivilegedExceptionAction pa = () -> {
- String pathName = "jdk.localedata".equals(module.getName()) ?
- "sun/text/resources/ext/" :
- "sun/text/resources/";
- InputStream in = module.getResourceAsStream(pathName + datafile);
- if (in == null) {
- // Try to load the file with "java.base" module instance. Assumption
- // here is that the fall back data files to be read should reside in
- // java.base.
- in = RuleBasedBreakIterator.class.getModule().getResourceAsStream("sun/text/resources/" + datafile);
- }
-
- return new BufferedInputStream(in);
- };
- is = AccessController.doPrivileged(pa);
- } catch (PrivilegedActionException e) {
- throw new InternalError(e.toString(), e);
- }
-
- int offset = 0;
-
- /* First, read magic, version, and header_info. */
- int len = LABEL_LENGTH + 5;
- byte[] buf = new byte[len];
- if (is.read(buf) != len) {
- throw new MissingResourceException("Wrong header length",
- datafile, "");
- }
-
- /* Validate the magic number. */
- for (int i = 0; i < LABEL_LENGTH; i++, offset++) {
- if (buf[offset] != LABEL[offset]) {
+ /**
+ * Validates the magic number, version, and the length of the given data.
+ *
+ * @throws BufferUnderflowException if the end-of-data is reached while
+ * validating data
+ * @throws MissingResourceException if valification failed
+ */
+ void validateRuleData(String ruleFile, ByteBuffer bb) {
+ /* Verify the magic number. */
+ for (int i = 0; i < LABEL_LENGTH; i++) {
+ if (bb.get() != LABEL[i]) {
throw new MissingResourceException("Wrong magic number",
- datafile, "");
+ ruleFile, "");
}
}
- /* Validate the version number. */
- if (buf[offset] != supportedVersion) {
- throw new MissingResourceException("Unsupported version(" + buf[offset] + ")",
- datafile, "");
+ /* Verify the version number. */
+ byte version = bb.get();
+ if (version != supportedVersion) {
+ throw new MissingResourceException("Unsupported version(" + version + ")",
+ ruleFile, "");
}
- /* Read data: totalDataSize + 8(for checksum) */
- len = getInt(buf, ++offset);
- buf = new byte[len];
- if (is.read(buf) != len) {
+ // Check the length of the rest of data
+ int len = bb.getInt();
+ if (bb.position() + len != bb.limit()) {
throw new MissingResourceException("Wrong data length",
- datafile, "");
+ ruleFile, "");
}
-
- is.close();
-
- return buf;
}
byte[] getAdditionalData() {
@@ -1061,28 +1029,6 @@ class RuleBasedBreakIterator extends BreakIterator {
return backwardsStateTable[state * numCategories + category];
}
- static long getLong(byte[] buf, int offset) {
- long num = buf[offset]&0xFF;
- for (int i = 1; i < 8; i++) {
- num = num<<8 | (buf[offset+i]&0xFF);
- }
- return num;
- }
-
- static int getInt(byte[] buf, int offset) {
- int num = buf[offset]&0xFF;
- for (int i = 1; i < 4; i++) {
- num = num<<8 | (buf[offset+i]&0xFF);
- }
- return num;
- }
-
- static short getShort(byte[] buf, int offset) {
- short num = (short)(buf[offset]&0xFF);
- num = (short)(num<<8 | (buf[offset+1]&0xFF));
- return num;
- }
-
/*
* This class exists to work around a bug in incorrect implementations
* of CharacterIterator, which incorrectly handle setIndex(endIndex).
diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ConfigurableModuleFinder.java b/jdk/src/java.base/share/classes/sun/text/resources/BreakIteratorResources.java
similarity index 71%
rename from jdk/src/java.base/share/classes/jdk/internal/module/ConfigurableModuleFinder.java
rename to jdk/src/java.base/share/classes/sun/text/resources/BreakIteratorResources.java
index 914f870044e..848117e126e 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/module/ConfigurableModuleFinder.java
+++ b/jdk/src/java.base/share/classes/sun/text/resources/BreakIteratorResources.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,25 +22,15 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.internal.module;
-import java.lang.module.ModuleFinder;
+package sun.text.resources;
-/**
- * A ModuleFinder that may be configured to work at either run-time
- * or link-time.
- */
+import java.util.ResourceBundle;
+import sun.util.resources.BreakIteratorResourceBundle;
-public interface ConfigurableModuleFinder extends ModuleFinder {
-
- public static enum Phase {
- RUN_TIME,
- LINK_TIME
+public class BreakIteratorResources extends BreakIteratorResourceBundle {
+ @Override
+ protected ResourceBundle getBreakIteratorInfo() {
+ return new BreakIteratorInfo();
}
-
- /**
- * Configures this finder to work in the given phase.
- */
- void configurePhase(Phase phase);
-
}
diff --git a/jdk/src/java.base/share/classes/sun/util/locale/provider/BreakIteratorProviderImpl.java b/jdk/src/java.base/share/classes/sun/util/locale/provider/BreakIteratorProviderImpl.java
index 2de50a98962..1343dadb3b9 100644
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/BreakIteratorProviderImpl.java
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/BreakIteratorProviderImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@ import java.util.Locale;
import java.util.MissingResourceException;
import java.util.Objects;
import java.util.Set;
+import sun.text.DictionaryBasedBreakIterator;
+import sun.text.RuleBasedBreakIterator;
/**
* Concrete implementation of the {@link java.text.spi.BreakIteratorProvider
@@ -153,29 +155,31 @@ public class BreakIteratorProviderImpl extends BreakIteratorProvider
}
private BreakIterator getBreakInstance(Locale locale,
- int type,
- String dataName,
- String dictionaryName) {
+ int type,
+ String ruleName,
+ String dictionaryName) {
Objects.requireNonNull(locale);
LocaleResources lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
String[] classNames = (String[]) lr.getBreakIteratorInfo("BreakIteratorClasses");
- String dataFile = (String) lr.getBreakIteratorInfo(dataName);
+ String ruleFile = (String) lr.getBreakIteratorInfo(ruleName);
+ byte[] ruleData = lr.getBreakIteratorResources(ruleName);
try {
switch (classNames[type]) {
case "RuleBasedBreakIterator":
- return new RuleBasedBreakIterator(
- lr.getBreakIteratorDataModule(), dataFile);
+ return new RuleBasedBreakIterator(ruleFile, ruleData);
+
case "DictionaryBasedBreakIterator":
String dictionaryFile = (String) lr.getBreakIteratorInfo(dictionaryName);
- return new DictionaryBasedBreakIterator(
- lr.getBreakIteratorDataModule(), dataFile, dictionaryFile);
+ byte[] dictionaryData = lr.getBreakIteratorResources(dictionaryName);
+ return new DictionaryBasedBreakIterator(ruleFile, ruleData,
+ dictionaryFile, dictionaryData);
default:
throw new IllegalArgumentException("Invalid break iterator class \"" +
classNames[type] + "\"");
}
- } catch (IOException | MissingResourceException | IllegalArgumentException e) {
+ } catch (MissingResourceException | IllegalArgumentException e) {
throw new InternalError(e.toString(), e);
}
}
diff --git a/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java b/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java
index 2269d608eb5..a6f3bc53bb0 100644
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@ package sun.util.locale.provider;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
-import java.lang.reflect.Module;
import java.text.MessageFormat;
import java.util.Calendar;
import java.util.LinkedHashSet;
@@ -113,13 +112,14 @@ public class LocaleResources {
if (data == null || ((biInfo = data.get()) == null)) {
biInfo = localeData.getBreakIteratorInfo(locale).getObject(key);
cache.put(cacheKey, new ResourceReference(cacheKey, biInfo, referenceQueue));
- }
+ }
return biInfo;
}
- Module getBreakIteratorDataModule() {
- return localeData.getBreakIteratorInfo(locale).getClass().getModule();
+ @SuppressWarnings("unchecked")
+ byte[] getBreakIteratorResources(String key) {
+ return (byte[]) localeData.getBreakIteratorResources(locale).getObject(key);
}
int getCalendarData(String key) {
diff --git a/jdk/src/java.base/share/classes/sun/util/resources/BreakIteratorResourceBundle.java b/jdk/src/java.base/share/classes/sun/util/resources/BreakIteratorResourceBundle.java
new file mode 100644
index 00000000000..d859e2a3ace
--- /dev/null
+++ b/jdk/src/java.base/share/classes/sun/util/resources/BreakIteratorResourceBundle.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. 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.util.resources;
+
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+/**
+ * BreakIteratorResourceBundle is an abstract class for loading BreakIterator
+ * data (rules or dictionary) from each module. An implementation class must
+ * implement getBreakIteratorInfo() that returns an instance of the
+ * corresponding BreakIteratorInfo (basename). The data name is taken from the
+ * BreakIteratorInfo instance.
+ *
+ * For example, if the given key is "WordDictionary" and Locale is "th", the
+ * data name is taken from a BreakIteratorInfo_th and the key's value is
+ * "thai_dict". Its data thai_dict is loaded from the Module of the
+ * implementation class of this class.
+ */
+
+public abstract class BreakIteratorResourceBundle extends ResourceBundle {
+ // If any keys that are not for data names are added to BreakIteratorInfo*,
+ // those keys must be added to NON_DATA_KEYS.
+ private static final Set NON_DATA_KEYS = Set.of("BreakIteratorClasses");
+
+ private volatile Set keys;
+
+ /**
+ * Returns an instance of the corresponding {@code BreakIteratorInfo} (basename).
+ * The instance shouldn't have its parent.
+ */
+ protected abstract ResourceBundle getBreakIteratorInfo();
+
+ @Override
+ protected Object handleGetObject(String key) {
+ if (NON_DATA_KEYS.contains(key)) {
+ return null;
+ }
+ ResourceBundle info = getBreakIteratorInfo();
+ if (!info.containsKey(key)) {
+ return null;
+ }
+ String path = getClass().getPackage().getName().replace('.', '/')
+ + '/' + info.getString(key);
+ byte[] data;
+ try (InputStream is = getResourceAsStream(path)) {
+ data = is.readAllBytes();
+ } catch (Exception e) {
+ throw new InternalError("Can't load " + path, e);
+ }
+ return data;
+ }
+
+ private InputStream getResourceAsStream(String path) throws Exception {
+ PrivilegedExceptionAction pa;
+ pa = () -> getClass().getModule().getResourceAsStream(path);
+ InputStream is;
+ try {
+ is = AccessController.doPrivileged(pa);
+ } catch (PrivilegedActionException e) {
+ throw e.getException();
+ }
+ return is;
+ }
+
+ @Override
+ public Enumeration getKeys() {
+ return Collections.enumeration(keySet());
+ }
+
+ @Override
+ protected Set handleKeySet() {
+ if (keys == null) {
+ ResourceBundle info = getBreakIteratorInfo();
+ Set k = info.keySet();
+ k.removeAll(NON_DATA_KEYS);
+ synchronized (this) {
+ if (keys == null) {
+ keys = k;
+ }
+ }
+ }
+ return keys;
+ }
+}
diff --git a/jdk/src/java.base/share/classes/sun/util/resources/LocaleData.java b/jdk/src/java.base/share/classes/sun/util/resources/LocaleData.java
index 5510b6cc250..497742667e7 100644
--- a/jdk/src/java.base/share/classes/sun/util/resources/LocaleData.java
+++ b/jdk/src/java.base/share/classes/sun/util/resources/LocaleData.java
@@ -122,6 +122,14 @@ public class LocaleData {
return getBundle(type.getTextResourcesPackage() + ".BreakIteratorInfo", locale);
}
+ /**
+ * Gets a break iterator resources resource bundle, using
+ * privileges to allow accessing a sun.* package.
+ */
+ public ResourceBundle getBreakIteratorResources(Locale locale) {
+ return getBundle(type.getTextResourcesPackage() + ".BreakIteratorResources", locale);
+ }
+
/**
* Gets a collation data resource bundle, using privileges
* to allow accessing a sun.* package.
diff --git a/jdk/src/java.base/share/conf/security/java.security b/jdk/src/java.base/share/conf/security/java.security
index 966f9ba027e..a521dde7ebb 100644
--- a/jdk/src/java.base/share/conf/security/java.security
+++ b/jdk/src/java.base/share/conf/security/java.security
@@ -645,6 +645,9 @@ krb5.kdc.bad.policy = tryLast
# before larger keysize constraints of the same algorithm. For example:
# "RSA keySize < 1024 & jdkCA, RSA keySize < 2048".
#
+# Note: The algorithm restrictions do not apply to trust anchors or
+# self-signed certificates.
+#
# Note: This property is currently used by Oracle's PKIX implementation. It
# is not guaranteed to be examined and used by other implementations.
#
@@ -714,6 +717,9 @@ jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024, \
# See the specification of "jdk.certpath.disabledAlgorithms" for the
# syntax of the disabled algorithm string.
#
+# Note: The algorithm restrictions do not apply to trust anchors or
+# self-signed certificates.
+#
# Note: This property is currently used by Oracle's JSSE implementation.
# It is not guaranteed to be examined and used by other implementations.
#
diff --git a/jdk/src/java.base/share/lib/security/default.policy b/jdk/src/java.base/share/lib/security/default.policy
index 17e1c80e627..966898459a7 100644
--- a/jdk/src/java.base/share/lib/security/default.policy
+++ b/jdk/src/java.base/share/lib/security/default.policy
@@ -32,8 +32,22 @@ grant codeBase "jrt:/java.smartcardio" {
permission javax.smartcardio.CardPermission "*", "*";
permission java.lang.RuntimePermission "loadLibrary.j2pcsc";
permission java.lang.RuntimePermission
- "accessClassInPackage.sun.security.*";
- permission java.util.PropertyPermission "*", "read";
+ "accessClassInPackage.sun.security.jca";
+ permission java.lang.RuntimePermission
+ "accessClassInPackage.sun.security.util";
+ permission java.util.PropertyPermission
+ "javax.smartcardio.TerminalFactory.DefaultType", "read";
+ permission java.util.PropertyPermission "os.name", "read";
+ permission java.util.PropertyPermission "os.arch", "read";
+ permission java.util.PropertyPermission "sun.arch.data.model", "read";
+ permission java.util.PropertyPermission
+ "sun.security.smartcardio.library", "read";
+ permission java.util.PropertyPermission
+ "sun.security.smartcardio.t0GetResponse", "read";
+ permission java.util.PropertyPermission
+ "sun.security.smartcardio.t1GetResponse", "read";
+ permission java.util.PropertyPermission
+ "sun.security.smartcardio.t1StripLe", "read";
// needed for looking up native PC/SC library
permission java.io.FilePermission "<>","read";
permission java.security.SecurityPermission "putProviderProperty.SunPCSC";
diff --git a/jdk/src/java.base/share/native/include/jvmti.h b/jdk/src/java.base/share/native/include/jvmti.h
deleted file mode 100644
index 0009a88ae29..00000000000
--- a/jdk/src/java.base/share/native/include/jvmti.h
+++ /dev/null
@@ -1,2551 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- */
-
- /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */
-
- /* Include file for the Java(tm) Virtual Machine Tool Interface */
-
-#ifndef _JAVA_JVMTI_H_
-#define _JAVA_JVMTI_H_
-
-#include "jni.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- JVMTI_VERSION_1 = 0x30010000,
- JVMTI_VERSION_1_0 = 0x30010000,
- JVMTI_VERSION_1_1 = 0x30010100,
- JVMTI_VERSION_1_2 = 0x30010200,
- JVMTI_VERSION_9 = 0x30090000,
-
- JVMTI_VERSION = 0x30000000 + (9 * 0x10000) + (0 * 0x100) + 0 /* version: 9.0.0 */
-};
-
-JNIEXPORT jint JNICALL
-Agent_OnLoad(JavaVM *vm, char *options, void *reserved);
-
-JNIEXPORT jint JNICALL
-Agent_OnAttach(JavaVM* vm, char* options, void* reserved);
-
-JNIEXPORT void JNICALL
-Agent_OnUnload(JavaVM *vm);
-
- /* Forward declaration of the environment */
-
-struct _jvmtiEnv;
-
-struct jvmtiInterface_1_;
-
-#ifdef __cplusplus
-typedef _jvmtiEnv jvmtiEnv;
-#else
-typedef const struct jvmtiInterface_1_ *jvmtiEnv;
-#endif /* __cplusplus */
-
-/* Derived Base Types */
-
-typedef jobject jthread;
-typedef jobject jthreadGroup;
-typedef jlong jlocation;
-struct _jrawMonitorID;
-typedef struct _jrawMonitorID *jrawMonitorID;
-typedef struct JNINativeInterface_ jniNativeInterface;
-
- /* Constants */
-
-
- /* Thread State Flags */
-
-enum {
- JVMTI_THREAD_STATE_ALIVE = 0x0001,
- JVMTI_THREAD_STATE_TERMINATED = 0x0002,
- JVMTI_THREAD_STATE_RUNNABLE = 0x0004,
- JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400,
- JVMTI_THREAD_STATE_WAITING = 0x0080,
- JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010,
- JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020,
- JVMTI_THREAD_STATE_SLEEPING = 0x0040,
- JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100,
- JVMTI_THREAD_STATE_PARKED = 0x0200,
- JVMTI_THREAD_STATE_SUSPENDED = 0x100000,
- JVMTI_THREAD_STATE_INTERRUPTED = 0x200000,
- JVMTI_THREAD_STATE_IN_NATIVE = 0x400000,
- JVMTI_THREAD_STATE_VENDOR_1 = 0x10000000,
- JVMTI_THREAD_STATE_VENDOR_2 = 0x20000000,
- JVMTI_THREAD_STATE_VENDOR_3 = 0x40000000
-};
-
- /* java.lang.Thread.State Conversion Masks */
-
-enum {
- JVMTI_JAVA_LANG_THREAD_STATE_MASK = JVMTI_THREAD_STATE_TERMINATED | JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT,
- JVMTI_JAVA_LANG_THREAD_STATE_NEW = 0,
- JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED = JVMTI_THREAD_STATE_TERMINATED,
- JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE,
- JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER,
- JVMTI_JAVA_LANG_THREAD_STATE_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY,
- JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT
-};
-
- /* Thread Priority Constants */
-
-enum {
- JVMTI_THREAD_MIN_PRIORITY = 1,
- JVMTI_THREAD_NORM_PRIORITY = 5,
- JVMTI_THREAD_MAX_PRIORITY = 10
-};
-
- /* Heap Filter Flags */
-
-enum {
- JVMTI_HEAP_FILTER_TAGGED = 0x4,
- JVMTI_HEAP_FILTER_UNTAGGED = 0x8,
- JVMTI_HEAP_FILTER_CLASS_TAGGED = 0x10,
- JVMTI_HEAP_FILTER_CLASS_UNTAGGED = 0x20
-};
-
- /* Heap Visit Control Flags */
-
-enum {
- JVMTI_VISIT_OBJECTS = 0x100,
- JVMTI_VISIT_ABORT = 0x8000
-};
-
- /* Heap Reference Enumeration */
-
-typedef enum {
- JVMTI_HEAP_REFERENCE_CLASS = 1,
- JVMTI_HEAP_REFERENCE_FIELD = 2,
- JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT = 3,
- JVMTI_HEAP_REFERENCE_CLASS_LOADER = 4,
- JVMTI_HEAP_REFERENCE_SIGNERS = 5,
- JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN = 6,
- JVMTI_HEAP_REFERENCE_INTERFACE = 7,
- JVMTI_HEAP_REFERENCE_STATIC_FIELD = 8,
- JVMTI_HEAP_REFERENCE_CONSTANT_POOL = 9,
- JVMTI_HEAP_REFERENCE_SUPERCLASS = 10,
- JVMTI_HEAP_REFERENCE_JNI_GLOBAL = 21,
- JVMTI_HEAP_REFERENCE_SYSTEM_CLASS = 22,
- JVMTI_HEAP_REFERENCE_MONITOR = 23,
- JVMTI_HEAP_REFERENCE_STACK_LOCAL = 24,
- JVMTI_HEAP_REFERENCE_JNI_LOCAL = 25,
- JVMTI_HEAP_REFERENCE_THREAD = 26,
- JVMTI_HEAP_REFERENCE_OTHER = 27
-} jvmtiHeapReferenceKind;
-
- /* Primitive Type Enumeration */
-
-typedef enum {
- JVMTI_PRIMITIVE_TYPE_BOOLEAN = 90,
- JVMTI_PRIMITIVE_TYPE_BYTE = 66,
- JVMTI_PRIMITIVE_TYPE_CHAR = 67,
- JVMTI_PRIMITIVE_TYPE_SHORT = 83,
- JVMTI_PRIMITIVE_TYPE_INT = 73,
- JVMTI_PRIMITIVE_TYPE_LONG = 74,
- JVMTI_PRIMITIVE_TYPE_FLOAT = 70,
- JVMTI_PRIMITIVE_TYPE_DOUBLE = 68
-} jvmtiPrimitiveType;
-
- /* Heap Object Filter Enumeration */
-
-typedef enum {
- JVMTI_HEAP_OBJECT_TAGGED = 1,
- JVMTI_HEAP_OBJECT_UNTAGGED = 2,
- JVMTI_HEAP_OBJECT_EITHER = 3
-} jvmtiHeapObjectFilter;
-
- /* Heap Root Kind Enumeration */
-
-typedef enum {
- JVMTI_HEAP_ROOT_JNI_GLOBAL = 1,
- JVMTI_HEAP_ROOT_SYSTEM_CLASS = 2,
- JVMTI_HEAP_ROOT_MONITOR = 3,
- JVMTI_HEAP_ROOT_STACK_LOCAL = 4,
- JVMTI_HEAP_ROOT_JNI_LOCAL = 5,
- JVMTI_HEAP_ROOT_THREAD = 6,
- JVMTI_HEAP_ROOT_OTHER = 7
-} jvmtiHeapRootKind;
-
- /* Object Reference Enumeration */
-
-typedef enum {
- JVMTI_REFERENCE_CLASS = 1,
- JVMTI_REFERENCE_FIELD = 2,
- JVMTI_REFERENCE_ARRAY_ELEMENT = 3,
- JVMTI_REFERENCE_CLASS_LOADER = 4,
- JVMTI_REFERENCE_SIGNERS = 5,
- JVMTI_REFERENCE_PROTECTION_DOMAIN = 6,
- JVMTI_REFERENCE_INTERFACE = 7,
- JVMTI_REFERENCE_STATIC_FIELD = 8,
- JVMTI_REFERENCE_CONSTANT_POOL = 9
-} jvmtiObjectReferenceKind;
-
- /* Iteration Control Enumeration */
-
-typedef enum {
- JVMTI_ITERATION_CONTINUE = 1,
- JVMTI_ITERATION_IGNORE = 2,
- JVMTI_ITERATION_ABORT = 0
-} jvmtiIterationControl;
-
- /* Class Status Flags */
-
-enum {
- JVMTI_CLASS_STATUS_VERIFIED = 1,
- JVMTI_CLASS_STATUS_PREPARED = 2,
- JVMTI_CLASS_STATUS_INITIALIZED = 4,
- JVMTI_CLASS_STATUS_ERROR = 8,
- JVMTI_CLASS_STATUS_ARRAY = 16,
- JVMTI_CLASS_STATUS_PRIMITIVE = 32
-};
-
- /* Event Enable/Disable */
-
-typedef enum {
- JVMTI_ENABLE = 1,
- JVMTI_DISABLE = 0
-} jvmtiEventMode;
-
- /* Extension Function/Event Parameter Types */
-
-typedef enum {
- JVMTI_TYPE_JBYTE = 101,
- JVMTI_TYPE_JCHAR = 102,
- JVMTI_TYPE_JSHORT = 103,
- JVMTI_TYPE_JINT = 104,
- JVMTI_TYPE_JLONG = 105,
- JVMTI_TYPE_JFLOAT = 106,
- JVMTI_TYPE_JDOUBLE = 107,
- JVMTI_TYPE_JBOOLEAN = 108,
- JVMTI_TYPE_JOBJECT = 109,
- JVMTI_TYPE_JTHREAD = 110,
- JVMTI_TYPE_JCLASS = 111,
- JVMTI_TYPE_JVALUE = 112,
- JVMTI_TYPE_JFIELDID = 113,
- JVMTI_TYPE_JMETHODID = 114,
- JVMTI_TYPE_CCHAR = 115,
- JVMTI_TYPE_CVOID = 116,
- JVMTI_TYPE_JNIENV = 117
-} jvmtiParamTypes;
-
- /* Extension Function/Event Parameter Kinds */
-
-typedef enum {
- JVMTI_KIND_IN = 91,
- JVMTI_KIND_IN_PTR = 92,
- JVMTI_KIND_IN_BUF = 93,
- JVMTI_KIND_ALLOC_BUF = 94,
- JVMTI_KIND_ALLOC_ALLOC_BUF = 95,
- JVMTI_KIND_OUT = 96,
- JVMTI_KIND_OUT_BUF = 97
-} jvmtiParamKind;
-
- /* Timer Kinds */
-
-typedef enum {
- JVMTI_TIMER_USER_CPU = 30,
- JVMTI_TIMER_TOTAL_CPU = 31,
- JVMTI_TIMER_ELAPSED = 32
-} jvmtiTimerKind;
-
- /* Phases of execution */
-
-typedef enum {
- JVMTI_PHASE_ONLOAD = 1,
- JVMTI_PHASE_PRIMORDIAL = 2,
- JVMTI_PHASE_START = 6,
- JVMTI_PHASE_LIVE = 4,
- JVMTI_PHASE_DEAD = 8
-} jvmtiPhase;
-
- /* Version Interface Types */
-
-enum {
- JVMTI_VERSION_INTERFACE_JNI = 0x00000000,
- JVMTI_VERSION_INTERFACE_JVMTI = 0x30000000
-};
-
- /* Version Masks */
-
-enum {
- JVMTI_VERSION_MASK_INTERFACE_TYPE = 0x70000000,
- JVMTI_VERSION_MASK_MAJOR = 0x0FFF0000,
- JVMTI_VERSION_MASK_MINOR = 0x0000FF00,
- JVMTI_VERSION_MASK_MICRO = 0x000000FF
-};
-
- /* Version Shifts */
-
-enum {
- JVMTI_VERSION_SHIFT_MAJOR = 16,
- JVMTI_VERSION_SHIFT_MINOR = 8,
- JVMTI_VERSION_SHIFT_MICRO = 0
-};
-
- /* Verbose Flag Enumeration */
-
-typedef enum {
- JVMTI_VERBOSE_OTHER = 0,
- JVMTI_VERBOSE_GC = 1,
- JVMTI_VERBOSE_CLASS = 2,
- JVMTI_VERBOSE_JNI = 4
-} jvmtiVerboseFlag;
-
- /* JLocation Format Enumeration */
-
-typedef enum {
- JVMTI_JLOCATION_JVMBCI = 1,
- JVMTI_JLOCATION_MACHINEPC = 2,
- JVMTI_JLOCATION_OTHER = 0
-} jvmtiJlocationFormat;
-
- /* Resource Exhaustion Flags */
-
-enum {
- JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR = 0x0001,
- JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP = 0x0002,
- JVMTI_RESOURCE_EXHAUSTED_THREADS = 0x0004
-};
-
- /* Errors */
-
-typedef enum {
- JVMTI_ERROR_NONE = 0,
- JVMTI_ERROR_INVALID_THREAD = 10,
- JVMTI_ERROR_INVALID_THREAD_GROUP = 11,
- JVMTI_ERROR_INVALID_PRIORITY = 12,
- JVMTI_ERROR_THREAD_NOT_SUSPENDED = 13,
- JVMTI_ERROR_THREAD_SUSPENDED = 14,
- JVMTI_ERROR_THREAD_NOT_ALIVE = 15,
- JVMTI_ERROR_INVALID_OBJECT = 20,
- JVMTI_ERROR_INVALID_CLASS = 21,
- JVMTI_ERROR_CLASS_NOT_PREPARED = 22,
- JVMTI_ERROR_INVALID_METHODID = 23,
- JVMTI_ERROR_INVALID_LOCATION = 24,
- JVMTI_ERROR_INVALID_FIELDID = 25,
- JVMTI_ERROR_NO_MORE_FRAMES = 31,
- JVMTI_ERROR_OPAQUE_FRAME = 32,
- JVMTI_ERROR_TYPE_MISMATCH = 34,
- JVMTI_ERROR_INVALID_SLOT = 35,
- JVMTI_ERROR_DUPLICATE = 40,
- JVMTI_ERROR_NOT_FOUND = 41,
- JVMTI_ERROR_INVALID_MONITOR = 50,
- JVMTI_ERROR_NOT_MONITOR_OWNER = 51,
- JVMTI_ERROR_INTERRUPT = 52,
- JVMTI_ERROR_INVALID_CLASS_FORMAT = 60,
- JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION = 61,
- JVMTI_ERROR_FAILS_VERIFICATION = 62,
- JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED = 63,
- JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED = 64,
- JVMTI_ERROR_INVALID_TYPESTATE = 65,
- JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED = 66,
- JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED = 67,
- JVMTI_ERROR_UNSUPPORTED_VERSION = 68,
- JVMTI_ERROR_NAMES_DONT_MATCH = 69,
- JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70,
- JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71,
- JVMTI_ERROR_UNMODIFIABLE_CLASS = 79,
- JVMTI_ERROR_NOT_AVAILABLE = 98,
- JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99,
- JVMTI_ERROR_NULL_POINTER = 100,
- JVMTI_ERROR_ABSENT_INFORMATION = 101,
- JVMTI_ERROR_INVALID_EVENT_TYPE = 102,
- JVMTI_ERROR_ILLEGAL_ARGUMENT = 103,
- JVMTI_ERROR_NATIVE_METHOD = 104,
- JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED = 106,
- JVMTI_ERROR_OUT_OF_MEMORY = 110,
- JVMTI_ERROR_ACCESS_DENIED = 111,
- JVMTI_ERROR_WRONG_PHASE = 112,
- JVMTI_ERROR_INTERNAL = 113,
- JVMTI_ERROR_UNATTACHED_THREAD = 115,
- JVMTI_ERROR_INVALID_ENVIRONMENT = 116,
- JVMTI_ERROR_MAX = 116
-} jvmtiError;
-
- /* Event IDs */
-
-typedef enum {
- JVMTI_MIN_EVENT_TYPE_VAL = 50,
- JVMTI_EVENT_VM_INIT = 50,
- JVMTI_EVENT_VM_DEATH = 51,
- JVMTI_EVENT_THREAD_START = 52,
- JVMTI_EVENT_THREAD_END = 53,
- JVMTI_EVENT_CLASS_FILE_LOAD_HOOK = 54,
- JVMTI_EVENT_CLASS_LOAD = 55,
- JVMTI_EVENT_CLASS_PREPARE = 56,
- JVMTI_EVENT_VM_START = 57,
- JVMTI_EVENT_EXCEPTION = 58,
- JVMTI_EVENT_EXCEPTION_CATCH = 59,
- JVMTI_EVENT_SINGLE_STEP = 60,
- JVMTI_EVENT_FRAME_POP = 61,
- JVMTI_EVENT_BREAKPOINT = 62,
- JVMTI_EVENT_FIELD_ACCESS = 63,
- JVMTI_EVENT_FIELD_MODIFICATION = 64,
- JVMTI_EVENT_METHOD_ENTRY = 65,
- JVMTI_EVENT_METHOD_EXIT = 66,
- JVMTI_EVENT_NATIVE_METHOD_BIND = 67,
- JVMTI_EVENT_COMPILED_METHOD_LOAD = 68,
- JVMTI_EVENT_COMPILED_METHOD_UNLOAD = 69,
- JVMTI_EVENT_DYNAMIC_CODE_GENERATED = 70,
- JVMTI_EVENT_DATA_DUMP_REQUEST = 71,
- JVMTI_EVENT_MONITOR_WAIT = 73,
- JVMTI_EVENT_MONITOR_WAITED = 74,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTER = 75,
- JVMTI_EVENT_MONITOR_CONTENDED_ENTERED = 76,
- JVMTI_EVENT_RESOURCE_EXHAUSTED = 80,
- JVMTI_EVENT_GARBAGE_COLLECTION_START = 81,
- JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82,
- JVMTI_EVENT_OBJECT_FREE = 83,
- JVMTI_EVENT_VM_OBJECT_ALLOC = 84,
- JVMTI_MAX_EVENT_TYPE_VAL = 84
-} jvmtiEvent;
-
-
- /* Pre-Declarations */
-struct _jvmtiThreadInfo;
-typedef struct _jvmtiThreadInfo jvmtiThreadInfo;
-struct _jvmtiMonitorStackDepthInfo;
-typedef struct _jvmtiMonitorStackDepthInfo jvmtiMonitorStackDepthInfo;
-struct _jvmtiThreadGroupInfo;
-typedef struct _jvmtiThreadGroupInfo jvmtiThreadGroupInfo;
-struct _jvmtiFrameInfo;
-typedef struct _jvmtiFrameInfo jvmtiFrameInfo;
-struct _jvmtiStackInfo;
-typedef struct _jvmtiStackInfo jvmtiStackInfo;
-struct _jvmtiHeapReferenceInfoField;
-typedef struct _jvmtiHeapReferenceInfoField jvmtiHeapReferenceInfoField;
-struct _jvmtiHeapReferenceInfoArray;
-typedef struct _jvmtiHeapReferenceInfoArray jvmtiHeapReferenceInfoArray;
-struct _jvmtiHeapReferenceInfoConstantPool;
-typedef struct _jvmtiHeapReferenceInfoConstantPool jvmtiHeapReferenceInfoConstantPool;
-struct _jvmtiHeapReferenceInfoStackLocal;
-typedef struct _jvmtiHeapReferenceInfoStackLocal jvmtiHeapReferenceInfoStackLocal;
-struct _jvmtiHeapReferenceInfoJniLocal;
-typedef struct _jvmtiHeapReferenceInfoJniLocal jvmtiHeapReferenceInfoJniLocal;
-struct _jvmtiHeapReferenceInfoReserved;
-typedef struct _jvmtiHeapReferenceInfoReserved jvmtiHeapReferenceInfoReserved;
-union _jvmtiHeapReferenceInfo;
-typedef union _jvmtiHeapReferenceInfo jvmtiHeapReferenceInfo;
-struct _jvmtiHeapCallbacks;
-typedef struct _jvmtiHeapCallbacks jvmtiHeapCallbacks;
-struct _jvmtiClassDefinition;
-typedef struct _jvmtiClassDefinition jvmtiClassDefinition;
-struct _jvmtiMonitorUsage;
-typedef struct _jvmtiMonitorUsage jvmtiMonitorUsage;
-struct _jvmtiLineNumberEntry;
-typedef struct _jvmtiLineNumberEntry jvmtiLineNumberEntry;
-struct _jvmtiLocalVariableEntry;
-typedef struct _jvmtiLocalVariableEntry jvmtiLocalVariableEntry;
-struct _jvmtiParamInfo;
-typedef struct _jvmtiParamInfo jvmtiParamInfo;
-struct _jvmtiExtensionFunctionInfo;
-typedef struct _jvmtiExtensionFunctionInfo jvmtiExtensionFunctionInfo;
-struct _jvmtiExtensionEventInfo;
-typedef struct _jvmtiExtensionEventInfo jvmtiExtensionEventInfo;
-struct _jvmtiTimerInfo;
-typedef struct _jvmtiTimerInfo jvmtiTimerInfo;
-struct _jvmtiAddrLocationMap;
-typedef struct _jvmtiAddrLocationMap jvmtiAddrLocationMap;
-
- /* Function Types */
-
-typedef void (JNICALL *jvmtiStartFunction)
- (jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg);
-
-typedef jint (JNICALL *jvmtiHeapIterationCallback)
- (jlong class_tag, jlong size, jlong* tag_ptr, jint length, void* user_data);
-
-typedef jint (JNICALL *jvmtiHeapReferenceCallback)
- (jvmtiHeapReferenceKind reference_kind, const jvmtiHeapReferenceInfo* reference_info, jlong class_tag, jlong referrer_class_tag, jlong size, jlong* tag_ptr, jlong* referrer_tag_ptr, jint length, void* user_data);
-
-typedef jint (JNICALL *jvmtiPrimitiveFieldCallback)
- (jvmtiHeapReferenceKind kind, const jvmtiHeapReferenceInfo* info, jlong object_class_tag, jlong* object_tag_ptr, jvalue value, jvmtiPrimitiveType value_type, void* user_data);
-
-typedef jint (JNICALL *jvmtiArrayPrimitiveValueCallback)
- (jlong class_tag, jlong size, jlong* tag_ptr, jint element_count, jvmtiPrimitiveType element_type, const void* elements, void* user_data);
-
-typedef jint (JNICALL *jvmtiStringPrimitiveValueCallback)
- (jlong class_tag, jlong size, jlong* tag_ptr, const jchar* value, jint value_length, void* user_data);
-
-typedef jint (JNICALL *jvmtiReservedCallback)
- ();
-
-typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback)
- (jlong class_tag, jlong size, jlong* tag_ptr, void* user_data);
-
-typedef jvmtiIterationControl (JNICALL *jvmtiHeapRootCallback)
- (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, void* user_data);
-
-typedef jvmtiIterationControl (JNICALL *jvmtiStackReferenceCallback)
- (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong thread_tag, jint depth, jmethodID method, jint slot, void* user_data);
-
-typedef jvmtiIterationControl (JNICALL *jvmtiObjectReferenceCallback)
- (jvmtiObjectReferenceKind reference_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data);
-
-typedef jvmtiError (JNICALL *jvmtiExtensionFunction)
- (jvmtiEnv* jvmti_env, ...);
-
-typedef void (JNICALL *jvmtiExtensionEvent)
- (jvmtiEnv* jvmti_env, ...);
-
-
- /* Structure Types */
-struct _jvmtiThreadInfo {
- char* name;
- jint priority;
- jboolean is_daemon;
- jthreadGroup thread_group;
- jobject context_class_loader;
-};
-struct _jvmtiMonitorStackDepthInfo {
- jobject monitor;
- jint stack_depth;
-};
-struct _jvmtiThreadGroupInfo {
- jthreadGroup parent;
- char* name;
- jint max_priority;
- jboolean is_daemon;
-};
-struct _jvmtiFrameInfo {
- jmethodID method;
- jlocation location;
-};
-struct _jvmtiStackInfo {
- jthread thread;
- jint state;
- jvmtiFrameInfo* frame_buffer;
- jint frame_count;
-};
-struct _jvmtiHeapReferenceInfoField {
- jint index;
-};
-struct _jvmtiHeapReferenceInfoArray {
- jint index;
-};
-struct _jvmtiHeapReferenceInfoConstantPool {
- jint index;
-};
-struct _jvmtiHeapReferenceInfoStackLocal {
- jlong thread_tag;
- jlong thread_id;
- jint depth;
- jmethodID method;
- jlocation location;
- jint slot;
-};
-struct _jvmtiHeapReferenceInfoJniLocal {
- jlong thread_tag;
- jlong thread_id;
- jint depth;
- jmethodID method;
-};
-struct _jvmtiHeapReferenceInfoReserved {
- jlong reserved1;
- jlong reserved2;
- jlong reserved3;
- jlong reserved4;
- jlong reserved5;
- jlong reserved6;
- jlong reserved7;
- jlong reserved8;
-};
-union _jvmtiHeapReferenceInfo {
- jvmtiHeapReferenceInfoField field;
- jvmtiHeapReferenceInfoArray array;
- jvmtiHeapReferenceInfoConstantPool constant_pool;
- jvmtiHeapReferenceInfoStackLocal stack_local;
- jvmtiHeapReferenceInfoJniLocal jni_local;
- jvmtiHeapReferenceInfoReserved other;
-};
-struct _jvmtiHeapCallbacks {
- jvmtiHeapIterationCallback heap_iteration_callback;
- jvmtiHeapReferenceCallback heap_reference_callback;
- jvmtiPrimitiveFieldCallback primitive_field_callback;
- jvmtiArrayPrimitiveValueCallback array_primitive_value_callback;
- jvmtiStringPrimitiveValueCallback string_primitive_value_callback;
- jvmtiReservedCallback reserved5;
- jvmtiReservedCallback reserved6;
- jvmtiReservedCallback reserved7;
- jvmtiReservedCallback reserved8;
- jvmtiReservedCallback reserved9;
- jvmtiReservedCallback reserved10;
- jvmtiReservedCallback reserved11;
- jvmtiReservedCallback reserved12;
- jvmtiReservedCallback reserved13;
- jvmtiReservedCallback reserved14;
- jvmtiReservedCallback reserved15;
-};
-struct _jvmtiClassDefinition {
- jclass klass;
- jint class_byte_count;
- const unsigned char* class_bytes;
-};
-struct _jvmtiMonitorUsage {
- jthread owner;
- jint entry_count;
- jint waiter_count;
- jthread* waiters;
- jint notify_waiter_count;
- jthread* notify_waiters;
-};
-struct _jvmtiLineNumberEntry {
- jlocation start_location;
- jint line_number;
-};
-struct _jvmtiLocalVariableEntry {
- jlocation start_location;
- jint length;
- char* name;
- char* signature;
- char* generic_signature;
- jint slot;
-};
-struct _jvmtiParamInfo {
- char* name;
- jvmtiParamKind kind;
- jvmtiParamTypes base_type;
- jboolean null_ok;
-};
-struct _jvmtiExtensionFunctionInfo {
- jvmtiExtensionFunction func;
- char* id;
- char* short_description;
- jint param_count;
- jvmtiParamInfo* params;
- jint error_count;
- jvmtiError* errors;
-};
-struct _jvmtiExtensionEventInfo {
- jint extension_event_index;
- char* id;
- char* short_description;
- jint param_count;
- jvmtiParamInfo* params;
-};
-struct _jvmtiTimerInfo {
- jlong max_value;
- jboolean may_skip_forward;
- jboolean may_skip_backward;
- jvmtiTimerKind kind;
- jlong reserved1;
- jlong reserved2;
-};
-struct _jvmtiAddrLocationMap {
- const void* start_address;
- jlocation location;
-};
-
-typedef struct {
- unsigned int can_tag_objects : 1;
- unsigned int can_generate_field_modification_events : 1;
- unsigned int can_generate_field_access_events : 1;
- unsigned int can_get_bytecodes : 1;
- unsigned int can_get_synthetic_attribute : 1;
- unsigned int can_get_owned_monitor_info : 1;
- unsigned int can_get_current_contended_monitor : 1;
- unsigned int can_get_monitor_info : 1;
- unsigned int can_pop_frame : 1;
- unsigned int can_redefine_classes : 1;
- unsigned int can_signal_thread : 1;
- unsigned int can_get_source_file_name : 1;
- unsigned int can_get_line_numbers : 1;
- unsigned int can_get_source_debug_extension : 1;
- unsigned int can_access_local_variables : 1;
- unsigned int can_maintain_original_method_order : 1;
- unsigned int can_generate_single_step_events : 1;
- unsigned int can_generate_exception_events : 1;
- unsigned int can_generate_frame_pop_events : 1;
- unsigned int can_generate_breakpoint_events : 1;
- unsigned int can_suspend : 1;
- unsigned int can_redefine_any_class : 1;
- unsigned int can_get_current_thread_cpu_time : 1;
- unsigned int can_get_thread_cpu_time : 1;
- unsigned int can_generate_method_entry_events : 1;
- unsigned int can_generate_method_exit_events : 1;
- unsigned int can_generate_all_class_hook_events : 1;
- unsigned int can_generate_compiled_method_load_events : 1;
- unsigned int can_generate_monitor_events : 1;
- unsigned int can_generate_vm_object_alloc_events : 1;
- unsigned int can_generate_native_method_bind_events : 1;
- unsigned int can_generate_garbage_collection_events : 1;
- unsigned int can_generate_object_free_events : 1;
- unsigned int can_force_early_return : 1;
- unsigned int can_get_owned_monitor_stack_depth_info : 1;
- unsigned int can_get_constant_pool : 1;
- unsigned int can_set_native_method_prefix : 1;
- unsigned int can_retransform_classes : 1;
- unsigned int can_retransform_any_class : 1;
- unsigned int can_generate_resource_exhaustion_heap_events : 1;
- unsigned int can_generate_resource_exhaustion_threads_events : 1;
- unsigned int can_generate_early_vmstart : 1;
- unsigned int can_generate_early_class_hook_events : 1;
- unsigned int : 5;
- unsigned int : 16;
- unsigned int : 16;
- unsigned int : 16;
- unsigned int : 16;
- unsigned int : 16;
-} jvmtiCapabilities;
-
-
- /* Event Definitions */
-
-typedef void (JNICALL *jvmtiEventReserved)(void);
-
-
-typedef void (JNICALL *jvmtiEventBreakpoint)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- jlocation location);
-
-typedef void (JNICALL *jvmtiEventClassFileLoadHook)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jclass class_being_redefined,
- jobject loader,
- const char* name,
- jobject protection_domain,
- jint class_data_len,
- const unsigned char* class_data,
- jint* new_class_data_len,
- unsigned char** new_class_data);
-
-typedef void (JNICALL *jvmtiEventClassLoad)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jclass klass);
-
-typedef void (JNICALL *jvmtiEventClassPrepare)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jclass klass);
-
-typedef void (JNICALL *jvmtiEventCompiledMethodLoad)
- (jvmtiEnv *jvmti_env,
- jmethodID method,
- jint code_size,
- const void* code_addr,
- jint map_length,
- const jvmtiAddrLocationMap* map,
- const void* compile_info);
-
-typedef void (JNICALL *jvmtiEventCompiledMethodUnload)
- (jvmtiEnv *jvmti_env,
- jmethodID method,
- const void* code_addr);
-
-typedef void (JNICALL *jvmtiEventDataDumpRequest)
- (jvmtiEnv *jvmti_env);
-
-typedef void (JNICALL *jvmtiEventDynamicCodeGenerated)
- (jvmtiEnv *jvmti_env,
- const char* name,
- const void* address,
- jint length);
-
-typedef void (JNICALL *jvmtiEventException)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- jlocation location,
- jobject exception,
- jmethodID catch_method,
- jlocation catch_location);
-
-typedef void (JNICALL *jvmtiEventExceptionCatch)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- jlocation location,
- jobject exception);
-
-typedef void (JNICALL *jvmtiEventFieldAccess)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- jlocation location,
- jclass field_klass,
- jobject object,
- jfieldID field);
-
-typedef void (JNICALL *jvmtiEventFieldModification)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- jlocation location,
- jclass field_klass,
- jobject object,
- jfieldID field,
- char signature_type,
- jvalue new_value);
-
-typedef void (JNICALL *jvmtiEventFramePop)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- jboolean was_popped_by_exception);
-
-typedef void (JNICALL *jvmtiEventGarbageCollectionFinish)
- (jvmtiEnv *jvmti_env);
-
-typedef void (JNICALL *jvmtiEventGarbageCollectionStart)
- (jvmtiEnv *jvmti_env);
-
-typedef void (JNICALL *jvmtiEventMethodEntry)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method);
-
-typedef void (JNICALL *jvmtiEventMethodExit)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- jboolean was_popped_by_exception,
- jvalue return_value);
-
-typedef void (JNICALL *jvmtiEventMonitorContendedEnter)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jobject object);
-
-typedef void (JNICALL *jvmtiEventMonitorContendedEntered)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jobject object);
-
-typedef void (JNICALL *jvmtiEventMonitorWait)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jobject object,
- jlong timeout);
-
-typedef void (JNICALL *jvmtiEventMonitorWaited)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jobject object,
- jboolean timed_out);
-
-typedef void (JNICALL *jvmtiEventNativeMethodBind)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- void* address,
- void** new_address_ptr);
-
-typedef void (JNICALL *jvmtiEventObjectFree)
- (jvmtiEnv *jvmti_env,
- jlong tag);
-
-typedef void (JNICALL *jvmtiEventResourceExhausted)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jint flags,
- const void* reserved,
- const char* description);
-
-typedef void (JNICALL *jvmtiEventSingleStep)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jmethodID method,
- jlocation location);
-
-typedef void (JNICALL *jvmtiEventThreadEnd)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread);
-
-typedef void (JNICALL *jvmtiEventThreadStart)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread);
-
-typedef void (JNICALL *jvmtiEventVMDeath)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env);
-
-typedef void (JNICALL *jvmtiEventVMInit)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread);
-
-typedef void (JNICALL *jvmtiEventVMObjectAlloc)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env,
- jthread thread,
- jobject object,
- jclass object_klass,
- jlong size);
-
-typedef void (JNICALL *jvmtiEventVMStart)
- (jvmtiEnv *jvmti_env,
- JNIEnv* jni_env);
-
- /* Event Callback Structure */
-
-typedef struct {
- /* 50 : VM Initialization Event */
- jvmtiEventVMInit VMInit;
- /* 51 : VM Death Event */
- jvmtiEventVMDeath VMDeath;
- /* 52 : Thread Start */
- jvmtiEventThreadStart ThreadStart;
- /* 53 : Thread End */
- jvmtiEventThreadEnd ThreadEnd;
- /* 54 : Class File Load Hook */
- jvmtiEventClassFileLoadHook ClassFileLoadHook;
- /* 55 : Class Load */
- jvmtiEventClassLoad ClassLoad;
- /* 56 : Class Prepare */
- jvmtiEventClassPrepare ClassPrepare;
- /* 57 : VM Start Event */
- jvmtiEventVMStart VMStart;
- /* 58 : Exception */
- jvmtiEventException Exception;
- /* 59 : Exception Catch */
- jvmtiEventExceptionCatch ExceptionCatch;
- /* 60 : Single Step */
- jvmtiEventSingleStep SingleStep;
- /* 61 : Frame Pop */
- jvmtiEventFramePop FramePop;
- /* 62 : Breakpoint */
- jvmtiEventBreakpoint Breakpoint;
- /* 63 : Field Access */
- jvmtiEventFieldAccess FieldAccess;
- /* 64 : Field Modification */
- jvmtiEventFieldModification FieldModification;
- /* 65 : Method Entry */
- jvmtiEventMethodEntry MethodEntry;
- /* 66 : Method Exit */
- jvmtiEventMethodExit MethodExit;
- /* 67 : Native Method Bind */
- jvmtiEventNativeMethodBind NativeMethodBind;
- /* 68 : Compiled Method Load */
- jvmtiEventCompiledMethodLoad CompiledMethodLoad;
- /* 69 : Compiled Method Unload */
- jvmtiEventCompiledMethodUnload CompiledMethodUnload;
- /* 70 : Dynamic Code Generated */
- jvmtiEventDynamicCodeGenerated DynamicCodeGenerated;
- /* 71 : Data Dump Request */
- jvmtiEventDataDumpRequest DataDumpRequest;
- /* 72 */
- jvmtiEventReserved reserved72;
- /* 73 : Monitor Wait */
- jvmtiEventMonitorWait MonitorWait;
- /* 74 : Monitor Waited */
- jvmtiEventMonitorWaited MonitorWaited;
- /* 75 : Monitor Contended Enter */
- jvmtiEventMonitorContendedEnter MonitorContendedEnter;
- /* 76 : Monitor Contended Entered */
- jvmtiEventMonitorContendedEntered MonitorContendedEntered;
- /* 77 */
- jvmtiEventReserved reserved77;
- /* 78 */
- jvmtiEventReserved reserved78;
- /* 79 */
- jvmtiEventReserved reserved79;
- /* 80 : Resource Exhausted */
- jvmtiEventResourceExhausted ResourceExhausted;
- /* 81 : Garbage Collection Start */
- jvmtiEventGarbageCollectionStart GarbageCollectionStart;
- /* 82 : Garbage Collection Finish */
- jvmtiEventGarbageCollectionFinish GarbageCollectionFinish;
- /* 83 : Object Free */
- jvmtiEventObjectFree ObjectFree;
- /* 84 : VM Object Allocation */
- jvmtiEventVMObjectAlloc VMObjectAlloc;
-} jvmtiEventCallbacks;
-
-
- /* Function Interface */
-
-typedef struct jvmtiInterface_1_ {
-
- /* 1 : RESERVED */
- void *reserved1;
-
- /* 2 : Set Event Notification Mode */
- jvmtiError (JNICALL *SetEventNotificationMode) (jvmtiEnv* env,
- jvmtiEventMode mode,
- jvmtiEvent event_type,
- jthread event_thread,
- ...);
-
- /* 3 : Get All Modules */
- jvmtiError (JNICALL *GetAllModules) (jvmtiEnv* env,
- jint* module_count_ptr,
- jobject** modules_ptr);
-
- /* 4 : Get All Threads */
- jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env,
- jint* threads_count_ptr,
- jthread** threads_ptr);
-
- /* 5 : Suspend Thread */
- jvmtiError (JNICALL *SuspendThread) (jvmtiEnv* env,
- jthread thread);
-
- /* 6 : Resume Thread */
- jvmtiError (JNICALL *ResumeThread) (jvmtiEnv* env,
- jthread thread);
-
- /* 7 : Stop Thread */
- jvmtiError (JNICALL *StopThread) (jvmtiEnv* env,
- jthread thread,
- jobject exception);
-
- /* 8 : Interrupt Thread */
- jvmtiError (JNICALL *InterruptThread) (jvmtiEnv* env,
- jthread thread);
-
- /* 9 : Get Thread Info */
- jvmtiError (JNICALL *GetThreadInfo) (jvmtiEnv* env,
- jthread thread,
- jvmtiThreadInfo* info_ptr);
-
- /* 10 : Get Owned Monitor Info */
- jvmtiError (JNICALL *GetOwnedMonitorInfo) (jvmtiEnv* env,
- jthread thread,
- jint* owned_monitor_count_ptr,
- jobject** owned_monitors_ptr);
-
- /* 11 : Get Current Contended Monitor */
- jvmtiError (JNICALL *GetCurrentContendedMonitor) (jvmtiEnv* env,
- jthread thread,
- jobject* monitor_ptr);
-
- /* 12 : Run Agent Thread */
- jvmtiError (JNICALL *RunAgentThread) (jvmtiEnv* env,
- jthread thread,
- jvmtiStartFunction proc,
- const void* arg,
- jint priority);
-
- /* 13 : Get Top Thread Groups */
- jvmtiError (JNICALL *GetTopThreadGroups) (jvmtiEnv* env,
- jint* group_count_ptr,
- jthreadGroup** groups_ptr);
-
- /* 14 : Get Thread Group Info */
- jvmtiError (JNICALL *GetThreadGroupInfo) (jvmtiEnv* env,
- jthreadGroup group,
- jvmtiThreadGroupInfo* info_ptr);
-
- /* 15 : Get Thread Group Children */
- jvmtiError (JNICALL *GetThreadGroupChildren) (jvmtiEnv* env,
- jthreadGroup group,
- jint* thread_count_ptr,
- jthread** threads_ptr,
- jint* group_count_ptr,
- jthreadGroup** groups_ptr);
-
- /* 16 : Get Frame Count */
- jvmtiError (JNICALL *GetFrameCount) (jvmtiEnv* env,
- jthread thread,
- jint* count_ptr);
-
- /* 17 : Get Thread State */
- jvmtiError (JNICALL *GetThreadState) (jvmtiEnv* env,
- jthread thread,
- jint* thread_state_ptr);
-
- /* 18 : Get Current Thread */
- jvmtiError (JNICALL *GetCurrentThread) (jvmtiEnv* env,
- jthread* thread_ptr);
-
- /* 19 : Get Frame Location */
- jvmtiError (JNICALL *GetFrameLocation) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jmethodID* method_ptr,
- jlocation* location_ptr);
-
- /* 20 : Notify Frame Pop */
- jvmtiError (JNICALL *NotifyFramePop) (jvmtiEnv* env,
- jthread thread,
- jint depth);
-
- /* 21 : Get Local Variable - Object */
- jvmtiError (JNICALL *GetLocalObject) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jobject* value_ptr);
-
- /* 22 : Get Local Variable - Int */
- jvmtiError (JNICALL *GetLocalInt) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jint* value_ptr);
-
- /* 23 : Get Local Variable - Long */
- jvmtiError (JNICALL *GetLocalLong) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jlong* value_ptr);
-
- /* 24 : Get Local Variable - Float */
- jvmtiError (JNICALL *GetLocalFloat) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jfloat* value_ptr);
-
- /* 25 : Get Local Variable - Double */
- jvmtiError (JNICALL *GetLocalDouble) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jdouble* value_ptr);
-
- /* 26 : Set Local Variable - Object */
- jvmtiError (JNICALL *SetLocalObject) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jobject value);
-
- /* 27 : Set Local Variable - Int */
- jvmtiError (JNICALL *SetLocalInt) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jint value);
-
- /* 28 : Set Local Variable - Long */
- jvmtiError (JNICALL *SetLocalLong) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jlong value);
-
- /* 29 : Set Local Variable - Float */
- jvmtiError (JNICALL *SetLocalFloat) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jfloat value);
-
- /* 30 : Set Local Variable - Double */
- jvmtiError (JNICALL *SetLocalDouble) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jint slot,
- jdouble value);
-
- /* 31 : Create Raw Monitor */
- jvmtiError (JNICALL *CreateRawMonitor) (jvmtiEnv* env,
- const char* name,
- jrawMonitorID* monitor_ptr);
-
- /* 32 : Destroy Raw Monitor */
- jvmtiError (JNICALL *DestroyRawMonitor) (jvmtiEnv* env,
- jrawMonitorID monitor);
-
- /* 33 : Raw Monitor Enter */
- jvmtiError (JNICALL *RawMonitorEnter) (jvmtiEnv* env,
- jrawMonitorID monitor);
-
- /* 34 : Raw Monitor Exit */
- jvmtiError (JNICALL *RawMonitorExit) (jvmtiEnv* env,
- jrawMonitorID monitor);
-
- /* 35 : Raw Monitor Wait */
- jvmtiError (JNICALL *RawMonitorWait) (jvmtiEnv* env,
- jrawMonitorID monitor,
- jlong millis);
-
- /* 36 : Raw Monitor Notify */
- jvmtiError (JNICALL *RawMonitorNotify) (jvmtiEnv* env,
- jrawMonitorID monitor);
-
- /* 37 : Raw Monitor Notify All */
- jvmtiError (JNICALL *RawMonitorNotifyAll) (jvmtiEnv* env,
- jrawMonitorID monitor);
-
- /* 38 : Set Breakpoint */
- jvmtiError (JNICALL *SetBreakpoint) (jvmtiEnv* env,
- jmethodID method,
- jlocation location);
-
- /* 39 : Clear Breakpoint */
- jvmtiError (JNICALL *ClearBreakpoint) (jvmtiEnv* env,
- jmethodID method,
- jlocation location);
-
- /* 40 : Get Named Module */
- jvmtiError (JNICALL *GetNamedModule) (jvmtiEnv* env,
- jobject class_loader,
- const char* package_name,
- jobject* module_ptr);
-
- /* 41 : Set Field Access Watch */
- jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env,
- jclass klass,
- jfieldID field);
-
- /* 42 : Clear Field Access Watch */
- jvmtiError (JNICALL *ClearFieldAccessWatch) (jvmtiEnv* env,
- jclass klass,
- jfieldID field);
-
- /* 43 : Set Field Modification Watch */
- jvmtiError (JNICALL *SetFieldModificationWatch) (jvmtiEnv* env,
- jclass klass,
- jfieldID field);
-
- /* 44 : Clear Field Modification Watch */
- jvmtiError (JNICALL *ClearFieldModificationWatch) (jvmtiEnv* env,
- jclass klass,
- jfieldID field);
-
- /* 45 : Is Modifiable Class */
- jvmtiError (JNICALL *IsModifiableClass) (jvmtiEnv* env,
- jclass klass,
- jboolean* is_modifiable_class_ptr);
-
- /* 46 : Allocate */
- jvmtiError (JNICALL *Allocate) (jvmtiEnv* env,
- jlong size,
- unsigned char** mem_ptr);
-
- /* 47 : Deallocate */
- jvmtiError (JNICALL *Deallocate) (jvmtiEnv* env,
- unsigned char* mem);
-
- /* 48 : Get Class Signature */
- jvmtiError (JNICALL *GetClassSignature) (jvmtiEnv* env,
- jclass klass,
- char** signature_ptr,
- char** generic_ptr);
-
- /* 49 : Get Class Status */
- jvmtiError (JNICALL *GetClassStatus) (jvmtiEnv* env,
- jclass klass,
- jint* status_ptr);
-
- /* 50 : Get Source File Name */
- jvmtiError (JNICALL *GetSourceFileName) (jvmtiEnv* env,
- jclass klass,
- char** source_name_ptr);
-
- /* 51 : Get Class Modifiers */
- jvmtiError (JNICALL *GetClassModifiers) (jvmtiEnv* env,
- jclass klass,
- jint* modifiers_ptr);
-
- /* 52 : Get Class Methods */
- jvmtiError (JNICALL *GetClassMethods) (jvmtiEnv* env,
- jclass klass,
- jint* method_count_ptr,
- jmethodID** methods_ptr);
-
- /* 53 : Get Class Fields */
- jvmtiError (JNICALL *GetClassFields) (jvmtiEnv* env,
- jclass klass,
- jint* field_count_ptr,
- jfieldID** fields_ptr);
-
- /* 54 : Get Implemented Interfaces */
- jvmtiError (JNICALL *GetImplementedInterfaces) (jvmtiEnv* env,
- jclass klass,
- jint* interface_count_ptr,
- jclass** interfaces_ptr);
-
- /* 55 : Is Interface */
- jvmtiError (JNICALL *IsInterface) (jvmtiEnv* env,
- jclass klass,
- jboolean* is_interface_ptr);
-
- /* 56 : Is Array Class */
- jvmtiError (JNICALL *IsArrayClass) (jvmtiEnv* env,
- jclass klass,
- jboolean* is_array_class_ptr);
-
- /* 57 : Get Class Loader */
- jvmtiError (JNICALL *GetClassLoader) (jvmtiEnv* env,
- jclass klass,
- jobject* classloader_ptr);
-
- /* 58 : Get Object Hash Code */
- jvmtiError (JNICALL *GetObjectHashCode) (jvmtiEnv* env,
- jobject object,
- jint* hash_code_ptr);
-
- /* 59 : Get Object Monitor Usage */
- jvmtiError (JNICALL *GetObjectMonitorUsage) (jvmtiEnv* env,
- jobject object,
- jvmtiMonitorUsage* info_ptr);
-
- /* 60 : Get Field Name (and Signature) */
- jvmtiError (JNICALL *GetFieldName) (jvmtiEnv* env,
- jclass klass,
- jfieldID field,
- char** name_ptr,
- char** signature_ptr,
- char** generic_ptr);
-
- /* 61 : Get Field Declaring Class */
- jvmtiError (JNICALL *GetFieldDeclaringClass) (jvmtiEnv* env,
- jclass klass,
- jfieldID field,
- jclass* declaring_class_ptr);
-
- /* 62 : Get Field Modifiers */
- jvmtiError (JNICALL *GetFieldModifiers) (jvmtiEnv* env,
- jclass klass,
- jfieldID field,
- jint* modifiers_ptr);
-
- /* 63 : Is Field Synthetic */
- jvmtiError (JNICALL *IsFieldSynthetic) (jvmtiEnv* env,
- jclass klass,
- jfieldID field,
- jboolean* is_synthetic_ptr);
-
- /* 64 : Get Method Name (and Signature) */
- jvmtiError (JNICALL *GetMethodName) (jvmtiEnv* env,
- jmethodID method,
- char** name_ptr,
- char** signature_ptr,
- char** generic_ptr);
-
- /* 65 : Get Method Declaring Class */
- jvmtiError (JNICALL *GetMethodDeclaringClass) (jvmtiEnv* env,
- jmethodID method,
- jclass* declaring_class_ptr);
-
- /* 66 : Get Method Modifiers */
- jvmtiError (JNICALL *GetMethodModifiers) (jvmtiEnv* env,
- jmethodID method,
- jint* modifiers_ptr);
-
- /* 67 : RESERVED */
- void *reserved67;
-
- /* 68 : Get Max Locals */
- jvmtiError (JNICALL *GetMaxLocals) (jvmtiEnv* env,
- jmethodID method,
- jint* max_ptr);
-
- /* 69 : Get Arguments Size */
- jvmtiError (JNICALL *GetArgumentsSize) (jvmtiEnv* env,
- jmethodID method,
- jint* size_ptr);
-
- /* 70 : Get Line Number Table */
- jvmtiError (JNICALL *GetLineNumberTable) (jvmtiEnv* env,
- jmethodID method,
- jint* entry_count_ptr,
- jvmtiLineNumberEntry** table_ptr);
-
- /* 71 : Get Method Location */
- jvmtiError (JNICALL *GetMethodLocation) (jvmtiEnv* env,
- jmethodID method,
- jlocation* start_location_ptr,
- jlocation* end_location_ptr);
-
- /* 72 : Get Local Variable Table */
- jvmtiError (JNICALL *GetLocalVariableTable) (jvmtiEnv* env,
- jmethodID method,
- jint* entry_count_ptr,
- jvmtiLocalVariableEntry** table_ptr);
-
- /* 73 : Set Native Method Prefix */
- jvmtiError (JNICALL *SetNativeMethodPrefix) (jvmtiEnv* env,
- const char* prefix);
-
- /* 74 : Set Native Method Prefixes */
- jvmtiError (JNICALL *SetNativeMethodPrefixes) (jvmtiEnv* env,
- jint prefix_count,
- char** prefixes);
-
- /* 75 : Get Bytecodes */
- jvmtiError (JNICALL *GetBytecodes) (jvmtiEnv* env,
- jmethodID method,
- jint* bytecode_count_ptr,
- unsigned char** bytecodes_ptr);
-
- /* 76 : Is Method Native */
- jvmtiError (JNICALL *IsMethodNative) (jvmtiEnv* env,
- jmethodID method,
- jboolean* is_native_ptr);
-
- /* 77 : Is Method Synthetic */
- jvmtiError (JNICALL *IsMethodSynthetic) (jvmtiEnv* env,
- jmethodID method,
- jboolean* is_synthetic_ptr);
-
- /* 78 : Get Loaded Classes */
- jvmtiError (JNICALL *GetLoadedClasses) (jvmtiEnv* env,
- jint* class_count_ptr,
- jclass** classes_ptr);
-
- /* 79 : Get Classloader Classes */
- jvmtiError (JNICALL *GetClassLoaderClasses) (jvmtiEnv* env,
- jobject initiating_loader,
- jint* class_count_ptr,
- jclass** classes_ptr);
-
- /* 80 : Pop Frame */
- jvmtiError (JNICALL *PopFrame) (jvmtiEnv* env,
- jthread thread);
-
- /* 81 : Force Early Return - Object */
- jvmtiError (JNICALL *ForceEarlyReturnObject) (jvmtiEnv* env,
- jthread thread,
- jobject value);
-
- /* 82 : Force Early Return - Int */
- jvmtiError (JNICALL *ForceEarlyReturnInt) (jvmtiEnv* env,
- jthread thread,
- jint value);
-
- /* 83 : Force Early Return - Long */
- jvmtiError (JNICALL *ForceEarlyReturnLong) (jvmtiEnv* env,
- jthread thread,
- jlong value);
-
- /* 84 : Force Early Return - Float */
- jvmtiError (JNICALL *ForceEarlyReturnFloat) (jvmtiEnv* env,
- jthread thread,
- jfloat value);
-
- /* 85 : Force Early Return - Double */
- jvmtiError (JNICALL *ForceEarlyReturnDouble) (jvmtiEnv* env,
- jthread thread,
- jdouble value);
-
- /* 86 : Force Early Return - Void */
- jvmtiError (JNICALL *ForceEarlyReturnVoid) (jvmtiEnv* env,
- jthread thread);
-
- /* 87 : Redefine Classes */
- jvmtiError (JNICALL *RedefineClasses) (jvmtiEnv* env,
- jint class_count,
- const jvmtiClassDefinition* class_definitions);
-
- /* 88 : Get Version Number */
- jvmtiError (JNICALL *GetVersionNumber) (jvmtiEnv* env,
- jint* version_ptr);
-
- /* 89 : Get Capabilities */
- jvmtiError (JNICALL *GetCapabilities) (jvmtiEnv* env,
- jvmtiCapabilities* capabilities_ptr);
-
- /* 90 : Get Source Debug Extension */
- jvmtiError (JNICALL *GetSourceDebugExtension) (jvmtiEnv* env,
- jclass klass,
- char** source_debug_extension_ptr);
-
- /* 91 : Is Method Obsolete */
- jvmtiError (JNICALL *IsMethodObsolete) (jvmtiEnv* env,
- jmethodID method,
- jboolean* is_obsolete_ptr);
-
- /* 92 : Suspend Thread List */
- jvmtiError (JNICALL *SuspendThreadList) (jvmtiEnv* env,
- jint request_count,
- const jthread* request_list,
- jvmtiError* results);
-
- /* 93 : Resume Thread List */
- jvmtiError (JNICALL *ResumeThreadList) (jvmtiEnv* env,
- jint request_count,
- const jthread* request_list,
- jvmtiError* results);
-
- /* 94 : RESERVED */
- void *reserved94;
-
- /* 95 : RESERVED */
- void *reserved95;
-
- /* 96 : RESERVED */
- void *reserved96;
-
- /* 97 : RESERVED */
- void *reserved97;
-
- /* 98 : RESERVED */
- void *reserved98;
-
- /* 99 : RESERVED */
- void *reserved99;
-
- /* 100 : Get All Stack Traces */
- jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env,
- jint max_frame_count,
- jvmtiStackInfo** stack_info_ptr,
- jint* thread_count_ptr);
-
- /* 101 : Get Thread List Stack Traces */
- jvmtiError (JNICALL *GetThreadListStackTraces) (jvmtiEnv* env,
- jint thread_count,
- const jthread* thread_list,
- jint max_frame_count,
- jvmtiStackInfo** stack_info_ptr);
-
- /* 102 : Get Thread Local Storage */
- jvmtiError (JNICALL *GetThreadLocalStorage) (jvmtiEnv* env,
- jthread thread,
- void** data_ptr);
-
- /* 103 : Set Thread Local Storage */
- jvmtiError (JNICALL *SetThreadLocalStorage) (jvmtiEnv* env,
- jthread thread,
- const void* data);
-
- /* 104 : Get Stack Trace */
- jvmtiError (JNICALL *GetStackTrace) (jvmtiEnv* env,
- jthread thread,
- jint start_depth,
- jint max_frame_count,
- jvmtiFrameInfo* frame_buffer,
- jint* count_ptr);
-
- /* 105 : RESERVED */
- void *reserved105;
-
- /* 106 : Get Tag */
- jvmtiError (JNICALL *GetTag) (jvmtiEnv* env,
- jobject object,
- jlong* tag_ptr);
-
- /* 107 : Set Tag */
- jvmtiError (JNICALL *SetTag) (jvmtiEnv* env,
- jobject object,
- jlong tag);
-
- /* 108 : Force Garbage Collection */
- jvmtiError (JNICALL *ForceGarbageCollection) (jvmtiEnv* env);
-
- /* 109 : Iterate Over Objects Reachable From Object */
- jvmtiError (JNICALL *IterateOverObjectsReachableFromObject) (jvmtiEnv* env,
- jobject object,
- jvmtiObjectReferenceCallback object_reference_callback,
- const void* user_data);
-
- /* 110 : Iterate Over Reachable Objects */
- jvmtiError (JNICALL *IterateOverReachableObjects) (jvmtiEnv* env,
- jvmtiHeapRootCallback heap_root_callback,
- jvmtiStackReferenceCallback stack_ref_callback,
- jvmtiObjectReferenceCallback object_ref_callback,
- const void* user_data);
-
- /* 111 : Iterate Over Heap */
- jvmtiError (JNICALL *IterateOverHeap) (jvmtiEnv* env,
- jvmtiHeapObjectFilter object_filter,
- jvmtiHeapObjectCallback heap_object_callback,
- const void* user_data);
-
- /* 112 : Iterate Over Instances Of Class */
- jvmtiError (JNICALL *IterateOverInstancesOfClass) (jvmtiEnv* env,
- jclass klass,
- jvmtiHeapObjectFilter object_filter,
- jvmtiHeapObjectCallback heap_object_callback,
- const void* user_data);
-
- /* 113 : RESERVED */
- void *reserved113;
-
- /* 114 : Get Objects With Tags */
- jvmtiError (JNICALL *GetObjectsWithTags) (jvmtiEnv* env,
- jint tag_count,
- const jlong* tags,
- jint* count_ptr,
- jobject** object_result_ptr,
- jlong** tag_result_ptr);
-
- /* 115 : Follow References */
- jvmtiError (JNICALL *FollowReferences) (jvmtiEnv* env,
- jint heap_filter,
- jclass klass,
- jobject initial_object,
- const jvmtiHeapCallbacks* callbacks,
- const void* user_data);
-
- /* 116 : Iterate Through Heap */
- jvmtiError (JNICALL *IterateThroughHeap) (jvmtiEnv* env,
- jint heap_filter,
- jclass klass,
- const jvmtiHeapCallbacks* callbacks,
- const void* user_data);
-
- /* 117 : RESERVED */
- void *reserved117;
-
- /* 118 : RESERVED */
- void *reserved118;
-
- /* 119 : RESERVED */
- void *reserved119;
-
- /* 120 : Set JNI Function Table */
- jvmtiError (JNICALL *SetJNIFunctionTable) (jvmtiEnv* env,
- const jniNativeInterface* function_table);
-
- /* 121 : Get JNI Function Table */
- jvmtiError (JNICALL *GetJNIFunctionTable) (jvmtiEnv* env,
- jniNativeInterface** function_table);
-
- /* 122 : Set Event Callbacks */
- jvmtiError (JNICALL *SetEventCallbacks) (jvmtiEnv* env,
- const jvmtiEventCallbacks* callbacks,
- jint size_of_callbacks);
-
- /* 123 : Generate Events */
- jvmtiError (JNICALL *GenerateEvents) (jvmtiEnv* env,
- jvmtiEvent event_type);
-
- /* 124 : Get Extension Functions */
- jvmtiError (JNICALL *GetExtensionFunctions) (jvmtiEnv* env,
- jint* extension_count_ptr,
- jvmtiExtensionFunctionInfo** extensions);
-
- /* 125 : Get Extension Events */
- jvmtiError (JNICALL *GetExtensionEvents) (jvmtiEnv* env,
- jint* extension_count_ptr,
- jvmtiExtensionEventInfo** extensions);
-
- /* 126 : Set Extension Event Callback */
- jvmtiError (JNICALL *SetExtensionEventCallback) (jvmtiEnv* env,
- jint extension_event_index,
- jvmtiExtensionEvent callback);
-
- /* 127 : Dispose Environment */
- jvmtiError (JNICALL *DisposeEnvironment) (jvmtiEnv* env);
-
- /* 128 : Get Error Name */
- jvmtiError (JNICALL *GetErrorName) (jvmtiEnv* env,
- jvmtiError error,
- char** name_ptr);
-
- /* 129 : Get JLocation Format */
- jvmtiError (JNICALL *GetJLocationFormat) (jvmtiEnv* env,
- jvmtiJlocationFormat* format_ptr);
-
- /* 130 : Get System Properties */
- jvmtiError (JNICALL *GetSystemProperties) (jvmtiEnv* env,
- jint* count_ptr,
- char*** property_ptr);
-
- /* 131 : Get System Property */
- jvmtiError (JNICALL *GetSystemProperty) (jvmtiEnv* env,
- const char* property,
- char** value_ptr);
-
- /* 132 : Set System Property */
- jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env,
- const char* property,
- const char* value_ptr);
-
- /* 133 : Get Phase */
- jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env,
- jvmtiPhase* phase_ptr);
-
- /* 134 : Get Current Thread CPU Timer Information */
- jvmtiError (JNICALL *GetCurrentThreadCpuTimerInfo) (jvmtiEnv* env,
- jvmtiTimerInfo* info_ptr);
-
- /* 135 : Get Current Thread CPU Time */
- jvmtiError (JNICALL *GetCurrentThreadCpuTime) (jvmtiEnv* env,
- jlong* nanos_ptr);
-
- /* 136 : Get Thread CPU Timer Information */
- jvmtiError (JNICALL *GetThreadCpuTimerInfo) (jvmtiEnv* env,
- jvmtiTimerInfo* info_ptr);
-
- /* 137 : Get Thread CPU Time */
- jvmtiError (JNICALL *GetThreadCpuTime) (jvmtiEnv* env,
- jthread thread,
- jlong* nanos_ptr);
-
- /* 138 : Get Timer Information */
- jvmtiError (JNICALL *GetTimerInfo) (jvmtiEnv* env,
- jvmtiTimerInfo* info_ptr);
-
- /* 139 : Get Time */
- jvmtiError (JNICALL *GetTime) (jvmtiEnv* env,
- jlong* nanos_ptr);
-
- /* 140 : Get Potential Capabilities */
- jvmtiError (JNICALL *GetPotentialCapabilities) (jvmtiEnv* env,
- jvmtiCapabilities* capabilities_ptr);
-
- /* 141 : RESERVED */
- void *reserved141;
-
- /* 142 : Add Capabilities */
- jvmtiError (JNICALL *AddCapabilities) (jvmtiEnv* env,
- const jvmtiCapabilities* capabilities_ptr);
-
- /* 143 : Relinquish Capabilities */
- jvmtiError (JNICALL *RelinquishCapabilities) (jvmtiEnv* env,
- const jvmtiCapabilities* capabilities_ptr);
-
- /* 144 : Get Available Processors */
- jvmtiError (JNICALL *GetAvailableProcessors) (jvmtiEnv* env,
- jint* processor_count_ptr);
-
- /* 145 : Get Class Version Numbers */
- jvmtiError (JNICALL *GetClassVersionNumbers) (jvmtiEnv* env,
- jclass klass,
- jint* minor_version_ptr,
- jint* major_version_ptr);
-
- /* 146 : Get Constant Pool */
- jvmtiError (JNICALL *GetConstantPool) (jvmtiEnv* env,
- jclass klass,
- jint* constant_pool_count_ptr,
- jint* constant_pool_byte_count_ptr,
- unsigned char** constant_pool_bytes_ptr);
-
- /* 147 : Get Environment Local Storage */
- jvmtiError (JNICALL *GetEnvironmentLocalStorage) (jvmtiEnv* env,
- void** data_ptr);
-
- /* 148 : Set Environment Local Storage */
- jvmtiError (JNICALL *SetEnvironmentLocalStorage) (jvmtiEnv* env,
- const void* data);
-
- /* 149 : Add To Bootstrap Class Loader Search */
- jvmtiError (JNICALL *AddToBootstrapClassLoaderSearch) (jvmtiEnv* env,
- const char* segment);
-
- /* 150 : Set Verbose Flag */
- jvmtiError (JNICALL *SetVerboseFlag) (jvmtiEnv* env,
- jvmtiVerboseFlag flag,
- jboolean value);
-
- /* 151 : Add To System Class Loader Search */
- jvmtiError (JNICALL *AddToSystemClassLoaderSearch) (jvmtiEnv* env,
- const char* segment);
-
- /* 152 : Retransform Classes */
- jvmtiError (JNICALL *RetransformClasses) (jvmtiEnv* env,
- jint class_count,
- const jclass* classes);
-
- /* 153 : Get Owned Monitor Stack Depth Info */
- jvmtiError (JNICALL *GetOwnedMonitorStackDepthInfo) (jvmtiEnv* env,
- jthread thread,
- jint* monitor_info_count_ptr,
- jvmtiMonitorStackDepthInfo** monitor_info_ptr);
-
- /* 154 : Get Object Size */
- jvmtiError (JNICALL *GetObjectSize) (jvmtiEnv* env,
- jobject object,
- jlong* size_ptr);
-
- /* 155 : Get Local Instance */
- jvmtiError (JNICALL *GetLocalInstance) (jvmtiEnv* env,
- jthread thread,
- jint depth,
- jobject* value_ptr);
-
-} jvmtiInterface_1;
-
-struct _jvmtiEnv {
- const struct jvmtiInterface_1_ *functions;
-#ifdef __cplusplus
-
-
- jvmtiError Allocate(jlong size,
- unsigned char** mem_ptr) {
- return functions->Allocate(this, size, mem_ptr);
- }
-
- jvmtiError Deallocate(unsigned char* mem) {
- return functions->Deallocate(this, mem);
- }
-
- jvmtiError GetThreadState(jthread thread,
- jint* thread_state_ptr) {
- return functions->GetThreadState(this, thread, thread_state_ptr);
- }
-
- jvmtiError GetCurrentThread(jthread* thread_ptr) {
- return functions->GetCurrentThread(this, thread_ptr);
- }
-
- jvmtiError GetAllThreads(jint* threads_count_ptr,
- jthread** threads_ptr) {
- return functions->GetAllThreads(this, threads_count_ptr, threads_ptr);
- }
-
- jvmtiError SuspendThread(jthread thread) {
- return functions->SuspendThread(this, thread);
- }
-
- jvmtiError SuspendThreadList(jint request_count,
- const jthread* request_list,
- jvmtiError* results) {
- return functions->SuspendThreadList(this, request_count, request_list, results);
- }
-
- jvmtiError ResumeThread(jthread thread) {
- return functions->ResumeThread(this, thread);
- }
-
- jvmtiError ResumeThreadList(jint request_count,
- const jthread* request_list,
- jvmtiError* results) {
- return functions->ResumeThreadList(this, request_count, request_list, results);
- }
-
- jvmtiError StopThread(jthread thread,
- jobject exception) {
- return functions->StopThread(this, thread, exception);
- }
-
- jvmtiError InterruptThread(jthread thread) {
- return functions->InterruptThread(this, thread);
- }
-
- jvmtiError GetThreadInfo(jthread thread,
- jvmtiThreadInfo* info_ptr) {
- return functions->GetThreadInfo(this, thread, info_ptr);
- }
-
- jvmtiError GetOwnedMonitorInfo(jthread thread,
- jint* owned_monitor_count_ptr,
- jobject** owned_monitors_ptr) {
- return functions->GetOwnedMonitorInfo(this, thread, owned_monitor_count_ptr, owned_monitors_ptr);
- }
-
- jvmtiError GetOwnedMonitorStackDepthInfo(jthread thread,
- jint* monitor_info_count_ptr,
- jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
- return functions->GetOwnedMonitorStackDepthInfo(this, thread, monitor_info_count_ptr, monitor_info_ptr);
- }
-
- jvmtiError GetCurrentContendedMonitor(jthread thread,
- jobject* monitor_ptr) {
- return functions->GetCurrentContendedMonitor(this, thread, monitor_ptr);
- }
-
- jvmtiError RunAgentThread(jthread thread,
- jvmtiStartFunction proc,
- const void* arg,
- jint priority) {
- return functions->RunAgentThread(this, thread, proc, arg, priority);
- }
-
- jvmtiError SetThreadLocalStorage(jthread thread,
- const void* data) {
- return functions->SetThreadLocalStorage(this, thread, data);
- }
-
- jvmtiError GetThreadLocalStorage(jthread thread,
- void** data_ptr) {
- return functions->GetThreadLocalStorage(this, thread, data_ptr);
- }
-
- jvmtiError GetTopThreadGroups(jint* group_count_ptr,
- jthreadGroup** groups_ptr) {
- return functions->GetTopThreadGroups(this, group_count_ptr, groups_ptr);
- }
-
- jvmtiError GetThreadGroupInfo(jthreadGroup group,
- jvmtiThreadGroupInfo* info_ptr) {
- return functions->GetThreadGroupInfo(this, group, info_ptr);
- }
-
- jvmtiError GetThreadGroupChildren(jthreadGroup group,
- jint* thread_count_ptr,
- jthread** threads_ptr,
- jint* group_count_ptr,
- jthreadGroup** groups_ptr) {
- return functions->GetThreadGroupChildren(this, group, thread_count_ptr, threads_ptr, group_count_ptr, groups_ptr);
- }
-
- jvmtiError GetStackTrace(jthread thread,
- jint start_depth,
- jint max_frame_count,
- jvmtiFrameInfo* frame_buffer,
- jint* count_ptr) {
- return functions->GetStackTrace(this, thread, start_depth, max_frame_count, frame_buffer, count_ptr);
- }
-
- jvmtiError GetAllStackTraces(jint max_frame_count,
- jvmtiStackInfo** stack_info_ptr,
- jint* thread_count_ptr) {
- return functions->GetAllStackTraces(this, max_frame_count, stack_info_ptr, thread_count_ptr);
- }
-
- jvmtiError GetThreadListStackTraces(jint thread_count,
- const jthread* thread_list,
- jint max_frame_count,
- jvmtiStackInfo** stack_info_ptr) {
- return functions->GetThreadListStackTraces(this, thread_count, thread_list, max_frame_count, stack_info_ptr);
- }
-
- jvmtiError GetFrameCount(jthread thread,
- jint* count_ptr) {
- return functions->GetFrameCount(this, thread, count_ptr);
- }
-
- jvmtiError PopFrame(jthread thread) {
- return functions->PopFrame(this, thread);
- }
-
- jvmtiError GetFrameLocation(jthread thread,
- jint depth,
- jmethodID* method_ptr,
- jlocation* location_ptr) {
- return functions->GetFrameLocation(this, thread, depth, method_ptr, location_ptr);
- }
-
- jvmtiError NotifyFramePop(jthread thread,
- jint depth) {
- return functions->NotifyFramePop(this, thread, depth);
- }
-
- jvmtiError ForceEarlyReturnObject(jthread thread,
- jobject value) {
- return functions->ForceEarlyReturnObject(this, thread, value);
- }
-
- jvmtiError ForceEarlyReturnInt(jthread thread,
- jint value) {
- return functions->ForceEarlyReturnInt(this, thread, value);
- }
-
- jvmtiError ForceEarlyReturnLong(jthread thread,
- jlong value) {
- return functions->ForceEarlyReturnLong(this, thread, value);
- }
-
- jvmtiError ForceEarlyReturnFloat(jthread thread,
- jfloat value) {
- return functions->ForceEarlyReturnFloat(this, thread, value);
- }
-
- jvmtiError ForceEarlyReturnDouble(jthread thread,
- jdouble value) {
- return functions->ForceEarlyReturnDouble(this, thread, value);
- }
-
- jvmtiError ForceEarlyReturnVoid(jthread thread) {
- return functions->ForceEarlyReturnVoid(this, thread);
- }
-
- jvmtiError FollowReferences(jint heap_filter,
- jclass klass,
- jobject initial_object,
- const jvmtiHeapCallbacks* callbacks,
- const void* user_data) {
- return functions->FollowReferences(this, heap_filter, klass, initial_object, callbacks, user_data);
- }
-
- jvmtiError IterateThroughHeap(jint heap_filter,
- jclass klass,
- const jvmtiHeapCallbacks* callbacks,
- const void* user_data) {
- return functions->IterateThroughHeap(this, heap_filter, klass, callbacks, user_data);
- }
-
- jvmtiError GetTag(jobject object,
- jlong* tag_ptr) {
- return functions->GetTag(this, object, tag_ptr);
- }
-
- jvmtiError SetTag(jobject object,
- jlong tag) {
- return functions->SetTag(this, object, tag);
- }
-
- jvmtiError GetObjectsWithTags(jint tag_count,
- const jlong* tags,
- jint* count_ptr,
- jobject** object_result_ptr,
- jlong** tag_result_ptr) {
- return functions->GetObjectsWithTags(this, tag_count, tags, count_ptr, object_result_ptr, tag_result_ptr);
- }
-
- jvmtiError ForceGarbageCollection() {
- return functions->ForceGarbageCollection(this);
- }
-
- jvmtiError IterateOverObjectsReachableFromObject(jobject object,
- jvmtiObjectReferenceCallback object_reference_callback,
- const void* user_data) {
- return functions->IterateOverObjectsReachableFromObject(this, object, object_reference_callback, user_data);
- }
-
- jvmtiError IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback,
- jvmtiStackReferenceCallback stack_ref_callback,
- jvmtiObjectReferenceCallback object_ref_callback,
- const void* user_data) {
- return functions->IterateOverReachableObjects(this, heap_root_callback, stack_ref_callback, object_ref_callback, user_data);
- }
-
- jvmtiError IterateOverHeap(jvmtiHeapObjectFilter object_filter,
- jvmtiHeapObjectCallback heap_object_callback,
- const void* user_data) {
- return functions->IterateOverHeap(this, object_filter, heap_object_callback, user_data);
- }
-
- jvmtiError IterateOverInstancesOfClass(jclass klass,
- jvmtiHeapObjectFilter object_filter,
- jvmtiHeapObjectCallback heap_object_callback,
- const void* user_data) {
- return functions->IterateOverInstancesOfClass(this, klass, object_filter, heap_object_callback, user_data);
- }
-
- jvmtiError GetLocalObject(jthread thread,
- jint depth,
- jint slot,
- jobject* value_ptr) {
- return functions->GetLocalObject(this, thread, depth, slot, value_ptr);
- }
-
- jvmtiError GetLocalInstance(jthread thread,
- jint depth,
- jobject* value_ptr) {
- return functions->GetLocalInstance(this, thread, depth, value_ptr);
- }
-
- jvmtiError GetLocalInt(jthread thread,
- jint depth,
- jint slot,
- jint* value_ptr) {
- return functions->GetLocalInt(this, thread, depth, slot, value_ptr);
- }
-
- jvmtiError GetLocalLong(jthread thread,
- jint depth,
- jint slot,
- jlong* value_ptr) {
- return functions->GetLocalLong(this, thread, depth, slot, value_ptr);
- }
-
- jvmtiError GetLocalFloat(jthread thread,
- jint depth,
- jint slot,
- jfloat* value_ptr) {
- return functions->GetLocalFloat(this, thread, depth, slot, value_ptr);
- }
-
- jvmtiError GetLocalDouble(jthread thread,
- jint depth,
- jint slot,
- jdouble* value_ptr) {
- return functions->GetLocalDouble(this, thread, depth, slot, value_ptr);
- }
-
- jvmtiError SetLocalObject(jthread thread,
- jint depth,
- jint slot,
- jobject value) {
- return functions->SetLocalObject(this, thread, depth, slot, value);
- }
-
- jvmtiError SetLocalInt(jthread thread,
- jint depth,
- jint slot,
- jint value) {
- return functions->SetLocalInt(this, thread, depth, slot, value);
- }
-
- jvmtiError SetLocalLong(jthread thread,
- jint depth,
- jint slot,
- jlong value) {
- return functions->SetLocalLong(this, thread, depth, slot, value);
- }
-
- jvmtiError SetLocalFloat(jthread thread,
- jint depth,
- jint slot,
- jfloat value) {
- return functions->SetLocalFloat(this, thread, depth, slot, value);
- }
-
- jvmtiError SetLocalDouble(jthread thread,
- jint depth,
- jint slot,
- jdouble value) {
- return functions->SetLocalDouble(this, thread, depth, slot, value);
- }
-
- jvmtiError SetBreakpoint(jmethodID method,
- jlocation location) {
- return functions->SetBreakpoint(this, method, location);
- }
-
- jvmtiError ClearBreakpoint(jmethodID method,
- jlocation location) {
- return functions->ClearBreakpoint(this, method, location);
- }
-
- jvmtiError SetFieldAccessWatch(jclass klass,
- jfieldID field) {
- return functions->SetFieldAccessWatch(this, klass, field);
- }
-
- jvmtiError ClearFieldAccessWatch(jclass klass,
- jfieldID field) {
- return functions->ClearFieldAccessWatch(this, klass, field);
- }
-
- jvmtiError SetFieldModificationWatch(jclass klass,
- jfieldID field) {
- return functions->SetFieldModificationWatch(this, klass, field);
- }
-
- jvmtiError ClearFieldModificationWatch(jclass klass,
- jfieldID field) {
- return functions->ClearFieldModificationWatch(this, klass, field);
- }
-
- jvmtiError GetAllModules(jint* module_count_ptr,
- jobject** modules_ptr) {
- return functions->GetAllModules(this, module_count_ptr, modules_ptr);
- }
-
- jvmtiError GetNamedModule(jobject class_loader,
- const char* package_name,
- jobject* module_ptr) {
- return functions->GetNamedModule(this, class_loader, package_name, module_ptr);
- }
-
- jvmtiError GetLoadedClasses(jint* class_count_ptr,
- jclass** classes_ptr) {
- return functions->GetLoadedClasses(this, class_count_ptr, classes_ptr);
- }
-
- jvmtiError GetClassLoaderClasses(jobject initiating_loader,
- jint* class_count_ptr,
- jclass** classes_ptr) {
- return functions->GetClassLoaderClasses(this, initiating_loader, class_count_ptr, classes_ptr);
- }
-
- jvmtiError GetClassSignature(jclass klass,
- char** signature_ptr,
- char** generic_ptr) {
- return functions->GetClassSignature(this, klass, signature_ptr, generic_ptr);
- }
-
- jvmtiError GetClassStatus(jclass klass,
- jint* status_ptr) {
- return functions->GetClassStatus(this, klass, status_ptr);
- }
-
- jvmtiError GetSourceFileName(jclass klass,
- char** source_name_ptr) {
- return functions->GetSourceFileName(this, klass, source_name_ptr);
- }
-
- jvmtiError GetClassModifiers(jclass klass,
- jint* modifiers_ptr) {
- return functions->GetClassModifiers(this, klass, modifiers_ptr);
- }
-
- jvmtiError GetClassMethods(jclass klass,
- jint* method_count_ptr,
- jmethodID** methods_ptr) {
- return functions->GetClassMethods(this, klass, method_count_ptr, methods_ptr);
- }
-
- jvmtiError GetClassFields(jclass klass,
- jint* field_count_ptr,
- jfieldID** fields_ptr) {
- return functions->GetClassFields(this, klass, field_count_ptr, fields_ptr);
- }
-
- jvmtiError GetImplementedInterfaces(jclass klass,
- jint* interface_count_ptr,
- jclass** interfaces_ptr) {
- return functions->GetImplementedInterfaces(this, klass, interface_count_ptr, interfaces_ptr);
- }
-
- jvmtiError GetClassVersionNumbers(jclass klass,
- jint* minor_version_ptr,
- jint* major_version_ptr) {
- return functions->GetClassVersionNumbers(this, klass, minor_version_ptr, major_version_ptr);
- }
-
- jvmtiError GetConstantPool(jclass klass,
- jint* constant_pool_count_ptr,
- jint* constant_pool_byte_count_ptr,
- unsigned char** constant_pool_bytes_ptr) {
- return functions->GetConstantPool(this, klass, constant_pool_count_ptr, constant_pool_byte_count_ptr, constant_pool_bytes_ptr);
- }
-
- jvmtiError IsInterface(jclass klass,
- jboolean* is_interface_ptr) {
- return functions->IsInterface(this, klass, is_interface_ptr);
- }
-
- jvmtiError IsArrayClass(jclass klass,
- jboolean* is_array_class_ptr) {
- return functions->IsArrayClass(this, klass, is_array_class_ptr);
- }
-
- jvmtiError IsModifiableClass(jclass klass,
- jboolean* is_modifiable_class_ptr) {
- return functions->IsModifiableClass(this, klass, is_modifiable_class_ptr);
- }
-
- jvmtiError GetClassLoader(jclass klass,
- jobject* classloader_ptr) {
- return functions->GetClassLoader(this, klass, classloader_ptr);
- }
-
- jvmtiError GetSourceDebugExtension(jclass klass,
- char** source_debug_extension_ptr) {
- return functions->GetSourceDebugExtension(this, klass, source_debug_extension_ptr);
- }
-
- jvmtiError RetransformClasses(jint class_count,
- const jclass* classes) {
- return functions->RetransformClasses(this, class_count, classes);
- }
-
- jvmtiError RedefineClasses(jint class_count,
- const jvmtiClassDefinition* class_definitions) {
- return functions->RedefineClasses(this, class_count, class_definitions);
- }
-
- jvmtiError GetObjectSize(jobject object,
- jlong* size_ptr) {
- return functions->GetObjectSize(this, object, size_ptr);
- }
-
- jvmtiError GetObjectHashCode(jobject object,
- jint* hash_code_ptr) {
- return functions->GetObjectHashCode(this, object, hash_code_ptr);
- }
-
- jvmtiError GetObjectMonitorUsage(jobject object,
- jvmtiMonitorUsage* info_ptr) {
- return functions->GetObjectMonitorUsage(this, object, info_ptr);
- }
-
- jvmtiError GetFieldName(jclass klass,
- jfieldID field,
- char** name_ptr,
- char** signature_ptr,
- char** generic_ptr) {
- return functions->GetFieldName(this, klass, field, name_ptr, signature_ptr, generic_ptr);
- }
-
- jvmtiError GetFieldDeclaringClass(jclass klass,
- jfieldID field,
- jclass* declaring_class_ptr) {
- return functions->GetFieldDeclaringClass(this, klass, field, declaring_class_ptr);
- }
-
- jvmtiError GetFieldModifiers(jclass klass,
- jfieldID field,
- jint* modifiers_ptr) {
- return functions->GetFieldModifiers(this, klass, field, modifiers_ptr);
- }
-
- jvmtiError IsFieldSynthetic(jclass klass,
- jfieldID field,
- jboolean* is_synthetic_ptr) {
- return functions->IsFieldSynthetic(this, klass, field, is_synthetic_ptr);
- }
-
- jvmtiError GetMethodName(jmethodID method,
- char** name_ptr,
- char** signature_ptr,
- char** generic_ptr) {
- return functions->GetMethodName(this, method, name_ptr, signature_ptr, generic_ptr);
- }
-
- jvmtiError GetMethodDeclaringClass(jmethodID method,
- jclass* declaring_class_ptr) {
- return functions->GetMethodDeclaringClass(this, method, declaring_class_ptr);
- }
-
- jvmtiError GetMethodModifiers(jmethodID method,
- jint* modifiers_ptr) {
- return functions->GetMethodModifiers(this, method, modifiers_ptr);
- }
-
- jvmtiError GetMaxLocals(jmethodID method,
- jint* max_ptr) {
- return functions->GetMaxLocals(this, method, max_ptr);
- }
-
- jvmtiError GetArgumentsSize(jmethodID method,
- jint* size_ptr) {
- return functions->GetArgumentsSize(this, method, size_ptr);
- }
-
- jvmtiError GetLineNumberTable(jmethodID method,
- jint* entry_count_ptr,
- jvmtiLineNumberEntry** table_ptr) {
- return functions->GetLineNumberTable(this, method, entry_count_ptr, table_ptr);
- }
-
- jvmtiError GetMethodLocation(jmethodID method,
- jlocation* start_location_ptr,
- jlocation* end_location_ptr) {
- return functions->GetMethodLocation(this, method, start_location_ptr, end_location_ptr);
- }
-
- jvmtiError GetLocalVariableTable(jmethodID method,
- jint* entry_count_ptr,
- jvmtiLocalVariableEntry** table_ptr) {
- return functions->GetLocalVariableTable(this, method, entry_count_ptr, table_ptr);
- }
-
- jvmtiError GetBytecodes(jmethodID method,
- jint* bytecode_count_ptr,
- unsigned char** bytecodes_ptr) {
- return functions->GetBytecodes(this, method, bytecode_count_ptr, bytecodes_ptr);
- }
-
- jvmtiError IsMethodNative(jmethodID method,
- jboolean* is_native_ptr) {
- return functions->IsMethodNative(this, method, is_native_ptr);
- }
-
- jvmtiError IsMethodSynthetic(jmethodID method,
- jboolean* is_synthetic_ptr) {
- return functions->IsMethodSynthetic(this, method, is_synthetic_ptr);
- }
-
- jvmtiError IsMethodObsolete(jmethodID method,
- jboolean* is_obsolete_ptr) {
- return functions->IsMethodObsolete(this, method, is_obsolete_ptr);
- }
-
- jvmtiError SetNativeMethodPrefix(const char* prefix) {
- return functions->SetNativeMethodPrefix(this, prefix);
- }
-
- jvmtiError SetNativeMethodPrefixes(jint prefix_count,
- char** prefixes) {
- return functions->SetNativeMethodPrefixes(this, prefix_count, prefixes);
- }
-
- jvmtiError CreateRawMonitor(const char* name,
- jrawMonitorID* monitor_ptr) {
- return functions->CreateRawMonitor(this, name, monitor_ptr);
- }
-
- jvmtiError DestroyRawMonitor(jrawMonitorID monitor) {
- return functions->DestroyRawMonitor(this, monitor);
- }
-
- jvmtiError RawMonitorEnter(jrawMonitorID monitor) {
- return functions->RawMonitorEnter(this, monitor);
- }
-
- jvmtiError RawMonitorExit(jrawMonitorID monitor) {
- return functions->RawMonitorExit(this, monitor);
- }
-
- jvmtiError RawMonitorWait(jrawMonitorID monitor,
- jlong millis) {
- return functions->RawMonitorWait(this, monitor, millis);
- }
-
- jvmtiError RawMonitorNotify(jrawMonitorID monitor) {
- return functions->RawMonitorNotify(this, monitor);
- }
-
- jvmtiError RawMonitorNotifyAll(jrawMonitorID monitor) {
- return functions->RawMonitorNotifyAll(this, monitor);
- }
-
- jvmtiError SetJNIFunctionTable(const jniNativeInterface* function_table) {
- return functions->SetJNIFunctionTable(this, function_table);
- }
-
- jvmtiError GetJNIFunctionTable(jniNativeInterface** function_table) {
- return functions->GetJNIFunctionTable(this, function_table);
- }
-
- jvmtiError SetEventCallbacks(const jvmtiEventCallbacks* callbacks,
- jint size_of_callbacks) {
- return functions->SetEventCallbacks(this, callbacks, size_of_callbacks);
- }
-
- jvmtiError SetEventNotificationMode(jvmtiEventMode mode,
- jvmtiEvent event_type,
- jthread event_thread,
- ...) {
- return functions->SetEventNotificationMode(this, mode, event_type, event_thread);
- }
-
- jvmtiError GenerateEvents(jvmtiEvent event_type) {
- return functions->GenerateEvents(this, event_type);
- }
-
- jvmtiError GetExtensionFunctions(jint* extension_count_ptr,
- jvmtiExtensionFunctionInfo** extensions) {
- return functions->GetExtensionFunctions(this, extension_count_ptr, extensions);
- }
-
- jvmtiError GetExtensionEvents(jint* extension_count_ptr,
- jvmtiExtensionEventInfo** extensions) {
- return functions->GetExtensionEvents(this, extension_count_ptr, extensions);
- }
-
- jvmtiError SetExtensionEventCallback(jint extension_event_index,
- jvmtiExtensionEvent callback) {
- return functions->SetExtensionEventCallback(this, extension_event_index, callback);
- }
-
- jvmtiError GetPotentialCapabilities(jvmtiCapabilities* capabilities_ptr) {
- return functions->GetPotentialCapabilities(this, capabilities_ptr);
- }
-
- jvmtiError AddCapabilities(const jvmtiCapabilities* capabilities_ptr) {
- return functions->AddCapabilities(this, capabilities_ptr);
- }
-
- jvmtiError RelinquishCapabilities(const jvmtiCapabilities* capabilities_ptr) {
- return functions->RelinquishCapabilities(this, capabilities_ptr);
- }
-
- jvmtiError GetCapabilities(jvmtiCapabilities* capabilities_ptr) {
- return functions->GetCapabilities(this, capabilities_ptr);
- }
-
- jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) {
- return functions->GetCurrentThreadCpuTimerInfo(this, info_ptr);
- }
-
- jvmtiError GetCurrentThreadCpuTime(jlong* nanos_ptr) {
- return functions->GetCurrentThreadCpuTime(this, nanos_ptr);
- }
-
- jvmtiError GetThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) {
- return functions->GetThreadCpuTimerInfo(this, info_ptr);
- }
-
- jvmtiError GetThreadCpuTime(jthread thread,
- jlong* nanos_ptr) {
- return functions->GetThreadCpuTime(this, thread, nanos_ptr);
- }
-
- jvmtiError GetTimerInfo(jvmtiTimerInfo* info_ptr) {
- return functions->GetTimerInfo(this, info_ptr);
- }
-
- jvmtiError GetTime(jlong* nanos_ptr) {
- return functions->GetTime(this, nanos_ptr);
- }
-
- jvmtiError GetAvailableProcessors(jint* processor_count_ptr) {
- return functions->GetAvailableProcessors(this, processor_count_ptr);
- }
-
- jvmtiError AddToBootstrapClassLoaderSearch(const char* segment) {
- return functions->AddToBootstrapClassLoaderSearch(this, segment);
- }
-
- jvmtiError AddToSystemClassLoaderSearch(const char* segment) {
- return functions->AddToSystemClassLoaderSearch(this, segment);
- }
-
- jvmtiError GetSystemProperties(jint* count_ptr,
- char*** property_ptr) {
- return functions->GetSystemProperties(this, count_ptr, property_ptr);
- }
-
- jvmtiError GetSystemProperty(const char* property,
- char** value_ptr) {
- return functions->GetSystemProperty(this, property, value_ptr);
- }
-
- jvmtiError SetSystemProperty(const char* property,
- const char* value_ptr) {
- return functions->SetSystemProperty(this, property, value_ptr);
- }
-
- jvmtiError GetPhase(jvmtiPhase* phase_ptr) {
- return functions->GetPhase(this, phase_ptr);
- }
-
- jvmtiError DisposeEnvironment() {
- return functions->DisposeEnvironment(this);
- }
-
- jvmtiError SetEnvironmentLocalStorage(const void* data) {
- return functions->SetEnvironmentLocalStorage(this, data);
- }
-
- jvmtiError GetEnvironmentLocalStorage(void** data_ptr) {
- return functions->GetEnvironmentLocalStorage(this, data_ptr);
- }
-
- jvmtiError GetVersionNumber(jint* version_ptr) {
- return functions->GetVersionNumber(this, version_ptr);
- }
-
- jvmtiError GetErrorName(jvmtiError error,
- char** name_ptr) {
- return functions->GetErrorName(this, error, name_ptr);
- }
-
- jvmtiError SetVerboseFlag(jvmtiVerboseFlag flag,
- jboolean value) {
- return functions->SetVerboseFlag(this, flag, value);
- }
-
- jvmtiError GetJLocationFormat(jvmtiJlocationFormat* format_ptr) {
- return functions->GetJLocationFormat(this, format_ptr);
- }
-
-#endif /* __cplusplus */
-};
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* __cplusplus */
-
-#endif /* !_JAVA_JVMTI_H_ */
diff --git a/jdk/src/java.base/share/native/launcher/defines.h b/jdk/src/java.base/share/native/launcher/defines.h
index 3b63e038f9d..1dd0cbe5b32 100644
--- a/jdk/src/java.base/share/native/launcher/defines.h
+++ b/jdk/src/java.base/share/native/launcher/defines.h
@@ -51,16 +51,6 @@ static const char* const_progname = PROGNAME;
static char* const_progname = NULL;
#endif
static const char* const_jargs[] = JAVA_ARGS;
-/*
- * ApplicationHome is prepended to each of these entries; the resulting
- * strings are concatenated (separated by PATH_SEPARATOR) and used as the
- * value of -cp option to the launcher.
- */
-#ifndef APP_CLASSPATH
-static const char* const_appclasspath[] = { NULL };
-#else
-static const char* const_appclasspath[] = APP_CLASSPATH;
-#endif /* APP_CLASSPATH */
#else /* !JAVA_ARGS */
#define HAS_JAVA_ARGS JNI_FALSE
static const char* const_progname = "java";
diff --git a/jdk/src/java.base/share/native/launcher/main.c b/jdk/src/java.base/share/native/launcher/main.c
index 9c24c2ebf68..22298385114 100644
--- a/jdk/src/java.base/share/native/launcher/main.c
+++ b/jdk/src/java.base/share/native/launcher/main.c
@@ -83,7 +83,7 @@ char **__initenv;
int WINAPI
WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
{
- int margc, appclassc;
+ int margc;
char** margv;
const jboolean const_javaw = JNI_TRUE;
@@ -93,7 +93,7 @@ WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
int
main(int argc, char **argv)
{
- int margc, appclassc;
+ int margc;
char** margv;
const jboolean const_javaw = JNI_FALSE;
#endif /* JAVAW */
@@ -148,14 +148,9 @@ main(int argc, char **argv)
margv = args->elements;
}
#endif /* WIN32 */
- if (const_appclasspath[0] == NULL) {
- appclassc = 0;
- } else {
- appclassc = sizeof(const_appclasspath) / sizeof(char *);
- }
return JLI_Launch(margc, margv,
sizeof(const_jargs) / sizeof(char *), const_jargs,
- appclassc, const_appclasspath,
+ 0, NULL,
VERSION_STRING,
DOT_VERSION,
(const_progname != NULL) ? const_progname : *margv,
diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c
index 6dc9674a6ed..70a7bf7a6d9 100644
--- a/jdk/src/java.base/share/native/libjli/java.c
+++ b/jdk/src/java.base/share/native/libjli/java.c
@@ -1664,19 +1664,21 @@ AddApplicationOptions(int cpathc, const char **cpathv)
AddOption(apphome, NULL);
/* How big is the application's classpath? */
- size = 40; /* 40: "-Djava.class.path=" */
- for (i = 0; i < cpathc; i++) {
- size += (int)JLI_StrLen(home) + (int)JLI_StrLen(cpathv[i]) + 1; /* 1: separator */
+ if (cpathc > 0) {
+ size = 40; /* 40: "-Djava.class.path=" */
+ for (i = 0; i < cpathc; i++) {
+ size += (int)JLI_StrLen(home) + (int)JLI_StrLen(cpathv[i]) + 1; /* 1: separator */
+ }
+ appcp = (char *)JLI_MemAlloc(size + 1);
+ JLI_StrCpy(appcp, "-Djava.class.path=");
+ for (i = 0; i < cpathc; i++) {
+ JLI_StrCat(appcp, home); /* c:\program files\myapp */
+ JLI_StrCat(appcp, cpathv[i]); /* \lib\myapp.jar */
+ JLI_StrCat(appcp, separator); /* ; */
+ }
+ appcp[JLI_StrLen(appcp)-1] = '\0'; /* remove trailing path separator */
+ AddOption(appcp, NULL);
}
- appcp = (char *)JLI_MemAlloc(size + 1);
- JLI_StrCpy(appcp, "-Djava.class.path=");
- for (i = 0; i < cpathc; i++) {
- JLI_StrCat(appcp, home); /* c:\program files\myapp */
- JLI_StrCat(appcp, cpathv[i]); /* \lib\myapp.jar */
- JLI_StrCat(appcp, separator); /* ; */
- }
- appcp[JLI_StrLen(appcp)-1] = '\0'; /* remove trailing path separator */
- AddOption(appcp, NULL);
return JNI_TRUE;
}
diff --git a/jdk/src/java.base/share/native/libnet/net_util.c b/jdk/src/java.base/share/native/libnet/net_util.c
index c2d4b002b04..02bf588ddc9 100644
--- a/jdk/src/java.base/share/native/libnet/net_util.c
+++ b/jdk/src/java.base/share/native/libnet/net_util.c
@@ -23,20 +23,19 @@
* questions.
*/
-#include "jni.h"
-#include "jvm.h"
-#include "jni_util.h"
#include "net_util.h"
-int IPv6_supported() ;
-int reuseport_supported() ;
+#include "java_net_InetAddress.h"
+
+int IPv6_supported();
+int reuseport_supported();
static int IPv6_available;
static int REUSEPORT_available;
JNIEXPORT jint JNICALL ipv6_available()
{
- return IPv6_available ;
+ return IPv6_available;
}
JNIEXPORT jint JNICALL reuseport_available()
@@ -204,13 +203,8 @@ jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj) {
JNIEXPORT jobject JNICALL
NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
jobject iaObj;
-#ifdef AF_INET6
if (him->sa_family == AF_INET6) {
-#ifdef WIN32
- struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
-#else
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
-#endif
jbyte *caddr = (jbyte *)&(him6->sin6_addr);
if (NET_IsIPv4Mapped(caddr)) {
int address;
@@ -218,7 +212,7 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
CHECK_NULL_RETURN(iaObj, NULL);
address = NET_IPv4MappedToIPv4(caddr);
setInetAddress_addr(env, iaObj, address);
- setInetAddress_family(env, iaObj, IPv4);
+ setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4);
} else {
jint scope;
jboolean ret;
@@ -227,21 +221,19 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
ret = setInet6Address_ipaddress(env, iaObj, (char *)&(him6->sin6_addr));
if (ret == JNI_FALSE)
return NULL;
- setInetAddress_family(env, iaObj, IPv6);
+ setInetAddress_family(env, iaObj, java_net_InetAddress_IPv6);
scope = getScopeID(him);
setInet6Address_scopeid(env, iaObj, scope);
}
*port = ntohs(him6->sin6_port);
- } else
-#endif /* AF_INET6 */
- {
- struct sockaddr_in *him4 = (struct sockaddr_in *)him;
- iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
- CHECK_NULL_RETURN(iaObj, NULL);
- setInetAddress_family(env, iaObj, IPv4);
- setInetAddress_addr(env, iaObj, ntohl(him4->sin_addr.s_addr));
- *port = ntohs(him4->sin_port);
- }
+ } else {
+ struct sockaddr_in *him4 = (struct sockaddr_in *)him;
+ iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
+ CHECK_NULL_RETURN(iaObj, NULL);
+ setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4);
+ setInetAddress_addr(env, iaObj, ntohl(him4->sin_addr.s_addr));
+ *port = ntohs(him4->sin_port);
+ }
return iaObj;
}
@@ -250,14 +242,10 @@ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
{
jint family = AF_INET;
-#ifdef AF_INET6
- family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
+ family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
+ AF_INET : AF_INET6;
if (him->sa_family == AF_INET6) {
-#ifdef WIN32
- struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
-#else
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
-#endif
jbyte *caddrNew = (jbyte *)&(him6->sin6_addr);
if (NET_IsIPv4Mapped(caddrNew)) {
int addrNew;
@@ -287,22 +275,20 @@ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
return JNI_FALSE;
}
}
- } else
-#endif /* AF_INET6 */
- {
- struct sockaddr_in *him4 = (struct sockaddr_in *)him;
- int addrNew, addrCur;
- if (family != AF_INET) {
- return JNI_FALSE;
- }
- addrNew = ntohl(him4->sin_addr.s_addr);
- addrCur = getInetAddress_addr(env, iaObj);
- if (addrNew == addrCur) {
- return JNI_TRUE;
- } else {
- return JNI_FALSE;
- }
+ } else {
+ struct sockaddr_in *him4 = (struct sockaddr_in *)him;
+ int addrNew, addrCur;
+ if (family != AF_INET) {
+ return JNI_FALSE;
}
+ addrNew = ntohl(him4->sin_addr.s_addr);
+ addrCur = getInetAddress_addr(env, iaObj);
+ if (addrNew == addrCur) {
+ return JNI_TRUE;
+ } else {
+ return JNI_FALSE;
+ }
+ }
}
unsigned short
diff --git a/jdk/src/java.base/share/native/libnet/net_util.h b/jdk/src/java.base/share/native/libnet/net_util.h
index 159079cd8f7..c625d60c27f 100644
--- a/jdk/src/java.base/share/native/libnet/net_util.h
+++ b/jdk/src/java.base/share/native/libnet/net_util.h
@@ -36,12 +36,6 @@
#define MAX_PACKET_LEN 65536
-#define IPv4 1
-#define IPv6 2
-
-#define NET_ERROR(env, ex, msg) \
-{ if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg); }
-
#define NET_WAIT_READ 0x01
#define NET_WAIT_WRITE 0x02
#define NET_WAIT_CONNECT 0x04
@@ -127,45 +121,43 @@ JNIEXPORT void JNICALL Java_java_net_Inet6Address_init(JNIEnv *env, jclass cls);
JNIEXPORT void JNICALL Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls);
JNIEXPORT void JNICALL NET_ThrowNew(JNIEnv *env, int errorNum, char *msg);
+
int NET_GetError();
void NET_ThrowCurrent(JNIEnv *env, char *msg);
jfieldID NET_GetFileDescriptorID(JNIEnv *env);
-JNIEXPORT jint JNICALL ipv6_available() ;
+JNIEXPORT jint JNICALL ipv6_available();
-JNIEXPORT jint JNICALL reuseport_available() ;
+JNIEXPORT jint JNICALL reuseport_available();
JNIEXPORT int JNICALL
-NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him, int *len, jboolean v4MappedAddress);
+NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port,
+ struct sockaddr *him, int *len,
+ jboolean v4MappedAddress);
JNIEXPORT jobject JNICALL
NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port);
void platformInit();
+
void parseExclusiveBindProperty(JNIEnv *env);
-void
-NET_SetTrafficClass(struct sockaddr *him, int trafficClass);
+void NET_SetTrafficClass(struct sockaddr *him, int trafficClass);
-JNIEXPORT jint JNICALL
-NET_GetPortFromSockaddr(struct sockaddr *him);
+JNIEXPORT jint JNICALL NET_GetPortFromSockaddr(struct sockaddr *him);
JNIEXPORT jint JNICALL
NET_SockaddrEqualsInetAddress(JNIEnv *env,struct sockaddr *him, jobject iaObj);
-int
-NET_IsIPv4Mapped(jbyte* caddr);
+int NET_IsIPv4Mapped(jbyte* caddr);
-int
-NET_IPv4MappedToIPv4(jbyte* caddr);
+int NET_IPv4MappedToIPv4(jbyte* caddr);
-int
-NET_IsEqual(jbyte* caddr1, jbyte* caddr2);
+int NET_IsEqual(jbyte* caddr1, jbyte* caddr2);
-int
-NET_IsZeroAddr(jbyte* caddr);
+int NET_IsZeroAddr(jbyte* caddr);
/* Socket operations
*
@@ -191,9 +183,9 @@ NET_MapSocketOptionV6(jint cmd, int *level, int *optname);
JNIEXPORT jint JNICALL
NET_EnableFastTcpLoopback(int fd);
-int getScopeID (struct sockaddr *);
+int getScopeID(struct sockaddr *);
-int cmpScopeID (unsigned int, struct sockaddr *);
+int cmpScopeID(unsigned int, struct sockaddr *);
unsigned short in_cksum(unsigned short *addr, int len);
diff --git a/jdk/src/java.base/unix/conf/s390x/jvm.cfg b/jdk/src/java.base/unix/conf/s390x/jvm.cfg
new file mode 100644
index 00000000000..2c147c9b97d
--- /dev/null
+++ b/jdk/src/java.base/unix/conf/s390x/jvm.cfg
@@ -0,0 +1,34 @@
+# Copyright (c) 2011, 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.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-server KNOWN
+-client IGNORE
diff --git a/jdk/src/java.base/unix/native/libnet/Inet4AddressImpl.c b/jdk/src/java.base/unix/native/libnet/Inet4AddressImpl.c
index d8786309105..e2e0f10fad9 100644
--- a/jdk/src/java.base/unix/native/libnet/Inet4AddressImpl.c
+++ b/jdk/src/java.base/unix/native/libnet/Inet4AddressImpl.c
@@ -22,27 +22,17 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
+#include
#include
-#include
#include
-#include
-#include
#include
+#include
#include
#include
-#include
-#include
#include
-#include
+#include
+#include
-#ifdef _ALLBSD_SOURCE
-#include
-#include
-#endif
-
-#include "jvm.h"
-#include "jni_util.h"
#include "net_util.h"
#include "java_net_Inet4AddressImpl.h"
@@ -293,13 +283,12 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
addr |= ((caddr[2] <<8) & 0xff00);
addr |= (caddr[3] & 0xff);
memset((char *) &him4, 0, sizeof(him4));
- him4.sin_addr.s_addr = (uint32_t) htonl(addr);
+ him4.sin_addr.s_addr = htonl(addr);
him4.sin_family = AF_INET;
sa = (struct sockaddr *) &him4;
len = sizeof(him4);
- error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0,
- NI_NAMEREQD);
+ error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
if (!error) {
ret = (*env)->NewStringUTF(env, host);
@@ -443,7 +432,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
if (!skip) {
struct addrinfo *next
- = (struct addrinfo*) malloc(sizeof(struct addrinfo));
+ = (struct addrinfo *)malloc(sizeof(struct addrinfo));
if (!next) {
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
ret = NULL;
@@ -528,13 +517,12 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
addr |= ((caddr[2] <<8) & 0xff00);
addr |= (caddr[3] & 0xff);
memset((void *) &him4, 0, sizeof(him4));
- him4.sin_addr.s_addr = (uint32_t) htonl(addr);
+ him4.sin_addr.s_addr = htonl(addr);
him4.sin_family = AF_INET;
sa = (struct sockaddr *) &him4;
len = sizeof(him4);
- error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0,
- NI_NAMEREQD);
+ error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
if (!error) {
ret = (*env)->NewStringUTF(env, host);
diff --git a/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c b/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c
index c297c3b3a64..f4b961d943b 100644
--- a/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c
+++ b/jdk/src/java.base/unix/native/libnet/Inet6AddressImpl.c
@@ -22,29 +22,21 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
+#include
#include
+#include
+#include
#include
#include
-#include
#include
-#include
-#include
-#include
-#include
-#include
-#ifdef MACOSX
+#include
+
+#if defined(_ALLBSD_SOURCE)
#include
#include
-#include /* gethostname */
#endif
-#include "jvm.h"
-#include "jni_util.h"
#include "net_util.h"
-#ifndef IPV6_DEFS_H
-#include
-#endif
#include "java_net_Inet4AddressImpl.h"
#include "java_net_Inet6AddressImpl.h"
@@ -80,7 +72,7 @@ Java_java_net_Inet6AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
hostname[NI_MAXHOST] = '\0';
}
-#if defined(__solaris__) && defined(AF_INET6)
+#if defined(__solaris__)
if (ret == 0) {
/* Solaris doesn't want to give us a fully qualified domain name.
* We do a reverse lookup to try and get one. This works
@@ -259,9 +251,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
int retLen = 0;
int getaddrinfo_error=0;
-#ifdef AF_INET6
struct addrinfo hints, *res, *resNew = NULL;
-#endif /* AF_INET6 */
initInetAddressIDs(env);
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
@@ -273,7 +263,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
CHECK_NULL_RETURN(hostname, NULL);
-#ifdef AF_INET6
/* Try once, with our static buffer. */
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
@@ -467,7 +456,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
}
freeaddrinfo(res);
-#endif /* AF_INET6 */
return ret;
}
@@ -483,7 +471,6 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
jstring ret = NULL;
-#ifdef AF_INET6
char host[NI_MAXHOST+1];
int error = 0;
int len = 0;
@@ -504,30 +491,28 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
addr |= ((caddr[2] <<8) & 0xff00);
addr |= (caddr[3] & 0xff);
memset((void *) &him4, 0, sizeof(him4));
- him4.sin_addr.s_addr = (uint32_t) htonl(addr);
+ him4.sin_addr.s_addr = htonl(addr);
him4.sin_family = AF_INET;
- sa = (struct sockaddr *) &him4;
+ sa = (struct sockaddr *)&him4;
len = sizeof(him4);
} else {
/*
* For IPv6 address construct a sockaddr_in6 structure.
*/
(*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
- memset((void *) &him6, 0, sizeof(him6));
- memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
+ memset((void *)&him6, 0, sizeof(him6));
+ memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr));
him6.sin6_family = AF_INET6;
- sa = (struct sockaddr *) &him6 ;
- len = sizeof(him6) ;
+ sa = (struct sockaddr *)&him6;
+ len = sizeof(him6);
}
- error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0,
- NI_NAMEREQD);
+ error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
if (!error) {
ret = (*env)->NewStringUTF(env, host);
CHECK_NULL_RETURN(ret, NULL);
}
-#endif /* AF_INET6 */
if (ret == NULL) {
JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", NULL);
@@ -542,7 +527,6 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
fcntl(fd, F_SETFL, flags); \
}
-#ifdef AF_INET6
static jboolean
ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
struct sockaddr_in6* netif, jint ttl) {
@@ -649,7 +633,6 @@ ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
close(fd);
return JNI_FALSE;
}
-#endif /* AF_INET6 */
/*
* Class: java_net_Inet6AddressImpl
@@ -663,7 +646,6 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
jint timeout,
jbyteArray ifArray,
jint ttl, jint if_scope) {
-#ifdef AF_INET6
jbyte caddr[16];
jint fd, sz;
struct sockaddr_in6 him6;
@@ -812,7 +794,4 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
close(fd);
return JNI_FALSE;
}
-#else /* AF_INET6 */
- return JNI_FALSE;
-#endif /* AF_INET6 */
}
diff --git a/jdk/src/java.base/unix/native/libnet/InetAddressImplFactory.c b/jdk/src/java.base/unix/native/libnet/InetAddressImplFactory.c
index feae9501590..2c799feb105 100644
--- a/jdk/src/java.base/unix/native/libnet/InetAddressImplFactory.c
+++ b/jdk/src/java.base/unix/native/libnet/InetAddressImplFactory.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -37,14 +37,10 @@
* Signature: ()I
*/
JNIEXPORT jboolean JNICALL
-Java_java_net_InetAddressImplFactory_isIPv6Supported(JNIEnv *env, jclass cls)
-{
-#ifdef AF_INET6
+Java_java_net_InetAddressImplFactory_isIPv6Supported(JNIEnv *env, jclass cls) {
if (ipv6_available()) {
return JNI_TRUE;
- } else
-#endif /* AF_INET6 */
- {
- return JNI_FALSE;
- }
+ } else {
+ return JNI_FALSE;
+ }
}
diff --git a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c
index d5b1824b314..d03e150a4f8 100644
--- a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c
+++ b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c
@@ -22,55 +22,36 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
#include
+#include
#include
#include
-
-#if defined(__solaris__)
-#include
-#include
-#include
-#include
-#endif
-
-#if defined(__linux__)
+#include
+#include
#include
-#include
-#include
-#endif
#if defined(_AIX)
-#include
#include
#include
#include
#endif
-#if defined(_ALLBSD_SOURCE)
-#include
-#include
+#if defined(__solaris__)
+#include
+#include
#include
-#if defined(__APPLE__)
-#include
-#include
-#include
-#include
-#include
-#endif
#endif
-#include "jvm.h"
-#include "jni_util.h"
+#if defined(_ALLBSD_SOURCE)
+#include
+#include
+#include
+#endif
+
#include "net_util.h"
+#include "java_net_InetAddress.h"
+
#if defined(__linux__)
#define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
#elif defined(__solaris__)
@@ -145,10 +126,7 @@ static int getFlags0(JNIEnv *env, jstring ifname);
static netif *enumInterfaces(JNIEnv *env);
static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs);
-
-#if defined(AF_INET6)
static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs);
-#endif
static netif *addif(JNIEnv *env, int sock, const char *if_name, netif *ifs,
struct sockaddr *ifr_addrP,
@@ -331,11 +309,8 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
(JNIEnv *env, jclass cls, jobject iaObj)
{
netif *ifs, *curr;
-#if defined(AF_INET6)
- int family = (getInetAddress_family(env, iaObj) == IPv4) ? AF_INET : AF_INET6;
-#else
- int family = AF_INET;
-#endif
+ int family = (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) ?
+ AF_INET : AF_INET6;
jobject obj = NULL;
jboolean match = JNI_FALSE;
@@ -361,9 +336,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
match = JNI_TRUE;
break;
}
- }
-#if defined(AF_INET6)
- if (family == AF_INET6) {
+ } else if (family == AF_INET6) {
jbyte *bytes = (jbyte *)&(
((struct sockaddr_in6*)addrP->addr)->sin6_addr);
jbyte caddr[16];
@@ -381,7 +354,6 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
break;
}
}
-#endif
}
if (match) {
@@ -725,7 +697,6 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) {
return NULL;
}
}
-#if defined(AF_INET6)
if (addrP->family == AF_INET6) {
int scope=0;
iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
@@ -754,7 +725,6 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) {
return NULL;
}
}
-#endif
(*env)->SetObjectArrayElement(env, addrArr, addr_index++, iaObj);
addrP = addrP->next;
@@ -815,25 +785,23 @@ static netif *enumInterfaces(JNIEnv *env) {
}
// If IPv6 is available then enumerate IPv6 addresses.
-#if defined(AF_INET6)
- // User can disable ipv6 explicitly by -Djava.net.preferIPv4Stack=true,
- // so we have to call ipv6_available()
- if (ipv6_available()) {
- sock = openSocket(env, AF_INET6);
- if (sock < 0 && (*env)->ExceptionOccurred(env)) {
- freeif(ifs);
- return NULL;
- }
-
- ifs = enumIPv6Interfaces(env, sock, ifs);
- close(sock);
-
- if ((*env)->ExceptionOccurred(env)) {
- freeif(ifs);
- return NULL;
- }
+ // User can disable ipv6 explicitly by -Djava.net.preferIPv4Stack=true,
+ // so we have to call ipv6_available()
+ if (ipv6_available()) {
+ sock = openSocket(env, AF_INET6);
+ if (sock < 0 && (*env)->ExceptionOccurred(env)) {
+ freeif(ifs);
+ return NULL;
}
-#endif
+
+ ifs = enumIPv6Interfaces(env, sock, ifs);
+ close(sock);
+
+ if ((*env)->ExceptionOccurred(env)) {
+ freeif(ifs);
+ return NULL;
+ }
+ }
return ifs;
}
@@ -889,12 +857,8 @@ static netif *addif(JNIEnv *env, int sock, const char *if_name, netif *ifs,
// Allocate for addr and brdcast at once
-#if defined(AF_INET6)
addr_size = (family == AF_INET) ? sizeof(struct sockaddr_in)
: sizeof(struct sockaddr_in6);
-#else
- addr_size = sizeof(struct sockaddr_in);
-#endif
CHECKED_MALLOC3(addrP, netaddr *, sizeof(netaddr) + 2 * addr_size);
addrP->addr = (struct sockaddr *)((char *)addrP + sizeof(netaddr));
@@ -1083,7 +1047,6 @@ static int openSocket(JNIEnv *env, int proto) {
/** Linux **/
#if defined(__linux__)
-#if defined(AF_INET6)
/*
* Opens a socket for further ioctl calls. Tries AF_INET socket first and
* if it fails return AF_INET6 socket.
@@ -1109,11 +1072,6 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
// IPv6 socket regardless of type of address of an interface.
return sock;
}
-#else
-static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
- return openSocket(env, AF_INET);
-}
-#endif
/*
* Enumerates and returns all IPv4 interfaces on Linux.
@@ -1197,8 +1155,6 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
return ifs;
}
-#if defined(AF_INET6)
-
/*
* Enumerates and returns all IPv6 interfaces on Linux.
*/
@@ -1240,8 +1196,6 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
return ifs;
}
-#endif /* AF_INET6 */
-
/*
* Try to get the interface index.
*/
@@ -1330,7 +1284,6 @@ static int getFlags(int sock, const char *ifname, int *flags) {
/** AIX **/
#if defined(_AIX)
-#if defined(AF_INET6)
/*
* Opens a socket for further ioctl calls. Tries AF_INET socket first and
* if it fails return AF_INET6 socket.
@@ -1354,11 +1307,6 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
return sock;
}
-#else
-static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
- return openSocket(env, AF_INET);
-}
-#endif
/*
* Enumerates and returns all IPv4 interfaces on AIX.
@@ -1442,8 +1390,6 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
return ifs;
}
-#if defined(AF_INET6)
-
/*
* Enumerates and returns all IPv6 interfaces on AIX.
*/
@@ -1518,8 +1464,6 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
return ifs;
}
-#endif /* AF_INET6 */
-
/*
* Try to get the interface index.
*/
@@ -1614,7 +1558,6 @@ static int getFlags(int sock, const char *ifname, int *flags) {
/** Solaris **/
#if defined(__solaris__)
-#if defined(AF_INET6)
/*
* Opens a socket for further ioctl calls. Tries AF_INET socket first and
* if it fails return AF_INET6 socket.
@@ -1659,11 +1602,6 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
return sock;
}
-#else
-static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
- return openSocket(env, AF_INET);
-}
-#endif
/*
* Enumerates and returns all IPv4 interfaces on Solaris.
@@ -1739,8 +1677,6 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
return ifs;
}
-#if defined(AF_INET6)
-
/*
* Enumerates and returns all IPv6 interfaces on Solaris.
*/
@@ -1803,8 +1739,6 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
return ifs;
}
-#endif /* AF_INET6 */
-
/*
* Try to get the interface index.
* (Not supported on Solaris 2.6 or 7)
@@ -1976,7 +1910,6 @@ static int getFlags(int sock, const char *ifname, int *flags) {
/** BSD **/
#if defined(_ALLBSD_SOURCE)
-#if defined(AF_INET6)
/*
* Opens a socket for further ioctl calls. Tries AF_INET socket first and
* if it fails return AF_INET6 socket.
@@ -2000,11 +1933,6 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
return sock;
}
-#else
-static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
- return openSocket(env, AF_INET);
-}
-#endif
/*
* Enumerates and returns all IPv4 interfaces on BSD.
@@ -2050,8 +1978,6 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
return ifs;
}
-#if defined(AF_INET6)
-
/*
* Enumerates and returns all IPv6 interfaces on BSD.
*/
@@ -2092,8 +2018,6 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
return ifs;
}
-#endif /* AF_INET6 */
-
/*
* Try to get the interface index.
*/
diff --git a/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c b/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
index a716db9d7cb..a7fddecedd5 100644
--- a/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
+++ b/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
@@ -22,29 +22,23 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
#include
-#include
#include
#include
-#include
-#include
+#include
-#ifdef __solaris__
-#include
-#include
-#include
+#if defined(__solaris__)
+#include
+#endif
+
+#include "net_util.h"
+
+#include "java_net_PlainDatagramSocketImpl.h"
+#include "java_net_InetAddress.h"
+#include "java_net_NetworkInterface.h"
+#include "java_net_SocketOptions.h"
-#ifndef BSD_COMP
-#define BSD_COMP
-#endif
-#endif
#ifdef __linux__
-#include
-#include
-#include
-#include
-
#define IPV6_MULTICAST_IF 17
#ifndef SO_BSDCOMPAT
#define SO_BSDCOMPAT 14
@@ -58,7 +52,11 @@
#endif
#endif // __linux__
-#include
+#ifdef __solaris__
+#ifndef BSD_COMP
+#define BSD_COMP
+#endif
+#endif
#ifndef IPTOS_TOS_MASK
#define IPTOS_TOS_MASK 0x1e
@@ -67,12 +65,6 @@
#define IPTOS_PREC_MASK 0xe0
#endif
-#include "jvm.h"
-#include "jni_util.h"
-#include "net_util.h"
-#include "java_net_SocketOptions.h"
-#include "java_net_PlainDatagramSocketImpl.h"
-#include "java_net_NetworkInterface.h"
/************************************************************************
* PlainDatagramSocketImpl
*/
@@ -151,9 +143,6 @@ static int getFD(JNIEnv *env, jobject this) {
JNIEXPORT void JNICALL
Java_java_net_PlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
-#ifdef __linux__
- struct utsname sysinfo;
-#endif
pdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
"Ljava/io/FileDescriptor;");
CHECK_NULL(pdsi_fdID);
@@ -310,13 +299,10 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
memset(&addr, 0, sizeof(addr));
-#ifdef AF_INET6
if (ipv6_available()) {
addr.sa6.sin6_family = AF_UNSPEC;
len = sizeof(struct sockaddr_in6);
- } else
-#endif
- {
+ } else {
addr.sa4.sin_family = AF_UNSPEC;
len = sizeof(struct sockaddr_in);
}
@@ -330,12 +316,9 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
localPort = NET_GetPortFromSockaddr(&addr.sa);
if (localPort == 0) {
localPort = (*env)->GetIntField(env, this, pdsi_localPortID);
-#ifdef AF_INET6
if (addr.sa.sa_family == AF_INET6) {
addr.sa6.sin6_port = htons(localPort);
- } else
-#endif /* AF_INET6 */
- {
+ } else {
addr.sa4.sin_port = htons(localPort);
}
@@ -443,12 +426,9 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
(*env)->GetByteArrayRegion(env, packetBuffer, packetBufferOffset, packetBufferLen,
(jbyte *)fullPacket);
-#ifdef AF_INET6
if (trafficClass != 0 && ipv6_available()) {
NET_SetTrafficClass(&rmtaddr.sa, trafficClass);
}
-#endif /* AF_INET6 */
-
/*
* Send the datagram.
@@ -549,11 +529,8 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
}
iaObj = NET_SockaddrToInetAddress(env, &rmtaddr.sa, &port);
-#ifdef AF_INET6
- family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
-#else
- family = AF_INET;
-#endif
+ family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
+ AF_INET : AF_INET6;
if (family == AF_INET) { /* this API can't handle IPV6 addresses */
int address = getInetAddress_addr(env, iaObj);
setInetAddress_addr(env, addressObj, address);
@@ -918,11 +895,7 @@ Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env,
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
int arg, fd, t = 1;
char tmpbuf[1024];
-#ifdef AF_INET6
int domain = ipv6_available() ? AF_INET6 : AF_INET;
-#else
- int domain = AF_INET;
-#endif
if (IS_NULL(fdObj)) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
@@ -936,7 +909,6 @@ Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env,
return;
}
-#ifdef AF_INET6
/* Disable IPV6_V6ONLY to ensure dual-socket support */
if (domain == AF_INET6) {
arg = 0;
@@ -947,7 +919,6 @@ Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env,
return;
}
}
-#endif /* AF_INET6 */
#ifdef __APPLE__
arg = 65507;
@@ -987,7 +958,7 @@ Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env,
}
#endif
-#if defined (__linux__) && defined (AF_INET6)
+#if defined (__linux__)
/*
* On Linux for IPv6 sockets we must set the hop limit
* to 1 to be compatible with default TTL of 1 for IPv4 sockets.
@@ -1071,7 +1042,7 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
*/
for (i = 0; i < len; i++) {
addr = (*env)->GetObjectArrayElement(env, addrArray, i);
- if (getInetAddress_family(env, addr) == IPv4) {
+ if (getInetAddress_family(env, addr) == java_net_InetAddress_IPv4) {
in.s_addr = htonl(getInetAddress_addr(env, addr));
break;
}
@@ -1088,7 +1059,6 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
* Set outgoing multicast interface designated by a NetworkInterface.
* Throw exception if failed.
*/
-#ifdef AF_INET6
static void mcast_set_if_by_if_v6(JNIEnv *env, jobject this, int fd, jobject value) {
static jfieldID ni_indexID;
int index;
@@ -1113,9 +1083,7 @@ static void mcast_set_if_by_if_v6(JNIEnv *env, jobject this, int fd, jobject val
}
return;
}
-
}
-#endif /* AF_INET6 */
/*
* Set outgoing multicast interface designated by an InetAddress.
@@ -1137,7 +1105,6 @@ static void mcast_set_if_by_addr_v4(JNIEnv *env, jobject this, int fd, jobject v
* Set outgoing multicast interface designated by an InetAddress.
* Throw exception if failed.
*/
-#ifdef AF_INET6
static void mcast_set_if_by_addr_v6(JNIEnv *env, jobject this, int fd, jobject value) {
static jclass ni_class;
if (ni_class == NULL) {
@@ -1159,7 +1126,6 @@ static void mcast_set_if_by_addr_v6(JNIEnv *env, jobject this, int fd, jobject v
mcast_set_if_by_if_v6(env, this, fd, value);
}
-#endif
/*
* Sets the multicast interface.
@@ -1191,7 +1157,6 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
/*
* value is an InetAddress.
*/
-#ifdef AF_INET6
#ifdef __linux__
mcast_set_if_by_addr_v4(env, this, fd, value);
if (ipv6_available()) {
@@ -1207,16 +1172,12 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
mcast_set_if_by_addr_v4(env, this, fd, value);
}
#endif /* __linux__ */
-#else
- mcast_set_if_by_addr_v4(env, this, fd, value);
-#endif /* AF_INET6 */
}
if (opt == java_net_SocketOptions_IP_MULTICAST_IF2) {
/*
* value is a NetworkInterface.
*/
-#ifdef AF_INET6
#ifdef __linux__
mcast_set_if_by_if_v4(env, this, fd, value);
if (ipv6_available()) {
@@ -1232,9 +1193,6 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd,
mcast_set_if_by_if_v4(env, this, fd, value);
}
#endif /* __linux__ */
-#else
- mcast_set_if_by_if_v4(env, this, fd, value);
-#endif /* AF_INET6 */
}
}
@@ -1266,7 +1224,6 @@ static void mcast_set_loop_v4(JNIEnv *env, jobject this, int fd, jobject value)
/*
* Enable/disable local loopback of multicast datagrams.
*/
-#ifdef AF_INET6
static void mcast_set_loop_v6(JNIEnv *env, jobject this, int fd, jobject value) {
jclass cls;
jfieldID fid;
@@ -1289,14 +1246,12 @@ static void mcast_set_loop_v6(JNIEnv *env, jobject this, int fd, jobject value)
}
}
-#endif /* AF_INET6 */
/*
* Sets the multicast loopback mode.
*/
static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
jint opt, jobject value) {
-#ifdef AF_INET6
#ifdef __linux__
mcast_set_loop_v4(env, this, fd, value);
if (ipv6_available()) {
@@ -1312,9 +1267,6 @@ static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
mcast_set_loop_v4(env, this, fd, value);
}
#endif /* __linux__ */
-#else
- mcast_set_loop_v4(env, this, fd, value);
-#endif /* AF_INET6 */
}
/*
@@ -1456,11 +1408,9 @@ Java_java_net_PlainDatagramSocketImpl_socketSetOption0
jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
jboolean isIPV4 = JNI_TRUE;
-#ifdef AF_INET6
if (ipv6_available()) {
isIPV4 = JNI_FALSE;
}
-#endif
/*
* IPv4 implementation
@@ -1559,7 +1509,6 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
}
-#ifdef AF_INET6
/*
* IPv6 implementation
*/
@@ -1677,7 +1626,6 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
}
return ni;
}
-#endif
return NULL;
}
@@ -1815,7 +1763,6 @@ static void setTTL(JNIEnv *env, int fd, jint ttl) {
/*
* Set hops limit for a socket. Throw exception if failed.
*/
-#ifdef AF_INET6
static void setHopLimit(JNIEnv *env, int fd, jint ttl) {
int ittl = (int)ttl;
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
@@ -1824,7 +1771,6 @@ static void setHopLimit(JNIEnv *env, int fd, jint ttl) {
(env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
}
-#endif
/*
* Class: java_net_PlainDatagramSocketImpl
@@ -1847,7 +1793,6 @@ Java_java_net_PlainDatagramSocketImpl_setTimeToLive(JNIEnv *env, jobject this,
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
}
/* setsockopt to be correct TTL */
-#ifdef AF_INET6
#ifdef __linux__
setTTL(env, fd, ttl);
JNU_CHECK_EXCEPTION(env);
@@ -1861,9 +1806,6 @@ Java_java_net_PlainDatagramSocketImpl_setTimeToLive(JNIEnv *env, jobject this,
setTTL(env, fd, ttl);
}
#endif /* __linux__ */
-#else
- setTTL(env, fd, ttl);
-#endif /* AF_INET6 */
}
/*
@@ -1896,7 +1838,6 @@ Java_java_net_PlainDatagramSocketImpl_getTimeToLive(JNIEnv *env, jobject this) {
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
}
/* getsockopt of TTL */
-#ifdef AF_INET6
if (ipv6_available()) {
int ttl = 0;
socklen_t len = sizeof(ttl);
@@ -1908,19 +1849,17 @@ Java_java_net_PlainDatagramSocketImpl_getTimeToLive(JNIEnv *env, jobject this) {
return -1;
}
return (jint)ttl;
- } else
-#endif /* AF_INET6 */
- {
- u_char ttl = 0;
- socklen_t len = sizeof(ttl);
- if (getsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
- (char*)&ttl, &len) < 0) {
- JNU_ThrowByNameWithMessageAndLastError
- (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
- return -1;
- }
- return (jint)ttl;
+ } else {
+ u_char ttl = 0;
+ socklen_t len = sizeof(ttl);
+ if (getsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
+ (char*)&ttl, &len) < 0) {
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
+ return -1;
}
+ return (jint)ttl;
+ }
}
@@ -1966,22 +1905,14 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
/*
* Determine if this is an IPv4 or IPv6 join/leave.
*/
-#ifdef AF_INET6
ipv6_join_leave = ipv6_available();
#ifdef __linux__
- if (getInetAddress_family(env, iaObj) == IPv4) {
+ if (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) {
ipv6_join_leave = JNI_FALSE;
}
#endif
-#else
- /*
- * IPv6 not compiled in
- */
- ipv6_join_leave = JNI_FALSE;
-#endif
-
/*
* For IPv4 join use IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP socket option
*
@@ -2006,7 +1937,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
* NetworkInterface
*/
if (niObj != NULL) {
-#if defined(__linux__) && defined(AF_INET6)
+#if defined(__linux__)
if (ipv6_available()) {
static jfieldID ni_indexID;
@@ -2062,7 +1993,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
if (niObj == NULL) {
-#if defined(__linux__) && defined(AF_INET6)
+#if defined(__linux__)
if (ipv6_available()) {
int index;
@@ -2118,7 +2049,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
* should return ENOPROTOOPT. We assume this will be fixed in Linux
* at some stage.
*/
-#if defined(__linux__) && defined(AF_INET6)
+#if defined(__linux__)
if (errno == ENOPROTOOPT) {
if (ipv6_available()) {
ipv6_join_leave = JNI_TRUE;
@@ -2155,14 +2086,14 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
* IPv6 join. If it's an IPv4 multicast group then we use an IPv4-mapped
* address.
*/
-#ifdef AF_INET6
{
struct ipv6_mreq mname6;
jbyteArray ipaddress;
jbyte caddr[16];
jint family;
jint address;
- family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
+ family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
+ AF_INET : AF_INET6;
if (family == AF_INET) { /* will convert to IPv4-mapped address */
memset((char *) caddr, 0, 16);
address = getInetAddress_addr(env, iaObj);
@@ -2242,7 +2173,6 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
}
}
}
-#endif
}
/*
diff --git a/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c b/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c
index c605edb700d..b5af3466ada 100644
--- a/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c
+++ b/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c
@@ -22,32 +22,8 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
#include
-#include
-#include
-#include
-#if defined(__linux__)
-#include
-#endif
-#include /* Defines TCP_NODELAY, needed for 2.6 */
-#include
-#ifdef __linux__
-#include
-#endif
-#include
-#include
-#ifdef __solaris__
-#include
-#endif
-#ifdef __linux__
-#include
-#include
-#endif
-
-#include "jvm.h"
-#include "jni_util.h"
#include "net_util.h"
#include "java_net_SocketOptions.h"
@@ -186,11 +162,7 @@ Java_java_net_PlainSocketImpl_socketCreate(JNIEnv *env, jobject this,
jobject fdObj, ssObj;
int fd;
int type = (stream ? SOCK_STREAM : SOCK_DGRAM);
-#ifdef AF_INET6
int domain = ipv6_available() ? AF_INET6 : AF_INET;
-#else
- int domain = AF_INET;
-#endif
if (socketExceptionCls == NULL) {
jclass c = (*env)->FindClass(env, "java/net/SocketException");
@@ -214,7 +186,6 @@ Java_java_net_PlainSocketImpl_socketCreate(JNIEnv *env, jobject this,
return;
}
-#ifdef AF_INET6
/* Disable IPV6_V6ONLY to ensure dual-socket support */
if (domain == AF_INET6) {
int arg = 0;
@@ -225,7 +196,6 @@ Java_java_net_PlainSocketImpl_socketCreate(JNIEnv *env, jobject this,
return;
}
}
-#endif /* AF_INET6 */
/*
* If this is a server socket then enable SO_REUSEADDR
@@ -295,11 +265,10 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
}
setDefaultScopeID(env, &him.sa);
-#ifdef AF_INET6
if (trafficClass != 0 && ipv6_available()) {
NET_SetTrafficClass(&him.sa, trafficClass);
}
-#endif /* AF_INET6 */
+
if (timeout <= 0) {
connect_rv = NET_Connect(fd, &him.sa, len);
#ifdef __solaris__
diff --git a/jdk/src/java.base/unix/native/libnet/SdpSupport.c b/jdk/src/java.base/unix/native/libnet/SdpSupport.c
index 1fe5353fcd6..d9dde8db7ab 100644
--- a/jdk/src/java.base/unix/native/libnet/SdpSupport.c
+++ b/jdk/src/java.base/unix/native/libnet/SdpSupport.c
@@ -56,11 +56,7 @@ static int create(JNIEnv* env)
int s;
#if defined(__solaris__)
- #ifdef AF_INET6
int domain = ipv6_available() ? AF_INET6 : AF_INET;
- #else
- int domain = AF_INET;
- #endif
s = socket(domain, SOCK_STREAM, PROTO_SDP);
#elif defined(__linux__)
/**
diff --git a/jdk/src/java.base/unix/native/libnet/SocketInputStream.c b/jdk/src/java.base/unix/native/libnet/SocketInputStream.c
index a27902b1f83..961f53c7baf 100644
--- a/jdk/src/java.base/unix/native/libnet/SocketInputStream.c
+++ b/jdk/src/java.base/unix/native/libnet/SocketInputStream.c
@@ -22,20 +22,15 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
-#include
#include
+#include
#include
-#include
-#include
-#include "jvm.h"
-#include "jni_util.h"
#include "net_util.h"
#include "java_net_SocketInputStream.h"
-/************************************************************************
+/*
* SocketInputStream
*/
diff --git a/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c b/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c
index f5a685a741c..17afe8b8d46 100644
--- a/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c
+++ b/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c
@@ -22,15 +22,10 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
-#include
#include
+#include
#include
-#include
-#include
-#include "jni_util.h"
-#include "jvm.h"
#include "net_util.h"
#include "java_net_SocketOutputStream.h"
diff --git a/jdk/src/java.base/unix/native/libnet/net_util_md.c b/jdk/src/java.base/unix/native/libnet/net_util_md.c
index 13b97dcbc9a..e6d19d0a19a 100644
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.c
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.c
@@ -22,59 +22,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
-#include
-#include
-#include
-#include
-#include /* Defines TCP_NODELAY, needed for 2.6 */
-#include
-#include
-#include
-#include
#include
+#include
+#include
+#include // defines TCP_NODELAY
+#include
+#include
+#include
#include
-#ifndef _ALLBSD_SOURCE
-#include
-#else
-#include
-#include
-#include
-#include
-#ifndef MAXINT
-#define MAXINT INT_MAX
-#endif
-#endif
-
-#ifdef __solaris__
-#include
-#include
-#include
-#include
-#endif
-
-#ifdef __linux__
-#include
+#if defined(__linux__)
#include
#include
#include
-
-#ifndef IPV6_FLOWINFO_SEND
-#define IPV6_FLOWINFO_SEND 33
#endif
+#if defined(__solaris__)
+#include
+#include
+#include
+#include
+#include
#endif
-#ifdef _AIX
-#include
-#endif
-
-#include "jni_util.h"
-#include "jvm.h"
#include "net_util.h"
#include "java_net_SocketOptions.h"
+#include "java_net_InetAddress.h"
+
+#if defined(__linux__) && !defined(IPV6_FLOWINFO_SEND)
+#define IPV6_FLOWINFO_SEND 33
+#endif
+
+#if defined(__solaris__) && !defined(MAXINT)
+#define MAXINT INT_MAX
+#endif
/*
* EXCLBIND socket options only on Solaris
@@ -324,11 +306,6 @@ jint IPv6_supported()
jint IPv6_supported()
{
-#ifndef AF_INET6
- return JNI_FALSE;
-#endif
-
-#ifdef AF_INET6
int fd;
void *ipv6_fn;
SOCKETADDRESS sa;
@@ -433,7 +410,6 @@ jint IPv6_supported()
} else {
return JNI_TRUE;
}
-#endif /* AF_INET6 */
}
#endif /* DONT_ENABLE_IPV6 */
@@ -484,7 +460,7 @@ void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env,
}
}
-#if defined(__linux__) && defined(AF_INET6)
+#if defined(__linux__)
/* following code creates a list of addresses from the kernel
* routing table that are routed via the loopback address.
@@ -804,15 +780,15 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
int *len, jboolean v4MappedAddress) {
jint family;
family = getInetAddress_family(env, iaObj);
-#ifdef AF_INET6
/* needs work. 1. family 2. clean up him6 etc deallocate memory */
- if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) {
+ if (ipv6_available() && !(family == java_net_InetAddress_IPv4 &&
+ v4MappedAddress == JNI_FALSE)) {
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
jbyte caddr[16];
jint address;
-
- if (family == IPv4) { /* will convert to IPv4-mapped address */
+ if (family == java_net_InetAddress_IPv4) {
+ // convert to IPv4-mapped address
memset((char *) caddr, 0, 16);
address = getInetAddress_addr(env, iaObj);
if (address == INADDR_ANY) {
@@ -834,9 +810,9 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
him6->sin6_port = htons(port);
memcpy((void *)&(him6->sin6_addr), caddr, sizeof(struct in6_addr) );
him6->sin6_family = AF_INET6;
- *len = sizeof(struct sockaddr_in6) ;
+ *len = sizeof(struct sockaddr_in6);
-#if defined(_ALLBSD_SOURCE) && defined(_AF_INET6)
+#if defined(_ALLBSD_SOURCE)
// XXXBSD: should we do something with scope id here ? see below linux comment
/* MMM: Come back to this! */
#endif
@@ -880,11 +856,11 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
* try determine the appropriate interface.
*/
if (kernelIsV24()) {
- cached_scope_id = getDefaultIPv6Interface( &(him6->sin6_addr) );
+ cached_scope_id = getDefaultIPv6Interface(&(him6->sin6_addr));
} else {
- cached_scope_id = getLocalScopeID( (char *)&(him6->sin6_addr) );
+ cached_scope_id = getLocalScopeID((char *)&(him6->sin6_addr));
if (cached_scope_id == 0) {
- cached_scope_id = getDefaultIPv6Interface( &(him6->sin6_addr) );
+ cached_scope_id = getDefaultIPv6Interface(&(him6->sin6_addr));
}
}
(*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
@@ -906,52 +882,44 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
#else
/* handle scope_id for solaris */
- if (family != IPv4) {
+ if (family != java_net_InetAddress_IPv4) {
if (ia6_scopeidID) {
him6->sin6_scope_id = getInet6Address_scopeid(env, iaObj);
}
}
#endif
- } else
-#endif /* AF_INET6 */
- {
- struct sockaddr_in *him4 = (struct sockaddr_in*)him;
- jint address;
- if (family == IPv6) {
- JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable");
- return -1;
- }
- memset((char *) him4, 0, sizeof(struct sockaddr_in));
- address = getInetAddress_addr(env, iaObj);
- him4->sin_port = htons((short) port);
- him4->sin_addr.s_addr = (uint32_t) htonl(address);
- him4->sin_family = AF_INET;
- *len = sizeof(struct sockaddr_in);
+ } else {
+ struct sockaddr_in *him4 = (struct sockaddr_in *)him;
+ jint address;
+ if (family == java_net_InetAddress_IPv6) {
+ JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable");
+ return -1;
}
+ memset((char *)him4, 0, sizeof(struct sockaddr_in));
+ address = getInetAddress_addr(env, iaObj);
+ him4->sin_port = htons((short) port);
+ him4->sin_addr.s_addr = htonl(address);
+ him4->sin_family = AF_INET;
+ *len = sizeof(struct sockaddr_in);
+ }
return 0;
}
void
NET_SetTrafficClass(struct sockaddr *him, int trafficClass) {
-#ifdef AF_INET6
if (him->sa_family == AF_INET6) {
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
him6->sin6_flowinfo = htonl((trafficClass & 0xff) << 20);
}
-#endif /* AF_INET6 */
}
JNIEXPORT jint JNICALL
NET_GetPortFromSockaddr(struct sockaddr *him) {
-#ifdef AF_INET6
if (him->sa_family == AF_INET6) {
return ntohs(((struct sockaddr_in6*)him)->sin6_port);
-
- } else
-#endif /* AF_INET6 */
- {
- return ntohs(((struct sockaddr_in*)him)->sin_port);
- }
+ } else {
+ return ntohs(((struct sockaddr_in*)him)->sin_port);
+ }
}
int
@@ -1024,7 +992,6 @@ NET_MapSocketOption(jint cmd, int *level, int *optname) {
int i;
-#ifdef AF_INET6
if (ipv6_available()) {
switch (cmd) {
// Different multicast options if IPv6 is enabled
@@ -1047,7 +1014,6 @@ NET_MapSocketOption(jint cmd, int *level, int *optname) {
#endif
}
}
-#endif
/*
* Map the Java level option to the native level
@@ -1079,7 +1045,7 @@ NET_MapSocketOption(jint cmd, int *level, int *optname) {
* 0 if no matching interface
* >1 interface index to use for the link-local address.
*/
-#if defined(__linux__) && defined(AF_INET6)
+#if defined(__linux__)
int getDefaultIPv6Interface(struct in6_addr *target_addr) {
FILE *f;
char srcp[8][5];
@@ -1316,7 +1282,7 @@ NET_SetSockOpt(int fd, int level, int opt, const void *arg,
if (level == IPPROTO_IP && opt == IP_TOS) {
int *iptos;
-#if defined(AF_INET6) && defined(__linux__)
+#if defined(__linux__)
if (ipv6_available()) {
int optval = 1;
if (setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
@@ -1520,7 +1486,7 @@ NET_SetSockOpt(int fd, int level, int opt, const void *arg,
int
NET_Bind(int fd, struct sockaddr *him, int len)
{
-#if defined(__solaris__) && defined(AF_INET6)
+#if defined(__solaris__)
int level = -1;
int exclbind = -1;
#endif
@@ -1584,7 +1550,7 @@ NET_Bind(int fd, struct sockaddr *him, int len)
rv = bind(fd, him, len);
-#if defined(__solaris__) && defined(AF_INET6)
+#if defined(__solaris__)
if (rv < 0) {
int en = errno;
/* Restore *_EXCLBIND if the bind fails */
diff --git a/jdk/src/java.base/unix/native/libnet/net_util_md.h b/jdk/src/java.base/unix/native/libnet/net_util_md.h
index d7f526d8e7c..48503d2efbe 100644
--- a/jdk/src/java.base/unix/native/libnet/net_util_md.h
+++ b/jdk/src/java.base/unix/native/libnet/net_util_md.h
@@ -26,13 +26,9 @@
#ifndef NET_UTILS_MD_H
#define NET_UTILS_MD_H
-#include
-#include
#include
-#include
-#include
-
#include
+#include