--- a/hotspot/.mx.jvmci/mx_jvmci.py Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/.mx.jvmci/mx_jvmci.py Fri Jul 01 16:50:34 2016 -0700
@@ -186,7 +186,8 @@
# Might be building with JDK8 which has cacerts under jre/
srcCerts = join(mx.get_jdk(tag='default').home, 'jre', 'lib', 'security', 'cacerts')
dstCerts = join(jdkImageDir, 'lib', 'security', 'cacerts')
- shutil.copyfile(srcCerts, dstCerts)
+ if srcCerts != dstCerts:
+ shutil.copyfile(srcCerts, dstCerts)
_create_jdk_bundle(jdkBuildDir, _vm.debugLevel, jdkImageDir)
--- a/hotspot/.mx.jvmci/suite.py Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/.mx.jvmci/suite.py Fri Jul 01 16:50:34 2016 -0700
@@ -149,7 +149,6 @@
"subDir" : "src/jdk.vm.ci/share/classes",
"sourceDirs" : ["src"],
"dependencies" : [
- "jdk.vm.ci.hotspotvmconfig",
"jdk.vm.ci.common",
"jdk.vm.ci.runtime",
"jdk.vm.ci.services",
@@ -175,14 +174,6 @@
"workingSets" : "API,JVMCI",
},
- "jdk.vm.ci.hotspotvmconfig" : {
- "subDir" : "src/jdk.vm.ci/share/classes",
- "sourceDirs" : ["src"],
- "checkstyle" : "jdk.vm.ci.services",
- "javaCompliance" : "9",
- "workingSets" : "JVMCI,HotSpot",
- },
-
"jdk.vm.ci.hotspot.aarch64" : {
"subDir" : "src/jdk.vm.ci/share/classes",
"sourceDirs" : ["src"],
@@ -248,13 +239,6 @@
],
},
- "JVMCI_HOTSPOTVMCONFIG" : {
- "subDir" : "src/jdk.vm.ci/share/classes",
- "dependencies" : [
- "jdk.vm.ci.hotspotvmconfig",
- ],
- },
-
"JVMCI_HOTSPOT" : {
"subDir" : "src/jdk.vm.ci/share/classes",
"dependencies" : [
@@ -263,7 +247,6 @@
"jdk.vm.ci.hotspot.sparc",
],
"distDependencies" : [
- "JVMCI_HOTSPOTVMCONFIG",
"JVMCI_SERVICES",
"JVMCI_API",
],
--- a/hotspot/make/lib/CompileGtest.gmk Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/make/lib/CompileGtest.gmk Fri Jul 01 16:50:34 2016 -0700
@@ -23,7 +23,10 @@
# questions.
#
-GTEST_TEST_SRC := $(HOTSPOT_TOPDIR)/test/native
+$(eval $(call IncludeCustomExtension, hotspot, lib/CompileGtest.gmk))
+
+GTEST_TEST_SRC += $(HOTSPOT_TOPDIR)/test/native
+GTEST_LAUNCHER_SRC := $(HOTSPOT_TOPDIR)/test/native/gtestLauncher.cpp
GTEST_FRAMEWORK_SRC := $(SRC_ROOT)/test/fmw/gtest
# On Windows, there are no internal debug symbols so must set copying to true
@@ -65,7 +68,7 @@
$(BUILD_LIBJVM_ALL_OBJS)), \
CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \
-I$(GTEST_FRAMEWORK_SRC)/include \
- -I$(GTEST_TEST_SRC), \
+ $(addprefix -I,$(GTEST_TEST_SRC)), \
CFLAGS_windows := /EHsc, \
CFLAGS_solaris := -DGTEST_HAS_EXCEPTIONS=0 -library=stlport4, \
CFLAGS_macosx := -DGTEST_OS_MAC=1, \
@@ -73,7 +76,7 @@
CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
DISABLED_WARNINGS_gcc := undef, \
DISABLED_WARNINGS_clang := undef switch format-nonliteral \
- tautological-undefined-compare, \
+ tautological-undefined-compare $(BUILD_LIBJVM_DISABLED_WARNINGS_clang), \
DISABLED_WARNINGS_solstudio := identexpected, \
LDFLAGS := $(JVM_LDFLAGS), \
LDFLAGS_solaris := -library=stlport4 $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -83,6 +86,8 @@
USE_MAPFILE_FOR_SYMBOLS := true, \
COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
+ PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
+ PRECOMPILED_HEADER_EXCLUDE := gtest-all.cc gtestMain.cpp, \
))
TARGETS += $(BUILD_GTEST_LIBJVM)
@@ -93,7 +98,7 @@
TOOLCHAIN := $(JVM_TOOLCHAIN), \
PROGRAM := gtestLauncher, \
OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
- EXTRA_FILES := $(GTEST_TEST_SRC)/gtestLauncher.cpp, \
+ EXTRA_FILES := $(GTEST_LAUNCHER_SRC), \
OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \
CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \
-I$(GTEST_FRAMEWORK_SRC)/include, \
--- a/hotspot/make/lib/JvmOverrideFiles.gmk Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/make/lib/JvmOverrideFiles.gmk Fri Jul 01 16:50:34 2016 -0700
@@ -35,6 +35,7 @@
ifeq ($(OPENJDK_TARGET_OS), linux)
BUILD_LIBJVM_ostream.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
+ BUILD_LIBJVM_logFileOutput.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad Fri Jul 01 16:50:34 2016 -0700
@@ -6629,6 +6629,82 @@
%}
%}
+// used for certain integral comparisons which can be
+// converted to cbxx or tbxx instructions
+
+operand cmpOpEqNe()
+%{
+ match(Bool);
+ match(CmpOp);
+ op_cost(0);
+ predicate(n->as_Bool()->_test._test == BoolTest::ne
+ || n->as_Bool()->_test._test == BoolTest::eq);
+
+ format %{ "" %}
+ interface(COND_INTER) %{
+ equal(0x0, "eq");
+ not_equal(0x1, "ne");
+ less(0xb, "lt");
+ greater_equal(0xa, "ge");
+ less_equal(0xd, "le");
+ greater(0xc, "gt");
+ overflow(0x6, "vs");
+ no_overflow(0x7, "vc");
+ %}
+%}
+
+// used for certain integral comparisons which can be
+// converted to cbxx or tbxx instructions
+
+operand cmpOpLtGe()
+%{
+ match(Bool);
+ match(CmpOp);
+ op_cost(0);
+
+ predicate(n->as_Bool()->_test._test == BoolTest::lt
+ || n->as_Bool()->_test._test == BoolTest::ge);
+
+ format %{ "" %}
+ interface(COND_INTER) %{
+ equal(0x0, "eq");
+ not_equal(0x1, "ne");
+ less(0xb, "lt");
+ greater_equal(0xa, "ge");
+ less_equal(0xd, "le");
+ greater(0xc, "gt");
+ overflow(0x6, "vs");
+ no_overflow(0x7, "vc");
+ %}
+%}
+
+// used for certain unsigned integral comparisons which can be
+// converted to cbxx or tbxx instructions
+
+operand cmpOpUEqNeLtGe()
+%{
+ match(Bool);
+ match(CmpOp);
+ op_cost(0);
+
+ predicate(n->as_Bool()->_test._test == BoolTest::eq
+ || n->as_Bool()->_test._test == BoolTest::ne
+ || n->as_Bool()->_test._test == BoolTest::lt
+ || n->as_Bool()->_test._test == BoolTest::ge);
+
+ format %{ "" %}
+ interface(COND_INTER) %{
+ equal(0x0, "eq");
+ not_equal(0x1, "ne");
+ less(0xb, "lt");
+ greater_equal(0xa, "ge");
+ less_equal(0xd, "le");
+ greater(0xc, "gt");
+ overflow(0x6, "vs");
+ no_overflow(0x7, "vc");
+ %}
+%}
+
// Special operand allowing long args to int ops to be truncated for free
operand iRegL2I(iRegL reg) %{
@@ -14286,10 +14362,8 @@
// shorter than (cmp; branch), have the additional benefit of not
// killing the flags.
-instruct cmpI_imm0_branch(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsReg cr) %{
+instruct cmpI_imm0_branch(cmpOpEqNe cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsReg cr) %{
match(If cmp (CmpI op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14305,10 +14379,8 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct cmpL_imm0_branch(cmpOp cmp, iRegL op1, immL0 op2, label labl, rFlagsReg cr) %{
+instruct cmpL_imm0_branch(cmpOpEqNe cmp, iRegL op1, immL0 op2, label labl, rFlagsReg cr) %{
match(If cmp (CmpL op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14324,10 +14396,8 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct cmpP_imm0_branch(cmpOp cmp, iRegP op1, immP0 op2, label labl, rFlagsReg cr) %{
+instruct cmpP_imm0_branch(cmpOpEqNe cmp, iRegP op1, immP0 op2, label labl, rFlagsReg cr) %{
match(If cmp (CmpP op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14343,10 +14413,8 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct cmpN_imm0_branch(cmpOp cmp, iRegN op1, immN0 op2, label labl, rFlagsReg cr) %{
+instruct cmpN_imm0_branch(cmpOpEqNe cmp, iRegN op1, immN0 op2, label labl, rFlagsReg cr) %{
match(If cmp (CmpN op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14362,10 +14430,8 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct cmpP_narrowOop_imm0_branch(cmpOp cmp, iRegN oop, immP0 zero, label labl, rFlagsReg cr) %{
+instruct cmpP_narrowOop_imm0_branch(cmpOpEqNe cmp, iRegN oop, immP0 zero, label labl, rFlagsReg cr) %{
match(If cmp (CmpP (DecodeN oop) zero));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14381,12 +14447,8 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct cmpUI_imm0_branch(cmpOpU cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsRegU cr) %{
+instruct cmpUI_imm0_branch(cmpOpUEqNeLtGe cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsRegU cr) %{
match(If cmp (CmpU op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq
- || n->in(1)->as_Bool()->_test._test == BoolTest::gt
- || n->in(1)->as_Bool()->_test._test == BoolTest::le);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14402,12 +14464,8 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct cmpUL_imm0_branch(cmpOpU cmp, iRegL op1, immL0 op2, label labl, rFlagsRegU cr) %{
+instruct cmpUL_imm0_branch(cmpOpUEqNeLtGe cmp, iRegL op1, immL0 op2, label labl, rFlagsRegU cr) %{
match(If cmp (CmpU op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq
- || n->in(1)->as_Bool()->_test._test == BoolTest::gt
- || n->in(1)->as_Bool()->_test._test == BoolTest::le);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14426,10 +14484,8 @@
// Test bit and Branch
// Patterns for short (< 32KiB) variants
-instruct cmpL_branch_sign(cmpOp cmp, iRegL op1, immL0 op2, label labl) %{
+instruct cmpL_branch_sign(cmpOpLtGe cmp, iRegL op1, immL0 op2, label labl) %{
match(If cmp (CmpL op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt
- || n->in(1)->as_Bool()->_test._test == BoolTest::ge);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14444,10 +14500,8 @@
ins_short_branch(1);
%}
-instruct cmpI_branch_sign(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl) %{
+instruct cmpI_branch_sign(cmpOpLtGe cmp, iRegIorL2I op1, immI0 op2, label labl) %{
match(If cmp (CmpI op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt
- || n->in(1)->as_Bool()->_test._test == BoolTest::ge);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14462,11 +14516,9 @@
ins_short_branch(1);
%}
-instruct cmpL_branch_bit(cmpOp cmp, iRegL op1, immL op2, immL0 op3, label labl) %{
+instruct cmpL_branch_bit(cmpOpEqNe cmp, iRegL op1, immL op2, immL0 op3, label labl) %{
match(If cmp (CmpL (AndL op1 op2) op3));
- predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq)
- && is_power_of_2(n->in(2)->in(1)->in(2)->get_long()));
+ predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_long()));
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14481,11 +14533,9 @@
ins_short_branch(1);
%}
-instruct cmpI_branch_bit(cmpOp cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
+instruct cmpI_branch_bit(cmpOpEqNe cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
match(If cmp (CmpI (AndI op1 op2) op3));
- predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq)
- && is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
+ predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14501,10 +14551,8 @@
%}
// And far variants
-instruct far_cmpL_branch_sign(cmpOp cmp, iRegL op1, immL0 op2, label labl) %{
+instruct far_cmpL_branch_sign(cmpOpLtGe cmp, iRegL op1, immL0 op2, label labl) %{
match(If cmp (CmpL op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt
- || n->in(1)->as_Bool()->_test._test == BoolTest::ge);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14518,10 +14566,8 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct far_cmpI_branch_sign(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl) %{
+instruct far_cmpI_branch_sign(cmpOpLtGe cmp, iRegIorL2I op1, immI0 op2, label labl) %{
match(If cmp (CmpI op1 op2));
- predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt
- || n->in(1)->as_Bool()->_test._test == BoolTest::ge);
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14535,11 +14581,9 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct far_cmpL_branch_bit(cmpOp cmp, iRegL op1, immL op2, immL0 op3, label labl) %{
+instruct far_cmpL_branch_bit(cmpOpEqNe cmp, iRegL op1, immL op2, immL0 op3, label labl) %{
match(If cmp (CmpL (AndL op1 op2) op3));
- predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq)
- && is_power_of_2(n->in(2)->in(1)->in(2)->get_long()));
+ predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_long()));
effect(USE labl);
ins_cost(BRANCH_COST);
@@ -14553,11 +14597,9 @@
ins_pipe(pipe_cmp_branch);
%}
-instruct far_cmpI_branch_bit(cmpOp cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
+instruct far_cmpI_branch_bit(cmpOpEqNe cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{
match(If cmp (CmpI (AndI op1 op2) op3));
- predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne
- || n->in(1)->as_Bool()->_test._test == BoolTest::eq)
- && is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
+ predicate(is_power_of_2(n->in(2)->in(1)->in(2)->get_int()));
effect(USE labl);
ins_cost(BRANCH_COST);
--- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -630,7 +630,11 @@
__ b(do_continue);
}
-// See if we've got enough room on the stack for locals plus overhead.
+// See if we've got enough room on the stack for locals plus overhead
+// below JavaThread::stack_overflow_limit(). If not, throw a StackOverflowError
+// without going through the signal handler, i.e., reserved and yellow zones
+// will not be made usable. The shadow zone must suffice to handle the
+// overflow.
// The expression stack grows down incrementally, so the normal guard
// page mechanism will work for that.
//
@@ -674,40 +678,25 @@
// compute rsp as if this were going to be the last frame on
// the stack before the red zone
- const Address stack_base(rthread, Thread::stack_base_offset());
- const Address stack_size(rthread, Thread::stack_size_offset());
-
// locals + overhead, in bytes
__ mov(r0, overhead_size);
__ add(r0, r0, r3, Assembler::LSL, Interpreter::logStackElementSize); // 2 slots per parameter.
- __ ldr(rscratch1, stack_base);
- __ ldr(rscratch2, stack_size);
+ const Address stack_limit(rthread, JavaThread::stack_overflow_limit_offset());
+ __ ldr(rscratch1, stack_limit);
#ifdef ASSERT
- Label stack_base_okay, stack_size_okay;
- // verify that thread stack base is non-zero
- __ cbnz(rscratch1, stack_base_okay);
- __ stop("stack base is zero");
- __ bind(stack_base_okay);
- // verify that thread stack size is non-zero
- __ cbnz(rscratch2, stack_size_okay);
- __ stop("stack size is zero");
- __ bind(stack_size_okay);
+ Label limit_okay;
+ // Verify that thread stack limit is non-zero.
+ __ cbnz(rscratch1, limit_okay);
+ __ stop("stack overflow limit is zero");
+ __ bind(limit_okay);
#endif
- // Add stack base to locals and subtract stack size
- __ sub(rscratch1, rscratch1, rscratch2); // Stack limit
+ // Add stack limit to locals.
__ add(r0, r0, rscratch1);
- // Use the bigger size for banging.
- const int max_bang_size = MAX2(JavaThread::stack_shadow_zone_size(),
- JavaThread::stack_red_zone_size() + JavaThread::stack_yellow_zone_size());
-
- // add in the red and yellow zone sizes
- __ add(r0, r0, max_bang_size * 2);
-
- // check against the current stack bottom
+ // Check against the current stack bottom.
__ cmp(sp, r0);
__ br(Assembler::HI, after_frame_check);
@@ -1088,9 +1077,9 @@
__ ldr(r2, constMethod);
__ load_unsigned_short(r2, size_of_parameters);
- // native calls don't need the stack size check since they have no
+ // Native calls don't need the stack size check since they have no
// expression stack and the arguments are already on the stack and
- // we only add a handful of words to the stack
+ // we only add a handful of words to the stack.
// rmethod: Method*
// r2: size of parameters
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -706,9 +706,13 @@
TW_OPCODE = (31u << OPCODE_SHIFT | 4u << 1),
// Atomics.
+ LBARX_OPCODE = (31u << OPCODE_SHIFT | 52u << 1),
+ LHARX_OPCODE = (31u << OPCODE_SHIFT | 116u << 1),
LWARX_OPCODE = (31u << OPCODE_SHIFT | 20u << 1),
LDARX_OPCODE = (31u << OPCODE_SHIFT | 84u << 1),
LQARX_OPCODE = (31u << OPCODE_SHIFT | 276u << 1),
+ STBCX_OPCODE = (31u << OPCODE_SHIFT | 694u << 1),
+ STHCX_OPCODE = (31u << OPCODE_SHIFT | 726u << 1),
STWCX_OPCODE = (31u << OPCODE_SHIFT | 150u << 1),
STDCX_OPCODE = (31u << OPCODE_SHIFT | 214u << 1),
STQCX_OPCODE = (31u << OPCODE_SHIFT | 182u << 1)
@@ -1796,13 +1800,19 @@
inline void waitrsv(); // >=Power7
// atomics
+ inline void lbarx_unchecked(Register d, Register a, Register b, int eh1 = 0); // >=Power 8
+ inline void lharx_unchecked(Register d, Register a, Register b, int eh1 = 0); // >=Power 8
inline void lwarx_unchecked(Register d, Register a, Register b, int eh1 = 0);
inline void ldarx_unchecked(Register d, Register a, Register b, int eh1 = 0);
- inline void lqarx_unchecked(Register d, Register a, Register b, int eh1 = 0);
+ inline void lqarx_unchecked(Register d, Register a, Register b, int eh1 = 0); // >=Power 8
inline bool lxarx_hint_exclusive_access();
+ inline void lbarx( Register d, Register a, Register b, bool hint_exclusive_access = false);
+ inline void lharx( Register d, Register a, Register b, bool hint_exclusive_access = false);
inline void lwarx( Register d, Register a, Register b, bool hint_exclusive_access = false);
inline void ldarx( Register d, Register a, Register b, bool hint_exclusive_access = false);
inline void lqarx( Register d, Register a, Register b, bool hint_exclusive_access = false);
+ inline void stbcx_( Register s, Register a, Register b);
+ inline void sthcx_( Register s, Register a, Register b);
inline void stwcx_( Register s, Register a, Register b);
inline void stdcx_( Register s, Register a, Register b);
inline void stqcx_( Register s, Register a, Register b);
@@ -2169,12 +2179,18 @@
inline void dcbtstct(Register s2, int ct);
// Atomics: use ra0mem to disallow R0 as base.
+ inline void lbarx_unchecked(Register d, Register b, int eh1);
+ inline void lharx_unchecked(Register d, Register b, int eh1);
inline void lwarx_unchecked(Register d, Register b, int eh1);
inline void ldarx_unchecked(Register d, Register b, int eh1);
inline void lqarx_unchecked(Register d, Register b, int eh1);
+ inline void lbarx( Register d, Register b, bool hint_exclusive_access);
+ inline void lharx( Register d, Register b, bool hint_exclusive_access);
inline void lwarx( Register d, Register b, bool hint_exclusive_access);
inline void ldarx( Register d, Register b, bool hint_exclusive_access);
inline void lqarx( Register d, Register b, bool hint_exclusive_access);
+ inline void stbcx_(Register s, Register b);
+ inline void sthcx_(Register s, Register b);
inline void stwcx_(Register s, Register b);
inline void stdcx_(Register s, Register b);
inline void stqcx_(Register s, Register b);
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -594,13 +594,19 @@
// atomics
// Use ra0mem to disallow R0 as base.
+inline void Assembler::lbarx_unchecked(Register d, Register a, Register b, int eh1) { emit_int32( LBARX_OPCODE | rt(d) | ra0mem(a) | rb(b) | eh(eh1)); }
+inline void Assembler::lharx_unchecked(Register d, Register a, Register b, int eh1) { emit_int32( LHARX_OPCODE | rt(d) | ra0mem(a) | rb(b) | eh(eh1)); }
inline void Assembler::lwarx_unchecked(Register d, Register a, Register b, int eh1) { emit_int32( LWARX_OPCODE | rt(d) | ra0mem(a) | rb(b) | eh(eh1)); }
inline void Assembler::ldarx_unchecked(Register d, Register a, Register b, int eh1) { emit_int32( LDARX_OPCODE | rt(d) | ra0mem(a) | rb(b) | eh(eh1)); }
inline void Assembler::lqarx_unchecked(Register d, Register a, Register b, int eh1) { emit_int32( LQARX_OPCODE | rt(d) | ra0mem(a) | rb(b) | eh(eh1)); }
inline bool Assembler::lxarx_hint_exclusive_access() { return VM_Version::has_lxarxeh(); }
+inline void Assembler::lbarx( Register d, Register a, Register b, bool hint_exclusive_access) { lbarx_unchecked(d, a, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
+inline void Assembler::lharx( Register d, Register a, Register b, bool hint_exclusive_access) { lharx_unchecked(d, a, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
inline void Assembler::lwarx( Register d, Register a, Register b, bool hint_exclusive_access) { lwarx_unchecked(d, a, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
inline void Assembler::ldarx( Register d, Register a, Register b, bool hint_exclusive_access) { ldarx_unchecked(d, a, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
inline void Assembler::lqarx( Register d, Register a, Register b, bool hint_exclusive_access) { lqarx_unchecked(d, a, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
+inline void Assembler::stbcx_(Register s, Register a, Register b) { emit_int32( STBCX_OPCODE | rs(s) | ra0mem(a) | rb(b) | rc(1)); }
+inline void Assembler::sthcx_(Register s, Register a, Register b) { emit_int32( STHCX_OPCODE | rs(s) | ra0mem(a) | rb(b) | rc(1)); }
inline void Assembler::stwcx_(Register s, Register a, Register b) { emit_int32( STWCX_OPCODE | rs(s) | ra0mem(a) | rb(b) | rc(1)); }
inline void Assembler::stdcx_(Register s, Register a, Register b) { emit_int32( STDCX_OPCODE | rs(s) | ra0mem(a) | rb(b) | rc(1)); }
inline void Assembler::stqcx_(Register s, Register a, Register b) { emit_int32( STQCX_OPCODE | rs(s) | ra0mem(a) | rb(b) | rc(1)); }
@@ -933,12 +939,18 @@
inline void Assembler::dcbtstct(Register s2, int ct) { emit_int32( DCBTST_OPCODE | rb(s2) | thct(ct)); }
// ra0 version
+inline void Assembler::lbarx_unchecked(Register d, Register b, int eh1) { emit_int32( LBARX_OPCODE | rt(d) | rb(b) | eh(eh1)); }
+inline void Assembler::lharx_unchecked(Register d, Register b, int eh1) { emit_int32( LHARX_OPCODE | rt(d) | rb(b) | eh(eh1)); }
inline void Assembler::lwarx_unchecked(Register d, Register b, int eh1) { emit_int32( LWARX_OPCODE | rt(d) | rb(b) | eh(eh1)); }
inline void Assembler::ldarx_unchecked(Register d, Register b, int eh1) { emit_int32( LDARX_OPCODE | rt(d) | rb(b) | eh(eh1)); }
inline void Assembler::lqarx_unchecked(Register d, Register b, int eh1) { emit_int32( LQARX_OPCODE | rt(d) | rb(b) | eh(eh1)); }
+inline void Assembler::lbarx( Register d, Register b, bool hint_exclusive_access){ lbarx_unchecked(d, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
+inline void Assembler::lharx( Register d, Register b, bool hint_exclusive_access){ lharx_unchecked(d, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
inline void Assembler::lwarx( Register d, Register b, bool hint_exclusive_access){ lwarx_unchecked(d, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
inline void Assembler::ldarx( Register d, Register b, bool hint_exclusive_access){ ldarx_unchecked(d, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
inline void Assembler::lqarx( Register d, Register b, bool hint_exclusive_access){ lqarx_unchecked(d, b, (hint_exclusive_access && lxarx_hint_exclusive_access() && UseExtendedLoadAndReserveInstructionsPPC64) ? 1 : 0); }
+inline void Assembler::stbcx_(Register s, Register b) { emit_int32( STBCX_OPCODE | rs(s) | rb(b) | rc(1)); }
+inline void Assembler::sthcx_(Register s, Register b) { emit_int32( STHCX_OPCODE | rs(s) | rb(b) | rc(1)); }
inline void Assembler::stwcx_(Register s, Register b) { emit_int32( STWCX_OPCODE | rs(s) | rb(b) | rc(1)); }
inline void Assembler::stdcx_(Register s, Register b) { emit_int32( STDCX_OPCODE | rs(s) | rb(b) | rc(1)); }
inline void Assembler::stqcx_(Register s, Register b) { emit_int32( STQCX_OPCODE | rs(s) | rb(b) | rc(1)); }
--- a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -40,9 +40,9 @@
define_pd_global(bool, TrapBasedNullChecks, true);
define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs passed to check cast.
-#define DEFAULT_STACK_YELLOW_PAGES (6)
+#define DEFAULT_STACK_YELLOW_PAGES (2)
#define DEFAULT_STACK_RED_PAGES (1)
-#define DEFAULT_STACK_SHADOW_PAGES (6 DEBUG_ONLY(+2))
+#define DEFAULT_STACK_SHADOW_PAGES (20 DEBUG_ONLY(+2))
#define DEFAULT_STACK_RESERVED_PAGES (1)
#define MIN_STACK_YELLOW_PAGES DEFAULT_STACK_YELLOW_PAGES
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -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.
* Copyright (c) 2012, 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -478,33 +478,6 @@
profile_typecheck_failed(Rtmp1, Rtmp2);
}
-void InterpreterMacroAssembler::generate_stack_overflow_check_with_compare_and_throw(Register Rmem_frame_size, Register Rscratch1) {
- Label done;
- BLOCK_COMMENT("stack_overflow_check_with_compare_and_throw {");
- sub(Rmem_frame_size, R1_SP, Rmem_frame_size);
- ld(Rscratch1, thread_(stack_overflow_limit));
- cmpld(CCR0/*is_stack_overflow*/, Rmem_frame_size, Rscratch1);
- bgt(CCR0/*is_stack_overflow*/, done);
-
- // Load target address of the runtime stub.
- assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "generated in wrong order");
- load_const_optimized(Rscratch1, (StubRoutines::throw_StackOverflowError_entry()), R0);
- mtctr(Rscratch1);
- // Restore caller_sp.
-#ifdef ASSERT
- ld(Rscratch1, 0, R1_SP);
- ld(R0, 0, R21_sender_SP);
- cmpd(CCR0, R0, Rscratch1);
- asm_assert_eq("backlink", 0x547);
-#endif // ASSERT
- mr(R1_SP, R21_sender_SP);
- bctr();
-
- align(32, 12);
- bind(done);
- BLOCK_COMMENT("} stack_overflow_check_with_compare_and_throw");
-}
-
// Separate these two to allow for delay slot in middle.
// These are used to do a test and full jump to exception-throwing code.
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -79,7 +79,6 @@
// Load object from cpool->resolved_references(index).
void load_resolved_reference_at_index(Register result, Register index, Label *is_null = NULL);
- void generate_stack_overflow_check_with_compare_and_throw(Register Rmem_frame_size, Register Rscratch1);
void load_receiver(Register Rparam_count, Register Rrecv_dst);
// helpers for expression stack
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1422,11 +1422,195 @@
bind(no_reserved_zone_enabling);
}
+void MacroAssembler::getandsetd(Register dest_current_value, Register exchange_value, Register addr_base,
+ bool cmpxchgx_hint) {
+ Label retry;
+ bind(retry);
+ ldarx(dest_current_value, addr_base, cmpxchgx_hint);
+ stdcx_(exchange_value, addr_base);
+ if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
+ bne_predict_not_taken(CCR0, retry); // StXcx_ sets CCR0.
+ } else {
+ bne( CCR0, retry); // StXcx_ sets CCR0.
+ }
+}
+
+void MacroAssembler::getandaddd(Register dest_current_value, Register inc_value, Register addr_base,
+ Register tmp, bool cmpxchgx_hint) {
+ Label retry;
+ bind(retry);
+ ldarx(dest_current_value, addr_base, cmpxchgx_hint);
+ add(tmp, dest_current_value, inc_value);
+ stdcx_(tmp, addr_base);
+ if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
+ bne_predict_not_taken(CCR0, retry); // StXcx_ sets CCR0.
+ } else {
+ bne( CCR0, retry); // StXcx_ sets CCR0.
+ }
+}
+
+// Word/sub-word atomic helper functions
+
+// Temps and addr_base are killed if size < 4 and processor does not support respective instructions.
+// Only signed types are supported with size < 4.
+// Atomic add always kills tmp1.
+void MacroAssembler::atomic_get_and_modify_generic(Register dest_current_value, Register exchange_value,
+ Register addr_base, Register tmp1, Register tmp2, Register tmp3,
+ bool cmpxchgx_hint, bool is_add, int size) {
+ // Sub-word instructions are available since Power 8.
+ // For older processors, instruction_type != size holds, and we
+ // emulate the sub-word instructions by constructing a 4-byte value
+ // that leaves the other bytes unchanged.
+ const int instruction_type = VM_Version::has_lqarx() ? size : 4;
+
+ Label retry;
+ Register shift_amount = noreg,
+ val32 = dest_current_value,
+ modval = is_add ? tmp1 : exchange_value;
+
+ if (instruction_type != size) {
+ assert_different_registers(tmp1, tmp2, tmp3, dest_current_value, exchange_value, addr_base);
+ modval = tmp1;
+ shift_amount = tmp2;
+ val32 = tmp3;
+ // Need some preperation: Compute shift amount, align address. Note: shorts must be 2 byte aligned.
+#ifdef VM_LITTLE_ENDIAN
+ rldic(shift_amount, addr_base, 3, 64-5); // (dest & 3) * 8;
+ clrrdi(addr_base, addr_base, 2);
+#else
+ xori(shift_amount, addr_base, (size == 1) ? 3 : 2);
+ clrrdi(addr_base, addr_base, 2);
+ rldic(shift_amount, shift_amount, 3, 64-5); // byte: ((3-dest) & 3) * 8; short: ((1-dest/2) & 1) * 16;
+#endif
+ }
+
+ // atomic emulation loop
+ bind(retry);
+
+ switch (instruction_type) {
+ case 4: lwarx(val32, addr_base, cmpxchgx_hint); break;
+ case 2: lharx(val32, addr_base, cmpxchgx_hint); break;
+ case 1: lbarx(val32, addr_base, cmpxchgx_hint); break;
+ default: ShouldNotReachHere();
+ }
+
+ if (instruction_type != size) {
+ srw(dest_current_value, val32, shift_amount);
+ }
+
+ if (is_add) { add(modval, dest_current_value, exchange_value); }
+
+ if (instruction_type != size) {
+ // Transform exchange value such that the replacement can be done by one xor instruction.
+ xorr(modval, dest_current_value, is_add ? modval : exchange_value);
+ clrldi(modval, modval, (size == 1) ? 56 : 48);
+ slw(modval, modval, shift_amount);
+ xorr(modval, val32, modval);
+ }
+
+ switch (instruction_type) {
+ case 4: stwcx_(modval, addr_base); break;
+ case 2: sthcx_(modval, addr_base); break;
+ case 1: stbcx_(modval, addr_base); break;
+ default: ShouldNotReachHere();
+ }
+
+ if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
+ bne_predict_not_taken(CCR0, retry); // StXcx_ sets CCR0.
+ } else {
+ bne( CCR0, retry); // StXcx_ sets CCR0.
+ }
+
+ // l?arx zero-extends, but Java wants byte/short values sign-extended.
+ if (size == 1) {
+ extsb(dest_current_value, dest_current_value);
+ } else if (size == 2) {
+ extsh(dest_current_value, dest_current_value);
+ };
+}
+
+// Temps, addr_base and exchange_value are killed if size < 4 and processor does not support respective instructions.
+// Only signed types are supported with size < 4.
+void MacroAssembler::cmpxchg_loop_body(ConditionRegister flag, Register dest_current_value,
+ Register compare_value, Register exchange_value,
+ Register addr_base, Register tmp1, Register tmp2,
+ Label &retry, Label &failed, bool cmpxchgx_hint, int size) {
+ // Sub-word instructions are available since Power 8.
+ // For older processors, instruction_type != size holds, and we
+ // emulate the sub-word instructions by constructing a 4-byte value
+ // that leaves the other bytes unchanged.
+ const int instruction_type = VM_Version::has_lqarx() ? size : 4;
+
+ Register shift_amount = noreg,
+ val32 = dest_current_value,
+ modval = exchange_value;
+
+ if (instruction_type != size) {
+ assert_different_registers(tmp1, tmp2, dest_current_value, compare_value, exchange_value, addr_base);
+ shift_amount = tmp1;
+ val32 = tmp2;
+ modval = tmp2;
+ // Need some preperation: Compute shift amount, align address. Note: shorts must be 2 byte aligned.
+#ifdef VM_LITTLE_ENDIAN
+ rldic(shift_amount, addr_base, 3, 64-5); // (dest & 3) * 8;
+ clrrdi(addr_base, addr_base, 2);
+#else
+ xori(shift_amount, addr_base, (size == 1) ? 3 : 2);
+ clrrdi(addr_base, addr_base, 2);
+ rldic(shift_amount, shift_amount, 3, 64-5); // byte: ((3-dest) & 3) * 8; short: ((1-dest/2) & 1) * 16;
+#endif
+ // Transform exchange value such that the replacement can be done by one xor instruction.
+ xorr(exchange_value, compare_value, exchange_value);
+ clrldi(exchange_value, exchange_value, (size == 1) ? 56 : 48);
+ slw(exchange_value, exchange_value, shift_amount);
+ }
+
+ // atomic emulation loop
+ bind(retry);
+
+ switch (instruction_type) {
+ case 4: lwarx(val32, addr_base, cmpxchgx_hint); break;
+ case 2: lharx(val32, addr_base, cmpxchgx_hint); break;
+ case 1: lbarx(val32, addr_base, cmpxchgx_hint); break;
+ default: ShouldNotReachHere();
+ }
+
+ if (instruction_type != size) {
+ srw(dest_current_value, val32, shift_amount);
+ }
+ if (size == 1) {
+ extsb(dest_current_value, dest_current_value);
+ } else if (size == 2) {
+ extsh(dest_current_value, dest_current_value);
+ };
+
+ cmpw(flag, dest_current_value, compare_value);
+ if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
+ bne_predict_not_taken(flag, failed);
+ } else {
+ bne( flag, failed);
+ }
+ // branch to done => (flag == ne), (dest_current_value != compare_value)
+ // fall through => (flag == eq), (dest_current_value == compare_value)
+
+ if (instruction_type != size) {
+ xorr(modval, val32, exchange_value);
+ }
+
+ switch (instruction_type) {
+ case 4: stwcx_(modval, addr_base); break;
+ case 2: sthcx_(modval, addr_base); break;
+ case 1: stbcx_(modval, addr_base); break;
+ default: ShouldNotReachHere();
+ }
+}
+
// CmpxchgX sets condition register to cmpX(current, compare).
-void MacroAssembler::cmpxchgw(ConditionRegister flag, Register dest_current_value,
- Register compare_value, Register exchange_value,
- Register addr_base, int semantics, bool cmpxchgx_hint,
- Register int_flag_success, bool contention_hint, bool weak) {
+void MacroAssembler::cmpxchg_generic(ConditionRegister flag, Register dest_current_value,
+ Register compare_value, Register exchange_value,
+ Register addr_base, Register tmp1, Register tmp2,
+ int semantics, bool cmpxchgx_hint,
+ Register int_flag_success, bool contention_hint, bool weak, int size) {
Label retry;
Label failed;
Label done;
@@ -1435,8 +1619,10 @@
// result register is different from the other ones.
bool use_result_reg = (int_flag_success != noreg);
bool preset_result_reg = (int_flag_success != dest_current_value && int_flag_success != compare_value &&
- int_flag_success != exchange_value && int_flag_success != addr_base);
+ int_flag_success != exchange_value && int_flag_success != addr_base &&
+ int_flag_success != tmp1 && int_flag_success != tmp2);
assert(!weak || flag == CCR0, "weak only supported with CCR0");
+ assert(size == 1 || size == 2 || size == 4, "unsupported");
if (use_result_reg && preset_result_reg) {
li(int_flag_success, 0); // preset (assume cas failed)
@@ -1444,7 +1630,12 @@
// Add simple guard in order to reduce risk of starving under high contention (recommended by IBM).
if (contention_hint) { // Don't try to reserve if cmp fails.
- lwz(dest_current_value, 0, addr_base);
+ switch (size) {
+ case 1: lbz(dest_current_value, 0, addr_base); extsb(dest_current_value, dest_current_value); break;
+ case 2: lha(dest_current_value, 0, addr_base); break;
+ case 4: lwz(dest_current_value, 0, addr_base); break;
+ default: ShouldNotReachHere();
+ }
cmpw(flag, dest_current_value, compare_value);
bne(flag, failed);
}
@@ -1454,20 +1645,8 @@
release();
}
- // atomic emulation loop
- bind(retry);
-
- lwarx(dest_current_value, addr_base, cmpxchgx_hint);
- cmpw(flag, dest_current_value, compare_value);
- if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- bne_predict_not_taken(flag, failed);
- } else {
- bne( flag, failed);
- }
- // branch to done => (flag == ne), (dest_current_value != compare_value)
- // fall through => (flag == eq), (dest_current_value == compare_value)
-
- stwcx_(exchange_value, addr_base);
+ cmpxchg_loop_body(flag, dest_current_value, compare_value, exchange_value, addr_base, tmp1, tmp2,
+ retry, failed, cmpxchgx_hint, size);
if (!weak || use_result_reg) {
if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
bne_predict_not_taken(CCR0, weak ? failed : retry); // StXcx_ sets CCR0.
@@ -3751,454 +3930,6 @@
bind(Ldone);
}
-
-// Intrinsics for non-CompactStrings
-
-// Search for a single jchar in an jchar[].
-//
-// Assumes that result differs from all other registers.
-//
-// 'haystack' is the addresses of a jchar-array.
-// 'needle' is either the character to search for or R0.
-// 'needleChar' is the character to search for if 'needle' == R0..
-// 'haycnt' is the length of the haystack. We assume 'haycnt' >=1.
-//
-// Preserves haystack, haycnt, needle and kills all other registers.
-//
-// If needle == R0, we search for the constant needleChar.
-void MacroAssembler::string_indexof_1(Register result, Register haystack, Register haycnt,
- Register needle, jchar needleChar,
- Register tmp1, Register tmp2) {
-
- assert_different_registers(result, haystack, haycnt, needle, tmp1, tmp2);
-
- Label L_InnerLoop, L_FinalCheck, L_Found1, L_Found2, L_Found3, L_NotFound, L_End;
- Register addr = tmp1,
- ch1 = tmp2,
- ch2 = R0;
-
-//3:
- dcbtct(haystack, 0x00); // Indicate R/O access to haystack.
-
- srwi_(tmp2, haycnt, 1); // Shift right by exact_log2(UNROLL_FACTOR).
- mr(addr, haystack);
- beq(CCR0, L_FinalCheck);
- mtctr(tmp2); // Move to count register.
-//8:
- bind(L_InnerLoop); // Main work horse (2x unrolled search loop).
- lhz(ch1, 0, addr); // Load characters from haystack.
- lhz(ch2, 2, addr);
- (needle != R0) ? cmpw(CCR0, ch1, needle) : cmplwi(CCR0, ch1, needleChar);
- (needle != R0) ? cmpw(CCR1, ch2, needle) : cmplwi(CCR1, ch2, needleChar);
- beq(CCR0, L_Found1); // Did we find the needle?
- beq(CCR1, L_Found2);
- addi(addr, addr, 4);
- bdnz(L_InnerLoop);
-//16:
- bind(L_FinalCheck);
- andi_(R0, haycnt, 1);
- beq(CCR0, L_NotFound);
- lhz(ch1, 0, addr); // One position left at which we have to compare.
- (needle != R0) ? cmpw(CCR1, ch1, needle) : cmplwi(CCR1, ch1, needleChar);
- beq(CCR1, L_Found3);
-//21:
- bind(L_NotFound);
- li(result, -1); // Not found.
- b(L_End);
-
- bind(L_Found2);
- addi(addr, addr, 2);
-//24:
- bind(L_Found1);
- bind(L_Found3); // Return index ...
- subf(addr, haystack, addr); // relative to haystack,
- srdi(result, addr, 1); // in characters.
- bind(L_End);
-}
-
-
-// Implementation of IndexOf for jchar arrays.
-//
-// The length of haystack and needle are not constant, i.e. passed in a register.
-//
-// Preserves registers haystack, needle.
-// Kills registers haycnt, needlecnt.
-// Assumes that result differs from all other registers.
-// Haystack, needle are the addresses of jchar-arrays.
-// Haycnt, needlecnt are the lengths of them, respectively.
-//
-// Needlecntval must be zero or 15-bit unsigned immediate and > 1.
-void MacroAssembler::string_indexof(Register result, Register haystack, Register haycnt,
- Register needle, ciTypeArray* needle_values, Register needlecnt, int needlecntval,
- Register tmp1, Register tmp2, Register tmp3, Register tmp4) {
-
- // Ensure 0<needlecnt<=haycnt in ideal graph as prerequisite!
- Label L_TooShort, L_Found, L_NotFound, L_End;
- Register last_addr = haycnt, // Kill haycnt at the beginning.
- addr = tmp1,
- n_start = tmp2,
- ch1 = tmp3,
- ch2 = R0;
-
- // **************************************************************************************************
- // Prepare for main loop: optimized for needle count >=2, bail out otherwise.
- // **************************************************************************************************
-
-//1 (variable) or 3 (const):
- dcbtct(needle, 0x00); // Indicate R/O access to str1.
- dcbtct(haystack, 0x00); // Indicate R/O access to str2.
-
- // Compute last haystack addr to use if no match gets found.
- if (needlecntval == 0) { // variable needlecnt
-//3:
- subf(ch1, needlecnt, haycnt); // Last character index to compare is haycnt-needlecnt.
- addi(addr, haystack, -2); // Accesses use pre-increment.
- cmpwi(CCR6, needlecnt, 2);
- blt(CCR6, L_TooShort); // Variable needlecnt: handle short needle separately.
- slwi(ch1, ch1, 1); // Scale to number of bytes.
- lwz(n_start, 0, needle); // Load first 2 characters of needle.
- add(last_addr, haystack, ch1); // Point to last address to compare (haystack+2*(haycnt-needlecnt)).
- addi(needlecnt, needlecnt, -2); // Rest of needle.
- } else { // constant needlecnt
- guarantee(needlecntval != 1, "IndexOf with single-character needle must be handled separately");
- assert((needlecntval & 0x7fff) == needlecntval, "wrong immediate");
-//5:
- addi(ch1, haycnt, -needlecntval); // Last character index to compare is haycnt-needlecnt.
- lwz(n_start, 0, needle); // Load first 2 characters of needle.
- addi(addr, haystack, -2); // Accesses use pre-increment.
- slwi(ch1, ch1, 1); // Scale to number of bytes.
- add(last_addr, haystack, ch1); // Point to last address to compare (haystack+2*(haycnt-needlecnt)).
- li(needlecnt, needlecntval-2); // Rest of needle.
- }
-
- // Main Loop (now we have at least 3 characters).
-//11:
- Label L_OuterLoop, L_InnerLoop, L_FinalCheck, L_Comp1, L_Comp2, L_Comp3;
- bind(L_OuterLoop); // Search for 1st 2 characters.
- Register addr_diff = tmp4;
- subf(addr_diff, addr, last_addr); // Difference between already checked address and last address to check.
- addi(addr, addr, 2); // This is the new address we want to use for comparing.
- srdi_(ch2, addr_diff, 2);
- beq(CCR0, L_FinalCheck); // 2 characters left?
- mtctr(ch2); // addr_diff/4
-//16:
- bind(L_InnerLoop); // Main work horse (2x unrolled search loop)
- lwz(ch1, 0, addr); // Load 2 characters of haystack (ignore alignment).
- lwz(ch2, 2, addr);
- cmpw(CCR0, ch1, n_start); // Compare 2 characters (1 would be sufficient but try to reduce branches to CompLoop).
- cmpw(CCR1, ch2, n_start);
- beq(CCR0, L_Comp1); // Did we find the needle start?
- beq(CCR1, L_Comp2);
- addi(addr, addr, 4);
- bdnz(L_InnerLoop);
-//24:
- bind(L_FinalCheck);
- rldicl_(addr_diff, addr_diff, 64-1, 63); // Remaining characters not covered by InnerLoop: (addr_diff>>1)&1.
- beq(CCR0, L_NotFound);
- lwz(ch1, 0, addr); // One position left at which we have to compare.
- cmpw(CCR1, ch1, n_start);
- beq(CCR1, L_Comp3);
-//29:
- bind(L_NotFound);
- li(result, -1); // not found
- b(L_End);
-
-
- // **************************************************************************************************
- // Special Case: unfortunately, the variable needle case can be called with needlecnt<2
- // **************************************************************************************************
-//31:
- if ((needlecntval>>1) !=1 ) { // Const needlecnt is 2 or 3? Reduce code size.
- int nopcnt = 5;
- if (needlecntval !=0 ) ++nopcnt; // Balance alignment (other case: see below).
- if (needlecntval == 0) { // We have to handle these cases separately.
- Label L_OneCharLoop;
- bind(L_TooShort);
- mtctr(haycnt);
- lhz(n_start, 0, needle); // First character of needle
- bind(L_OneCharLoop);
- lhzu(ch1, 2, addr);
- cmpw(CCR1, ch1, n_start);
- beq(CCR1, L_Found); // Did we find the one character needle?
- bdnz(L_OneCharLoop);
- li(result, -1); // Not found.
- b(L_End);
- } // 8 instructions, so no impact on alignment.
- for (int x = 0; x < nopcnt; ++x) nop();
- }
-
- // **************************************************************************************************
- // Regular Case Part II: compare rest of needle (first 2 characters have been compared already)
- // **************************************************************************************************
-
- // Compare the rest
-//36 if needlecntval==0, else 37:
- bind(L_Comp2);
- addi(addr, addr, 2); // First comparison has failed, 2nd one hit.
- bind(L_Comp1); // Addr points to possible needle start.
- bind(L_Comp3); // Could have created a copy and use a different return address but saving code size here.
- if (needlecntval != 2) { // Const needlecnt==2?
- if (needlecntval != 3) {
- if (needlecntval == 0) beq(CCR6, L_Found); // Variable needlecnt==2?
- Register ind_reg = tmp4;
- li(ind_reg, 2*2); // First 2 characters are already compared, use index 2.
- mtctr(needlecnt); // Decremented by 2, still > 0.
-//40:
- Label L_CompLoop;
- bind(L_CompLoop);
- lhzx(ch2, needle, ind_reg);
- lhzx(ch1, addr, ind_reg);
- cmpw(CCR1, ch1, ch2);
- bne(CCR1, L_OuterLoop);
- addi(ind_reg, ind_reg, 2);
- bdnz(L_CompLoop);
- } else { // No loop required if there's only one needle character left.
- lhz(ch2, 2*2, needle);
- lhz(ch1, 2*2, addr);
- cmpw(CCR1, ch1, ch2);
- bne(CCR1, L_OuterLoop);
- }
- }
- // Return index ...
-//46:
- bind(L_Found);
- subf(addr, haystack, addr); // relative to haystack, ...
- srdi(result, addr, 1); // in characters.
-//48:
- bind(L_End);
-}
-
-// Implementation of Compare for jchar arrays.
-//
-// Kills the registers str1, str2, cnt1, cnt2.
-// Kills cr0, ctr.
-// Assumes that result differes from the input registers.
-void MacroAssembler::string_compare(Register str1_reg, Register str2_reg, Register cnt1_reg, Register cnt2_reg,
- Register result_reg, Register tmp_reg) {
- assert_different_registers(result_reg, str1_reg, str2_reg, cnt1_reg, cnt2_reg, tmp_reg);
-
- Label Ldone, Lslow_case, Lslow_loop, Lfast_loop;
- Register cnt_diff = R0,
- limit_reg = cnt1_reg,
- chr1_reg = result_reg,
- chr2_reg = cnt2_reg,
- addr_diff = str2_reg;
-
- // 'cnt_reg' contains the number of characters in the string's character array for the
- // pre-CompactStrings strings implementation and the number of bytes in the string's
- // byte array for the CompactStrings strings implementation.
- const int HAS_COMPACT_STRING = java_lang_String::has_coder_field() ? 1 : 0; // '1' = byte array, '0' = char array
-
- // Offset 0 should be 32 byte aligned.
-//-6:
- srawi(cnt1_reg, cnt1_reg, HAS_COMPACT_STRING);
- srawi(cnt2_reg, cnt2_reg, HAS_COMPACT_STRING);
-//-4:
- dcbtct(str1_reg, 0x00); // Indicate R/O access to str1.
- dcbtct(str2_reg, 0x00); // Indicate R/O access to str2.
-//-2:
- // Compute min(cnt1, cnt2) and check if 0 (bail out if we don't need to compare characters).
- subf(result_reg, cnt2_reg, cnt1_reg); // difference between cnt1/2
- subf_(addr_diff, str1_reg, str2_reg); // alias?
- beq(CCR0, Ldone); // return cnt difference if both ones are identical
- srawi(limit_reg, result_reg, 31); // generate signmask (cnt1/2 must be non-negative so cnt_diff can't overflow)
- mr(cnt_diff, result_reg);
- andr(limit_reg, result_reg, limit_reg); // difference or zero (negative): cnt1<cnt2 ? cnt1-cnt2 : 0
- add_(limit_reg, cnt2_reg, limit_reg); // min(cnt1, cnt2)==0?
- beq(CCR0, Ldone); // return cnt difference if one has 0 length
-
- lhz(chr1_reg, 0, str1_reg); // optional: early out if first characters mismatch
- lhzx(chr2_reg, str1_reg, addr_diff); // optional: early out if first characters mismatch
- addi(tmp_reg, limit_reg, -1); // min(cnt1, cnt2)-1
- subf_(result_reg, chr2_reg, chr1_reg); // optional: early out if first characters mismatch
- bne(CCR0, Ldone); // optional: early out if first characters mismatch
-
- // Set loop counter by scaling down tmp_reg
- srawi_(chr2_reg, tmp_reg, exact_log2(4)); // (min(cnt1, cnt2)-1)/4
- ble(CCR0, Lslow_case); // need >4 characters for fast loop
- andi(limit_reg, tmp_reg, 4-1); // remaining characters
-
- // Adapt str1_reg str2_reg for the first loop iteration
- mtctr(chr2_reg); // (min(cnt1, cnt2)-1)/4
- addi(limit_reg, limit_reg, 4+1); // compare last 5-8 characters in slow_case if mismatch found in fast_loop
-//16:
- // Compare the rest of the characters
- bind(Lfast_loop);
- ld(chr1_reg, 0, str1_reg);
- ldx(chr2_reg, str1_reg, addr_diff);
- cmpd(CCR0, chr2_reg, chr1_reg);
- bne(CCR0, Lslow_case); // return chr1_reg
- addi(str1_reg, str1_reg, 4*2);
- bdnz(Lfast_loop);
- addi(limit_reg, limit_reg, -4); // no mismatch found in fast_loop, only 1-4 characters missing
-//23:
- bind(Lslow_case);
- mtctr(limit_reg);
-//24:
- bind(Lslow_loop);
- lhz(chr1_reg, 0, str1_reg);
- lhzx(chr2_reg, str1_reg, addr_diff);
- subf_(result_reg, chr2_reg, chr1_reg);
- bne(CCR0, Ldone); // return chr1_reg
- addi(str1_reg, str1_reg, 1*2);
- bdnz(Lslow_loop);
-//30:
- // If strings are equal up to min length, return the length difference.
- mr(result_reg, cnt_diff);
- nop(); // alignment
-//32:
- // Otherwise, return the difference between the first mismatched chars.
- bind(Ldone);
-}
-
-
-// Compare char[] arrays.
-//
-// str1_reg USE only
-// str2_reg USE only
-// cnt_reg USE_DEF, due to tmp reg shortage
-// result_reg DEF only, might compromise USE only registers
-void MacroAssembler::char_arrays_equals(Register str1_reg, Register str2_reg, Register cnt_reg, Register result_reg,
- Register tmp1_reg, Register tmp2_reg, Register tmp3_reg, Register tmp4_reg,
- Register tmp5_reg) {
-
- // Str1 may be the same register as str2 which can occur e.g. after scalar replacement.
- assert_different_registers(result_reg, str1_reg, cnt_reg, tmp1_reg, tmp2_reg, tmp3_reg, tmp4_reg, tmp5_reg);
- assert_different_registers(result_reg, str2_reg, cnt_reg, tmp1_reg, tmp2_reg, tmp3_reg, tmp4_reg, tmp5_reg);
-
- // Offset 0 should be 32 byte aligned.
- Label Linit_cbc, Lcbc, Lloop, Ldone_true, Ldone_false;
- Register index_reg = tmp5_reg;
- Register cbc_iter = tmp4_reg;
-
- // 'cnt_reg' contains the number of characters in the string's character array for the
- // pre-CompactStrings strings implementation and the number of bytes in the string's
- // byte array for the CompactStrings strings implementation.
- const int HAS_COMPACT_STRING = java_lang_String::has_coder_field() ? 1 : 0; // '1' = byte array, '0' = char array
-
-//-1:
- dcbtct(str1_reg, 0x00); // Indicate R/O access to str1.
- dcbtct(str2_reg, 0x00); // Indicate R/O access to str2.
-//1:
- // cbc_iter: remaining characters after the '4 java characters per iteration' loop.
- rlwinm(cbc_iter, cnt_reg, 32 - HAS_COMPACT_STRING, 30, 31); // (cnt_reg % (HAS_COMPACT_STRING ? 8 : 4)) >> HAS_COMPACT_STRING
- li(index_reg, 0); // init
- li(result_reg, 0); // assume false
- // tmp2_reg: units of 4 java characters (i.e. 8 bytes) per iteration (main loop).
- srwi_(tmp2_reg, cnt_reg, exact_log2(4 << HAS_COMPACT_STRING)); // cnt_reg / (HAS_COMPACT_STRING ? 8 : 4)
-
- cmpwi(CCR1, cbc_iter, 0); // CCR1 = (cbc_iter==0)
- beq(CCR0, Linit_cbc); // too short
- mtctr(tmp2_reg);
-//8:
- bind(Lloop);
- ldx(tmp1_reg, str1_reg, index_reg);
- ldx(tmp2_reg, str2_reg, index_reg);
- cmpd(CCR0, tmp1_reg, tmp2_reg);
- bne(CCR0, Ldone_false); // Unequal char pair found -> done.
- addi(index_reg, index_reg, 4*sizeof(jchar));
- bdnz(Lloop);
-//14:
- bind(Linit_cbc);
- beq(CCR1, Ldone_true);
- mtctr(cbc_iter);
-//16:
- bind(Lcbc);
- lhzx(tmp1_reg, str1_reg, index_reg);
- lhzx(tmp2_reg, str2_reg, index_reg);
- cmpw(CCR0, tmp1_reg, tmp2_reg);
- bne(CCR0, Ldone_false); // Unequal char pair found -> done.
- addi(index_reg, index_reg, 1*sizeof(jchar));
- bdnz(Lcbc);
- nop();
- bind(Ldone_true);
- li(result_reg, 1);
-//24:
- bind(Ldone_false);
-}
-
-
-void MacroAssembler::char_arrays_equalsImm(Register str1_reg, Register str2_reg, int cntval, Register result_reg,
- Register tmp1_reg, Register tmp2_reg) {
- // Str1 may be the same register as str2 which can occur e.g. after scalar replacement.
- assert_different_registers(result_reg, str1_reg, tmp1_reg, tmp2_reg);
- assert_different_registers(result_reg, str2_reg, tmp1_reg, tmp2_reg);
- assert(sizeof(jchar) == 2, "must be");
- assert(cntval >= 0 && ((cntval & 0x7fff) == cntval), "wrong immediate");
-
- // 'cntval' contains the number of characters in the string's character array for the
- // pre-CompactStrings strings implementation and the number of bytes in the string's
- // byte array for the CompactStrings strings implementation.
- cntval >>= (java_lang_String::has_coder_field() ? 1 : 0); // '1' = byte array strings, '0' = char array strings
-
- Label Ldone_false;
-
- if (cntval < 16) { // short case
- if (cntval != 0) li(result_reg, 0); // assume false
-
- const int num_bytes = cntval*sizeof(jchar);
- int index = 0;
- for (int next_index; (next_index = index + 8) <= num_bytes; index = next_index) {
- ld(tmp1_reg, index, str1_reg);
- ld(tmp2_reg, index, str2_reg);
- cmpd(CCR0, tmp1_reg, tmp2_reg);
- bne(CCR0, Ldone_false);
- }
- if (cntval & 2) {
- lwz(tmp1_reg, index, str1_reg);
- lwz(tmp2_reg, index, str2_reg);
- cmpw(CCR0, tmp1_reg, tmp2_reg);
- bne(CCR0, Ldone_false);
- index += 4;
- }
- if (cntval & 1) {
- lhz(tmp1_reg, index, str1_reg);
- lhz(tmp2_reg, index, str2_reg);
- cmpw(CCR0, tmp1_reg, tmp2_reg);
- bne(CCR0, Ldone_false);
- }
- // fallthrough: true
- } else {
- Label Lloop;
- Register index_reg = tmp1_reg;
- const int loopcnt = cntval/4;
- assert(loopcnt > 0, "must be");
- // Offset 0 should be 32 byte aligned.
- //2:
- dcbtct(str1_reg, 0x00); // Indicate R/O access to str1.
- dcbtct(str2_reg, 0x00); // Indicate R/O access to str2.
- li(tmp2_reg, loopcnt);
- li(index_reg, 0); // init
- li(result_reg, 0); // assume false
- mtctr(tmp2_reg);
- //8:
- bind(Lloop);
- ldx(R0, str1_reg, index_reg);
- ldx(tmp2_reg, str2_reg, index_reg);
- cmpd(CCR0, R0, tmp2_reg);
- bne(CCR0, Ldone_false); // Unequal char pair found -> done.
- addi(index_reg, index_reg, 4*sizeof(jchar));
- bdnz(Lloop);
- //14:
- if (cntval & 2) {
- lwzx(R0, str1_reg, index_reg);
- lwzx(tmp2_reg, str2_reg, index_reg);
- cmpw(CCR0, R0, tmp2_reg);
- bne(CCR0, Ldone_false);
- if (cntval & 1) addi(index_reg, index_reg, 2*sizeof(jchar));
- }
- if (cntval & 1) {
- lhzx(R0, str1_reg, index_reg);
- lhzx(tmp2_reg, str2_reg, index_reg);
- cmpw(CCR0, R0, tmp2_reg);
- bne(CCR0, Ldone_false);
- }
- // fallthru: true
- }
- li(result_reg, 1);
- bind(Ldone_false);
-}
-
#endif // Compiler2
// Helpers for Intrinsic Emitters
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -431,10 +431,81 @@
MemBarAcq = 2,
MemBarFenceAfter = 4 // use powers of 2
};
+ private:
+ // Helper functions for word/sub-word atomics.
+ void atomic_get_and_modify_generic(Register dest_current_value, Register exchange_value,
+ Register addr_base, Register tmp1, Register tmp2, Register tmp3,
+ bool cmpxchgx_hint, bool is_add, int size);
+ void cmpxchg_loop_body(ConditionRegister flag, Register dest_current_value,
+ Register compare_value, Register exchange_value,
+ Register addr_base, Register tmp1, Register tmp2,
+ Label &retry, Label &failed, bool cmpxchgx_hint, int size);
+ void cmpxchg_generic(ConditionRegister flag,
+ Register dest_current_value, Register compare_value, Register exchange_value, Register addr_base,
+ Register tmp1, Register tmp2,
+ int semantics, bool cmpxchgx_hint, Register int_flag_success, bool contention_hint, bool weak, int size);
+ public:
+ // Temps and addr_base are killed if processor does not support Power 8 instructions.
+ // Result will be sign extended.
+ void getandsetb(Register dest_current_value, Register exchange_value, Register addr_base,
+ Register tmp1, Register tmp2, Register tmp3, bool cmpxchgx_hint) {
+ atomic_get_and_modify_generic(dest_current_value, exchange_value, addr_base, tmp1, tmp2, tmp3, cmpxchgx_hint, false, 1);
+ }
+ // Temps and addr_base are killed if processor does not support Power 8 instructions.
+ // Result will be sign extended.
+ void getandseth(Register dest_current_value, Register exchange_value, Register addr_base,
+ Register tmp1, Register tmp2, Register tmp3, bool cmpxchgx_hint) {
+ atomic_get_and_modify_generic(dest_current_value, exchange_value, addr_base, tmp1, tmp2, tmp3, cmpxchgx_hint, false, 2);
+ }
+ void getandsetw(Register dest_current_value, Register exchange_value, Register addr_base,
+ bool cmpxchgx_hint) {
+ atomic_get_and_modify_generic(dest_current_value, exchange_value, addr_base, noreg, noreg, noreg, cmpxchgx_hint, false, 4);
+ }
+ void getandsetd(Register dest_current_value, Register exchange_value, Register addr_base,
+ bool cmpxchgx_hint);
+ // tmp2/3 and addr_base are killed if processor does not support Power 8 instructions (tmp1 is always needed).
+ // Result will be sign extended.
+ void getandaddb(Register dest_current_value, Register inc_value, Register addr_base,
+ Register tmp1, Register tmp2, Register tmp3, bool cmpxchgx_hint) {
+ atomic_get_and_modify_generic(dest_current_value, inc_value, addr_base, tmp1, tmp2, tmp3, cmpxchgx_hint, true, 1);
+ }
+ // tmp2/3 and addr_base are killed if processor does not support Power 8 instructions (tmp1 is always needed).
+ // Result will be sign extended.
+ void getandaddh(Register dest_current_value, Register inc_value, Register addr_base,
+ Register tmp1, Register tmp2, Register tmp3, bool cmpxchgx_hint) {
+ atomic_get_and_modify_generic(dest_current_value, inc_value, addr_base, tmp1, tmp2, tmp3, cmpxchgx_hint, true, 2);
+ }
+ void getandaddw(Register dest_current_value, Register inc_value, Register addr_base,
+ Register tmp1, bool cmpxchgx_hint) {
+ atomic_get_and_modify_generic(dest_current_value, inc_value, addr_base, tmp1, noreg, noreg, cmpxchgx_hint, true, 4);
+ }
+ void getandaddd(Register dest_current_value, Register exchange_value, Register addr_base,
+ Register tmp, bool cmpxchgx_hint);
+ // Temps, addr_base and exchange_value are killed if processor does not support Power 8 instructions.
+ // compare_value must be at least 32 bit sign extended. Result will be sign extended.
+ void cmpxchgb(ConditionRegister flag,
+ Register dest_current_value, Register compare_value, Register exchange_value, Register addr_base,
+ Register tmp1, Register tmp2, int semantics, bool cmpxchgx_hint = false,
+ Register int_flag_success = noreg, bool contention_hint = false, bool weak = false) {
+ cmpxchg_generic(flag, dest_current_value, compare_value, exchange_value, addr_base, tmp1, tmp2,
+ semantics, cmpxchgx_hint, int_flag_success, contention_hint, weak, 1);
+ }
+ // Temps, addr_base and exchange_value are killed if processor does not support Power 8 instructions.
+ // compare_value must be at least 32 bit sign extended. Result will be sign extended.
+ void cmpxchgh(ConditionRegister flag,
+ Register dest_current_value, Register compare_value, Register exchange_value, Register addr_base,
+ Register tmp1, Register tmp2, int semantics, bool cmpxchgx_hint = false,
+ Register int_flag_success = noreg, bool contention_hint = false, bool weak = false) {
+ cmpxchg_generic(flag, dest_current_value, compare_value, exchange_value, addr_base, tmp1, tmp2,
+ semantics, cmpxchgx_hint, int_flag_success, contention_hint, weak, 2);
+ }
void cmpxchgw(ConditionRegister flag,
Register dest_current_value, Register compare_value, Register exchange_value, Register addr_base,
int semantics, bool cmpxchgx_hint = false,
- Register int_flag_success = noreg, bool contention_hint = false, bool weak = false);
+ Register int_flag_success = noreg, bool contention_hint = false, bool weak = false) {
+ cmpxchg_generic(flag, dest_current_value, compare_value, exchange_value, addr_base, noreg, noreg,
+ semantics, cmpxchgx_hint, int_flag_success, contention_hint, weak, 4);
+ }
void cmpxchgd(ConditionRegister flag,
Register dest_current_value, RegisterOrConstant compare_value, Register exchange_value,
Register addr_base, int semantics, bool cmpxchgx_hint = false,
@@ -717,23 +788,6 @@
Register needle, jchar needleChar, Register tmp1, Register tmp2, bool is_byte);
void has_negatives(Register src, Register cnt, Register result, Register tmp1, Register tmp2);
-
- // Intrinsics for non-CompactStrings
- // Needle of length 1.
- void string_indexof_1(Register result, Register haystack, Register haycnt,
- Register needle, jchar needleChar,
- Register tmp1, Register tmp2);
- // General indexof, eventually with constant needle length.
- void string_indexof(Register result, Register haystack, Register haycnt,
- Register needle, ciTypeArray* needle_values, Register needlecnt, int needlecntval,
- Register tmp1, Register tmp2, Register tmp3, Register tmp4);
- void string_compare(Register str1_reg, Register str2_reg, Register cnt1_reg, Register cnt2_reg,
- Register result_reg, Register tmp_reg);
- void char_arrays_equals(Register str1_reg, Register str2_reg, Register cnt_reg, Register result_reg,
- Register tmp1_reg, Register tmp2_reg, Register tmp3_reg, Register tmp4_reg,
- Register tmp5_reg);
- void char_arrays_equalsImm(Register str1_reg, Register str2_reg, int cntval, Register result_reg,
- Register tmp1_reg, Register tmp2_reg);
#endif
// Emitters for BigInteger.multiplyToLen intrinsic.
--- a/hotspot/src/cpu/ppc/vm/ppc.ad Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad Fri Jul 01 16:50:34 2016 -0700
@@ -965,41 +965,9 @@
// is the number of bytes (not instructions) which will be inserted before
// the instruction. The padding must match the size of a NOP instruction.
-int string_indexOf_imm1_charNode::compute_padding(int current_offset) const {
- return (3*4-current_offset)&31; // see MacroAssembler::string_indexof_1
-}
-
-int string_indexOf_imm1Node::compute_padding(int current_offset) const {
- return (3*4-current_offset)&31; // see MacroAssembler::string_indexof_1
-}
-
-int string_indexOfCharNode::compute_padding(int current_offset) const {
- return (3*4-current_offset)&31; // see MacroAssembler::string_indexof_1
-}
-
-int string_indexOf_immNode::compute_padding(int current_offset) const {
- return (3*4-current_offset)&31; // see MacroAssembler::string_indexof(constant needlecount)
-}
-
-int string_indexOfNode::compute_padding(int current_offset) const {
- return (1*4-current_offset)&31; // see MacroAssembler::string_indexof(variable needlecount)
-}
-
-int string_compareNode::compute_padding(int current_offset) const {
- return (2*4-current_offset)&31; // see MacroAssembler::string_compare
-}
-
-int string_equals_immNode::compute_padding(int current_offset) const {
- if (opnd_array(3)->constant() < 16) return 0; // For strlen < 16 no nops because loop completely unrolled
- return (2*4-current_offset)&31; // Genral case - see MacroAssembler::char_arrays_equalsImm
-}
-
-int string_equalsNode::compute_padding(int current_offset) const {
- return (7*4-current_offset)&31; // see MacroAssembler::char_arrays_equals
-}
-
int inlineCallClearArrayNode::compute_padding(int current_offset) const {
- return (2*4-current_offset)&31; // see MacroAssembler::clear_memory_doubleword
+ int desired_padding = (2*4-current_offset)&31; // see MacroAssembler::clear_memory_doubleword
+ return (desired_padding <= 3*4) ? desired_padding : 0;
}
//=============================================================================
@@ -3064,121 +3032,6 @@
__ bind(done);
%}
- // New atomics.
- enc_class enc_GetAndAddI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src) %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
-
- MacroAssembler _masm(&cbuf);
- Register Rtmp = R0;
- Register Rres = $res$$Register;
- Register Rsrc = $src$$Register;
- Register Rptr = $mem_ptr$$Register;
- bool RegCollision = (Rres == Rsrc) || (Rres == Rptr);
- Register Rold = RegCollision ? Rtmp : Rres;
-
- Label Lretry;
- __ bind(Lretry);
- __ lwarx(Rold, Rptr, MacroAssembler::cmpxchgx_hint_atomic_update());
- __ add(Rtmp, Rsrc, Rold);
- __ stwcx_(Rtmp, Rptr);
- if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- __ bne_predict_not_taken(CCR0, Lretry);
- } else {
- __ bne( CCR0, Lretry);
- }
- if (RegCollision) __ subf(Rres, Rsrc, Rtmp);
- if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
- __ isync();
- } else {
- __ sync();
- }
- %}
-
- enc_class enc_GetAndAddL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src) %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
-
- MacroAssembler _masm(&cbuf);
- Register Rtmp = R0;
- Register Rres = $res$$Register;
- Register Rsrc = $src$$Register;
- Register Rptr = $mem_ptr$$Register;
- bool RegCollision = (Rres == Rsrc) || (Rres == Rptr);
- Register Rold = RegCollision ? Rtmp : Rres;
-
- Label Lretry;
- __ bind(Lretry);
- __ ldarx(Rold, Rptr, MacroAssembler::cmpxchgx_hint_atomic_update());
- __ add(Rtmp, Rsrc, Rold);
- __ stdcx_(Rtmp, Rptr);
- if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- __ bne_predict_not_taken(CCR0, Lretry);
- } else {
- __ bne( CCR0, Lretry);
- }
- if (RegCollision) __ subf(Rres, Rsrc, Rtmp);
- if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
- __ isync();
- } else {
- __ sync();
- }
- %}
-
- enc_class enc_GetAndSetI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src) %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
-
- MacroAssembler _masm(&cbuf);
- Register Rtmp = R0;
- Register Rres = $res$$Register;
- Register Rsrc = $src$$Register;
- Register Rptr = $mem_ptr$$Register;
- bool RegCollision = (Rres == Rsrc) || (Rres == Rptr);
- Register Rold = RegCollision ? Rtmp : Rres;
-
- Label Lretry;
- __ bind(Lretry);
- __ lwarx(Rold, Rptr, MacroAssembler::cmpxchgx_hint_atomic_update());
- __ stwcx_(Rsrc, Rptr);
- if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- __ bne_predict_not_taken(CCR0, Lretry);
- } else {
- __ bne( CCR0, Lretry);
- }
- if (RegCollision) __ mr(Rres, Rtmp);
- if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
- __ isync();
- } else {
- __ sync();
- }
- %}
-
- enc_class enc_GetAndSetL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src) %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
-
- MacroAssembler _masm(&cbuf);
- Register Rtmp = R0;
- Register Rres = $res$$Register;
- Register Rsrc = $src$$Register;
- Register Rptr = $mem_ptr$$Register;
- bool RegCollision = (Rres == Rsrc) || (Rres == Rptr);
- Register Rold = RegCollision ? Rtmp : Rres;
-
- Label Lretry;
- __ bind(Lretry);
- __ ldarx(Rold, Rptr, MacroAssembler::cmpxchgx_hint_atomic_update());
- __ stdcx_(Rsrc, Rptr);
- if (UseStaticBranchPredictionInCompareAndSwapPPC64) {
- __ bne_predict_not_taken(CCR0, Lretry);
- } else {
- __ bne( CCR0, Lretry);
- }
- if (RegCollision) __ mr(Rres, Rtmp);
- if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
- __ isync();
- } else {
- __ sync();
- }
- %}
-
// This enc_class is needed so that scheduler gets proper
// input mapping for latency computation.
enc_class enc_andc(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
@@ -5416,7 +5269,7 @@
%}
// Match loading integer and casting it to long.
-instruct loadI2L(iRegLdst dst, memory mem) %{
+instruct loadI2L(iRegLdst dst, memoryAlg4 mem) %{
match(Set dst (ConvI2L (LoadI mem)));
predicate(_kids[0]->_leaf->as_Load()->is_unordered());
ins_cost(MEMORY_REF_COST);
@@ -5432,7 +5285,7 @@
%}
// Match loading integer and casting it to long - acquire.
-instruct loadI2L_ac(iRegLdst dst, memory mem) %{
+instruct loadI2L_ac(iRegLdst dst, memoryAlg4 mem) %{
match(Set dst (ConvI2L (LoadI mem)));
ins_cost(3*MEMORY_REF_COST);
@@ -7575,11 +7428,90 @@
// Strong versions:
+instruct compareAndSwapB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndSwapB mem_ptr (Binary src1 src2)));
+ predicate(VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ $res$$Register, true);
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndSwapB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndSwapB mem_ptr (Binary src1 src2)));
+ predicate(!VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ $res$$Register, true);
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndSwapS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndSwapS mem_ptr (Binary src1 src2)));
+ predicate(VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ $res$$Register, true);
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndSwapS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndSwapS mem_ptr (Binary src1 src2)));
+ predicate(!VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ $res$$Register, true);
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
instruct compareAndSwapI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
match(Set res (CompareAndSwapI mem_ptr (Binary src1 src2)));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7597,9 +7529,8 @@
instruct compareAndSwapN_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2, flagsRegCR0 cr0) %{
match(Set res (CompareAndSwapN mem_ptr (Binary src1 src2)));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7617,9 +7548,8 @@
instruct compareAndSwapL_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
match(Set res (CompareAndSwapL mem_ptr (Binary src1 src2)));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7637,9 +7567,8 @@
instruct compareAndSwapP_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2, flagsRegCR0 cr0) %{
match(Set res (CompareAndSwapP mem_ptr (Binary src1 src2)));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7657,12 +7586,131 @@
// Weak versions:
+instruct weakCompareAndSwapB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
+ predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "weak CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ MacroAssembler::MemBarNone,
+ MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct weakCompareAndSwapB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
+ match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
+ predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && !VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "weak CMPXCHGB $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ MacroAssembler::MemBarNone,
+ MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct weakCompareAndSwapB_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
+ predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "weak CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
+ MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct weakCompareAndSwapB4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
+ match(Set res (WeakCompareAndSwapB mem_ptr (Binary src1 src2)));
+ predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && !VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "weak CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
+ MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct weakCompareAndSwapS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
+ predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "weak CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ MacroAssembler::MemBarNone,
+ MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct weakCompareAndSwapS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
+ match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
+ predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && !VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "weak CMPXCHGH $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ MacroAssembler::MemBarNone,
+ MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct weakCompareAndSwapS_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
+ predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "weak CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
+ MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct weakCompareAndSwapS4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, iRegIdst tmp2, flagsRegCR0 cr0) %{
+ match(Set res (WeakCompareAndSwapS mem_ptr (Binary src1 src2)));
+ predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && !VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0); // TEMP_DEF to avoid jump
+ format %{ "weak CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as bool" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, $tmp2$$Register,
+ support_IRIW_for_not_multiple_copy_atomic_cpu ? MacroAssembler::MemBarAcq : MacroAssembler::MemBarFenceAfter,
+ MacroAssembler::cmpxchgx_hint_atomic_update(), $res$$Register, true, /*weak*/ true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
instruct weakCompareAndSwapI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
match(Set res (WeakCompareAndSwapI mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7676,9 +7724,8 @@
instruct weakCompareAndSwapI_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
match(Set res (WeakCompareAndSwapI mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7694,9 +7741,8 @@
instruct weakCompareAndSwapN_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2, flagsRegCR0 cr0) %{
match(Set res (WeakCompareAndSwapN mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGW $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7710,9 +7756,8 @@
instruct weakCompareAndSwapN_acq_regP_regN_regN(iRegIdst res, iRegPdst mem_ptr, iRegNsrc src1, iRegNsrc src2, flagsRegCR0 cr0) %{
match(Set res (WeakCompareAndSwapN mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7728,9 +7773,8 @@
instruct weakCompareAndSwapL_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
match(Set res (WeakCompareAndSwapL mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7745,9 +7789,8 @@
instruct weakCompareAndSwapL_acq_regP_regL_regL(iRegIdst res, iRegPdst mem_ptr, iRegLsrc src1, iRegLsrc src2, flagsRegCR0 cr0) %{
match(Set res (WeakCompareAndSwapL mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as bool" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7763,9 +7806,8 @@
instruct weakCompareAndSwapP_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2, flagsRegCR0 cr0) %{
match(Set res (WeakCompareAndSwapP mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGD $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7779,9 +7821,8 @@
instruct weakCompareAndSwapP_acq_regP_regP_regP(iRegIdst res, iRegPdst mem_ptr, iRegPsrc src1, iRegPsrc src2, flagsRegCR0 cr0) %{
match(Set res (WeakCompareAndSwapP mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0); // TEMP_DEF to avoid jump
format %{ "weak CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as bool; ptr" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7796,12 +7837,155 @@
// CompareAndExchange
+instruct compareAndExchangeB_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
+ predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0);
+ format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as int" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ noreg, true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndExchangeB4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
+ predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && !VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
+ format %{ "CMPXCHGB $res, $mem_ptr, $src1, $src2; as int" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ noreg, true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndExchangeB_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
+ predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0);
+ format %{ "CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as int" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ noreg, true);
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndExchangeB4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndExchangeB mem_ptr (Binary src1 src2)));
+ predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && !VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
+ format %{ "CMPXCHGB acq $res, $mem_ptr, $src1, $src2; as int" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgb(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ noreg, true);
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndExchangeS_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
+ predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0);
+ format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as int" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ noreg, true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndExchangeS4_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
+ predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst && !VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
+ format %{ "CMPXCHGH $res, $mem_ptr, $src1, $src2; as int" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ noreg, true);
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndExchangeS_acq_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
+ predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0);
+ format %{ "CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as int" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, noreg, noreg,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ noreg, true);
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct compareAndExchangeS4_acq_regP_regI_regI(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src1, rarg4RegI src2, iRegIdst tmp1, flagsRegCR0 cr0) %{
+ match(Set res (CompareAndExchangeS mem_ptr (Binary src1 src2)));
+ predicate((((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst) && !VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL src2, USE_KILL mem_ptr, TEMP tmp1, TEMP cr0);
+ format %{ "CMPXCHGH acq $res, $mem_ptr, $src1, $src2; as int" %}
+ ins_encode %{
+ // TODO: PPC port $archOpcode(ppc64Opcode_compound);
+ // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
+ __ cmpxchgh(CCR0, $res$$Register, $src1$$Register, $src2$$Register, $mem_ptr$$Register, $tmp1$$Register, R0,
+ MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+ noreg, true);
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ // isync would be sufficient in case of CompareAndExchangeAcquire, but we currently don't optimize for that.
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
instruct compareAndExchangeI_regP_regI_regI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src1, iRegIsrc src2, flagsRegCR0 cr0) %{
match(Set res (CompareAndExchangeI mem_ptr (Binary src1 src2)));
predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as int" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7817,7 +8001,6 @@
predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as int" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7839,7 +8022,6 @@
predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGW $res, $mem_ptr, $src1, $src2; as narrow oop" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7855,7 +8037,6 @@
predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGW acq $res, $mem_ptr, $src1, $src2; as narrow oop" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7877,7 +8058,6 @@
predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as long" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7893,7 +8073,6 @@
predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as long" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7915,7 +8094,6 @@
predicate(((CompareAndSwapNode*)n)->order() != MemNode::acquire && ((CompareAndSwapNode*)n)->order() != MemNode::seqcst);
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGD $res, $mem_ptr, $src1, $src2; as ptr; ptr" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7931,7 +8109,6 @@
predicate(((CompareAndSwapNode*)n)->order() == MemNode::acquire || ((CompareAndSwapNode*)n)->order() == MemNode::seqcst);
effect(TEMP_DEF res, TEMP cr0);
format %{ "CMPXCHGD acq $res, $mem_ptr, $src1, $src2; as ptr; ptr" %}
- // Variable size: instruction count smaller if regs are disjoint.
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_compound);
// CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
@@ -7950,57 +8127,235 @@
// Special RMW
+instruct getAndAddB(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
+ match(Set res (GetAndAddB mem_ptr src));
+ predicate(VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0);
+ format %{ "GetAndAddB $res, $mem_ptr, $src" %}
+ ins_encode %{
+ __ getandaddb($res$$Register, $src$$Register, $mem_ptr$$Register,
+ R0, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct getAndAddB4(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src, iRegIsrc tmp1, iRegIsrc tmp2, flagsRegCR0 cr0) %{
+ match(Set res (GetAndAddB mem_ptr src));
+ predicate(!VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0);
+ format %{ "GetAndAddB $res, $mem_ptr, $src" %}
+ ins_encode %{
+ __ getandaddb($res$$Register, $src$$Register, $mem_ptr$$Register,
+ R0, $tmp1$$Register, $tmp2$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct getAndAddS(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
+ match(Set res (GetAndAddS mem_ptr src));
+ predicate(VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0);
+ format %{ "GetAndAddS $res, $mem_ptr, $src" %}
+ ins_encode %{
+ __ getandaddh($res$$Register, $src$$Register, $mem_ptr$$Register,
+ R0, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct getAndAddS4(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src, iRegIsrc tmp1, iRegIsrc tmp2, flagsRegCR0 cr0) %{
+ match(Set res (GetAndAddS mem_ptr src));
+ predicate(!VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0);
+ format %{ "GetAndAddS $res, $mem_ptr, $src" %}
+ ins_encode %{
+ __ getandaddh($res$$Register, $src$$Register, $mem_ptr$$Register,
+ R0, $tmp1$$Register, $tmp2$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
instruct getAndAddI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
match(Set res (GetAndAddI mem_ptr src));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0);
format %{ "GetAndAddI $res, $mem_ptr, $src" %}
- // Variable size: instruction count smaller if regs are disjoint.
- ins_encode( enc_GetAndAddI(res, mem_ptr, src) );
+ ins_encode %{
+ __ getandaddw($res$$Register, $src$$Register, $mem_ptr$$Register,
+ R0, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
ins_pipe(pipe_class_default);
%}
instruct getAndAddL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src, flagsRegCR0 cr0) %{
match(Set res (GetAndAddL mem_ptr src));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0);
format %{ "GetAndAddL $res, $mem_ptr, $src" %}
- // Variable size: instruction count smaller if regs are disjoint.
- ins_encode( enc_GetAndAddL(res, mem_ptr, src) );
+ ins_encode %{
+ __ getandaddd($res$$Register, $src$$Register, $mem_ptr$$Register,
+ R0, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct getAndSetB(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
+ match(Set res (GetAndSetB mem_ptr src));
+ predicate(VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0);
+ format %{ "GetAndSetB $res, $mem_ptr, $src" %}
+ ins_encode %{
+ __ getandsetb($res$$Register, $src$$Register, $mem_ptr$$Register,
+ noreg, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct getAndSetB4(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src, iRegIsrc tmp1, iRegIsrc tmp2, flagsRegCR0 cr0) %{
+ match(Set res (GetAndSetB mem_ptr src));
+ predicate(!VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0);
+ format %{ "GetAndSetB $res, $mem_ptr, $src" %}
+ ins_encode %{
+ __ getandsetb($res$$Register, $src$$Register, $mem_ptr$$Register,
+ R0, $tmp1$$Register, $tmp2$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct getAndSetS(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
+ match(Set res (GetAndSetS mem_ptr src));
+ predicate(VM_Version::has_lqarx());
+ effect(TEMP_DEF res, TEMP cr0);
+ format %{ "GetAndSetS $res, $mem_ptr, $src" %}
+ ins_encode %{
+ __ getandseth($res$$Register, $src$$Register, $mem_ptr$$Register,
+ noreg, noreg, noreg, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
+ ins_pipe(pipe_class_default);
+%}
+
+instruct getAndSetS4(iRegIdst res, rarg3RegP mem_ptr, iRegIsrc src, iRegIsrc tmp1, iRegIsrc tmp2, flagsRegCR0 cr0) %{
+ match(Set res (GetAndSetS mem_ptr src));
+ predicate(!VM_Version::has_lqarx());
+ effect(TEMP_DEF res, USE_KILL mem_ptr, TEMP tmp1, TEMP tmp2, TEMP cr0);
+ format %{ "GetAndSetS $res, $mem_ptr, $src" %}
+ ins_encode %{
+ __ getandseth($res$$Register, $src$$Register, $mem_ptr$$Register,
+ R0, $tmp1$$Register, $tmp2$$Register, MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
ins_pipe(pipe_class_default);
%}
instruct getAndSetI(iRegIdst res, iRegPdst mem_ptr, iRegIsrc src, flagsRegCR0 cr0) %{
match(Set res (GetAndSetI mem_ptr src));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0);
format %{ "GetAndSetI $res, $mem_ptr, $src" %}
- // Variable size: instruction count smaller if regs are disjoint.
- ins_encode( enc_GetAndSetI(res, mem_ptr, src) );
+ ins_encode %{
+ __ getandsetw($res$$Register, $src$$Register, $mem_ptr$$Register,
+ MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
ins_pipe(pipe_class_default);
%}
instruct getAndSetL(iRegLdst res, iRegPdst mem_ptr, iRegLsrc src, flagsRegCR0 cr0) %{
match(Set res (GetAndSetL mem_ptr src));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0);
format %{ "GetAndSetL $res, $mem_ptr, $src" %}
- // Variable size: instruction count smaller if regs are disjoint.
- ins_encode( enc_GetAndSetL(res, mem_ptr, src) );
+ ins_encode %{
+ __ getandsetd($res$$Register, $src$$Register, $mem_ptr$$Register,
+ MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
ins_pipe(pipe_class_default);
%}
instruct getAndSetP(iRegPdst res, iRegPdst mem_ptr, iRegPsrc src, flagsRegCR0 cr0) %{
match(Set res (GetAndSetP mem_ptr src));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0);
format %{ "GetAndSetP $res, $mem_ptr, $src" %}
- // Variable size: instruction count smaller if regs are disjoint.
- ins_encode( enc_GetAndSetL(res, mem_ptr, src) );
+ ins_encode %{
+ __ getandsetd($res$$Register, $src$$Register, $mem_ptr$$Register,
+ MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
ins_pipe(pipe_class_default);
%}
instruct getAndSetN(iRegNdst res, iRegPdst mem_ptr, iRegNsrc src, flagsRegCR0 cr0) %{
match(Set res (GetAndSetN mem_ptr src));
- effect(TEMP cr0);
+ effect(TEMP_DEF res, TEMP cr0);
format %{ "GetAndSetN $res, $mem_ptr, $src" %}
- // Variable size: instruction count smaller if regs are disjoint.
- ins_encode( enc_GetAndSetI(res, mem_ptr, src) );
+ ins_encode %{
+ __ getandsetw($res$$Register, $src$$Register, $mem_ptr$$Register,
+ MacroAssembler::cmpxchgx_hint_atomic_update());
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ __ isync();
+ } else {
+ __ sync();
+ }
+ %}
ins_pipe(pipe_class_default);
%}
@@ -11360,7 +11715,7 @@
effect(USE_KILL cnt, USE_KILL base, KILL ctr);
ins_cost(MEMORY_REF_COST);
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
+ ins_alignment(4); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
format %{ "ClearArray $cnt, $base" %}
ins_encode %{
@@ -11686,7 +12041,6 @@
flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
effect(TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
- predicate(CompactStrings);
ins_cost(180);
format %{ "String IndexOfChar $haystack[0..$haycnt], $ch"
@@ -11948,283 +12302,6 @@
%}
-// String_IndexOf for needle of length 1.
-//
-// Match needle into immediate operands: no loadConP node needed. Saves one
-// register and two instructions over string_indexOf_imm1Node.
-//
-// Assumes register result differs from all input registers.
-//
-// Preserves registers haystack, haycnt
-// Kills registers tmp1, tmp2
-// Defines registers result
-//
-// Use dst register classes if register gets killed, as it is the case for tmp registers!
-//
-// Unfortunately this does not match too often. In many situations the AddP is used
-// by several nodes, even several StrIndexOf nodes, breaking the match tree.
-instruct string_indexOf_imm1_char(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
- immP needleImm, immL offsetImm, immI_1 needlecntImm,
- iRegIdst tmp1, iRegIdst tmp2,
- flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
- predicate(SpecialStringIndexOf && !CompactStrings); // type check implicit by parameter type, See Matcher::match_rule_supported
- match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
-
- effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
-
- ins_cost(150);
- format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
- "-> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
-
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted
- ins_encode %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
- immPOper *needleOper = (immPOper *)$needleImm;
- const TypeOopPtr *t = needleOper->type()->isa_oopptr();
- ciTypeArray* needle_values = t->const_oop()->as_type_array(); // Pointer to live char *
- jchar chr;
- if (java_lang_String::has_coder_field()) {
- // New compact strings byte array strings
-#ifdef VM_LITTLE_ENDIAN
- chr = (((jchar)(unsigned char)needle_values->element_value(1).as_byte()) << 8) |
- ((jchar)(unsigned char)needle_values->element_value(0).as_byte());
-#else
- chr = (((jchar)(unsigned char)needle_values->element_value(0).as_byte()) << 8) |
- ((jchar)(unsigned char)needle_values->element_value(1).as_byte());
-#endif
- } else {
- // Old char array strings
- chr = needle_values->char_at(0);
- }
- __ string_indexof_1($result$$Register,
- $haystack$$Register, $haycnt$$Register,
- R0, chr,
- $tmp1$$Register, $tmp2$$Register);
- %}
- ins_pipe(pipe_class_compare);
-%}
-
-// String_IndexOf for needle of length 1.
-//
-// Special case requires less registers and emits less instructions.
-//
-// Assumes register result differs from all input registers.
-//
-// Preserves registers haystack, haycnt
-// Kills registers tmp1, tmp2, needle
-// Defines registers result
-//
-// Use dst register classes if register gets killed, as it is the case for tmp registers!
-instruct string_indexOf_imm1(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
- rscratch2RegP needle, immI_1 needlecntImm,
- iRegIdst tmp1, iRegIdst tmp2,
- flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
- match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
- effect(USE_KILL needle, /* TDEF needle, */ TEMP_DEF result,
- TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
- // Required for EA: check if it is still a type_array.
- predicate(SpecialStringIndexOf && !CompactStrings &&
- n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
- n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
- ins_cost(180);
-
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
-
- format %{ "String IndexOf SCL1 $haystack[0..$haycnt], $needle[0..$needlecntImm]"
- " -> $result \t// KILL $haycnt, $needle, $tmp1, $tmp2, $cr0, $cr1" %}
- ins_encode %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
- Node *ndl = in(operand_index($needle)); // The node that defines needle.
- ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
- guarantee(needle_values, "sanity");
- jchar chr;
- if (java_lang_String::has_coder_field()) {
- // New compact strings byte array strings
-#ifdef VM_LITTLE_ENDIAN
- chr = (((jchar)(unsigned char)needle_values->element_value(1).as_byte()) << 8) |
- ((jchar)(unsigned char)needle_values->element_value(0).as_byte());
-#else
- chr = (((jchar)(unsigned char)needle_values->element_value(0).as_byte()) << 8) |
- ((jchar)(unsigned char)needle_values->element_value(1).as_byte());
-#endif
- } else {
- // Old char array strings
- chr = needle_values->char_at(0);
- }
- __ string_indexof_1($result$$Register,
- $haystack$$Register, $haycnt$$Register,
- R0, chr,
- $tmp1$$Register, $tmp2$$Register);
- %}
- ins_pipe(pipe_class_compare);
-%}
-
-// String_IndexOfChar
-//
-// Assumes register result differs from all input registers.
-//
-// Preserves registers haystack, haycnt
-// Kills registers tmp1, tmp2
-// Defines registers result
-//
-// Use dst register classes if register gets killed, as it is the case for tmp registers!
-instruct string_indexOfChar(iRegIdst result, iRegPsrc haystack, iRegIsrc haycnt,
- iRegIsrc ch, iRegIdst tmp1, iRegIdst tmp2,
- flagsRegCR0 cr0, flagsRegCR1 cr1, regCTR ctr) %{
- match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
- effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1, KILL ctr);
- predicate(SpecialStringIndexOf && !CompactStrings);
- ins_cost(180);
-
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
-
- format %{ "String IndexOfChar $haystack[0..$haycnt], $ch"
- " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $cr0, $cr1" %}
- ins_encode %{
- __ string_indexof_1($result$$Register,
- $haystack$$Register, $haycnt$$Register,
- $ch$$Register, 0 /* this is not used if the character is already in a register */,
- $tmp1$$Register, $tmp2$$Register);
- %}
- ins_pipe(pipe_class_compare);
-%}
-
-// String_IndexOf.
-//
-// Length of needle as immediate. This saves instruction loading constant needle
-// length.
-// @@@ TODO Specify rules for length < 8 or so, and roll out comparison of needle
-// completely or do it in vector instruction. This should save registers for
-// needlecnt and needle.
-//
-// Assumes register result differs from all input registers.
-// Overwrites haycnt, needlecnt.
-// Use dst register classes if register gets killed, as it is the case for tmp registers!
-instruct string_indexOf_imm(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt,
- iRegPsrc needle, uimmI15 needlecntImm,
- iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
- flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
- match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
- effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP_DEF result,
- TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, KILL cr0, KILL cr1, KILL cr6, KILL ctr);
- // Required for EA: check if it is still a type_array.
- predicate(SpecialStringIndexOf && !CompactStrings && n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
- n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop()->is_type_array());
- ins_cost(250);
-
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
-
- format %{ "String IndexOf SCL $haystack[0..$haycnt], $needle[0..$needlecntImm]"
- " -> $result \t// KILL $haycnt, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5, $cr0, $cr1" %}
- ins_encode %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
- Node *ndl = in(operand_index($needle)); // The node that defines needle.
- ciTypeArray* needle_values = ndl->bottom_type()->is_aryptr()->const_oop()->as_type_array();
-
- __ string_indexof($result$$Register,
- $haystack$$Register, $haycnt$$Register,
- $needle$$Register, needle_values, $tmp5$$Register, $needlecntImm$$constant,
- $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register);
- %}
- ins_pipe(pipe_class_compare);
-%}
-
-// StrIndexOf node.
-//
-// Assumes register result differs from all input registers.
-// Overwrites haycnt, needlecnt.
-// Use dst register classes if register gets killed, as it is the case for tmp registers!
-instruct string_indexOf(iRegIdst result, iRegPsrc haystack, rscratch1RegI haycnt, iRegPsrc needle, rscratch2RegI needlecnt,
- iRegLdst tmp1, iRegLdst tmp2, iRegLdst tmp3, iRegLdst tmp4,
- flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
- match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
- effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
- TEMP_DEF result,
- TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr0, KILL cr1, KILL cr6, KILL ctr);
- predicate(SpecialStringIndexOf && !CompactStrings); // See Matcher::match_rule_supported.
- ins_cost(300);
-
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
-
- format %{ "String IndexOf $haystack[0..$haycnt], $needle[0..$needlecnt]"
- " -> $result \t// KILL $haycnt, $needlecnt, $tmp1, $tmp2, $tmp3, $tmp4, $cr0, $cr1" %}
- ins_encode %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
- __ string_indexof($result$$Register,
- $haystack$$Register, $haycnt$$Register,
- $needle$$Register, NULL, $needlecnt$$Register, 0, // needlecnt not constant.
- $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register);
- %}
- ins_pipe(pipe_class_compare);
-%}
-
-// String equals with immediate.
-instruct string_equals_imm(iRegPsrc str1, iRegPsrc str2, uimmI15 cntImm, iRegIdst result,
- iRegPdst tmp1, iRegPdst tmp2,
- flagsRegCR0 cr0, flagsRegCR6 cr6, regCTR ctr) %{
- match(Set result (StrEquals (Binary str1 str2) cntImm));
- effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2,
- KILL cr0, KILL cr6, KILL ctr);
- predicate(SpecialStringEquals && !CompactStrings); // See Matcher::match_rule_supported.
- ins_cost(250);
-
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
-
- format %{ "String Equals SCL [0..$cntImm]($str1),[0..$cntImm]($str2)"
- " -> $result \t// KILL $cr0, $cr6, $ctr, TEMP $result, $tmp1, $tmp2" %}
- ins_encode %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
- __ char_arrays_equalsImm($str1$$Register, $str2$$Register, $cntImm$$constant,
- $result$$Register, $tmp1$$Register, $tmp2$$Register);
- %}
- ins_pipe(pipe_class_compare);
-%}
-
-// String equals.
-// Use dst register classes if register gets killed, as it is the case for TEMP operands!
-instruct string_equals(iRegPsrc str1, iRegPsrc str2, iRegIsrc cnt, iRegIdst result,
- iRegPdst tmp1, iRegPdst tmp2, iRegPdst tmp3, iRegPdst tmp4, iRegPdst tmp5,
- flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
- match(Set result (StrEquals (Binary str1 str2) cnt));
- effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5,
- KILL cr0, KILL cr1, KILL cr6, KILL ctr);
- predicate(SpecialStringEquals && !CompactStrings); // See Matcher::match_rule_supported.
- ins_cost(300);
-
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
-
- format %{ "String Equals [0..$cnt]($str1),[0..$cnt]($str2) -> $result"
- " \t// KILL $cr0, $cr1, $cr6, $ctr, TEMP $result, $tmp1, $tmp2, $tmp3, $tmp4, $tmp5" %}
- ins_encode %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
- __ char_arrays_equals($str1$$Register, $str2$$Register, $cnt$$Register, $result$$Register,
- $tmp1$$Register, $tmp2$$Register, $tmp3$$Register, $tmp4$$Register, $tmp5$$Register);
- %}
- ins_pipe(pipe_class_compare);
-%}
-
-// String compare.
-// Char[] pointers are passed in.
-// Use dst register classes if register gets killed, as it is the case for TEMP operands!
-instruct string_compare(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
- iRegPdst tmp, flagsRegCR0 cr0, regCTR ctr) %{
- predicate(!CompactStrings);
- match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
- effect(USE_KILL cnt1, USE_KILL cnt2, USE_KILL str1, USE_KILL str2, TEMP_DEF result, TEMP tmp, KILL cr0, KILL ctr);
- ins_cost(300);
-
- ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
-
- format %{ "String Compare $str1[0..$cnt1], $str2[0..$cnt2] -> $result"
- " \t// TEMP $tmp, $result KILLs $str1, $cnt1, $str2, $cnt2, $cr0, $ctr" %}
- ins_encode %{
- // TODO: PPC port $archOpcode(ppc64Opcode_compound);
- __ string_compare($str1$$Register, $str2$$Register, $cnt1$$Register, $cnt2$$Register,
- $result$$Register, $tmp$$Register);
- %}
- ins_pipe(pipe_class_compare);
-%}
-
//---------- Min/Max Instructions ---------------------------------------------
instruct minI_reg_reg_Ex(iRegIdst dst, iRegIsrc src1, iRegIsrc src2) %{
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1123,7 +1123,10 @@
Register tmp3 = R8_ARG6;
Register tmp4 = R9_ARG7;
- Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9;
+ VectorSRegister tmp_vsr1 = VSR1;
+ VectorSRegister tmp_vsr2 = VSR2;
+
+ Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9, l_10;
// Don't try anything fancy if arrays don't have many elements.
__ li(tmp3, 0);
@@ -1178,6 +1181,8 @@
__ andi_(R5_ARG3, R5_ARG3, 31);
__ mtctr(tmp1);
+ if (!VM_Version::has_vsx()) {
+
__ bind(l_8);
// Use unrolled version for mass copying (copy 32 elements a time)
// Load feeding store gets zero latency on Power6, however not on Power5.
@@ -1193,7 +1198,44 @@
__ addi(R3_ARG1, R3_ARG1, 32);
__ addi(R4_ARG2, R4_ARG2, 32);
__ bdnz(l_8);
- }
+
+ } else { // Processor supports VSX, so use it to mass copy.
+
+ // Prefetch the data into the L2 cache.
+ __ dcbt(R3_ARG1, 0);
+
+ // If supported set DSCR pre-fetch to deepest.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
+ __ mtdscr(tmp2);
+ }
+
+ __ li(tmp1, 16);
+
+ // Backbranch target aligned to 32-byte. Not 16-byte align as
+ // loop contains < 8 instructions that fit inside a single
+ // i-cache sector.
+ __ align(32);
+
+ __ bind(l_10);
+ // Use loop with VSX load/store instructions to
+ // copy 32 elements a time.
+ __ lxvd2x(tmp_vsr1, 0, R3_ARG1); // Load src
+ __ stxvd2x(tmp_vsr1, 0, R4_ARG2); // Store to dst
+ __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src + 16
+ __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16
+ __ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32
+ __ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32
+ __ bdnz(l_10); // Dec CTR and loop if not zero.
+
+ // Restore DSCR pre-fetch value.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val);
+ __ mtdscr(tmp2);
+ }
+
+ } // VSX
+ } // FasterArrayCopy
__ bind(l_6);
@@ -1557,7 +1599,10 @@
Register tmp3 = R8_ARG6;
Register tmp4 = R0;
- Label l_1, l_2, l_3, l_4, l_5, l_6;
+ VectorSRegister tmp_vsr1 = VSR1;
+ VectorSRegister tmp_vsr2 = VSR2;
+
+ Label l_1, l_2, l_3, l_4, l_5, l_6, l_7;
// for short arrays, just do single element copy
__ li(tmp3, 0);
@@ -1593,6 +1638,8 @@
__ andi_(R5_ARG3, R5_ARG3, 7);
__ mtctr(tmp1);
+ if (!VM_Version::has_vsx()) {
+
__ bind(l_6);
// Use unrolled version for mass copying (copy 8 elements a time).
// Load feeding store gets zero latency on power6, however not on power 5.
@@ -1608,7 +1655,44 @@
__ addi(R3_ARG1, R3_ARG1, 32);
__ addi(R4_ARG2, R4_ARG2, 32);
__ bdnz(l_6);
- }
+
+ } else { // Processor supports VSX, so use it to mass copy.
+
+ // Prefetch the data into the L2 cache.
+ __ dcbt(R3_ARG1, 0);
+
+ // If supported set DSCR pre-fetch to deepest.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
+ __ mtdscr(tmp2);
+ }
+
+ __ li(tmp1, 16);
+
+ // Backbranch target aligned to 32-byte. Not 16-byte align as
+ // loop contains < 8 instructions that fit inside a single
+ // i-cache sector.
+ __ align(32);
+
+ __ bind(l_7);
+ // Use loop with VSX load/store instructions to
+ // copy 8 elements a time.
+ __ lxvd2x(tmp_vsr1, 0, R3_ARG1); // Load src
+ __ stxvd2x(tmp_vsr1, 0, R4_ARG2); // Store to dst
+ __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src + 16
+ __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16
+ __ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32
+ __ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32
+ __ bdnz(l_7); // Dec CTR and loop if not zero.
+
+ // Restore DSCR pre-fetch value.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val);
+ __ mtdscr(tmp2);
+ }
+
+ } // VSX
+ } // FasterArrayCopy
// copy 1 element at a time
__ bind(l_2);
@@ -1757,7 +1841,10 @@
Register tmp3 = R8_ARG6;
Register tmp4 = R0;
- Label l_1, l_2, l_3, l_4;
+ Label l_1, l_2, l_3, l_4, l_5;
+
+ VectorSRegister tmp_vsr1 = VSR1;
+ VectorSRegister tmp_vsr2 = VSR2;
{ // FasterArrayCopy
__ cmpwi(CCR0, R5_ARG3, 3);
@@ -1767,6 +1854,7 @@
__ andi_(R5_ARG3, R5_ARG3, 3);
__ mtctr(tmp1);
+ if (!VM_Version::has_vsx()) {
__ bind(l_4);
// Use unrolled version for mass copying (copy 4 elements a time).
// Load feeding store gets zero latency on Power6, however not on Power5.
@@ -1782,7 +1870,44 @@
__ addi(R3_ARG1, R3_ARG1, 32);
__ addi(R4_ARG2, R4_ARG2, 32);
__ bdnz(l_4);
- }
+
+ } else { // Processor supports VSX, so use it to mass copy.
+
+ // Prefetch the data into the L2 cache.
+ __ dcbt(R3_ARG1, 0);
+
+ // If supported set DSCR pre-fetch to deepest.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
+ __ mtdscr(tmp2);
+ }
+
+ __ li(tmp1, 16);
+
+ // Backbranch target aligned to 32-byte. Not 16-byte align as
+ // loop contains < 8 instructions that fit inside a single
+ // i-cache sector.
+ __ align(32);
+
+ __ bind(l_5);
+ // Use loop with VSX load/store instructions to
+ // copy 4 elements a time.
+ __ lxvd2x(tmp_vsr1, 0, R3_ARG1); // Load src
+ __ stxvd2x(tmp_vsr1, 0, R4_ARG2); // Store to dst
+ __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src + 16
+ __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16
+ __ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32
+ __ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32
+ __ bdnz(l_5); // Dec CTR and loop if not zero.
+
+ // Restore DSCR pre-fetch value.
+ if (VM_Version::has_mfdscr()) {
+ __ load_const_optimized(tmp2, VM_Version::_dscr_val);
+ __ mtdscr(tmp2);
+ }
+
+ } // VSX
+ } // FasterArrayCopy
// copy 1 element at a time
__ bind(l_3);
--- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -845,9 +845,40 @@
__ b(continue_entry);
}
+// See if we've got enough room on the stack for locals plus overhead below
+// JavaThread::stack_overflow_limit(). If not, throw a StackOverflowError
+// without going through the signal handler, i.e., reserved and yellow zones
+// will not be made usable. The shadow zone must suffice to handle the
+// overflow.
+//
+// Kills Rmem_frame_size, Rscratch1.
void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rmem_frame_size, Register Rscratch1) {
+ Label done;
assert_different_registers(Rmem_frame_size, Rscratch1);
- __ generate_stack_overflow_check_with_compare_and_throw(Rmem_frame_size, Rscratch1);
+
+ BLOCK_COMMENT("stack_overflow_check_with_compare {");
+ __ sub(Rmem_frame_size, R1_SP, Rmem_frame_size);
+ __ ld(Rscratch1, thread_(stack_overflow_limit));
+ __ cmpld(CCR0/*is_stack_overflow*/, Rmem_frame_size, Rscratch1);
+ __ bgt(CCR0/*is_stack_overflow*/, done);
+
+ // The stack overflows. Load target address of the runtime stub and call it.
+ assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "generated in wrong order");
+ __ load_const_optimized(Rscratch1, (StubRoutines::throw_StackOverflowError_entry()), R0);
+ __ mtctr(Rscratch1);
+ // Restore caller_sp.
+#ifdef ASSERT
+ __ ld(Rscratch1, 0, R1_SP);
+ __ ld(R0, 0, R21_sender_SP);
+ __ cmpd(CCR0, R0, Rscratch1);
+ __ asm_assert_eq("backlink", 0x547);
+#endif // ASSERT
+ __ mr(R1_SP, R21_sender_SP);
+ __ bctr();
+
+ __ align(32, 12);
+ __ bind(done);
+ BLOCK_COMMENT("} stack_overflow_check_with_compare");
}
void TemplateInterpreterGenerator::unlock_method(bool check_exceptions) {
@@ -1014,10 +1045,10 @@
// Enlarge by locals-parameters (not in case of native_call), shrink by ESP-SP-ABI48.
if (!native_call) {
- // --------------------------------------------------------------------------
- // Stack overflow check
-
- Label cont;
+ // Stack overflow check.
+ // Native calls don't need the stack size check since they have no
+ // expression stack and the arguments are already on the stack and
+ // we only add a handful of words to the stack.
__ add(R11_scratch1, parent_frame_resize, top_frame_size);
generate_stack_overflow_check(R11_scratch1, R12_scratch2);
}
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -4093,20 +4093,8 @@
__ lock_object(Rcurrent_monitor, Robj_to_lock);
// Check if there's enough space on the stack for the monitors after locking.
- Label Lskip_stack_check;
- // Optimization: If the monitors stack section is less then a std page size (4K) don't run
- // the stack check. There should be enough shadow pages to fit that in.
- __ ld(Rscratch3, 0, R1_SP);
- __ sub(Rscratch3, Rscratch3, R26_monitor);
- __ cmpdi(CCR0, Rscratch3, 4*K);
- __ blt(CCR0, Lskip_stack_check);
-
- DEBUG_ONLY(__ untested("stack overflow check during monitor enter");)
- __ li(Rscratch1, 0);
- __ generate_stack_overflow_check_with_compare_and_throw(Rscratch1, Rscratch2);
-
- __ align(32, 12);
- __ bind(Lskip_stack_check);
+ // This emits a single store.
+ __ generate_stack_overflow_check(0);
// The bcp has already been incremented. Just need to dispatch to next instruction.
__ dispatch_next(vtos);
--- a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -59,11 +59,11 @@
// Stack slots are 2X larger in LP64 than in the 32 bit VM.
define_pd_global(intx, ThreadStackSize, 1024);
define_pd_global(intx, VMThreadStackSize, 1024);
-#define DEFAULT_STACK_SHADOW_PAGES (10 DEBUG_ONLY(+1))
+#define DEFAULT_STACK_SHADOW_PAGES (20 DEBUG_ONLY(+2))
#else
define_pd_global(intx, ThreadStackSize, 512);
define_pd_global(intx, VMThreadStackSize, 512);
-#define DEFAULT_STACK_SHADOW_PAGES (3 DEBUG_ONLY(+1))
+#define DEFAULT_STACK_SHADOW_PAGES (6 DEBUG_ONLY(+2))
#endif // _LP64
#define MIN_STACK_YELLOW_PAGES DEFAULT_STACK_YELLOW_PAGES
--- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -578,51 +578,39 @@
__ lock_object(Lmonitors, O0);
}
-
+// See if we've got enough room on the stack for locals plus overhead below
+// JavaThread::stack_overflow_limit(). If not, throw a StackOverflowError
+// without going through the signal handler, i.e., reserved and yellow zones
+// will not be made usable. The shadow zone must suffice to handle the
+// overflow.
void TemplateInterpreterGenerator::generate_stack_overflow_check(Register Rframe_size,
- Register Rscratch,
- Register Rscratch2) {
+ Register Rscratch) {
const int page_size = os::vm_page_size();
Label after_frame_check;
- assert_different_registers(Rframe_size, Rscratch, Rscratch2);
+ assert_different_registers(Rframe_size, Rscratch);
__ set(page_size, Rscratch);
__ cmp_and_br_short(Rframe_size, Rscratch, Assembler::lessEqual, Assembler::pt, after_frame_check);
- // get the stack base, and in debug, verify it is non-zero
- __ ld_ptr( G2_thread, Thread::stack_base_offset(), Rscratch );
+ // Get the stack overflow limit, and in debug, verify it is non-zero.
+ __ ld_ptr(G2_thread, JavaThread::stack_overflow_limit_offset(), Rscratch);
#ifdef ASSERT
- Label base_not_zero;
- __ br_notnull_short(Rscratch, Assembler::pn, base_not_zero);
- __ stop("stack base is zero in generate_stack_overflow_check");
- __ bind(base_not_zero);
+ Label limit_ok;
+ __ br_notnull_short(Rscratch, Assembler::pn, limit_ok);
+ __ stop("stack overflow limit is zero in generate_stack_overflow_check");
+ __ bind(limit_ok);
#endif
- // get the stack size, and in debug, verify it is non-zero
- assert( sizeof(size_t) == sizeof(intptr_t), "wrong load size" );
- __ ld_ptr( G2_thread, Thread::stack_size_offset(), Rscratch2 );
-#ifdef ASSERT
- Label size_not_zero;
- __ br_notnull_short(Rscratch2, Assembler::pn, size_not_zero);
- __ stop("stack size is zero in generate_stack_overflow_check");
- __ bind(size_not_zero);
-#endif
+ // Add in the size of the frame (which is the same as subtracting it from the
+ // SP, which would take another register.
+ __ add(Rscratch, Rframe_size, Rscratch);
- // compute the beginning of the protected zone minus the requested frame size
- __ sub( Rscratch, Rscratch2, Rscratch );
- __ set(MAX2(JavaThread::stack_shadow_zone_size(), JavaThread::stack_guard_zone_size()), Rscratch2 );
- __ add( Rscratch, Rscratch2, Rscratch );
-
- // Add in the size of the frame (which is the same as subtracting it from the
- // SP, which would take another register
- __ add( Rscratch, Rframe_size, Rscratch );
-
- // the frame is greater than one page in size, so check against
- // the bottom of the stack
+ // The frame is greater than one page in size, so check against
+ // the bottom of the stack.
__ cmp_and_brx_short(SP, Rscratch, Assembler::greaterUnsigned, Assembler::pt, after_frame_check);
- // the stack will overflow, throw an exception
+ // The stack will overflow, throw an exception.
// Note that SP is restored to sender's sp (in the delay slot). This
// is necessary if the sender's frame is an extended compiled frame
@@ -636,8 +624,8 @@
__ jump_to(stub, Rscratch);
__ delayed()->mov(O5_savedSP, SP);
- // if you get to here, then there is enough stack space
- __ bind( after_frame_check );
+ // If you get to here, then there is enough stack space.
+ __ bind(after_frame_check);
}
@@ -821,40 +809,44 @@
__ add( Gframe_size, extra_space, Gframe_size);
__ round_to( Gframe_size, WordsPerLong );
__ sll( Gframe_size, LogBytesPerWord, Gframe_size );
+
+ // Native calls don't need the stack size check since they have no
+ // expression stack and the arguments are already on the stack and
+ // we only add a handful of words to the stack.
} else {
//
// Compute number of locals in method apart from incoming parameters
//
- const Address size_of_locals (Otmp1, ConstMethod::size_of_locals_offset());
- __ ld_ptr( constMethod, Otmp1 );
- __ lduh( size_of_locals, Otmp1 );
- __ sub( Otmp1, Glocals_size, Glocals_size );
- __ round_to( Glocals_size, WordsPerLong );
- __ sll( Glocals_size, Interpreter::logStackElementSize, Glocals_size );
+ const Address size_of_locals(Otmp1, ConstMethod::size_of_locals_offset());
+ __ ld_ptr(constMethod, Otmp1);
+ __ lduh(size_of_locals, Otmp1);
+ __ sub(Otmp1, Glocals_size, Glocals_size);
+ __ round_to(Glocals_size, WordsPerLong);
+ __ sll(Glocals_size, Interpreter::logStackElementSize, Glocals_size);
- // see if the frame is greater than one page in size. If so,
- // then we need to verify there is enough stack space remaining
+ // See if the frame is greater than one page in size. If so,
+ // then we need to verify there is enough stack space remaining.
// Frame_size = (max_stack + extra_space) * BytesPerWord;
- __ ld_ptr( constMethod, Gframe_size );
- __ lduh( Gframe_size, in_bytes(ConstMethod::max_stack_offset()), Gframe_size );
- __ add( Gframe_size, extra_space, Gframe_size );
- __ round_to( Gframe_size, WordsPerLong );
- __ sll( Gframe_size, Interpreter::logStackElementSize, Gframe_size);
+ __ ld_ptr(constMethod, Gframe_size);
+ __ lduh(Gframe_size, in_bytes(ConstMethod::max_stack_offset()), Gframe_size);
+ __ add(Gframe_size, extra_space, Gframe_size);
+ __ round_to(Gframe_size, WordsPerLong);
+ __ sll(Gframe_size, Interpreter::logStackElementSize, Gframe_size);
// Add in java locals size for stack overflow check only
- __ add( Gframe_size, Glocals_size, Gframe_size );
+ __ add(Gframe_size, Glocals_size, Gframe_size);
const Register Otmp2 = O4;
assert_different_registers(Otmp1, Otmp2, O5_savedSP);
- generate_stack_overflow_check(Gframe_size, Otmp1, Otmp2);
+ generate_stack_overflow_check(Gframe_size, Otmp1);
- __ sub( Gframe_size, Glocals_size, Gframe_size);
+ __ sub(Gframe_size, Glocals_size, Gframe_size);
//
// bump SP to accomodate the extra locals
//
- __ sub( SP, Glocals_size, SP );
+ __ sub(SP, Glocals_size, SP);
}
//
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1173,6 +1173,23 @@
emit_arith_operand(0x81, rax, dst, imm32);
}
+void Assembler::addb(Address dst, int imm8) {
+ InstructionMark im(this);
+ prefix(dst);
+ emit_int8((unsigned char)0x80);
+ emit_operand(rax, dst, 1);
+ emit_int8(imm8);
+}
+
+void Assembler::addw(Address dst, int imm16) {
+ InstructionMark im(this);
+ emit_int8(0x66);
+ prefix(dst);
+ emit_int8((unsigned char)0x81);
+ emit_operand(rax, dst, 2);
+ emit_int16(imm16);
+}
+
void Assembler::addl(Address dst, Register src) {
InstructionMark im(this);
prefix(dst, src);
@@ -4567,6 +4584,23 @@
emit_int8((unsigned char)(imm8 & 0xFF));
}
+void Assembler::xaddb(Address dst, Register src) {
+ InstructionMark im(this);
+ prefix(dst, src, true);
+ emit_int8(0x0F);
+ emit_int8((unsigned char)0xC0);
+ emit_operand(src, dst);
+}
+
+void Assembler::xaddw(Address dst, Register src) {
+ InstructionMark im(this);
+ emit_int8(0x66);
+ prefix(dst, src);
+ emit_int8(0x0F);
+ emit_int8((unsigned char)0xC1);
+ emit_operand(src, dst);
+}
+
void Assembler::xaddl(Address dst, Register src) {
InstructionMark im(this);
prefix(dst, src);
@@ -4593,6 +4627,21 @@
}
}
+void Assembler::xchgb(Register dst, Address src) { // xchg
+ InstructionMark im(this);
+ prefix(src, dst, true);
+ emit_int8((unsigned char)0x86);
+ emit_operand(dst, src);
+}
+
+void Assembler::xchgw(Register dst, Address src) { // xchg
+ InstructionMark im(this);
+ emit_int8(0x66);
+ prefix(src, dst);
+ emit_int8((unsigned char)0x87);
+ emit_operand(dst, src);
+}
+
void Assembler::xchgl(Register dst, Address src) { // xchg
InstructionMark im(this);
prefix(src, dst);
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -881,6 +881,9 @@
void adcq(Register dst, Address src);
void adcq(Register dst, Register src);
+ void addb(Address dst, int imm8);
+ void addw(Address dst, int imm16);
+
void addl(Address dst, int32_t imm32);
void addl(Address dst, Register src);
void addl(Register dst, int32_t imm32);
@@ -1816,12 +1819,15 @@
void xabort(int8_t imm8);
+ void xaddb(Address dst, Register src);
+ void xaddw(Address dst, Register src);
void xaddl(Address dst, Register src);
-
void xaddq(Address dst, Register src);
void xbegin(Label& abort, relocInfo::relocType rtype = relocInfo::none);
+ void xchgb(Register reg, Address adr);
+ void xchgw(Register reg, Address adr);
void xchgl(Register reg, Address adr);
void xchgl(Register dst, Register src);
--- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -473,7 +473,11 @@
__ jmp(do_continue, relocInfo::none);
}
-// See if we've got enough room on the stack for locals plus overhead.
+// See if we've got enough room on the stack for locals plus overhead below
+// JavaThread::stack_overflow_limit(). If not, throw a StackOverflowError
+// without going through the signal handler, i.e., reserved and yellow zones
+// will not be made usable. The shadow zone must suffice to handle the
+// overflow.
// The expression stack grows down incrementally, so the normal guard
// page mechanism will work for that.
//
@@ -518,40 +522,26 @@
__ get_thread(thread);
#endif
- const Address stack_base(thread, Thread::stack_base_offset());
- const Address stack_size(thread, Thread::stack_size_offset());
+ const Address stack_limit(thread, JavaThread::stack_overflow_limit_offset());
// locals + overhead, in bytes
__ mov(rax, rdx);
- __ shlptr(rax, Interpreter::logStackElementSize); // 2 slots per parameter.
+ __ shlptr(rax, Interpreter::logStackElementSize); // Convert parameter count to bytes.
__ addptr(rax, overhead_size);
#ifdef ASSERT
- Label stack_base_okay, stack_size_okay;
- // verify that thread stack base is non-zero
- __ cmpptr(stack_base, (int32_t)NULL_WORD);
- __ jcc(Assembler::notEqual, stack_base_okay);
- __ stop("stack base is zero");
- __ bind(stack_base_okay);
- // verify that thread stack size is non-zero
- __ cmpptr(stack_size, 0);
- __ jcc(Assembler::notEqual, stack_size_okay);
- __ stop("stack size is zero");
- __ bind(stack_size_okay);
+ Label limit_okay;
+ // Verify that thread stack overflow limit is non-zero.
+ __ cmpptr(stack_limit, (int32_t)NULL_WORD);
+ __ jcc(Assembler::notEqual, limit_okay);
+ __ stop("stack overflow limit is zero");
+ __ bind(limit_okay);
#endif
- // Add stack base to locals and subtract stack size
- __ addptr(rax, stack_base);
- __ subptr(rax, stack_size);
+ // Add locals/frame size to stack limit.
+ __ addptr(rax, stack_limit);
- // Use the bigger size for banging.
- const int max_bang_size = (int)MAX2(JavaThread::stack_shadow_zone_size(),
- JavaThread::stack_guard_zone_size());
-
- // add in the red and yellow zone sizes
- __ addptr(rax, max_bang_size);
-
- // check against the current stack bottom
+ // Check against the current stack bottom.
__ cmpptr(rsp, rax);
__ jcc(Assembler::above, after_frame_check_pop);
@@ -782,8 +772,6 @@
return NULL;
}
-// TODO: rather than touching all pages, check against stack_overflow_limit and bang yellow page to
-// generate exception. Windows might need this to map the shadow pages though.
void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) {
// Quick & dirty stack overflow checking: bang the stack & handle trap.
// Note that we do the banging after the frame is setup, since the exception
@@ -945,7 +933,7 @@
__ load_unsigned_short(t, Address(t, ConstMethod::size_of_parameters_offset()));
#ifndef _LP64
- __ shlptr(t, Interpreter::logStackElementSize);
+ __ shlptr(t, Interpreter::logStackElementSize); // Convert parameter count to bytes.
__ addptr(t, 2*wordSize); // allocate two more slots for JNIEnv and possible mirror
__ subptr(rsp, t);
__ andptr(rsp, -(StackAlignmentInBytes)); // gcc needs 16 byte aligned stacks to do XMM intrinsics
--- a/hotspot/src/cpu/x86/vm/x86_32.ad Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad Fri Jul 01 16:50:34 2016 -0700
@@ -2127,6 +2127,31 @@
emit_rm( cbuf, 0x0, 1, $mem_ptr$$reg );
%}
+ enc_class enc_cmpxchgb(eSIRegP mem_ptr) %{
+ // [Lock]
+ if( os::is_MP() )
+ emit_opcode(cbuf,0xF0);
+
+ // CMPXCHGB [Eptr]
+ emit_opcode(cbuf,0x0F);
+ emit_opcode(cbuf,0xB0);
+ emit_rm( cbuf, 0x0, 1, $mem_ptr$$reg );
+ %}
+
+ enc_class enc_cmpxchgw(eSIRegP mem_ptr) %{
+ // [Lock]
+ if( os::is_MP() )
+ emit_opcode(cbuf,0xF0);
+
+ // 16-bit mode
+ emit_opcode(cbuf, 0x66);
+
+ // CMPXCHGW [Eptr]
+ emit_opcode(cbuf,0x0F);
+ emit_opcode(cbuf,0xB1);
+ emit_rm( cbuf, 0x0, 1, $mem_ptr$$reg );
+ %}
+
enc_class enc_flags_ne_to_boolean( iRegI res ) %{
int res_encoding = $res$$reg;
@@ -7262,6 +7287,34 @@
ins_pipe( pipe_cmpxchg );
%}
+instruct compareAndSwapB( rRegI res, pRegP mem_ptr, eAXRegI oldval, eCXRegI newval, eFlagsReg cr ) %{
+ match(Set res (CompareAndSwapB mem_ptr (Binary oldval newval)));
+ match(Set res (WeakCompareAndSwapB mem_ptr (Binary oldval newval)));
+ effect(KILL cr, KILL oldval);
+ format %{ "CMPXCHGB [$mem_ptr],$newval\t# If EAX==[$mem_ptr] Then store $newval into [$mem_ptr]\n\t"
+ "MOV $res,0\n\t"
+ "JNE,s fail\n\t"
+ "MOV $res,1\n"
+ "fail:" %}
+ ins_encode( enc_cmpxchgb(mem_ptr),
+ enc_flags_ne_to_boolean(res) );
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct compareAndSwapS( rRegI res, pRegP mem_ptr, eAXRegI oldval, eCXRegI newval, eFlagsReg cr ) %{
+ match(Set res (CompareAndSwapS mem_ptr (Binary oldval newval)));
+ match(Set res (WeakCompareAndSwapS mem_ptr (Binary oldval newval)));
+ effect(KILL cr, KILL oldval);
+ format %{ "CMPXCHGW [$mem_ptr],$newval\t# If EAX==[$mem_ptr] Then store $newval into [$mem_ptr]\n\t"
+ "MOV $res,0\n\t"
+ "JNE,s fail\n\t"
+ "MOV $res,1\n"
+ "fail:" %}
+ ins_encode( enc_cmpxchgw(mem_ptr),
+ enc_flags_ne_to_boolean(res) );
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct compareAndSwapI( rRegI res, pRegP mem_ptr, eAXRegI oldval, eCXRegI newval, eFlagsReg cr) %{
match(Set res (CompareAndSwapI mem_ptr (Binary oldval newval)));
match(Set res (WeakCompareAndSwapI mem_ptr (Binary oldval newval)));
@@ -7292,6 +7345,22 @@
ins_pipe( pipe_cmpxchg );
%}
+instruct compareAndExchangeB( pRegP mem_ptr, eAXRegI oldval, eCXRegI newval, eFlagsReg cr) %{
+ match(Set oldval (CompareAndExchangeB mem_ptr (Binary oldval newval)));
+ effect(KILL cr);
+ format %{ "CMPXCHGB [$mem_ptr],$newval\t# If EAX==[$mem_ptr] Then store $newval into [$mem_ptr]\n\t" %}
+ ins_encode( enc_cmpxchgb(mem_ptr) );
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct compareAndExchangeS( pRegP mem_ptr, eAXRegI oldval, eCXRegI newval, eFlagsReg cr) %{
+ match(Set oldval (CompareAndExchangeS mem_ptr (Binary oldval newval)));
+ effect(KILL cr);
+ format %{ "CMPXCHGW [$mem_ptr],$newval\t# If EAX==[$mem_ptr] Then store $newval into [$mem_ptr]\n\t" %}
+ ins_encode( enc_cmpxchgw(mem_ptr) );
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct compareAndExchangeI( pRegP mem_ptr, eAXRegI oldval, eCXRegI newval, eFlagsReg cr) %{
match(Set oldval (CompareAndExchangeI mem_ptr (Binary oldval newval)));
effect(KILL cr);
@@ -7300,6 +7369,53 @@
ins_pipe( pipe_cmpxchg );
%}
+instruct xaddB_no_res( memory mem, Universe dummy, immI add, eFlagsReg cr) %{
+ predicate(n->as_LoadStore()->result_not_used());
+ match(Set dummy (GetAndAddB mem add));
+ effect(KILL cr);
+ format %{ "ADDB [$mem],$add" %}
+ ins_encode %{
+ if (os::is_MP()) { __ lock(); }
+ __ addb($mem$$Address, $add$$constant);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
+// Important to match to xRegI: only 8-bit regs.
+instruct xaddB( memory mem, xRegI newval, eFlagsReg cr) %{
+ match(Set newval (GetAndAddB mem newval));
+ effect(KILL cr);
+ format %{ "XADDB [$mem],$newval" %}
+ ins_encode %{
+ if (os::is_MP()) { __ lock(); }
+ __ xaddb($mem$$Address, $newval$$Register);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct xaddS_no_res( memory mem, Universe dummy, immI add, eFlagsReg cr) %{
+ predicate(n->as_LoadStore()->result_not_used());
+ match(Set dummy (GetAndAddS mem add));
+ effect(KILL cr);
+ format %{ "ADDS [$mem],$add" %}
+ ins_encode %{
+ if (os::is_MP()) { __ lock(); }
+ __ addw($mem$$Address, $add$$constant);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct xaddS( memory mem, rRegI newval, eFlagsReg cr) %{
+ match(Set newval (GetAndAddS mem newval));
+ effect(KILL cr);
+ format %{ "XADDS [$mem],$newval" %}
+ ins_encode %{
+ if (os::is_MP()) { __ lock(); }
+ __ xaddw($mem$$Address, $newval$$Register);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct xaddI_no_res( memory mem, Universe dummy, immI add, eFlagsReg cr) %{
predicate(n->as_LoadStore()->result_not_used());
match(Set dummy (GetAndAddI mem add));
@@ -7323,6 +7439,25 @@
ins_pipe( pipe_cmpxchg );
%}
+// Important to match to xRegI: only 8-bit regs.
+instruct xchgB( memory mem, xRegI newval) %{
+ match(Set newval (GetAndSetB mem newval));
+ format %{ "XCHGB $newval,[$mem]" %}
+ ins_encode %{
+ __ xchgb($newval$$Register, $mem$$Address);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct xchgS( memory mem, rRegI newval) %{
+ match(Set newval (GetAndSetS mem newval));
+ format %{ "XCHGW $newval,[$mem]" %}
+ ins_encode %{
+ __ xchgw($newval$$Register, $mem$$Address);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct xchgI( memory mem, rRegI newval) %{
match(Set newval (GetAndSetI mem newval));
format %{ "XCHGL $newval,[$mem]" %}
--- a/hotspot/src/cpu/x86/vm/x86_64.ad Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad Fri Jul 01 16:50:34 2016 -0700
@@ -7340,6 +7340,54 @@
ins_pipe( pipe_cmpxchg );
%}
+instruct compareAndSwapB(rRegI res,
+ memory mem_ptr,
+ rax_RegI oldval, rRegI newval,
+ rFlagsReg cr)
+%{
+ match(Set res (CompareAndSwapB mem_ptr (Binary oldval newval)));
+ match(Set res (WeakCompareAndSwapB mem_ptr (Binary oldval newval)));
+ effect(KILL cr, KILL oldval);
+
+ format %{ "cmpxchgb $mem_ptr,$newval\t# "
+ "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
+ "sete $res\n\t"
+ "movzbl $res, $res" %}
+ opcode(0x0F, 0xB0);
+ ins_encode(lock_prefix,
+ REX_reg_mem(newval, mem_ptr),
+ OpcP, OpcS,
+ reg_mem(newval, mem_ptr),
+ REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
+ REX_reg_breg(res, res), // movzbl
+ Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct compareAndSwapS(rRegI res,
+ memory mem_ptr,
+ rax_RegI oldval, rRegI newval,
+ rFlagsReg cr)
+%{
+ match(Set res (CompareAndSwapS mem_ptr (Binary oldval newval)));
+ match(Set res (WeakCompareAndSwapS mem_ptr (Binary oldval newval)));
+ effect(KILL cr, KILL oldval);
+
+ format %{ "cmpxchgw $mem_ptr,$newval\t# "
+ "If rax == $mem_ptr then store $newval into $mem_ptr\n\t"
+ "sete $res\n\t"
+ "movzbl $res, $res" %}
+ opcode(0x0F, 0xB1);
+ ins_encode(lock_prefix,
+ SizePrefix,
+ REX_reg_mem(newval, mem_ptr),
+ OpcP, OpcS,
+ reg_mem(newval, mem_ptr),
+ REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete
+ REX_reg_breg(res, res), // movzbl
+ Opcode(0xF), Opcode(0xB6), reg_reg(res, res));
+ ins_pipe( pipe_cmpxchg );
+%}
instruct compareAndSwapN(rRegI res,
memory mem_ptr,
@@ -7364,6 +7412,45 @@
ins_pipe( pipe_cmpxchg );
%}
+instruct compareAndExchangeB(
+ memory mem_ptr,
+ rax_RegI oldval, rRegI newval,
+ rFlagsReg cr)
+%{
+ match(Set oldval (CompareAndExchangeB mem_ptr (Binary oldval newval)));
+ effect(KILL cr);
+
+ format %{ "cmpxchgb $mem_ptr,$newval\t# "
+ "If rax == $mem_ptr then store $newval into $mem_ptr\n\t" %}
+ opcode(0x0F, 0xB0);
+ ins_encode(lock_prefix,
+ REX_reg_mem(newval, mem_ptr),
+ OpcP, OpcS,
+ reg_mem(newval, mem_ptr) // lock cmpxchg
+ );
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct compareAndExchangeS(
+ memory mem_ptr,
+ rax_RegI oldval, rRegI newval,
+ rFlagsReg cr)
+%{
+ match(Set oldval (CompareAndExchangeS mem_ptr (Binary oldval newval)));
+ effect(KILL cr);
+
+ format %{ "cmpxchgw $mem_ptr,$newval\t# "
+ "If rax == $mem_ptr then store $newval into $mem_ptr\n\t" %}
+ opcode(0x0F, 0xB1);
+ ins_encode(lock_prefix,
+ SizePrefix,
+ REX_reg_mem(newval, mem_ptr),
+ OpcP, OpcS,
+ reg_mem(newval, mem_ptr) // lock cmpxchg
+ );
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct compareAndExchangeI(
memory mem_ptr,
rax_RegI oldval, rRegI newval,
@@ -7441,6 +7528,52 @@
ins_pipe( pipe_cmpxchg );
%}
+instruct xaddB_no_res( memory mem, Universe dummy, immI add, rFlagsReg cr) %{
+ predicate(n->as_LoadStore()->result_not_used());
+ match(Set dummy (GetAndAddB mem add));
+ effect(KILL cr);
+ format %{ "ADDB [$mem],$add" %}
+ ins_encode %{
+ if (os::is_MP()) { __ lock(); }
+ __ addb($mem$$Address, $add$$constant);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct xaddB( memory mem, rRegI newval, rFlagsReg cr) %{
+ match(Set newval (GetAndAddB mem newval));
+ effect(KILL cr);
+ format %{ "XADDB [$mem],$newval" %}
+ ins_encode %{
+ if (os::is_MP()) { __ lock(); }
+ __ xaddb($mem$$Address, $newval$$Register);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct xaddS_no_res( memory mem, Universe dummy, immI add, rFlagsReg cr) %{
+ predicate(n->as_LoadStore()->result_not_used());
+ match(Set dummy (GetAndAddS mem add));
+ effect(KILL cr);
+ format %{ "ADDW [$mem],$add" %}
+ ins_encode %{
+ if (os::is_MP()) { __ lock(); }
+ __ addw($mem$$Address, $add$$constant);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct xaddS( memory mem, rRegI newval, rFlagsReg cr) %{
+ match(Set newval (GetAndAddS mem newval));
+ effect(KILL cr);
+ format %{ "XADDW [$mem],$newval" %}
+ ins_encode %{
+ if (os::is_MP()) { __ lock(); }
+ __ xaddw($mem$$Address, $newval$$Register);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct xaddI_no_res( memory mem, Universe dummy, immI add, rFlagsReg cr) %{
predicate(n->as_LoadStore()->result_not_used());
match(Set dummy (GetAndAddI mem add));
@@ -7487,6 +7620,24 @@
ins_pipe( pipe_cmpxchg );
%}
+instruct xchgB( memory mem, rRegI newval) %{
+ match(Set newval (GetAndSetB mem newval));
+ format %{ "XCHGB $newval,[$mem]" %}
+ ins_encode %{
+ __ xchgb($newval$$Register, $mem$$Address);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
+instruct xchgS( memory mem, rRegI newval) %{
+ match(Set newval (GetAndSetS mem newval));
+ format %{ "XCHGW $newval,[$mem]" %}
+ ins_encode %{
+ __ xchgw($newval$$Register, $mem$$Address);
+ %}
+ ins_pipe( pipe_cmpxchg );
+%}
+
instruct xchgI( memory mem, rRegI newval) %{
match(Set newval (GetAndSetI mem newval));
format %{ "XCHGL $newval,[$mem]" %}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,6 +28,7 @@
import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.Register.RegisterCategory;
+import jdk.vm.ci.code.RegisterArray;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.PlatformKind;
@@ -84,13 +85,13 @@
public static final Register lr = r30;
// @formatter:off
- public static final Register[] cpuRegisters = {
+ public static final RegisterArray cpuRegisters = new RegisterArray(
r0, r1, r2, r3, r4, r5, r6, r7,
r8, r9, r10, r11, r12, r13, r14, r15,
r16, r17, r18, r19, r20, r21, r22, r23,
r24, r25, r26, r27, r28, r29, r30, r31,
zr, sp
- };
+ );
// @formatter:on
public static final RegisterCategory SIMD = new RegisterCategory("SIMD");
@@ -130,16 +131,16 @@
public static final Register v31 = new Register(65, 31, "v31", SIMD);
// @formatter:off
- public static final Register[] simdRegisters = {
+ public static final RegisterArray simdRegisters = new RegisterArray(
v0, v1, v2, v3, v4, v5, v6, v7,
v8, v9, v10, v11, v12, v13, v14, v15,
v16, v17, v18, v19, v20, v21, v22, v23,
v24, v25, v26, v27, v28, v29, v30, v31
- };
+ );
// @formatter:on
// @formatter:off
- public static final Register[] allRegisters = {
+ public static final RegisterArray allRegisters = new RegisterArray(
r0, r1, r2, r3, r4, r5, r6, r7,
r8, r9, r10, r11, r12, r13, r14, r15,
r16, r17, r18, r19, r20, r21, r22, r23,
@@ -150,7 +151,7 @@
v8, v9, v10, v11, v12, v13, v14, v15,
v16, v17, v18, v19, v20, v21, v22, v23,
v24, v25, v26, v27, v28, v29, v30, v31
- };
+ );
// @formatter:on
/**
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java Fri Jul 01 16:50:34 2016 -0700
@@ -33,6 +33,7 @@
import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.Register.RegisterCategory;
+import jdk.vm.ci.code.RegisterArray;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.PlatformKind;
@@ -131,14 +132,14 @@
public static final Register k6 = new Register(54, 6, "k6", MASK);
public static final Register k7 = new Register(55, 7, "k7", MASK);
- public static final Register[] valueRegistersSSE = {
+ public static final RegisterArray valueRegistersSSE = new RegisterArray(
rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
r8, r9, r10, r11, r12, r13, r14, r15,
xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
- };
+ );
- public static final Register[] valueRegistersAVX512 = {
+ public static final RegisterArray valueRegistersAVX512 = new RegisterArray(
rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
r8, r9, r10, r11, r12, r13, r14, r15,
xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
@@ -146,14 +147,14 @@
xmm16, xmm17, xmm18, xmm19, xmm20, xmm21, xmm22, xmm23,
xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, xmm30, xmm31,
k0, k1, k2, k3, k4, k5, k6, k7
- };
+ );
/**
* Register used to construct an instruction-relative address.
*/
public static final Register rip = new Register(56, -1, "rip", SPECIAL);
- public static final Register[] allRegisters = {
+ public static final RegisterArray allRegisters = new RegisterArray(
rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
r8, r9, r10, r11, r12, r13, r14, r15,
xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
@@ -162,7 +163,7 @@
xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, xmm30, xmm31,
k0, k1, k2, k3, k4, k5, k6, k7,
rip
- };
+ );
// @formatter:on
@@ -245,7 +246,7 @@
}
@Override
- public Register[] getAvailableValueRegisters() {
+ public RegisterArray getAvailableValueRegisters() {
if (features.contains(CPUFeature.AVX512F)) {
return valueRegistersAVX512;
} else {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,7 +23,6 @@
package jdk.vm.ci.code;
import java.nio.ByteOrder;
-import java.util.Arrays;
import jdk.vm.ci.code.Register.RegisterCategory;
import jdk.vm.ci.meta.JavaKind;
@@ -46,10 +45,10 @@
private final String name;
/**
- * Array of all available registers on this architecture. The index of each register in this
- * array is equal to its {@linkplain Register#number number}.
+ * List of all available registers on this architecture. The index of each register in this list
+ * is equal to its {@linkplain Register#number number}.
*/
- private final Register[] registers;
+ private final RegisterArray registers;
/**
* The byte ordering can be either little or big endian.
@@ -78,7 +77,8 @@
*/
private final int returnAddressSize;
- protected Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset,
+ protected Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, RegisterArray registers, int implicitMemoryBarriers,
+ int nativeCallDisplacementOffset,
int returnAddressSize) {
this.name = name;
this.registers = registers;
@@ -120,20 +120,20 @@
}
/**
- * Gets an array of all registers that exist on this architecture. This contains all registers
+ * Gets the list of all registers that exist on this architecture. This contains all registers
* that exist in the specification of this architecture. Not all of them may be available on
- * this particular architecture instance. The index of each register in this array is equal to
+ * this particular architecture instance. The index of each register in this list is equal to
* its {@linkplain Register#number number}.
*/
- public Register[] getRegisters() {
- return registers.clone();
+ public RegisterArray getRegisters() {
+ return registers;
}
/**
- * Gets an array of all registers available for storing values on this architecture. This may be
- * a subset of {@link #getRegisters()}, depending on the capabilities of this particular CPU.
+ * Gets a list of all registers available for storing values on this architecture. This may be a
+ * subset of {@link #getRegisters()}, depending on the capabilities of this particular CPU.
*/
- public Register[] getAvailableValueRegisters() {
+ public RegisterArray getAvailableValueRegisters() {
return getRegisters();
}
@@ -206,7 +206,7 @@
assert this.byteOrder.equals(that.byteOrder);
assert this.implicitMemoryBarriers == that.implicitMemoryBarriers;
assert this.machineCodeCallDisplacementOffset == that.machineCodeCallDisplacementOffset;
- assert Arrays.equals(this.registers, that.registers);
+ assert this.registers.equals(that.registers);
assert this.returnAddressSize == that.returnAddressSize;
assert this.unalignedMemoryAccess == that.unalignedMemoryAccess;
assert this.wordKind == that.wordKind;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodeFrame.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodeFrame.java Fri Jul 01 16:50:34 2016 -0700
@@ -34,7 +34,7 @@
* where to find the local variables, operand stack values and locked objects of the bytecode
* frame(s).
*/
-public class BytecodeFrame extends BytecodePosition {
+public final class BytecodeFrame extends BytecodePosition {
/**
* An array of values representing how to reconstruct the state of the Java frame. This is array
@@ -65,14 +65,18 @@
* <p>
* Note that the number of locals and the number of stack slots may be smaller than the maximum
* number of locals and stack slots as specified in the compiled method.
+ *
+ * This field is intentionally exposed as a mutable array that a compiler may modify (e.g.
+ * during register allocation).
*/
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "field is intentionally mutable")//
public final JavaValue[] values;
/**
- * An array describing the Java kind of the {@link #values}. It records a kind for the locals
- * and the operand stack.
+ * An array describing the Java kinds in {@link #values}. It records a kind for the locals and
+ * the operand stack.
*/
- public final JavaKind[] slotKinds;
+ private final JavaKind[] slotKinds;
/**
* The number of locals in the values array.
@@ -99,8 +103,8 @@
public final boolean rethrowException;
/**
- * Specifies if this object represents a frame state in the middle of executing a call. If
- * true, the arguments to the call have been popped from the stack and the return value (for a
+ * Specifies if this object represents a frame state in the middle of executing a call. If true,
+ * the arguments to the call have been popped from the stack and the return value (for a
* non-void call) has not yet been pushed.
*/
public final boolean duringCall;
@@ -178,11 +182,14 @@
* @param bci a BCI within the method
* @param rethrowException specifies if the VM should re-throw the pending exception when
* deopt'ing using this frame
- * @param values the frame state {@link #values}
+ * @param values the frame state {@link #values}.
+ * @param slotKinds the kinds in {@code values}. This array is now owned by this object and must
+ * not be mutated by the caller.
* @param numLocals the number of local variables
* @param numStack the depth of the stack
* @param numLocks the number of locked objects
*/
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `slotKinds`")
public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, JavaValue[] values, JavaKind[] slotKinds, int numLocals, int numStack,
int numLocks) {
super(caller, method, bci);
@@ -219,12 +226,44 @@
}
/**
+ * Gets the kind of a local variable.
+ *
+ * @param i the local variable to query
+ * @return the kind of local variable {@code i}
+ * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numLocals}
+ */
+ public JavaKind getLocalValueKind(int i) {
+ if (i < 0 || i >= numLocals) {
+ throw new IndexOutOfBoundsException();
+ }
+ return slotKinds[i];
+ }
+
+ /**
+ * Gets the kind of a stack slot.
+ *
+ * @param i the local variable to query
+ * @return the kind of stack slot {@code i}
+ * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numStack}
+ */
+ public JavaKind getStackValueKind(int i) {
+ if (i < 0 || i >= numStack) {
+ throw new IndexOutOfBoundsException();
+ }
+ return slotKinds[i + numLocals];
+ }
+
+ /**
* Gets the value representing the specified local variable.
*
* @param i the local variable index
* @return the value that can be used to reconstruct the local's current value
+ * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numLocals}
*/
public JavaValue getLocalValue(int i) {
+ if (i < 0 || i >= numLocals) {
+ throw new IndexOutOfBoundsException();
+ }
return values[i];
}
@@ -233,8 +272,12 @@
*
* @param i the stack index
* @return the value that can be used to reconstruct the stack slot's current value
+ * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numStack}
*/
public JavaValue getStackValue(int i) {
+ if (i < 0 || i >= numStack) {
+ throw new IndexOutOfBoundsException();
+ }
return values[i + numLocals];
}
@@ -243,8 +286,12 @@
*
* @param i the lock index
* @return the value that can be used to reconstruct the lock's current value
+ * @throw {@link IndexOutOfBoundsException} if {@code i < 0 || i >= this.numLocks}
*/
public JavaValue getLockValue(int i) {
+ if (i < 0 || i >= numLocks) {
+ throw new IndexOutOfBoundsException();
+ }
return values[i + numLocals + numStack];
}
@@ -258,6 +305,11 @@
}
@Override
+ public int hashCode() {
+ return (numLocals + 1) ^ (numStack + 11) ^ (numLocks + 7);
+ }
+
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CallingConvention.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CallingConvention.java Fri Jul 01 16:50:34 2016 -0700
@@ -100,6 +100,7 @@
/**
* Gets the locations required for the arguments.
*/
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "FB false positive")
public AllocatableValue[] getArguments() {
if (argumentLocations.length == 0) {
return argumentLocations;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/DebugInfo.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/DebugInfo.java Fri Jul 01 16:50:34 2016 -0700
@@ -48,8 +48,10 @@
*
* @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame
* frame} info
- * @param virtualObjectMapping the mapping of {@link VirtualObject}s to their real values
+ * @param virtualObjectMapping the mapping of {@link VirtualObject}s to their real values. This
+ * array is now owned by this object and must not be mutated by the caller.
*/
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `virtualObjectMapping`")
public DebugInfo(BytecodePosition codePos, VirtualObject[] virtualObjectMapping) {
this.bytecodePosition = codePos;
this.virtualObjectMapping = virtualObjectMapping;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterArray.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,105 @@
+/*
+ * 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.code;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * An immutable ordered list of registers. Only required because Java lacks immutable arrays.
+ */
+public final class RegisterArray implements Iterable<Register> {
+
+ private final Register[] registers;
+ private int hash;
+
+ public RegisterArray(Register... registers) {
+ this.registers = registers;
+ }
+
+ public RegisterArray(Collection<Register> registers) {
+ this.registers = registers.toArray(new Register[registers.size()]);
+ }
+
+ /**
+ * Gets the number of registers.
+ */
+ public int size() {
+ return registers.length;
+ }
+
+ /**
+ * Gets the register at a given index.
+ *
+ * @param index the index of the register to retrieve
+ */
+ public Register get(int index) {
+ return registers[index];
+ }
+
+ public void addTo(Collection<Register> collection) {
+ collection.addAll(Arrays.asList(registers));
+ }
+
+ /**
+ * Gets an immutable view of the registers as a list.
+ */
+ public List<Register> asList() {
+ return Collections.unmodifiableList(Arrays.asList(registers));
+ }
+
+ /**
+ * Gets a copy of the registers as an array.
+ */
+ public Register[] toArray() {
+ return registers.clone();
+ }
+
+ public Iterator<Register> iterator() {
+ return Arrays.asList(registers).iterator();
+ }
+
+ @Override
+ public int hashCode() {
+ if (hash == 0 && registers.length > 0) {
+ hash = Arrays.hashCode(registers);
+ }
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof RegisterArray) {
+ return Arrays.equals(registers, ((RegisterArray) obj).registers);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return Arrays.toString(registers);
+ }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterAttributes.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterAttributes.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,6 +23,8 @@
package jdk.vm.ci.code;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
/**
* A collection of register attributes. The specific attribute values for a register may be local to
@@ -53,13 +55,14 @@
* @return an array whose length is the max register number in {@code registers} plus 1. An
* element at index i holds the attributes of the register whose number is i.
*/
- public static RegisterAttributes[] createMap(RegisterConfig registerConfig, Register[] registers) {
- RegisterAttributes[] map = new RegisterAttributes[registers.length];
+ public static RegisterAttributes[] createMap(RegisterConfig registerConfig, RegisterArray registers) {
+ RegisterAttributes[] map = new RegisterAttributes[registers.size()];
+ List<Register> callerSaveRegisters = registerConfig.getCallerSaveRegisters().asList();
+ List<Register> calleeSaveRegisters = registerConfig.getCalleeSaveRegisters() == null ? Collections.emptyList() : registerConfig.getCalleeSaveRegisters().asList();
+ List<Register> allocatableRegisters = registerConfig.getAllocatableRegisters().asList();
for (Register reg : registers) {
if (reg != null) {
- Register[] csr = registerConfig.getCalleeSaveRegisters();
- RegisterAttributes attr = new RegisterAttributes(Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg), csr == null ? false : Arrays.asList(csr).contains(reg),
- Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg));
+ RegisterAttributes attr = new RegisterAttributes(callerSaveRegisters.contains(reg), calleeSaveRegisters.contains(reg), allocatableRegisters.contains(reg));
if (map.length <= reg.number) {
map = Arrays.copyOf(map, reg.number + 1);
}
@@ -75,23 +78,24 @@
}
/**
- * @return Denotes a register that is available for use by a register allocator.
+ * @return {@code true} if a register is available for use by a register allocator otherwise
+ * {@code false}
*/
public boolean isAllocatable() {
return allocatable;
}
/**
- * @return Denotes a register whose value preservation (if required) across a call is the
- * responsibility of the callee.
+ * @return {@code true} if a register whose value preservation (if required) across a call is
+ * the responsibility of the callee otherwise {@code false}
*/
public boolean isCalleeSave() {
return calleeSave;
}
/**
- * @return Denotes a register whose value preservation (if required) across a call is the
- * responsibility of the caller.
+ * @return {@code true} if a register whose value preservation (if required) across a call is
+ * the responsibility of the caller otherwise {@code false}
*/
public boolean isCallerSave() {
return callerSave;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -71,7 +71,7 @@
* @return the ordered set of registers that may be used to pass parameters in a call conforming
* to {@code type}
*/
- Register[] getCallingConventionRegisters(Type type, JavaKind kind);
+ RegisterArray getCallingConventionRegisters(Type type, JavaKind kind);
/**
* Gets the set of all registers that might be used by the register allocator.
@@ -80,23 +80,23 @@
* {@link RegisterAllocationConfig#getAllocatableRegisters()}
*/
@SuppressWarnings("javadoc")
- Register[] getAllocatableRegisters();
+ RegisterArray getAllocatableRegisters();
/**
* Filters a set of registers and returns only those that can be used by the register allocator
* for a value of a particular kind.
*/
- Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers);
+ RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers);
/**
* Gets the registers whose values must be preserved by a method across any call it makes.
*/
- Register[] getCallerSaveRegisters();
+ RegisterArray getCallerSaveRegisters();
/**
* Gets the registers whose values must be preserved by the callee.
*/
- Register[] getCalleeSaveRegisters();
+ RegisterArray getCalleeSaveRegisters();
/**
* Gets a map from register {@linkplain Register#number numbers} to register
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterSaveLayout.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterSaveLayout.java Fri Jul 01 16:50:34 2016 -0700
@@ -50,6 +50,7 @@
* @param registers the keys in the map
* @param slots frame slot index for each register in {@code registers}
*/
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `registers` and `slots`")
public RegisterSaveLayout(Register[] registers, int[] slots) {
assert registers.length == slots.length;
this.registers = registers;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/SuppressFBWarnings.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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.code;
+
+/**
+ * Used to suppress <a href="http://findbugs.sourceforge.net">FindBugs</a> warnings.
+ */
+@interface SuppressFBWarnings {
+ /**
+ * The set of FindBugs
+ * <a href="http://findbugs.sourceforge.net/bugDescriptions.html">warnings</a> that are to be
+ * suppressed in annotated element. The value can be a bug category, kind or pattern.
+ */
+ String[] value();
+
+ /**
+ * Reason why the warning is suppressed.
+ */
+ String justification();
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/VirtualObject.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/VirtualObject.java Fri Jul 01 16:50:34 2016 -0700
@@ -119,17 +119,20 @@
}
/**
- * Returns an array containing all the values to be stored into the object when it is recreated.
+ * Returns the array containing all the values to be stored into the object when it is
+ * recreated. This field is intentional exposed as a mutable array that a compiler may modify
+ * (e.g. during register allocation).
*/
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "`values` is intentional mutable")//
public JavaValue[] getValues() {
return values;
}
/**
- * Returns an array containing the Java kind of all values in the object.
+ * Returns the kind of the value at {@code index}.
*/
- public JavaKind[] getSlotKinds() {
- return slotKinds;
+ public JavaKind getSlotKind(int index) {
+ return slotKinds[index];
}
/**
@@ -145,9 +148,13 @@
*
* @param values an array containing all the values to be stored into the object when it is
* recreated.
- * @param slotKinds an array containing the Java kinds of the values.
+ * @param slotKinds an array containing the Java kinds of the values. This must have the same
+ * length as {@code values}. This array is now owned by this object and must not be
+ * mutated by the caller.
*/
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `slotKinds`")
public void setValues(JavaValue[] values, JavaKind[] slotKinds) {
+ assert values.length == slotKinds.length;
this.values = values;
this.slotKinds = slotKinds;
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/InitTimer.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/InitTimer.java Fri Jul 01 16:50:34 2016 -0700
@@ -30,8 +30,8 @@
* {@code "jvmci.inittimer"} system property to {@code "true"}.
*/
public final class InitTimer implements AutoCloseable {
- final String name;
- final long start;
+ private final String name;
+ private final long start;
private InitTimer(String name) {
int n = nesting.getAndIncrement();
@@ -76,5 +76,5 @@
/**
* Used to assert the invariant that all related initialization happens on the same thread.
*/
- public static Thread initializingThread;
+ static Thread initializingThread;
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotJVMCIBackendFactory.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotJVMCIBackendFactory.java Fri Jul 01 16:50:34 2016 -0700
@@ -38,24 +38,23 @@
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider;
import jdk.vm.ci.hotspot.HotSpotStackIntrospection;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.runtime.JVMCIBackend;
public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
- protected EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") HotSpotVMConfig config) {
+ protected EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
// Configure the feature set using the HotSpot flag settings.
EnumSet<AArch64.CPUFeature> features = EnumSet.noneOf(AArch64.CPUFeature.class);
return features;
}
- protected EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") HotSpotVMConfig config) {
+ protected EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
EnumSet<AArch64.Flag> flags = EnumSet.noneOf(AArch64.Flag.class);
return flags;
}
- protected TargetDescription createTarget(HotSpotVMConfig config) {
+ protected TargetDescription createTarget(AArch64HotSpotVMConfig config) {
final int stackFrameAlignment = 16;
final int implicitNullCheckLimit = 4096;
final boolean inlineObjects = true;
@@ -67,8 +66,8 @@
return new HotSpotConstantReflectionProvider(runtime);
}
- protected RegisterConfig createRegisterConfig(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target) {
- return new AArch64HotSpotRegisterConfig(target, runtime.getConfig());
+ protected RegisterConfig createRegisterConfig(AArch64HotSpotVMConfig config, TargetDescription target) {
+ return new AArch64HotSpotRegisterConfig(target, config.useCompressedOops);
}
protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
@@ -93,7 +92,8 @@
public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) {
assert host == null;
- TargetDescription target = createTarget(runtime.getConfig());
+ AArch64HotSpotVMConfig config = new AArch64HotSpotVMConfig(runtime.getConfigStore());
+ TargetDescription target = createTarget(config);
RegisterConfig regConfig;
HotSpotCodeCacheProvider codeCache;
@@ -105,7 +105,7 @@
metaAccess = createMetaAccess(runtime);
}
try (InitTimer rt = timer("create RegisterConfig")) {
- regConfig = createRegisterConfig(runtime, target);
+ regConfig = createRegisterConfig(config, target);
}
try (InitTimer rt = timer("create CodeCache provider")) {
codeCache = createCodeCache(runtime, target, regConfig);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotRegisterConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotRegisterConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -49,8 +49,6 @@
import static jdk.vm.ci.aarch64.AArch64.zr;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -60,6 +58,7 @@
import jdk.vm.ci.code.CallingConvention;
import jdk.vm.ci.code.CallingConvention.Type;
import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterArray;
import jdk.vm.ci.code.RegisterAttributes;
import jdk.vm.ci.code.RegisterConfig;
import jdk.vm.ci.code.StackSlot;
@@ -67,7 +66,6 @@
import jdk.vm.ci.code.ValueKindFactory;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.AllocatableValue;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
@@ -79,30 +77,24 @@
private final TargetDescription target;
- private final Register[] allocatable;
-
- private final int maxFrameSize;
+ private final RegisterArray allocatable;
/**
* The caller saved registers always include all parameter registers.
*/
- private final Register[] callerSaved;
+ private final RegisterArray callerSaved;
private final boolean allAllocatableAreCallerSaved;
private final RegisterAttributes[] attributesMap;
- public int getMaximumFrameSize() {
- return maxFrameSize;
+ @Override
+ public RegisterArray getAllocatableRegisters() {
+ return allocatable;
}
@Override
- public Register[] getAllocatableRegisters() {
- return allocatable.clone();
- }
-
- @Override
- public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) {
+ public RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers) {
ArrayList<Register> list = new ArrayList<>();
for (Register reg : registers) {
if (target.arch.canStoreValue(reg.getRegisterCategory(), kind)) {
@@ -110,8 +102,7 @@
}
}
- Register[] ret = list.toArray(new Register[list.size()]);
- return ret;
+ return new RegisterArray(list);
}
@Override
@@ -119,9 +110,9 @@
return attributesMap.clone();
}
- private final Register[] javaGeneralParameterRegisters = {r1, r2, r3, r4, r5, r6, r7, r0};
- private final Register[] nativeGeneralParameterRegisters = {r0, r1, r2, r3, r4, r5, r6, r7};
- private final Register[] simdParameterRegisters = {v0, v1, v2, v3, v4, v5, v6, v7};
+ private final RegisterArray javaGeneralParameterRegisters = new RegisterArray(r1, r2, r3, r4, r5, r6, r7, r0);
+ private final RegisterArray nativeGeneralParameterRegisters = new RegisterArray(r0, r1, r2, r3, r4, r5, r6, r7);
+ private final RegisterArray simdParameterRegisters = new RegisterArray(v0, v1, v2, v3, v4, v5, v6, v7);
public static final Register inlineCacheRegister = r9;
@@ -134,12 +125,12 @@
public static final Register threadRegister = r28;
public static final Register fp = r29;
- private static final Register[] reservedRegisters = {threadRegister, fp, lr, r31, zr, sp};
+ private static final RegisterArray reservedRegisters = new RegisterArray(threadRegister, fp, lr, r31, zr, sp);
- private static Register[] initAllocatable(Architecture arch, boolean reserveForHeapBase) {
- Register[] allRegisters = arch.getAvailableValueRegisters();
- Register[] registers = new Register[allRegisters.length - reservedRegisters.length - (reserveForHeapBase ? 1 : 0)];
- List<Register> reservedRegistersList = Arrays.asList(reservedRegisters);
+ private static RegisterArray initAllocatable(Architecture arch, boolean reserveForHeapBase) {
+ RegisterArray allRegisters = arch.getAvailableValueRegisters();
+ Register[] registers = new Register[allRegisters.size() - reservedRegisters.size() - (reserveForHeapBase ? 1 : 0)];
+ List<Register> reservedRegistersList = reservedRegisters.asList();
int idx = 0;
for (Register reg : allRegisters) {
@@ -157,36 +148,35 @@
}
assert idx == registers.length;
- return registers;
+ return new RegisterArray(registers);
}
- public AArch64HotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) {
- this(target, config, initAllocatable(target.arch, config.useCompressedOops));
- assert callerSaved.length >= allocatable.length;
+ public AArch64HotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops) {
+ this(target, initAllocatable(target.arch, useCompressedOops));
+ assert callerSaved.size() >= allocatable.size();
}
- public AArch64HotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config, Register[] allocatable) {
+ public AArch64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable) {
this.target = target;
- this.maxFrameSize = config.maxFrameSize;
- this.allocatable = allocatable.clone();
+ this.allocatable = allocatable;
Set<Register> callerSaveSet = new HashSet<>();
- Collections.addAll(callerSaveSet, allocatable);
- Collections.addAll(callerSaveSet, simdParameterRegisters);
- Collections.addAll(callerSaveSet, javaGeneralParameterRegisters);
- Collections.addAll(callerSaveSet, nativeGeneralParameterRegisters);
- callerSaved = callerSaveSet.toArray(new Register[callerSaveSet.size()]);
+ allocatable.addTo(callerSaveSet);
+ simdParameterRegisters.addTo(callerSaveSet);
+ javaGeneralParameterRegisters.addTo(callerSaveSet);
+ nativeGeneralParameterRegisters.addTo(callerSaveSet);
+ callerSaved = new RegisterArray(callerSaveSet);
allAllocatableAreCallerSaved = true;
attributesMap = RegisterAttributes.createMap(this, AArch64.allRegisters);
}
@Override
- public Register[] getCallerSaveRegisters() {
+ public RegisterArray getCallerSaveRegisters() {
return callerSaved;
}
- public Register[] getCalleeSaveRegisters() {
+ public RegisterArray getCalleeSaveRegisters() {
return null;
}
@@ -207,7 +197,7 @@
}
@Override
- public Register[] getCallingConventionRegisters(Type type, JavaKind kind) {
+ public RegisterArray getCallingConventionRegisters(Type type, JavaKind kind) {
HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type;
switch (kind) {
case Boolean:
@@ -226,7 +216,7 @@
}
}
- private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type,
+ private CallingConvention callingConvention(RegisterArray generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type,
ValueKindFactory<?> valueKindFactory) {
AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
@@ -245,15 +235,15 @@
case Int:
case Long:
case Object:
- if (currentGeneral < generalParameterRegisters.length) {
- Register register = generalParameterRegisters[currentGeneral++];
+ if (currentGeneral < generalParameterRegisters.size()) {
+ Register register = generalParameterRegisters.get(currentGeneral++);
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
}
break;
case Float:
case Double:
- if (currentSIMD < simdParameterRegisters.length) {
- Register register = simdParameterRegisters[currentSIMD++];
+ if (currentSIMD < simdParameterRegisters.size()) {
+ Register register = simdParameterRegisters.get(currentSIMD++);
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
}
break;
@@ -302,6 +292,6 @@
@Override
public String toString() {
- return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n");
+ return String.format("Allocatable: " + getAllocatableRegisters() + "%n" + "CallerSave: " + getCallerSaveRegisters() + "%n");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotVMConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,42 @@
+/*
+ * 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.hotspot.aarch64;
+
+import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
+import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
+
+/**
+ * Used to access native configuration details.
+ *
+ * All non-static, public fields in this class are so that they can be compiled as constants.
+ */
+class AArch64HotSpotVMConfig extends HotSpotVMConfigAccess {
+
+ AArch64HotSpotVMConfig(HotSpotVMConfigStore config) {
+ super(config);
+ }
+
+ final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux");
+
+ final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java Fri Jul 01 16:50:34 2016 -0700
@@ -38,13 +38,12 @@
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider;
import jdk.vm.ci.hotspot.HotSpotStackIntrospection;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.runtime.JVMCIBackend;
public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
- protected EnumSet<AMD64.CPUFeature> computeFeatures(HotSpotVMConfig config) {
+ protected EnumSet<AMD64.CPUFeature> computeFeatures(AMD64HotSpotVMConfig config) {
// Configure the feature set using the HotSpot flag settings.
EnumSet<AMD64.CPUFeature> features = EnumSet.noneOf(AMD64.CPUFeature.class);
if ((config.vmVersionFeatures & config.amd643DNOWPREFETCH) != 0) {
@@ -128,7 +127,7 @@
return features;
}
- protected EnumSet<AMD64.Flag> computeFlags(HotSpotVMConfig config) {
+ protected EnumSet<AMD64.Flag> computeFlags(AMD64HotSpotVMConfig config) {
EnumSet<AMD64.Flag> flags = EnumSet.noneOf(AMD64.Flag.class);
if (config.useCountLeadingZerosInstruction) {
flags.add(AMD64.Flag.UseCountLeadingZerosInstruction);
@@ -139,7 +138,7 @@
return flags;
}
- protected TargetDescription createTarget(HotSpotVMConfig config) {
+ protected TargetDescription createTarget(AMD64HotSpotVMConfig config) {
final int stackFrameAlignment = 16;
final int implicitNullCheckLimit = 4096;
final boolean inlineObjects = true;
@@ -151,8 +150,8 @@
return new HotSpotConstantReflectionProvider(runtime);
}
- protected RegisterConfig createRegisterConfig(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target) {
- return new AMD64HotSpotRegisterConfig(target, runtime.getConfig());
+ protected RegisterConfig createRegisterConfig(AMD64HotSpotVMConfig config, TargetDescription target) {
+ return new AMD64HotSpotRegisterConfig(target, config.useCompressedOops, config.windowsOs);
}
protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
@@ -175,9 +174,9 @@
@SuppressWarnings("try")
public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) {
-
assert host == null;
- TargetDescription target = createTarget(runtime.getConfig());
+ AMD64HotSpotVMConfig config = new AMD64HotSpotVMConfig(runtime.getConfigStore());
+ TargetDescription target = createTarget(config);
RegisterConfig regConfig;
HotSpotCodeCacheProvider codeCache;
@@ -189,7 +188,7 @@
metaAccess = createMetaAccess(runtime);
}
try (InitTimer rt = timer("create RegisterConfig")) {
- regConfig = createRegisterConfig(runtime, target);
+ regConfig = createRegisterConfig(config, target);
}
try (InitTimer rt = timer("create CodeCache provider")) {
codeCache = createCodeCache(runtime, target, regConfig);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -42,8 +42,6 @@
import static jdk.vm.ci.amd64.AMD64.xmm7;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -52,6 +50,7 @@
import jdk.vm.ci.code.CallingConvention;
import jdk.vm.ci.code.CallingConvention.Type;
import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterArray;
import jdk.vm.ci.code.RegisterAttributes;
import jdk.vm.ci.code.RegisterConfig;
import jdk.vm.ci.code.StackSlot;
@@ -59,7 +58,6 @@
import jdk.vm.ci.code.ValueKindFactory;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.AllocatableValue;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
@@ -71,30 +69,24 @@
private final TargetDescription target;
- private final Register[] allocatable;
-
- private final int maxFrameSize;
+ private final RegisterArray allocatable;
/**
* The caller saved registers always include all parameter registers.
*/
- private final Register[] callerSaved;
+ private final RegisterArray callerSaved;
private final boolean allAllocatableAreCallerSaved;
private final RegisterAttributes[] attributesMap;
- public int getMaximumFrameSize() {
- return maxFrameSize;
+ @Override
+ public RegisterArray getAllocatableRegisters() {
+ return allocatable;
}
@Override
- public Register[] getAllocatableRegisters() {
- return allocatable.clone();
- }
-
- @Override
- public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) {
+ public RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers) {
ArrayList<Register> list = new ArrayList<>();
for (Register reg : registers) {
if (target.arch.canStoreValue(reg.getRegisterCategory(), kind)) {
@@ -102,7 +94,7 @@
}
}
- Register[] ret = list.toArray(new Register[list.size()]);
+ RegisterArray ret = new RegisterArray(list);
return ret;
}
@@ -111,9 +103,9 @@
return attributesMap.clone();
}
- private final Register[] javaGeneralParameterRegisters;
- private final Register[] nativeGeneralParameterRegisters;
- private final Register[] xmmParameterRegisters = {xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7};
+ private final RegisterArray javaGeneralParameterRegisters;
+ private final RegisterArray nativeGeneralParameterRegisters;
+ private final RegisterArray xmmParameterRegisters = new RegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7);
/*
* Some ABIs (e.g. Windows) require a so-called "home space", that is a save area on the stack
@@ -121,12 +113,12 @@
*/
private final boolean needsNativeStackHomeSpace;
- private static final Register[] reservedRegisters = {rsp, r15};
+ private static final RegisterArray reservedRegisters = new RegisterArray(rsp, r15);
- private static Register[] initAllocatable(Architecture arch, boolean reserveForHeapBase) {
- Register[] allRegisters = arch.getAvailableValueRegisters();
- Register[] registers = new Register[allRegisters.length - reservedRegisters.length - (reserveForHeapBase ? 1 : 0)];
- List<Register> reservedRegistersList = Arrays.asList(reservedRegisters);
+ private static RegisterArray initAllocatable(Architecture arch, boolean reserveForHeapBase) {
+ RegisterArray allRegisters = arch.getAvailableValueRegisters();
+ Register[] registers = new Register[allRegisters.size() - reservedRegisters.size() - (reserveForHeapBase ? 1 : 0)];
+ List<Register> reservedRegistersList = reservedRegisters.asList();
int idx = 0;
for (Register reg : allRegisters) {
@@ -143,47 +135,46 @@
}
assert idx == registers.length;
- return registers;
+ return new RegisterArray(registers);
}
- public AMD64HotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) {
- this(target, config, initAllocatable(target.arch, config.useCompressedOops));
- assert callerSaved.length >= allocatable.length;
+ public AMD64HotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops, boolean windowsOs) {
+ this(target, initAllocatable(target.arch, useCompressedOops), windowsOs);
+ assert callerSaved.size() >= allocatable.size();
}
- public AMD64HotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config, Register[] allocatable) {
+ public AMD64HotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable, boolean windowsOs) {
this.target = target;
- this.maxFrameSize = config.maxFrameSize;
- if (config.windowsOs) {
- javaGeneralParameterRegisters = new Register[]{rdx, r8, r9, rdi, rsi, rcx};
- nativeGeneralParameterRegisters = new Register[]{rcx, rdx, r8, r9};
+ if (windowsOs) {
+ javaGeneralParameterRegisters = new RegisterArray(rdx, r8, r9, rdi, rsi, rcx);
+ nativeGeneralParameterRegisters = new RegisterArray(rcx, rdx, r8, r9);
this.needsNativeStackHomeSpace = true;
} else {
- javaGeneralParameterRegisters = new Register[]{rsi, rdx, rcx, r8, r9, rdi};
- nativeGeneralParameterRegisters = new Register[]{rdi, rsi, rdx, rcx, r8, r9};
+ javaGeneralParameterRegisters = new RegisterArray(rsi, rdx, rcx, r8, r9, rdi);
+ nativeGeneralParameterRegisters = new RegisterArray(rdi, rsi, rdx, rcx, r8, r9);
this.needsNativeStackHomeSpace = false;
}
this.allocatable = allocatable;
Set<Register> callerSaveSet = new HashSet<>();
- Collections.addAll(callerSaveSet, allocatable);
- Collections.addAll(callerSaveSet, xmmParameterRegisters);
- Collections.addAll(callerSaveSet, javaGeneralParameterRegisters);
- Collections.addAll(callerSaveSet, nativeGeneralParameterRegisters);
- callerSaved = callerSaveSet.toArray(new Register[callerSaveSet.size()]);
+ allocatable.addTo(callerSaveSet);
+ xmmParameterRegisters.addTo(callerSaveSet);
+ callerSaveSet.addAll(javaGeneralParameterRegisters.asList());
+ nativeGeneralParameterRegisters.addTo(callerSaveSet);
+ callerSaved = new RegisterArray(callerSaveSet);
allAllocatableAreCallerSaved = true;
attributesMap = RegisterAttributes.createMap(this, target.arch.getRegisters());
}
@Override
- public Register[] getCallerSaveRegisters() {
+ public RegisterArray getCallerSaveRegisters() {
return callerSaved;
}
@Override
- public Register[] getCalleeSaveRegisters() {
+ public RegisterArray getCalleeSaveRegisters() {
return null;
}
@@ -204,7 +195,7 @@
}
@Override
- public Register[] getCallingConventionRegisters(Type type, JavaKind kind) {
+ public RegisterArray getCallingConventionRegisters(Type type, JavaKind kind) {
HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type;
switch (kind) {
case Boolean:
@@ -223,13 +214,13 @@
}
}
- private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type,
+ private CallingConvention callingConvention(RegisterArray generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type,
ValueKindFactory<?> valueKindFactory) {
AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
int currentGeneral = 0;
int currentXMM = 0;
- int currentStackOffset = type == HotSpotCallingConventionType.NativeCall && needsNativeStackHomeSpace ? generalParameterRegisters.length * target.wordSize : 0;
+ int currentStackOffset = type == HotSpotCallingConventionType.NativeCall && needsNativeStackHomeSpace ? generalParameterRegisters.size() * target.wordSize : 0;
for (int i = 0; i < parameterTypes.length; i++) {
final JavaKind kind = parameterTypes[i].getJavaKind().getStackKind();
@@ -242,15 +233,15 @@
case Int:
case Long:
case Object:
- if (currentGeneral < generalParameterRegisters.length) {
- Register register = generalParameterRegisters[currentGeneral++];
+ if (currentGeneral < generalParameterRegisters.size()) {
+ Register register = generalParameterRegisters.get(currentGeneral++);
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
}
break;
case Float:
case Double:
- if (currentXMM < xmmParameterRegisters.length) {
- Register register = xmmParameterRegisters[currentXMM++];
+ if (currentXMM < xmmParameterRegisters.size()) {
+ Register register = xmmParameterRegisters.get(currentXMM++);
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
}
break;
@@ -299,6 +290,6 @@
@Override
public String toString() {
- return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n");
+ return String.format("Allocatable: " + getAllocatableRegisters() + "%n" + "CallerSave: " + getCallerSaveRegisters() + "%n");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotVMConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,81 @@
+/*
+ * 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.hotspot.amd64;
+
+import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
+import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
+
+class AMD64HotSpotVMConfig extends HotSpotVMConfigAccess {
+
+ AMD64HotSpotVMConfig(HotSpotVMConfigStore config) {
+ super(config);
+ }
+
+ final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows");
+
+ final boolean useCountLeadingZerosInstruction = getFlag("UseCountLeadingZerosInstruction", Boolean.class);
+ final boolean useCountTrailingZerosInstruction = getFlag("UseCountTrailingZerosInstruction", Boolean.class);
+ final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
+
+ // CPU capabilities
+ final int useSSE = getFlag("UseSSE", Integer.class);
+ final int useAVX = getFlag("UseAVX", Integer.class);
+
+ final long vmVersionFeatures = getFieldValue("Abstract_VM_Version::_features", Long.class, "uint64_t");
+
+ // CPU feature flags
+ final long amd64CX8 = getConstant("VM_Version::CPU_CX8", Long.class);
+ final long amd64CMOV = getConstant("VM_Version::CPU_CMOV", Long.class);
+ final long amd64FXSR = getConstant("VM_Version::CPU_FXSR", Long.class);
+ final long amd64HT = getConstant("VM_Version::CPU_HT", Long.class);
+ final long amd64MMX = getConstant("VM_Version::CPU_MMX", Long.class);
+ final long amd643DNOWPREFETCH = getConstant("VM_Version::CPU_3DNOW_PREFETCH", Long.class);
+ final long amd64SSE = getConstant("VM_Version::CPU_SSE", Long.class);
+ final long amd64SSE2 = getConstant("VM_Version::CPU_SSE2", Long.class);
+ final long amd64SSE3 = getConstant("VM_Version::CPU_SSE3", Long.class);
+ final long amd64SSSE3 = getConstant("VM_Version::CPU_SSSE3", Long.class);
+ final long amd64SSE4A = getConstant("VM_Version::CPU_SSE4A", Long.class);
+ final long amd64SSE41 = getConstant("VM_Version::CPU_SSE4_1", Long.class);
+ final long amd64SSE42 = getConstant("VM_Version::CPU_SSE4_2", Long.class);
+ final long amd64POPCNT = getConstant("VM_Version::CPU_POPCNT", Long.class);
+ final long amd64LZCNT = getConstant("VM_Version::CPU_LZCNT", Long.class);
+ final long amd64TSC = getConstant("VM_Version::CPU_TSC", Long.class);
+ final long amd64TSCINV = getConstant("VM_Version::CPU_TSCINV", Long.class);
+ final long amd64AVX = getConstant("VM_Version::CPU_AVX", Long.class);
+ final long amd64AVX2 = getConstant("VM_Version::CPU_AVX2", Long.class);
+ final long amd64AES = getConstant("VM_Version::CPU_AES", Long.class);
+ final long amd64ERMS = getConstant("VM_Version::CPU_ERMS", Long.class);
+ final long amd64CLMUL = getConstant("VM_Version::CPU_CLMUL", Long.class);
+ final long amd64BMI1 = getConstant("VM_Version::CPU_BMI1", Long.class);
+ final long amd64BMI2 = getConstant("VM_Version::CPU_BMI2", Long.class);
+ final long amd64RTM = getConstant("VM_Version::CPU_RTM", Long.class);
+ final long amd64ADX = getConstant("VM_Version::CPU_ADX", Long.class);
+ final long amd64AVX512F = getConstant("VM_Version::CPU_AVX512F", Long.class);
+ final long amd64AVX512DQ = getConstant("VM_Version::CPU_AVX512DQ", Long.class);
+ final long amd64AVX512PF = getConstant("VM_Version::CPU_AVX512PF", Long.class);
+ final long amd64AVX512ER = getConstant("VM_Version::CPU_AVX512ER", Long.class);
+ final long amd64AVX512CD = getConstant("VM_Version::CPU_AVX512CD", Long.class);
+ final long amd64AVX512BW = getConstant("VM_Version::CPU_AVX512BW", Long.class);
+ final long amd64AVX512VL = getConstant("VM_Version::CPU_AVX512VL", Long.class);
+ final long amd64SHA = getConstant("VM_Version::CPU_SHA", Long.class);
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Fri Jul 01 16:50:34 2016 -0700
@@ -37,14 +37,13 @@
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider;
import jdk.vm.ci.hotspot.HotSpotStackIntrospection;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.runtime.JVMCIBackend;
import jdk.vm.ci.sparc.SPARC;
import jdk.vm.ci.sparc.SPARC.CPUFeature;
public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
- protected TargetDescription createTarget(HotSpotVMConfig config) {
+ protected TargetDescription createTarget(SPARCHotSpotVMConfig config) {
final int stackFrameAlignment = 16;
final int implicitNullCheckLimit = 4096;
final boolean inlineObjects = false;
@@ -56,7 +55,7 @@
return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig);
}
- protected EnumSet<CPUFeature> computeFeatures(HotSpotVMConfig config) {
+ protected EnumSet<CPUFeature> computeFeatures(SPARCHotSpotVMConfig config) {
EnumSet<CPUFeature> features = EnumSet.noneOf(CPUFeature.class);
if ((config.vmVersionFeatures & config.sparcVis1Instructions) != 0) {
features.add(CPUFeature.VIS1);
@@ -143,10 +142,11 @@
@SuppressWarnings("try")
public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) {
assert host == null;
- TargetDescription target = createTarget(runtime.getConfig());
+ SPARCHotSpotVMConfig config = new SPARCHotSpotVMConfig(runtime.getConfigStore());
+ TargetDescription target = createTarget(config);
HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime);
- RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, runtime.getConfig());
+ RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, config.useCompressedOops);
HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target, regConfig);
HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime);
StackIntrospection stackIntrospection = new HotSpotStackIntrospection(runtime);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -65,8 +65,6 @@
import static jdk.vm.ci.sparc.SPARC.sp;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -74,6 +72,7 @@
import jdk.vm.ci.code.CallingConvention;
import jdk.vm.ci.code.CallingConvention.Type;
import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterArray;
import jdk.vm.ci.code.RegisterAttributes;
import jdk.vm.ci.code.RegisterConfig;
import jdk.vm.ci.code.StackSlot;
@@ -81,7 +80,6 @@
import jdk.vm.ci.code.ValueKindFactory;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.AllocatableValue;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
@@ -93,7 +91,7 @@
private final TargetDescription target;
- private final Register[] allocatable;
+ private final RegisterArray allocatable;
private final RegisterAttributes[] attributesMap;
@@ -103,20 +101,19 @@
private final boolean addNativeRegisterArgumentSlots;
@Override
- public Register[] getAllocatableRegisters() {
- return allocatable.clone();
+ public RegisterArray getAllocatableRegisters() {
+ return allocatable;
}
@Override
- public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) {
+ public RegisterArray filterAllocatableRegisters(PlatformKind kind, RegisterArray registers) {
ArrayList<Register> list = new ArrayList<>();
for (Register reg : registers) {
if (target.arch.canStoreValue(reg.getRegisterCategory(), kind)) {
list.add(reg);
}
}
- Register[] ret = list.toArray(new Register[list.size()]);
- return ret;
+ return new RegisterArray(list);
}
@Override
@@ -124,30 +121,29 @@
return attributesMap.clone();
}
- private final Register[] cpuCallerParameterRegisters = {o0, o1, o2, o3, o4, o5};
- private final Register[] cpuCalleeParameterRegisters = {i0, i1, i2, i3, i4, i5};
+ private final RegisterArray cpuCallerParameterRegisters = new RegisterArray(o0, o1, o2, o3, o4, o5);
+ private final RegisterArray cpuCalleeParameterRegisters = new RegisterArray(i0, i1, i2, i3, i4, i5);
- private final Register[] fpuFloatParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7};
- private final Register[] fpuDoubleParameterRegisters = {d0, null, d2, null, d4, null, d6, null};
+ private final RegisterArray fpuFloatParameterRegisters = new RegisterArray(f0, f1, f2, f3, f4, f5, f6, f7);
+ private final RegisterArray fpuDoubleParameterRegisters = new RegisterArray(d0, null, d2, null, d4, null, d6, null);
// @formatter:off
- private final Register[] callerSaveRegisters;
+ private final RegisterArray callerSaveRegisters;
/**
- * Registers saved by the callee. This lists all L and I registers which are saved in the
- * register window.
+ * This lists all L and I registers which are saved in the register window.
*/
- private final Register[] calleeSaveRegisters = {
+ private final RegisterArray windowSaveRegisters = new RegisterArray(
l0, l1, l2, l3, l4, l5, l6, l7,
- i0, i1, i2, i3, i4, i5, i6, i7};
+ i0, i1, i2, i3, i4, i5, i6, i7);
// @formatter:on
- private static final Register[] reservedRegisters = {sp, g0, g2};
+ private static final RegisterArray reservedRegisters = new RegisterArray(sp, g0, g2);
- private static Register[] initAllocatable(Architecture arch, boolean reserveForHeapBase) {
- Register[] allRegisters = arch.getAvailableValueRegisters();
- Register[] registers = new Register[allRegisters.length - reservedRegisters.length - (reserveForHeapBase ? 1 : 0)];
- List<Register> reservedRegistersList = Arrays.asList(reservedRegisters);
+ private static RegisterArray initAllocatable(Architecture arch, boolean reserveForHeapBase) {
+ RegisterArray allRegisters = arch.getAvailableValueRegisters();
+ Register[] registers = new Register[allRegisters.size() - reservedRegisters.size() - (reserveForHeapBase ? 1 : 0)];
+ List<Register> reservedRegistersList = reservedRegisters.asList();
int idx = 0;
for (Register reg : allRegisters) {
@@ -164,33 +160,33 @@
}
assert idx == registers.length;
- return registers;
+ return new RegisterArray(registers);
}
- public SPARCHotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) {
- this(target, initAllocatable(target.arch, config.useCompressedOops), config);
+ public SPARCHotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops) {
+ this(target, initAllocatable(target.arch, useCompressedOops));
}
- public SPARCHotSpotRegisterConfig(TargetDescription target, Register[] allocatable, HotSpotVMConfig config) {
+ public SPARCHotSpotRegisterConfig(TargetDescription target, RegisterArray allocatable) {
this.target = target;
- this.allocatable = allocatable.clone();
- this.addNativeRegisterArgumentSlots = config.linuxOs;
- HashSet<Register> callerSaveSet = new HashSet<>();
- Collections.addAll(callerSaveSet, target.arch.getAvailableValueRegisters());
- for (Register cs : calleeSaveRegisters) {
+ this.allocatable = allocatable;
+ this.addNativeRegisterArgumentSlots = false;
+ HashSet<Register> callerSaveSet = new HashSet<>(target.arch.getAvailableValueRegisters().asList());
+ for (Register cs : windowSaveRegisters) {
callerSaveSet.remove(cs);
}
- this.callerSaveRegisters = callerSaveSet.toArray(new Register[callerSaveSet.size()]);
+ this.callerSaveRegisters = new RegisterArray(callerSaveSet);
attributesMap = RegisterAttributes.createMap(this, SPARC.allRegisters);
}
@Override
- public Register[] getCallerSaveRegisters() {
+ public RegisterArray getCallerSaveRegisters() {
return callerSaveRegisters;
}
- public Register[] getCalleeSaveRegisters() {
- return calleeSaveRegisters;
+ @Override
+ public RegisterArray getCalleeSaveRegisters() {
+ return null;
}
@Override
@@ -211,7 +207,7 @@
}
@Override
- public Register[] getCallingConventionRegisters(Type type, JavaKind kind) {
+ public RegisterArray getCallingConventionRegisters(Type type, JavaKind kind) {
HotSpotCallingConventionType hotspotType = (HotSpotCallingConventionType) type;
switch (kind) {
case Boolean:
@@ -230,7 +226,7 @@
}
}
- private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type,
+ private CallingConvention callingConvention(RegisterArray generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, HotSpotCallingConventionType type,
ValueKindFactory<?> valueKindFactory) {
AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
@@ -249,25 +245,25 @@
case Int:
case Long:
case Object:
- if (currentGeneral < generalParameterRegisters.length) {
- Register register = generalParameterRegisters[currentGeneral++];
+ if (currentGeneral < generalParameterRegisters.size()) {
+ Register register = generalParameterRegisters.get(currentGeneral++);
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
}
break;
case Double:
- if (currentFloating < fpuFloatParameterRegisters.length) {
+ if (currentFloating < fpuFloatParameterRegisters.size()) {
if (currentFloating % 2 != 0) {
// Make register number even to be a double reg
currentFloating++;
}
- Register register = fpuDoubleParameterRegisters[currentFloating];
+ Register register = fpuDoubleParameterRegisters.get(currentFloating);
currentFloating += 2; // Only every second is a double register
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
}
break;
case Float:
- if (currentFloating < fpuFloatParameterRegisters.length) {
- Register register = fpuFloatParameterRegisters[currentFloating++];
+ if (currentFloating < fpuFloatParameterRegisters.size()) {
+ Register register = fpuFloatParameterRegisters.get(currentFloating++);
locations[i] = register.asValue(valueKindFactory.getValueKind(kind));
}
break;
@@ -292,7 +288,7 @@
int outArgSpillArea;
if (type == HotSpotCallingConventionType.NativeCall && addNativeRegisterArgumentSlots) {
// Space for native callee which may spill our outgoing arguments
- outArgSpillArea = Math.min(locations.length, generalParameterRegisters.length) * target.wordSize;
+ outArgSpillArea = Math.min(locations.length, generalParameterRegisters.size()) * target.wordSize;
} else {
outArgSpillArea = 0;
}
@@ -337,6 +333,6 @@
@Override
public String toString() {
- return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n");
+ return String.format("Allocatable: " + getAllocatableRegisters() + "%n" + "CallerSave: " + getCallerSaveRegisters() + "%n");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotVMConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -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.
+ */
+package jdk.vm.ci.hotspot.sparc;
+
+import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
+import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
+
+/**
+ * Used to access native configuration details.
+ *
+ * All non-static, public fields in this class are so that they can be compiled as constants.
+ */
+class SPARCHotSpotVMConfig extends HotSpotVMConfigAccess {
+
+ SPARCHotSpotVMConfig(HotSpotVMConfigStore config) {
+ super(config);
+ }
+
+ final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
+
+ // CPU capabilities
+ final long vmVersionFeatures = getFieldValue("Abstract_VM_Version::_features", Long.class, "uint64_t");
+
+ // SPARC specific values
+ final int sparcVis3Instructions = getConstant("VM_Version::vis3_instructions_m", Integer.class);
+ final int sparcVis2Instructions = getConstant("VM_Version::vis2_instructions_m", Integer.class);
+ final int sparcVis1Instructions = getConstant("VM_Version::vis1_instructions_m", Integer.class);
+ final int sparcCbcondInstructions = getConstant("VM_Version::cbcond_instructions_m", Integer.class);
+ final int sparcV8Instructions = getConstant("VM_Version::v8_instructions_m", Integer.class);
+ final int sparcHardwareMul32 = getConstant("VM_Version::hardware_mul32_m", Integer.class);
+ final int sparcHardwareDiv32 = getConstant("VM_Version::hardware_div32_m", Integer.class);
+ final int sparcHardwareFsmuld = getConstant("VM_Version::hardware_fsmuld_m", Integer.class);
+ final int sparcHardwarePopc = getConstant("VM_Version::hardware_popc_m", Integer.class);
+ final int sparcV9Instructions = getConstant("VM_Version::v9_instructions_m", Integer.class);
+ 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);
+ final int sparcT1Model = getConstant("VM_Version::T1_model_m", Integer.class);
+ final int sparcSparc5Instructions = getConstant("VM_Version::sparc5_instructions_m", Integer.class);
+ final int sparcAesInstructions = getConstant("VM_Version::aes_instructions_m", Integer.class);
+ final int sparcSha1Instruction = getConstant("VM_Version::sha1_instruction_m", Integer.class);
+ final int sparcSha256Instruction = getConstant("VM_Version::sha256_instruction_m", Integer.class);
+ final int sparcSha512Instruction = getConstant("VM_Version::sha512_instruction_m", Integer.class);
+
+ final boolean useBlockZeroing = getFlag("UseBlockZeroing", Boolean.class);
+ final int blockZeroingLowLimit = getFlag("BlockZeroingLowLimit", Integer.class);
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Fri Jul 01 16:50:34 2016 -0700
@@ -35,11 +35,9 @@
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.common.InitTimer;
import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.hotspotvmconfig.HotSpotVMField;
import jdk.vm.ci.meta.JavaType;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.internal.misc.Unsafe;
/**
* Calls from Java into HotSpot. The behavior of all the methods in this class that take a native
@@ -267,8 +265,9 @@
native HotSpotResolvedObjectTypeImpl resolveTypeInPool(HotSpotConstantPool constantPool, int cpi) throws LinkageError;
/**
- * Looks up and attempts to resolve the {@code JVM_CONSTANT_Field} entry at index {@code cpi} in
- * {@code constantPool}. The values returned in {@code info} are:
+ * Looks up and attempts to resolve the {@code JVM_CONSTANT_Field} entry for at index {@code cpi} in
+ * {@code constantPool}. For some opcodes, checks are performed that require the {@code method}
+ * that contains {@code opcode} to be specified. The values returned in {@code info} are:
*
* <pre>
* [(int) flags, // only valid if field is resolved
@@ -281,7 +280,7 @@
* @param info an array in which the details of the field are returned
* @return the type defining the field if resolution is successful, 0 otherwise
*/
- native HotSpotResolvedObjectTypeImpl resolveFieldInPool(HotSpotConstantPool constantPool, int cpi, byte opcode, long[] info);
+ native HotSpotResolvedObjectTypeImpl resolveFieldInPool(HotSpotConstantPool constantPool, int cpi, HotSpotResolvedJavaMethodImpl method, byte opcode, long[] info);
/**
* Converts {@code cpci} from an index into the cache for {@code constantPool} to an index
@@ -338,9 +337,22 @@
native void resetCompilationStatistics();
/**
- * Initializes the fields of {@code config}.
+ * Reads the database of VM info. The return value encodes the info in a nested object array
+ * that is described by the pseudo Java object {@code info} below:
+ *
+ * <pre>
+ * info = [
+ * VMField[] vmFields,
+ * [String name, Long size, ...] vmTypeSizes,
+ * [String name, Long value, ...] vmConstants,
+ * [String name, Long value, ...] vmAddresses,
+ * VMFlag[] vmFlags
+ * ]
+ * </pre>
+ *
+ * @return VM info as encoded above
*/
- native long initializeConfiguration(HotSpotVMConfig config);
+ native Object[] readConfiguration();
/**
* Resolves the implementation of {@code method} for virtual dispatches on objects of dynamic
@@ -428,7 +440,6 @@
* <li>{@link HotSpotVMConfig#localVariableTableElementLengthOffset}</li>
* <li>{@link HotSpotVMConfig#localVariableTableElementNameCpIndexOffset}</li>
* <li>{@link HotSpotVMConfig#localVariableTableElementDescriptorCpIndexOffset}</li>
- * <li>{@link HotSpotVMConfig#localVariableTableElementSignatureCpIndexOffset}
* <li>{@link HotSpotVMConfig#localVariableTableElementSlotOffset}
* <li>{@link HotSpotVMConfig#localVariableTableElementStartBciOffset}
* </ul>
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java Fri Jul 01 16:50:34 2016 -0700
@@ -42,7 +42,7 @@
public class HotSpotCodeCacheProvider implements CodeCacheProvider {
protected final HotSpotJVMCIRuntimeProvider runtime;
- public final HotSpotVMConfig config;
+ protected final HotSpotVMConfig config;
protected final TargetDescription target;
protected final RegisterConfig regConfig;
@@ -80,12 +80,13 @@
for (Field f : fields) {
if (f.getName().endsWith("Stub")) {
f.setAccessible(true);
+ Object address;
try {
- Object address = f.get(runtime.getConfig());
+ address = f.get(runtime.getConfig());
if (address.equals(call.target)) {
return f.getName() + ":0x" + Long.toHexString((Long) address);
}
- } catch (Exception e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
}
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java Fri Jul 01 16:50:34 2016 -0700
@@ -115,6 +115,7 @@
}
}
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `sites`, `targetCode`, `comments`, `methods`, `dataSection`, `dataSectionPatches` and `assumptions`")
public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot) {
this.name = name;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java Fri Jul 01 16:50:34 2016 -0700
@@ -196,7 +196,9 @@
*/
@SuppressWarnings("unused")
private static HotSpotConstantPool fromMetaspace(long metaspaceConstantPool) {
- return new HotSpotConstantPool(metaspaceConstantPool);
+ HotSpotConstantPool cp = new HotSpotConstantPool(metaspaceConstantPool);
+ runtime().metaAccessContext.add(cp);
+ return cp;
}
private HotSpotConstantPool(long metaspaceConstantPool) {
@@ -298,7 +300,8 @@
*/
private long getEntryAt(int index) {
assertBounds(index);
- return UNSAFE.getAddress(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
+ return UNSAFE.getAddress(getMetaspaceConstantPool() + config().constantPoolSize + offset);
}
/**
@@ -309,7 +312,8 @@
*/
private int getIntAt(int index) {
assertTag(index, JVM_CONSTANT.Integer);
- return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
+ return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + offset);
}
/**
@@ -320,7 +324,8 @@
*/
private long getLongAt(int index) {
assertTag(index, JVM_CONSTANT.Long);
- return UNSAFE.getLong(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
+ return UNSAFE.getLong(getMetaspaceConstantPool() + config().constantPoolSize + offset);
}
/**
@@ -331,7 +336,8 @@
*/
private float getFloatAt(int index) {
assertTag(index, JVM_CONSTANT.Float);
- return UNSAFE.getFloat(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
+ return UNSAFE.getFloat(getMetaspaceConstantPool() + config().constantPoolSize + offset);
}
/**
@@ -342,7 +348,8 @@
*/
private double getDoubleAt(int index) {
assertTag(index, JVM_CONSTANT.Double);
- return UNSAFE.getDouble(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
+ return UNSAFE.getDouble(getMetaspaceConstantPool() + config().constantPoolSize + offset);
}
/**
@@ -353,7 +360,8 @@
*/
private int getNameAndTypeAt(int index) {
assertTag(index, JVM_CONSTANT.NameAndType);
- return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
+ return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + offset);
}
/**
@@ -434,7 +442,8 @@
*/
private int getUncachedKlassRefIndexAt(int index) {
assertTagIsFieldOrMethod(index);
- final int refIndex = UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
+ final int refIndex = UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + offset);
// klass ref index is in the low 16-bits.
return refIndex & 0xFFFF;
}
@@ -587,7 +596,7 @@
}
@Override
- public JavaField lookupField(int cpi, int opcode) {
+ public JavaField lookupField(int cpi, ResolvedJavaMethod method, int opcode) {
final int index = rawIndexToConstantPoolIndex(cpi, opcode);
final int nameAndTypeIndex = getNameAndTypeRefIndexAt(index);
final int nameIndex = getNameRefIndexAt(nameAndTypeIndex);
@@ -603,7 +612,7 @@
long[] info = new long[2];
HotSpotResolvedObjectTypeImpl resolvedHolder;
try {
- resolvedHolder = compilerToVM().resolveFieldInPool(this, index, (byte) opcode, info);
+ resolvedHolder = compilerToVM().resolveFieldInPool(this, index, (HotSpotResolvedJavaMethodImpl) method, (byte) opcode, info);
} catch (Throwable t) {
/*
* If there was an exception resolving the field we give up and return an unresolved
@@ -680,15 +689,15 @@
if (!klass.isPrimitive() && !klass.isArray()) {
UNSAFE.ensureClassInitialized(klass);
}
- switch (tag) {
- case MethodRef:
- if (Bytecodes.isInvokeHandleAlias(opcode)) {
- final int methodRefCacheIndex = rawIndexToConstantPoolIndex(cpi, opcode);
- if (isInvokeHandle(methodRefCacheIndex, type)) {
- compilerToVM().resolveInvokeHandleInPool(this, methodRefCacheIndex);
- }
+ if (tag == JVM_CONSTANT.MethodRef) {
+ if (Bytecodes.isInvokeHandleAlias(opcode)) {
+ final int methodRefCacheIndex = rawIndexToConstantPoolIndex(cpi, opcode);
+ if (isInvokeHandle(methodRefCacheIndex, type)) {
+ compilerToVM().resolveInvokeHandleInPool(this, methodRefCacheIndex);
}
+ }
}
+
break;
case InvokeDynamic:
if (isInvokedynamicIndex(cpi)) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,6 @@
import java.lang.reflect.Array;
import java.util.Objects;
-import jdk.internal.vm.annotation.Stable;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.ConstantReflectionProvider;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotForeignCallTarget.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotForeignCallTarget.java Fri Jul 01 16:50:34 2016 -0700
@@ -29,6 +29,7 @@
/**
* The entry point address of this call's target.
*/
+ @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "accessed by subclasses")//
protected long address;
public HotSpotForeignCallTarget(long address) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,8 +22,6 @@
*/
package jdk.vm.ci.hotspot;
-import java.lang.reflect.Module;
-
import jdk.vm.ci.code.CompilationRequest;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
@@ -68,7 +66,6 @@
if (compilerName != null) {
for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
if (f.getCompilerName().equals(compilerName)) {
- Module jvmciModule = JVMCICompilerFactory.class.getModule();
Services.exportJVMCITo(f.getClass());
f.onSelection();
factory = f;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java Fri Jul 01 16:50:34 2016 -0700
@@ -135,6 +135,7 @@
*/
metadataRoots = list.getHead();
}
+ assert isRegistered(metaspaceObject);
}
protected ResolvedJavaType createClass(Class<?> javaClass) {
@@ -208,7 +209,7 @@
ChunkIterator() {
currentChunk = head;
currentIndex = -1;
- findNext();
+ next = findNext();
}
Object[] currentChunk;
@@ -245,4 +246,13 @@
}
}
+
+ synchronized boolean isRegistered(MetaspaceWrapperObject wrapper) {
+ for (WeakReference<MetaspaceWrapperObject> m : list) {
+ if (m != null && m.get() == wrapper) {
+ return true;
+ }
+ }
+ return false;
+ }
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,10 +27,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -48,6 +44,7 @@
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.meta.JavaKind;
import jdk.vm.ci.meta.JavaType;
@@ -94,9 +91,10 @@
*/
public enum Option {
Compiler(String.class, null, "Selects the system compiler."),
- // Note: The following one is not used (see InitTimer.ENABLED).
+ // 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 all HotSpotVMConfig fields."),
+ 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, "");
@@ -200,6 +198,7 @@
protected final CompilerToVM compilerToVm;
+ protected final HotSpotVMConfigStore configStore;
protected final HotSpotVMConfig config;
private final JVMCIBackend hostBackend;
@@ -240,11 +239,13 @@
@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();
try (InitTimer t = timer("HotSpotVMConfig<init>")) {
- config = new HotSpotVMConfig(compilerToVm);
+ configStore = new HotSpotVMConfigStore(compilerToVm);
+ config = new HotSpotVMConfig(configStore);
}
String hostArchitecture = config.getHostArchitectureName();
@@ -270,18 +271,32 @@
}
if (Option.PrintConfig.getBoolean()) {
- printConfig(config, compilerToVm);
+ printConfig(configStore, compilerToVm);
+ System.exit(0);
}
compilerFactory = HotSpotJVMCICompilerConfig.getCompilerFactory();
if (compilerFactory instanceof HotSpotJVMCICompilerFactory) {
hsCompilerFactory = (HotSpotJVMCICompilerFactory) compilerFactory;
trivialPrefixes = hsCompilerFactory.getTrivialPrefixes();
- compilationLevelAdjustment = hsCompilerFactory.getCompilationLevelAdjustment(config);
+ switch (hsCompilerFactory.getCompilationLevelAdjustment()) {
+ case None:
+ compilationLevelAdjustment = config.compLevelAdjustmentNone;
+ break;
+ case ByHolder:
+ compilationLevelAdjustment = config.compLevelAdjustmentByHolder;
+ break;
+ case ByFullSignature:
+ compilationLevelAdjustment = config.compLevelAdjustmentByFullSignature;
+ break;
+ default:
+ compilationLevelAdjustment = config.compLevelAdjustmentNone;
+ break;
+ }
} else {
hsCompilerFactory = null;
trivialPrefixes = null;
- compilationLevelAdjustment = 0;
+ compilationLevelAdjustment = config.compLevelAdjustmentNone;
}
}
@@ -296,6 +311,10 @@
return metaAccessContext.fromClass(javaClass);
}
+ public HotSpotVMConfigStore getConfigStore() {
+ return configStore;
+ }
+
public HotSpotVMConfig getConfig() {
return config;
}
@@ -352,7 +371,35 @@
*/
@SuppressWarnings({"unused"})
private int adjustCompilationLevel(Class<?> declaringClass, String name, String signature, boolean isOsr, int level) {
- return hsCompilerFactory.adjustCompilationLevel(config, declaringClass, name, signature, isOsr, level);
+ CompilationLevel curLevel;
+ if (level == config.compilationLevelNone) {
+ curLevel = CompilationLevel.None;
+ } else if (level == config.compilationLevelSimple) {
+ curLevel = CompilationLevel.Simple;
+ } else if (level == config.compilationLevelLimitedProfile) {
+ curLevel = CompilationLevel.LimitedProfile;
+ } else if (level == config.compilationLevelFullProfile) {
+ curLevel = CompilationLevel.FullProfile;
+ } else if (level == config.compilationLevelFullOptimization) {
+ curLevel = CompilationLevel.FullOptimization;
+ } else {
+ throw JVMCIError.shouldNotReachHere();
+ }
+
+ switch (hsCompilerFactory.adjustCompilationLevel(declaringClass, name, signature, isOsr, curLevel)) {
+ case None:
+ return config.compilationLevelNone;
+ case Simple:
+ return config.compilationLevelSimple;
+ case LimitedProfile:
+ return config.compilationLevelLimitedProfile;
+ case FullProfile:
+ return config.compilationLevelFullProfile;
+ case FullOptimization:
+ return config.compilationLevelFullOptimization;
+ default:
+ return level;
+ }
}
/**
@@ -416,71 +463,40 @@
}
}
- private static void printConfig(HotSpotVMConfig config, CompilerToVM vm) {
- Field[] fields = config.getClass().getDeclaredFields();
- Map<String, Field> sortedFields = new TreeMap<>();
- for (Field f : fields) {
- if (!f.isSynthetic() && !Modifier.isStatic(f.getModifiers())) {
- f.setAccessible(true);
- sortedFields.put(f.getName(), f);
- }
- }
- for (Field f : sortedFields.values()) {
- try {
- String line = String.format("%9s %-40s = %s%n", f.getType().getSimpleName(), f.getName(), pretty(f.get(config)));
- byte[] lineBytes = line.getBytes();
- vm.writeDebugOutput(lineBytes, 0, lineBytes.length);
- vm.flushDebugOutput();
- } catch (Exception e) {
- }
- }
+ @SuppressFBWarnings(value = "DM_DEFAULT_ENCODING", justification = "no localization here please!")
+ private static void printConfigLine(CompilerToVM vm, String format, Object... args) {
+ String line = String.format(format, args);
+ byte[] lineBytes = line.getBytes();
+ vm.writeDebugOutput(lineBytes, 0, lineBytes.length);
+ vm.flushDebugOutput();
}
- private static String pretty(Object value) {
- if (value == null) {
- return "null";
- }
-
- Class<?> klass = value.getClass();
- if (value instanceof String) {
- return "\"" + value + "\"";
- } else if (value instanceof Method) {
- return "method \"" + ((Method) value).getName() + "\"";
- } else if (value instanceof Class<?>) {
- return "class \"" + ((Class<?>) value).getSimpleName() + "\"";
- } else if (value instanceof Integer) {
- if ((Integer) value < 10) {
- return value.toString();
- }
- return value + " (0x" + Integer.toHexString((Integer) value) + ")";
- } else if (value instanceof Long) {
- if ((Long) value < 10 && (Long) value > -10) {
- return value + "l";
+ private static void printConfig(HotSpotVMConfigStore store, CompilerToVM vm) {
+ TreeMap<String, VMField> fields = new TreeMap<>(store.getFields());
+ for (VMField field : fields.values()) {
+ if (!field.isStatic()) {
+ printConfigLine(vm, "[vmconfig:instance field] %s %s {offset=%d[0x%x]}%n", field.type, field.name, field.offset, field.offset);
+ } else {
+ String value = field.value == null ? "null" : String.format("%d[0x%x]", field.value, field.value);
+ printConfigLine(vm, "[vmconfig:static field] %s %s = %s {address=0x%x}%n", field.type, field.name, value, field.address);
}
- return value + "l (0x" + Long.toHexString((Long) value) + "l)";
- } else if (klass.isArray()) {
- StringBuilder str = new StringBuilder();
- int dimensions = 0;
- while (klass.isArray()) {
- dimensions++;
- klass = klass.getComponentType();
- }
- int length = Array.getLength(value);
- str.append(klass.getSimpleName()).append('[').append(length).append(']');
- for (int i = 1; i < dimensions; i++) {
- str.append("[]");
- }
- str.append(" {");
- for (int i = 0; i < length; i++) {
- str.append(pretty(Array.get(value, i)));
- if (i < length - 1) {
- str.append(", ");
- }
- }
- str.append('}');
- return str.toString();
+ }
+ TreeMap<String, VMFlag> flags = new TreeMap<>(store.getFlags());
+ for (VMFlag flag : flags.values()) {
+ printConfigLine(vm, "[vmconfig:flag] %s %s = %s%n", flag.type, flag.name, flag.value);
+ }
+ TreeMap<String, Long> addresses = new TreeMap<>(store.getAddresses());
+ for (Map.Entry<String, Long> e : addresses.entrySet()) {
+ printConfigLine(vm, "[vmconfig:address] %s = %d[0x%x]%n", e.getKey(), e.getValue(), e.getValue());
}
- return value.toString();
+ TreeMap<String, Long> constants = new TreeMap<>(store.getConstants());
+ for (Map.Entry<String, Long> e : constants.entrySet()) {
+ printConfigLine(vm, "[vmconfig:constant] %s = %d[0x%x]%n", e.getKey(), e.getValue(), e.getValue());
+ }
+ TreeMap<String, Long> typeSizes = new TreeMap<>(store.getTypeSizes());
+ for (Map.Entry<String, Long> e : typeSizes.entrySet()) {
+ printConfigLine(vm, "[vmconfig:type size] %s = %d%n", e.getKey(), e.getValue());
+ }
}
public OutputStream getLogStream() {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -36,6 +36,8 @@
*/
public interface HotSpotJVMCIRuntimeProvider extends JVMCIRuntime {
+ HotSpotVMConfigStore getConfigStore();
+
HotSpotVMConfig getConfig();
CompilerToVM getCompilerToVM();
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,6 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.hotspot.HotSpotVMConfig.CompressEncoding;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.MemoryAccessProvider;
@@ -32,11 +31,11 @@
*/
public interface HotSpotMemoryAccessProvider extends MemoryAccessProvider {
- JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding);
+ JavaConstant readNarrowOopConstant(Constant base, long displacement);
Constant readKlassPointerConstant(Constant base, long displacement);
- Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding);
+ Constant readNarrowKlassPointerConstant(Constant base, long displacement);
Constant readMethodPointerConstant(Constant base, long displacement);
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,7 +23,7 @@
package jdk.vm.ci.hotspot;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import jdk.vm.ci.hotspot.HotSpotVMConfig.CompressEncoding;
+
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
@@ -206,8 +206,7 @@
}
@Override
- public JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding) {
- assert encoding.equals(runtime.getConfig().getOopEncoding()) : "unexpected oop encoding: " + encoding + " != " + runtime.getConfig().getOopEncoding();
+ public JavaConstant readNarrowOopConstant(Constant base, long displacement) {
return HotSpotObjectConstantImpl.forObject(readRawObject(base, displacement, true), true);
}
@@ -227,7 +226,7 @@
}
@Override
- public Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding) {
+ public Constant readNarrowKlassPointerConstant(Constant base, long displacement) {
HotSpotResolvedObjectTypeImpl klass = readKlass(base, displacement, true);
if (klass == null) {
return HotSpotCompressedNullConstant.COMPRESSED_NULL;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java Fri Jul 01 16:50:34 2016 -0700
@@ -30,7 +30,7 @@
import java.util.Arrays;
-import jdk.vm.ci.hotspot.HotSpotMethodDataAccessor.Tag;
+import jdk.internal.misc.Unsafe;
import jdk.vm.ci.meta.DeoptimizationReason;
import jdk.vm.ci.meta.JavaMethodProfile;
import jdk.vm.ci.meta.JavaMethodProfile.ProfiledMethod;
@@ -39,41 +39,20 @@
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;
import jdk.vm.ci.meta.TriState;
-import jdk.internal.misc.Unsafe;
/**
- * Access to a HotSpot MethodData structure (defined in methodData.hpp).
+ * Access to a HotSpot {@code MethodData} structure (defined in methodData.hpp).
*/
-public final class HotSpotMethodData {
-
- private static final HotSpotVMConfig config = config();
- private static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(TriState.FALSE);
- private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(TriState.UNKNOWN);
+final class HotSpotMethodData {
- // sorted by tag
- // @formatter:off
- private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {
- null,
- new BitData(),
- new CounterData(),
- new JumpData(),
- new ReceiverTypeData(),
- new VirtualCallData(),
- new RetData(),
- new BranchData(),
- new MultiBranchData(),
- new ArgInfoData(),
- new UnknownProfileData(Tag.CallTypeData),
- new VirtualCallTypeData(),
- new UnknownProfileData(Tag.ParametersTypeData),
- new UnknownProfileData(Tag.SpeculativeTrapData),
- };
- // @formatter:on
+ static final HotSpotVMConfig config = config();
+ static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(config, config.dataLayoutNoTag, TriState.FALSE);
+ static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(config, config.dataLayoutNoTag, TriState.UNKNOWN);
/**
* Reference to the C++ MethodData object.
*/
- private final long metaspaceMethodData;
+ final long metaspaceMethodData;
@SuppressWarnings("unused") private final HotSpotResolvedJavaMethodImpl method;
public HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) {
@@ -133,10 +112,7 @@
return null;
}
- HotSpotMethodDataAccessor result = getData(position);
- final Tag tag = AbstractMethodData.readTag(this, position);
- assert result != null : "NO_DATA tag is not allowed " + tag;
- return result;
+ return getData(position);
}
public HotSpotMethodDataAccessor getExtraData(int position) {
@@ -160,18 +136,18 @@
private HotSpotMethodDataAccessor getData(int position) {
assert position >= 0 : "out of bounds";
- final Tag tag = AbstractMethodData.readTag(this, position);
- HotSpotMethodDataAccessor accessor = PROFILE_DATA_ACCESSORS[tag.getValue()];
+ final int tag = HotSpotMethodDataAccessor.readTag(config, this, position);
+ HotSpotMethodDataAccessor accessor = PROFILE_DATA_ACCESSORS[tag];
assert accessor == null || accessor.getTag() == tag : "wrong data accessor " + accessor + " for tag " + tag;
return accessor;
}
- private int readUnsignedByte(int position, int offsetInBytes) {
+ int readUnsignedByte(int position, int offsetInBytes) {
long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
return UNSAFE.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF;
}
- private int readUnsignedShort(int position, int offsetInBytes) {
+ int readUnsignedShort(int position, int offsetInBytes) {
long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
return UNSAFE.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF;
}
@@ -269,102 +245,14 @@
return sb.toString();
}
- private abstract static class AbstractMethodData implements HotSpotMethodDataAccessor {
-
- /**
- * Corresponds to {@code exception_seen_flag}.
- */
- private static final int EXCEPTIONS_MASK = 1 << config.bitDataExceptionSeenFlag;
-
- private final Tag tag;
- protected final int staticSize;
-
- protected AbstractMethodData(Tag tag, int staticSize) {
- this.tag = tag;
- this.staticSize = staticSize;
- }
-
- public Tag getTag() {
- return tag;
- }
-
- public static Tag readTag(HotSpotMethodData data, int position) {
- final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset);
- return Tag.getEnum(tag);
- }
-
- @Override
- public int getBCI(HotSpotMethodData data, int position) {
- return data.readUnsignedShort(position, config.dataLayoutBCIOffset);
- }
-
- @Override
- public final int getSize(HotSpotMethodData data, int position) {
- int size = staticSize + getDynamicSize(data, position);
- // Sanity check against VM
- int vmSize = HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position);
- assert size == vmSize : size + " != " + vmSize;
- return size;
- }
-
- @Override
- public TriState getExceptionSeen(HotSpotMethodData data, int position) {
- return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0);
- }
+ static final int NO_DATA_SIZE = cellIndexToOffset(0);
- @Override
- public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
- return null;
- }
-
- @Override
- public JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position) {
- return null;
- }
-
- @Override
- public double getBranchTakenProbability(HotSpotMethodData data, int position) {
- return -1;
- }
-
- @Override
- public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
- return null;
- }
-
- @Override
- public int getExecutionCount(HotSpotMethodData data, int position) {
- return -1;
- }
-
- @Override
- public TriState getNullSeen(HotSpotMethodData data, int position) {
- return TriState.UNKNOWN;
- }
-
- protected int getFlags(HotSpotMethodData data, int position) {
- return data.readUnsignedByte(position, config.dataLayoutFlagsOffset);
- }
-
- /**
- * @param data
- * @param position
- */
- protected int getDynamicSize(HotSpotMethodData data, int position) {
- return 0;
- }
-
- public abstract StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos);
- }
-
- private static class NoMethodData extends AbstractMethodData {
-
- private static final int NO_DATA_SIZE = cellIndexToOffset(0);
+ static class NoMethodData extends HotSpotMethodDataAccessor {
private final TriState exceptionSeen;
- protected NoMethodData(TriState exceptionSeen) {
- super(Tag.No, NO_DATA_SIZE);
+ protected NoMethodData(HotSpotVMConfig config, int tag, TriState exceptionSeen) {
+ super(config, tag, NO_DATA_SIZE);
this.exceptionSeen = exceptionSeen;
}
@@ -384,17 +272,17 @@
}
}
- private static class BitData extends AbstractMethodData {
+ static final int BIT_DATA_SIZE = cellIndexToOffset(0);
+ static final int BIT_DATA_NULL_SEEN_FLAG = 1 << config.bitDataNullSeenFlag;
- private static final int BIT_DATA_SIZE = cellIndexToOffset(0);
- private static final int BIT_DATA_NULL_SEEN_FLAG = 1 << config.bitDataNullSeenFlag;
+ static class BitData extends HotSpotMethodDataAccessor {
- private BitData() {
- super(Tag.BitData, BIT_DATA_SIZE);
+ private BitData(HotSpotVMConfig config, int tag) {
+ super(config, tag, BIT_DATA_SIZE);
}
- protected BitData(Tag tag, int staticSize) {
- super(tag, staticSize);
+ protected BitData(HotSpotVMConfig config, int tag, int staticSize) {
+ super(config, tag, staticSize);
}
@Override
@@ -408,17 +296,17 @@
}
}
- private static class CounterData extends BitData {
+ static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
+ static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(config.methodDataCountOffset);
- private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
- private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(config.methodDataCountOffset);
+ static class CounterData extends BitData {
- CounterData() {
- super(Tag.CounterData, COUNTER_DATA_SIZE);
+ CounterData(HotSpotVMConfig config, int tag) {
+ super(config, tag, COUNTER_DATA_SIZE);
}
- protected CounterData(Tag tag, int staticSize) {
- super(tag, staticSize);
+ protected CounterData(HotSpotVMConfig config, int tag, int staticSize) {
+ super(config, tag, staticSize);
}
@Override
@@ -436,18 +324,18 @@
}
}
- private static class JumpData extends AbstractMethodData {
+ static final int JUMP_DATA_SIZE = cellIndexToOffset(2);
+ static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(config.jumpDataTakenOffset);
+ static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(config.jumpDataDisplacementOffset);
- private static final int JUMP_DATA_SIZE = cellIndexToOffset(2);
- protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(config.jumpDataTakenOffset);
- protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(config.jumpDataDisplacementOffset);
+ static class JumpData extends HotSpotMethodDataAccessor {
- JumpData() {
- super(Tag.JumpData, JUMP_DATA_SIZE);
+ JumpData(HotSpotVMConfig config, int tag) {
+ super(config, tag, JUMP_DATA_SIZE);
}
- protected JumpData(Tag tag, int staticSize) {
- super(tag, staticSize);
+ protected JumpData(HotSpotVMConfig config, int tag, int staticSize) {
+ super(config, tag, staticSize);
}
@Override
@@ -484,16 +372,16 @@
}
}
- private abstract static class AbstractTypeData extends CounterData {
-
- protected static final int TYPE_DATA_ROW_SIZE = cellsToBytes(config.receiverTypeDataReceiverTypeRowCellCount);
+ static final int TYPE_DATA_ROW_SIZE = cellsToBytes(config.receiverTypeDataReceiverTypeRowCellCount);
- protected static final int NONPROFILED_COUNT_OFFSET = cellIndexToOffset(config.receiverTypeDataNonprofiledCountOffset);
- protected static final int TYPE_DATA_FIRST_TYPE_OFFSET = cellIndexToOffset(config.receiverTypeDataReceiver0Offset);
- protected static final int TYPE_DATA_FIRST_TYPE_COUNT_OFFSET = cellIndexToOffset(config.receiverTypeDataCount0Offset);
+ static final int NONPROFILED_COUNT_OFFSET = cellIndexToOffset(config.receiverTypeDataNonprofiledCountOffset);
+ static final int TYPE_DATA_FIRST_TYPE_OFFSET = cellIndexToOffset(config.receiverTypeDataReceiver0Offset);
+ static final int TYPE_DATA_FIRST_TYPE_COUNT_OFFSET = cellIndexToOffset(config.receiverTypeDataCount0Offset);
- protected AbstractTypeData(Tag tag, int staticSize) {
- super(tag, staticSize);
+ abstract static class AbstractTypeData extends CounterData {
+
+ protected AbstractTypeData(HotSpotVMConfig config, int tag, int staticSize) {
+ super(config, tag, staticSize);
}
@Override
@@ -539,7 +427,7 @@
protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position);
- private static JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) {
+ private JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) {
if (profile.entries <= 0 || profile.totalCount <= 0) {
return null;
}
@@ -583,16 +471,16 @@
}
}
- private static class ReceiverTypeData extends AbstractTypeData {
+ static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
- private static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
+ static class ReceiverTypeData extends AbstractTypeData {
- ReceiverTypeData() {
- super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE);
+ ReceiverTypeData(HotSpotVMConfig config, int tag) {
+ super(config, tag, TYPE_CHECK_DATA_SIZE);
}
- protected ReceiverTypeData(Tag tag, int staticSize) {
- super(tag, staticSize);
+ protected ReceiverTypeData(HotSpotVMConfig config, int tag, int staticSize) {
+ super(config, tag, staticSize);
}
@Override
@@ -606,18 +494,18 @@
}
}
- private static class VirtualCallData extends ReceiverTypeData {
+ static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth);
+ static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
+ static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
- private static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth);
- private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
- private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
+ static class VirtualCallData extends ReceiverTypeData {
- VirtualCallData() {
- super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE);
+ VirtualCallData(HotSpotVMConfig config, int tag) {
+ super(config, tag, VIRTUAL_CALL_DATA_SIZE);
}
- protected VirtualCallData(Tag tag, int staticSize) {
- super(tag, staticSize);
+ protected VirtualCallData(HotSpotVMConfig config, int tag, int staticSize) {
+ super(config, tag, staticSize);
}
@Override
@@ -647,7 +535,7 @@
return createMethodProfile(getRawMethodProfile(data, position));
}
- private static RawItemProfile<ResolvedJavaMethod> getRawMethodProfile(HotSpotMethodData data, int position) {
+ private RawItemProfile<ResolvedJavaMethod> getRawMethodProfile(HotSpotMethodData data, int position) {
int profileWidth = config.methodProfileWidth;
ResolvedJavaMethod[] methods = new ResolvedJavaMethod[profileWidth];
@@ -671,7 +559,7 @@
return new RawItemProfile<>(entries, methods, counts, totalCount);
}
- private static JavaMethodProfile createMethodProfile(RawItemProfile<ResolvedJavaMethod> profile) {
+ private JavaMethodProfile createMethodProfile(RawItemProfile<ResolvedJavaMethod> profile) {
if (profile.entries <= 0 || profile.totalCount <= 0) {
return null;
}
@@ -712,10 +600,10 @@
}
}
- private static class VirtualCallTypeData extends VirtualCallData {
+ static class VirtualCallTypeData extends VirtualCallData {
- VirtualCallTypeData() {
- super(Tag.VirtualCallTypeData, 0);
+ VirtualCallTypeData(HotSpotVMConfig config, int tag) {
+ super(config, tag, 0);
}
@Override
@@ -725,23 +613,23 @@
}
}
- private static class RetData extends CounterData {
+ static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
+ static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth;
- private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
- private static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth;
+ static class RetData extends CounterData {
- RetData() {
- super(Tag.RetData, RET_DATA_SIZE);
+ RetData(HotSpotVMConfig config, int tag) {
+ super(config, tag, RET_DATA_SIZE);
}
}
- private static class BranchData extends JumpData {
+ static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
+ static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(config.branchDataNotTakenOffset);
- private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
- private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(config.branchDataNotTakenOffset);
+ static class BranchData extends JumpData {
- BranchData() {
- super(Tag.BranchData, BRANCH_DATA_SIZE);
+ BranchData(HotSpotVMConfig config, int tag) {
+ super(config, tag, BRANCH_DATA_SIZE);
}
@Override
@@ -768,13 +656,13 @@
}
}
- private static class ArrayData extends AbstractMethodData {
+ static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(config.arrayDataArrayLenOffset);
+ static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(config.arrayDataArrayStartOffset);
- private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(config.arrayDataArrayLenOffset);
- protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(config.arrayDataArrayStartOffset);
+ static class ArrayData extends HotSpotMethodDataAccessor {
- ArrayData(Tag tag, int staticSize) {
- super(tag, staticSize);
+ ArrayData(HotSpotVMConfig config, int tag, int staticSize) {
+ super(config, tag, staticSize);
}
@Override
@@ -792,16 +680,16 @@
}
}
- private static class MultiBranchData extends ArrayData {
+ static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1);
+ static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = config.multiBranchDataPerCaseCellCount;
+ static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS);
+ static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
+ static final int MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(1);
- private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1);
- private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = config.multiBranchDataPerCaseCellCount;
- private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS);
- private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
- private static final int MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(1);
+ static class MultiBranchData extends ArrayData {
- MultiBranchData() {
- super(Tag.MultiBranchData, MULTI_BRANCH_DATA_SIZE);
+ MultiBranchData(HotSpotVMConfig config, int tag) {
+ super(config, tag, MULTI_BRANCH_DATA_SIZE);
}
@Override
@@ -878,18 +766,18 @@
}
}
- private static class ArgInfoData extends ArrayData {
+ static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1);
- private static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1);
+ static class ArgInfoData extends ArrayData {
- ArgInfoData() {
- super(Tag.ArgInfoData, ARG_INFO_DATA_SIZE);
+ ArgInfoData(HotSpotVMConfig config, int tag) {
+ super(config, tag, ARG_INFO_DATA_SIZE);
}
}
- private static class UnknownProfileData extends AbstractMethodData {
- UnknownProfileData(Tag tag) {
- super(tag, 0);
+ static class UnknownProfileData extends HotSpotMethodDataAccessor {
+ UnknownProfileData(HotSpotVMConfig config, int tag) {
+ super(config, tag, 0);
}
@Override
@@ -900,7 +788,6 @@
@Override
public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
- // TODO Auto-generated method stub
return null;
}
}
@@ -912,4 +799,41 @@
public int getCompiledIRSize() {
return UNSAFE.getInt(metaspaceMethodData + config.methodDataIRSizeOffset);
}
+
+ // sorted by tag
+ // @formatter:off
+ static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {
+ null,
+ new BitData(config, config.dataLayoutBitDataTag),
+ new CounterData(config, config.dataLayoutCounterDataTag),
+ new JumpData(config, config.dataLayoutJumpDataTag),
+ new ReceiverTypeData(config, config.dataLayoutReceiverTypeDataTag),
+ new VirtualCallData(config, config.dataLayoutVirtualCallDataTag),
+ new RetData(config, config.dataLayoutRetDataTag),
+ new BranchData(config, config.dataLayoutBranchDataTag),
+ new MultiBranchData(config, config.dataLayoutMultiBranchDataTag),
+ new ArgInfoData(config, config.dataLayoutArgInfoDataTag),
+ new UnknownProfileData(config, config.dataLayoutCallTypeDataTag),
+ new VirtualCallTypeData(config, config.dataLayoutVirtualCallTypeDataTag),
+ new UnknownProfileData(config, config.dataLayoutParametersTypeDataTag),
+ new UnknownProfileData(config, config.dataLayoutSpeculativeTrapDataTag),
+ };
+
+ private static boolean checkAccessorTags() {
+ int expectedTag = 0;
+ for (HotSpotMethodDataAccessor accessor : PROFILE_DATA_ACCESSORS) {
+ if (expectedTag ==0 ) {
+ assert accessor == null;
+ } else {
+ assert accessor.tag == expectedTag: expectedTag + " != " + accessor.tag + " " + accessor;
+ }
+ expectedTag++;
+ }
+ return true;
+ }
+
+ static {
+ assert checkAccessorTags();
+ }
+ // @formatter:on
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,110 +1,129 @@
-/*
- * Copyright (c) 2011, 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.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
import jdk.vm.ci.meta.JavaMethodProfile;
import jdk.vm.ci.meta.JavaTypeProfile;
import jdk.vm.ci.meta.ProfilingInfo;
import jdk.vm.ci.meta.TriState;
/**
- * Interface for accessor objects that encapsulate the logic for accessing the different kinds of
- * data in a HotSpot methodDataOop. This interface is similar to the interface {@link ProfilingInfo}
- * , but most methods require a MethodDataObject and the exact position within the methodData.
+ * Base class for accessing the different kinds of data in a HotSpot {@code MethodData}. This is
+ * similar to {@link ProfilingInfo}, but most methods require a {@link HotSpotMethodData} and the
+ * exact position within the method data.
*/
-public interface HotSpotMethodDataAccessor {
+abstract class HotSpotMethodDataAccessor {
- /**
- * {@code DataLayout} tag values.
- */
- enum Tag {
- No(config().dataLayoutNoTag),
- BitData(config().dataLayoutBitDataTag),
- CounterData(config().dataLayoutCounterDataTag),
- JumpData(config().dataLayoutJumpDataTag),
- ReceiverTypeData(config().dataLayoutReceiverTypeDataTag),
- VirtualCallData(config().dataLayoutVirtualCallDataTag),
- RetData(config().dataLayoutRetDataTag),
- BranchData(config().dataLayoutBranchDataTag),
- MultiBranchData(config().dataLayoutMultiBranchDataTag),
- ArgInfoData(config().dataLayoutArgInfoDataTag),
- CallTypeData(config().dataLayoutCallTypeDataTag),
- VirtualCallTypeData(config().dataLayoutVirtualCallTypeDataTag),
- ParametersTypeData(config().dataLayoutParametersTypeDataTag),
- SpeculativeTrapData(config().dataLayoutSpeculativeTrapDataTag);
+ final int tag;
+ final int staticSize;
+ final HotSpotVMConfig config;
- private final int value;
-
- Tag(int value) {
- this.value = value;
- }
-
- public int getValue() {
- return value;
- }
-
- public static Tag getEnum(int value) {
- Tag result = values()[value];
- assert value == result.value;
- return result;
- }
+ protected HotSpotMethodDataAccessor(HotSpotVMConfig config, int tag, int staticSize) {
+ this.config = config;
+ this.tag = tag;
+ this.staticSize = staticSize;
}
/**
- * Returns the {@link Tag} stored in the LayoutData header.
+ * Returns the tag stored in the LayoutData header.
*
* @return tag stored in the LayoutData header
*/
- Tag getTag();
+ int getTag() {
+ return tag;
+ }
+
+ static int readTag(HotSpotVMConfig config, HotSpotMethodData data, int position) {
+ final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset);
+ assert tag >= config.dataLayoutNoTag && tag <= config.dataLayoutSpeculativeTrapDataTag : "profile data tag out of bounds: " + tag;
+ return tag;
+ }
/**
* Returns the BCI stored in the LayoutData header.
*
- * @return An integer ≥ 0 and ≤ Short.MAX_VALUE, or -1 if not supported.
+ * @return an integer between 0 and {@link Short#MAX_VALUE} inclusive, or -1 if not supported
*/
- int getBCI(HotSpotMethodData data, int position);
+ int getBCI(HotSpotMethodData data, int position) {
+ return data.readUnsignedShort(position, config.dataLayoutBCIOffset);
+ }
/**
* Computes the size for the specific data at the given position.
*
- * @return An integer > 0.
+ * @return a value greater than 0
*/
- int getSize(HotSpotMethodData data, int position);
+ final int getSize(HotSpotMethodData data, int position) {
+ int size = staticSize + getDynamicSize(data, position);
+ // Sanity check against VM
+ int vmSize = HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position);
+ assert size == vmSize : size + " != " + vmSize;
+ return size;
+ }
+
+ TriState getExceptionSeen(HotSpotMethodData data, int position) {
+ final int EXCEPTIONS_MASK = 1 << config.bitDataExceptionSeenFlag;
+ return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0);
+ }
- JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position);
+ /**
+ * @param data
+ * @param position
+ */
+ JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
+ return null;
+ }
- JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position);
+ /**
+ * @param data
+ * @param position
+ */
+ JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position) {
+ return null;
+ }
- double getBranchTakenProbability(HotSpotMethodData data, int position);
+ /**
+ * @param data
+ * @param position
+ */
+ double getBranchTakenProbability(HotSpotMethodData data, int position) {
+ return -1;
+ }
- double[] getSwitchProbabilities(HotSpotMethodData data, int position);
+ /**
+ * @param data
+ * @param position
+ */
+ double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
+ return null;
+ }
- TriState getExceptionSeen(HotSpotMethodData data, int position);
+ /**
+ * @param data
+ * @param position
+ */
+ int getExecutionCount(HotSpotMethodData data, int position) {
+ return -1;
+ }
- TriState getNullSeen(HotSpotMethodData data, int position);
+ /**
+ * @param data
+ * @param position
+ */
+ TriState getNullSeen(HotSpotMethodData data, int position) {
+ return TriState.UNKNOWN;
+ }
+
+ protected int getFlags(HotSpotMethodData data, int position) {
+ return data.readUnsignedByte(position, config.dataLayoutFlagsOffset);
+ }
- int getExecutionCount(HotSpotMethodData data, int position);
+ /**
+ * @param data
+ * @param position
+ */
+ protected int getDynamicSize(HotSpotMethodData data, int position) {
+ return 0;
+ }
- StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos);
-}
+ abstract StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos);
+
+}
\ No newline at end of file
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotReferenceMap.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotReferenceMap.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,13 +27,25 @@
import jdk.vm.ci.code.Location;
import jdk.vm.ci.code.ReferenceMap;
+/**
+ * Describes where the object references are in machine state, compliant with what HotSpot expects.
+ */
public final class HotSpotReferenceMap extends ReferenceMap {
- final Location[] objects;
- final Location[] derivedBase;
- final int[] sizeInBytes;
- final int maxRegisterSize;
+ private final Location[] objects;
+ private final Location[] derivedBase;
+ private final int[] sizeInBytes;
+ private final int maxRegisterSize;
+ /**
+ *
+ * @param objects This array is now owned by this object and must not be mutated by the caller.
+ * @param derivedBase This array is now owned by this object and must not be mutated by the
+ * caller.
+ * @param sizeInBytes This array is now owned by this object and must not be mutated by the
+ * caller.
+ */
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `objects`, `derivedBase` and `sizeInBytes`")
public HotSpotReferenceMap(Location[] objects, Location[] derivedBase, int[] sizeInBytes, int maxRegisterSize) {
this.objects = objects;
this.derivedBase = derivedBase;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -28,12 +28,8 @@
import java.lang.reflect.Field;
import jdk.internal.vm.annotation.Stable;
-import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
import jdk.vm.ci.meta.JavaType;
-import jdk.vm.ci.meta.MetaAccessProvider;
import jdk.vm.ci.meta.ModifiersProvider;
-import jdk.vm.ci.meta.ResolvedJavaField;
import jdk.vm.ci.meta.ResolvedJavaType;
/**
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Fri Jul 01 16:50:34 2016 -0700
@@ -132,10 +132,20 @@
return UNSAFE.getInt(javaClass, config().klassOffset) & 0xFFFFFFFFL;
}
+ @Override
public long getMetaspacePointer() {
return getMetaspaceKlass();
}
+ /**
+ * The Klass* for this object is kept alive by the direct reference to {@link #javaClass} so no
+ * extra work is required.
+ */
+ @Override
+ public boolean isRegistered() {
+ return true;
+ }
+
@Override
public int getModifiers() {
if (isArray()) {
@@ -428,7 +438,13 @@
}
public HotSpotConstantPool getConstantPool() {
- if (constantPool == null) {
+ if (constantPool == null || !isArray() && UNSAFE.getAddress(getMetaspaceKlass() + config().instanceKlassConstantsOffset) != constantPool.getMetaspaceConstantPool()) {
+ /*
+ * If the pointer to the ConstantPool has changed since this was last read refresh the
+ * HotSpotConstantPool wrapper object. This ensures that uses of the constant pool are
+ * operating on the latest one and that HotSpotResolvedJavaMethodImpls will be able to
+ * use the shared copy instead of creating their own instance.
+ */
constantPool = compilerToVM().getConstantPool(this, config().instanceKlassConstantsOffset);
}
return constantPool;
@@ -575,7 +591,8 @@
// Get Klass::_fields
final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code";
- metaspaceData = metaspaceFields + config.arrayU2DataOffset + config.fieldInfoFieldSlots * Short.BYTES * index;
+ int offset = config.fieldInfoFieldSlots * Short.BYTES * index;
+ metaspaceData = metaspaceFields + config.arrayU2DataOffset + offset;
}
private int getAccessFlags() {
@@ -603,7 +620,8 @@
* on top an array of Java shorts.
*/
private int readFieldSlot(int index) {
- return UNSAFE.getChar(metaspaceData + Short.BYTES * index);
+ int offset = Short.BYTES * index;
+ return UNSAFE.getChar(metaspaceData + offset);
}
/**
@@ -612,7 +630,7 @@
*/
public String getName() {
final int nameIndex = getNameIndex();
- return isInternal() ? HotSpotVmSymbols.symbolAt(nameIndex) : getConstantPool().lookupUtf8(nameIndex);
+ return isInternal() ? config().symbolAt(nameIndex) : getConstantPool().lookupUtf8(nameIndex);
}
/**
@@ -621,7 +639,7 @@
*/
public String getSignature() {
final int signatureIndex = getSignatureIndex();
- return isInternal() ? HotSpotVmSymbols.symbolAt(signatureIndex) : getConstantPool().lookupUtf8(signatureIndex);
+ return isInternal() ? config().symbolAt(signatureIndex) : getConstantPool().lookupUtf8(signatureIndex);
}
public JavaType getType() {
@@ -642,6 +660,7 @@
}
}
+ @SuppressFBWarnings(value = "SE_COMPARATOR_SHOULD_BE_SERIALIZABLE", justification = "comparator is only used transiently")
private static class OffsetComparator implements java.util.Comparator<HotSpotResolvedJavaField> {
@Override
public int compare(HotSpotResolvedJavaField o1, HotSpotResolvedJavaField o2) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java Fri Jul 01 16:50:34 2016 -0700
@@ -35,7 +35,7 @@
/** Written by the C++ code that performs deoptimization. */
private volatile Object lastFailed;
- /** All speculations that have been a deoptimization reason. */
+ /** All speculations that have caused a deoptimization. */
private Set<SpeculationReason> failedSpeculations;
/** Strong references to all reasons embedded in the current nmethod. */
@@ -54,7 +54,7 @@
}
@Override
- public boolean maySpeculate(SpeculationReason reason) {
+ public synchronized boolean maySpeculate(SpeculationReason reason) {
if (failedSpeculations != null && failedSpeculations.contains(reason)) {
return false;
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,1639 +25,310 @@
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.Iterator;
-
import jdk.internal.misc.Unsafe;
-import jdk.internal.vm.annotation.Stable;
-import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.hotspotvmconfig.HotSpotVMAddress;
-import jdk.vm.ci.hotspotvmconfig.HotSpotVMConstant;
-import jdk.vm.ci.hotspotvmconfig.HotSpotVMData;
-import jdk.vm.ci.hotspotvmconfig.HotSpotVMField;
-import jdk.vm.ci.hotspotvmconfig.HotSpotVMFlag;
-import jdk.vm.ci.hotspotvmconfig.HotSpotVMType;
/**
* Used to access native configuration details.
*
* All non-static, public fields in this class are so that they can be compiled as constants.
*/
-public class HotSpotVMConfig {
+class HotSpotVMConfig extends HotSpotVMConfigAccess {
/**
* Gets the configuration associated with the singleton {@link HotSpotJVMCIRuntime}.
*/
- public static HotSpotVMConfig config() {
+ static HotSpotVMConfig config() {
return runtime().getConfig();
}
- /**
- * Maximum allowed size of allocated area for a frame.
- */
- public final int maxFrameSize = 16 * 1024;
-
- public HotSpotVMConfig(CompilerToVM compilerToVm) {
- // Get raw pointer to the array that contains all gHotSpotVM values.
- final long gHotSpotVMData = compilerToVm.initializeConfiguration(this);
- assert gHotSpotVMData != 0;
-
- // Make FindBugs happy.
- jvmciHotSpotVMStructs = 0;
- jvmciHotSpotVMTypes = 0;
- jvmciHotSpotVMIntConstants = 0;
- jvmciHotSpotVMLongConstants = 0;
- jvmciHotSpotVMAddresses = 0;
-
- // Initialize the gHotSpotVM fields.
- for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
- if (f.isAnnotationPresent(HotSpotVMData.class)) {
- HotSpotVMData annotation = f.getAnnotation(HotSpotVMData.class);
- final int index = annotation.index();
- final long value = UNSAFE.getAddress(gHotSpotVMData + Unsafe.ADDRESS_SIZE * index);
- try {
- f.setLong(this, value);
- } catch (IllegalAccessException e) {
- throw new JVMCIError("index " + index, e);
- }
- }
- }
-
- // Quick sanity check.
- assert jvmciHotSpotVMStructs != 0;
- assert jvmciHotSpotVMTypes != 0;
- assert jvmciHotSpotVMIntConstants != 0;
- assert jvmciHotSpotVMLongConstants != 0;
- assert jvmciHotSpotVMAddresses != 0;
-
- initialize();
-
- oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift, logMinObjAlignment());
- klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift, logKlassAlignment);
-
- assert check();
- assert HotSpotVMConfigVerifier.check();
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName();
- }
-
- /**
- * Reads a {@code '\0'} terminated C string from native memory and converts it to a
- * {@link String}.
- *
- * @return a Java string
- */
- private static String readCString(Unsafe unsafe, long address) {
- if (address == 0) {
- return null;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0;; i++) {
- char c = (char) unsafe.getByte(address + i);
- if (c == 0) {
- break;
- }
- sb.append(c);
- }
- return sb.toString();
- }
-
- /**
- * Initialize fields by reading their values from vmStructs.
- */
- private void initialize() {
- // Fill the VM fields hash map.
- HashMap<String, VMFields.Field> vmFields = new HashMap<>();
- for (VMFields.Field e : new VMFields(jvmciHotSpotVMStructs)) {
- vmFields.put(e.getName(), e);
- }
-
- // Fill the VM types hash map.
- HashMap<String, VMTypes.Type> vmTypes = new HashMap<>();
- for (VMTypes.Type e : new VMTypes(jvmciHotSpotVMTypes)) {
- vmTypes.put(e.getTypeName(), e);
- }
-
- // Fill the VM constants hash map.
- HashMap<String, AbstractConstant> vmConstants = new HashMap<>();
- for (AbstractConstant e : new VMIntConstants(jvmciHotSpotVMIntConstants)) {
- vmConstants.put(e.getName(), e);
- }
- for (AbstractConstant e : new VMLongConstants(jvmciHotSpotVMLongConstants)) {
- vmConstants.put(e.getName(), e);
- }
-
- // Fill the VM addresses hash map.
- HashMap<String, VMAddresses.Address> vmAddresses = new HashMap<>();
- for (VMAddresses.Address e : new VMAddresses(jvmciHotSpotVMAddresses)) {
- vmAddresses.put(e.getName(), e);
- }
-
- // Fill the flags hash map.
- HashMap<String, Flags.Flag> flags = new HashMap<>();
- for (Flags.Flag e : new Flags(vmFields, vmTypes)) {
- flags.put(e.getName(), e);
- }
-
- String osName = getHostOSName();
- String osArch = getHostArchitectureName();
-
- for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
- if (f.isAnnotationPresent(HotSpotVMField.class)) {
- HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
- String name = annotation.name();
- String type = annotation.type();
- VMFields.Field entry = vmFields.get(name);
- if (entry == null) {
- if (!isRequired(osArch, annotation.archs())) {
- continue;
- }
- throw new JVMCIError(f.getName() + ": expected VM field not found: " + name);
- }
-
- // Make sure the native type is still the type we expect.
- if (!type.isEmpty()) {
- if (!type.equals(entry.getTypeString())) {
- throw new JVMCIError(f.getName() + ": compiler expects type " + type + " but VM field " + name + " is of type " + entry.getTypeString());
- }
- }
+ private final String osArch = getHostArchitectureName();
- switch (annotation.get()) {
- case OFFSET:
- setField(f, entry.getOffset());
- break;
- case ADDRESS:
- setField(f, entry.getAddress());
- break;
- case VALUE:
- setField(f, entry.getValue());
- break;
- default:
- throw new JVMCIError(f.getName() + ": unknown kind: " + annotation.get());
- }
- } else if (f.isAnnotationPresent(HotSpotVMType.class)) {
- HotSpotVMType annotation = f.getAnnotation(HotSpotVMType.class);
- String name = annotation.name();
- VMTypes.Type entry = vmTypes.get(name);
- if (entry == null) {
- throw new JVMCIError(f.getName() + ": expected VM type not found: " + name);
- }
-
- switch (annotation.get()) {
- case SIZE:
- setField(f, entry.getSize());
- break;
- default:
- throw new JVMCIError(f.getName() + ": unknown kind: " + annotation.get());
- }
- } else if (f.isAnnotationPresent(HotSpotVMConstant.class)) {
- HotSpotVMConstant annotation = f.getAnnotation(HotSpotVMConstant.class);
- String name = annotation.name();
- AbstractConstant entry = vmConstants.get(name);
- if (entry == null) {
- if (!isRequired(osArch, annotation.archs())) {
- continue;
- }
- throw new JVMCIError(f.getName() + ": expected VM constant not found: " + name);
- }
- setField(f, entry.getValue());
- } else if (f.isAnnotationPresent(HotSpotVMAddress.class)) {
- HotSpotVMAddress annotation = f.getAnnotation(HotSpotVMAddress.class);
- String name = annotation.name();
- VMAddresses.Address entry = vmAddresses.get(name);
- if (entry == null) {
- if (!isRequired(osName, annotation.os())) {
- continue;
- }
- throw new JVMCIError(f.getName() + ": expected VM address not found: " + name);
- }
- setField(f, entry.getValue());
- } else if (f.isAnnotationPresent(HotSpotVMFlag.class)) {
- HotSpotVMFlag annotation = f.getAnnotation(HotSpotVMFlag.class);
- String name = annotation.name();
- Flags.Flag entry = flags.get(name);
- if (entry == null) {
- if (annotation.optional() || !isRequired(osArch, annotation.archs())) {
- continue;
- }
- throw new JVMCIError(f.getName() + ": expected VM flag not found: " + name);
-
- }
- setField(f, entry.getValue());
- }
- }
- }
-
- private final CompressEncoding oopEncoding;
- private final CompressEncoding klassEncoding;
-
- public CompressEncoding getOopEncoding() {
- return oopEncoding;
- }
-
- public CompressEncoding getKlassEncoding() {
- return klassEncoding;
- }
-
- private void setField(Field field, Object value) {
- try {
- Class<?> fieldType = field.getType();
- if (fieldType == boolean.class) {
- if (value instanceof String) {
- field.setBoolean(this, Boolean.valueOf((String) value));
- } else if (value instanceof Boolean) {
- field.setBoolean(this, (boolean) value);
- } else if (value instanceof Long) {
- field.setBoolean(this, ((long) value) != 0);
- } else {
- throw new JVMCIError(value.getClass().getSimpleName());
- }
- } else if (fieldType == byte.class) {
- if (value instanceof Long) {
- field.setByte(this, (byte) (long) value);
- } else {
- throw new JVMCIError(value.getClass().getSimpleName());
- }
- } else if (fieldType == int.class) {
- if (value instanceof Integer) {
- field.setInt(this, (int) value);
- } else if (value instanceof Long) {
- field.setInt(this, (int) (long) value);
- } else {
- throw new JVMCIError(value.getClass().getSimpleName());
- }
- } else if (fieldType == long.class) {
- field.setLong(this, (long) value);
- } else {
- throw new JVMCIError(field.toString());
- }
- } catch (IllegalAccessException e) {
- throw new JVMCIError("%s: %s", field, e);
- }
- }
-
- /**
- * Gets the host operating system name.
- */
- private static String getHostOSName() {
- String osName = System.getProperty("os.name");
- switch (osName) {
- case "Linux":
- osName = "linux";
- break;
- case "SunOS":
- osName = "solaris";
- break;
- case "Mac OS X":
- osName = "bsd";
- break;
- default:
- // Of course Windows is different...
- if (osName.startsWith("Windows")) {
- osName = "windows";
- } else {
- throw new JVMCIError("Unexpected OS name: " + osName);
- }
- }
- return osName;
+ HotSpotVMConfig(HotSpotVMConfigStore store) {
+ super(store);
}
/**
* Gets the host architecture name for the purpose of finding the corresponding
* {@linkplain HotSpotJVMCIBackendFactory backend}.
*/
- public String getHostArchitectureName() {
+ String getHostArchitectureName() {
String arch = System.getProperty("os.arch");
switch (arch) {
case "x86_64":
- arch = "amd64";
- break;
- case "sparcv9":
- arch = "sparc";
- break;
- }
- return arch;
- }
-
- /**
- * Determines if the current specification is included in a given set of specifications.
- *
- * @param current
- * @param specification specifies a set of specifications, e.g. architectures or operating
- * systems. A zero length value implies all.
- */
- private static boolean isRequired(String current, String[] specification) {
- if (specification.length == 0) {
- return true;
- }
- for (String arch : specification) {
- if (arch.equals(current)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * VMStructEntry (see {@code vmStructs.hpp}).
- */
- @HotSpotVMData(index = 0) @Stable private long jvmciHotSpotVMStructs;
- @HotSpotVMData(index = 1) @Stable private long jvmciHotSpotVMStructEntryTypeNameOffset;
- @HotSpotVMData(index = 2) @Stable private long jvmciHotSpotVMStructEntryFieldNameOffset;
- @HotSpotVMData(index = 3) @Stable private long jvmciHotSpotVMStructEntryTypeStringOffset;
- @HotSpotVMData(index = 4) @Stable private long jvmciHotSpotVMStructEntryIsStaticOffset;
- @HotSpotVMData(index = 5) @Stable private long jvmciHotSpotVMStructEntryOffsetOffset;
- @HotSpotVMData(index = 6) @Stable private long jvmciHotSpotVMStructEntryAddressOffset;
- @HotSpotVMData(index = 7) @Stable private long jvmciHotSpotVMStructEntryArrayStride;
-
- final class VMFields implements Iterable<VMFields.Field> {
-
- private final long address;
-
- VMFields(long address) {
- this.address = address;
- }
-
- public Iterator<VMFields.Field> iterator() {
- return new Iterator<VMFields.Field>() {
-
- private int index = 0;
-
- private Field current() {
- return new Field(address + jvmciHotSpotVMStructEntryArrayStride * index);
- }
-
- /**
- * The last entry is identified by a NULL fieldName.
- */
- public boolean hasNext() {
- Field entry = current();
- return entry.getFieldName() != null;
- }
-
- public Field next() {
- Field entry = current();
- index++;
- return entry;
- }
- };
- }
-
- final class Field {
-
- private final long entryAddress;
-
- Field(long address) {
- this.entryAddress = address;
- }
-
- public String getTypeName() {
- long typeNameAddress = UNSAFE.getAddress(entryAddress + jvmciHotSpotVMStructEntryTypeNameOffset);
- return readCString(UNSAFE, typeNameAddress);
- }
-
- public String getFieldName() {
- long fieldNameAddress = UNSAFE.getAddress(entryAddress + jvmciHotSpotVMStructEntryFieldNameOffset);
- return readCString(UNSAFE, fieldNameAddress);
- }
-
- public String getTypeString() {
- long typeStringAddress = UNSAFE.getAddress(entryAddress + jvmciHotSpotVMStructEntryTypeStringOffset);
- return readCString(UNSAFE, typeStringAddress);
- }
-
- public boolean isStatic() {
- return UNSAFE.getInt(entryAddress + jvmciHotSpotVMStructEntryIsStaticOffset) != 0;
- }
-
- public long getOffset() {
- return UNSAFE.getLong(entryAddress + jvmciHotSpotVMStructEntryOffsetOffset);
- }
-
- public long getAddress() {
- return UNSAFE.getAddress(entryAddress + jvmciHotSpotVMStructEntryAddressOffset);
- }
-
- public String getName() {
- String typeName = getTypeName();
- String fieldName = getFieldName();
- return typeName + "::" + fieldName;
- }
-
- public long getValue() {
- String type = getTypeString();
- switch (type) {
- case "bool":
- return UNSAFE.getByte(getAddress());
- case "int":
- return UNSAFE.getInt(getAddress());
- case "uint64_t":
- return UNSAFE.getLong(getAddress());
- case "address":
- case "intptr_t":
- case "uintptr_t":
- case "size_t":
- return UNSAFE.getAddress(getAddress());
- default:
- // All foo* types are addresses.
- if (type.endsWith("*")) {
- return UNSAFE.getAddress(getAddress());
- }
- throw new JVMCIError(type);
- }
- }
-
- @Override
- public String toString() {
- return String.format("Field[typeName=%s, fieldName=%s, typeString=%s, isStatic=%b, offset=%d, address=0x%x]", getTypeName(), getFieldName(), getTypeString(), isStatic(), getOffset(),
- getAddress());
- }
- }
- }
+ return "amd64";
- /**
- * VMTypeEntry (see vmStructs.hpp).
- */
- @HotSpotVMData(index = 8) @Stable private long jvmciHotSpotVMTypes;
- @HotSpotVMData(index = 9) @Stable private long jvmciHotSpotVMTypeEntryTypeNameOffset;
- @HotSpotVMData(index = 10) @Stable private long jvmciHotSpotVMTypeEntrySuperclassNameOffset;
- @HotSpotVMData(index = 11) @Stable private long jvmciHotSpotVMTypeEntryIsOopTypeOffset;
- @HotSpotVMData(index = 12) @Stable private long jvmciHotSpotVMTypeEntryIsIntegerTypeOffset;
- @HotSpotVMData(index = 13) @Stable private long jvmciHotSpotVMTypeEntryIsUnsignedOffset;
- @HotSpotVMData(index = 14) @Stable private long jvmciHotSpotVMTypeEntrySizeOffset;
- @HotSpotVMData(index = 15) @Stable private long jvmciHotSpotVMTypeEntryArrayStride;
-
- final class VMTypes implements Iterable<VMTypes.Type> {
-
- private final long address;
-
- VMTypes(long address) {
- this.address = address;
- }
-
- public Iterator<VMTypes.Type> iterator() {
- return new Iterator<VMTypes.Type>() {
-
- private int index = 0;
-
- private Type current() {
- return new Type(address + jvmciHotSpotVMTypeEntryArrayStride * index);
- }
-
- /**
- * The last entry is identified by a NULL type name.
- */
- public boolean hasNext() {
- Type entry = current();
- return entry.getTypeName() != null;
- }
-
- public Type next() {
- Type entry = current();
- index++;
- return entry;
- }
- };
- }
-
- final class Type {
-
- private final long entryAddress;
-
- Type(long address) {
- this.entryAddress = address;
- }
-
- public String getTypeName() {
- long typeNameAddress = UNSAFE.getAddress(entryAddress + jvmciHotSpotVMTypeEntryTypeNameOffset);
- return readCString(UNSAFE, typeNameAddress);
- }
-
- public String getSuperclassName() {
- long superclassNameAddress = UNSAFE.getAddress(entryAddress + jvmciHotSpotVMTypeEntrySuperclassNameOffset);
- return readCString(UNSAFE, superclassNameAddress);
- }
-
- public boolean isOopType() {
- return UNSAFE.getInt(entryAddress + jvmciHotSpotVMTypeEntryIsOopTypeOffset) != 0;
- }
-
- public boolean isIntegerType() {
- return UNSAFE.getInt(entryAddress + jvmciHotSpotVMTypeEntryIsIntegerTypeOffset) != 0;
- }
-
- public boolean isUnsigned() {
- return UNSAFE.getInt(entryAddress + jvmciHotSpotVMTypeEntryIsUnsignedOffset) != 0;
- }
-
- public long getSize() {
- return UNSAFE.getLong(entryAddress + jvmciHotSpotVMTypeEntrySizeOffset);
- }
-
- @Override
- public String toString() {
- return String.format("Type[typeName=%s, superclassName=%s, isOopType=%b, isIntegerType=%b, isUnsigned=%b, size=%d]", getTypeName(), getSuperclassName(), isOopType(), isIntegerType(),
- isUnsigned(), getSize());
- }
- }
- }
-
- public abstract class AbstractConstant {
-
- protected final long address;
- protected final long nameOffset;
- protected final long valueOffset;
-
- AbstractConstant(long address, long nameOffset, long valueOffset) {
- this.address = address;
- this.nameOffset = nameOffset;
- this.valueOffset = valueOffset;
- }
-
- public String getName() {
- long nameAddress = UNSAFE.getAddress(address + nameOffset);
- return readCString(UNSAFE, nameAddress);
- }
-
- public abstract long getValue();
- }
-
- /**
- * VMIntConstantEntry (see vmStructs.hpp).
- */
- @HotSpotVMData(index = 16) @Stable private long jvmciHotSpotVMIntConstants;
- @HotSpotVMData(index = 17) @Stable private long jvmciHotSpotVMIntConstantEntryNameOffset;
- @HotSpotVMData(index = 18) @Stable private long jvmciHotSpotVMIntConstantEntryValueOffset;
- @HotSpotVMData(index = 19) @Stable private long jvmciHotSpotVMIntConstantEntryArrayStride;
-
- final class VMIntConstants implements Iterable<VMIntConstants.Constant> {
-
- private final long address;
-
- VMIntConstants(long address) {
- this.address = address;
- }
-
- public Iterator<VMIntConstants.Constant> iterator() {
- return new Iterator<VMIntConstants.Constant>() {
-
- private int index = 0;
-
- private Constant current() {
- return new Constant(address + jvmciHotSpotVMIntConstantEntryArrayStride * index);
- }
-
- /**
- * The last entry is identified by a NULL name.
- */
- public boolean hasNext() {
- Constant entry = current();
- return entry.getName() != null;
- }
-
- public Constant next() {
- Constant entry = current();
- index++;
- return entry;
- }
- };
- }
-
- final class Constant extends AbstractConstant {
-
- Constant(long address) {
- super(address, jvmciHotSpotVMIntConstantEntryNameOffset, jvmciHotSpotVMIntConstantEntryValueOffset);
- }
-
- @Override
- public long getValue() {
- return UNSAFE.getInt(address + valueOffset);
- }
-
- @Override
- public String toString() {
- return String.format("IntConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
- }
+ case "sparcv9":
+ return "sparc";
+ default:
+ return arch;
}
}
- /**
- * VMLongConstantEntry (see vmStructs.hpp).
- */
- @HotSpotVMData(index = 20) @Stable private long jvmciHotSpotVMLongConstants;
- @HotSpotVMData(index = 21) @Stable private long jvmciHotSpotVMLongConstantEntryNameOffset;
- @HotSpotVMData(index = 22) @Stable private long jvmciHotSpotVMLongConstantEntryValueOffset;
- @HotSpotVMData(index = 23) @Stable private long jvmciHotSpotVMLongConstantEntryArrayStride;
-
- final class VMLongConstants implements Iterable<VMLongConstants.Constant> {
-
- private final long address;
-
- VMLongConstants(long address) {
- this.address = address;
- }
-
- public Iterator<VMLongConstants.Constant> iterator() {
- return new Iterator<VMLongConstants.Constant>() {
-
- private int index = 0;
-
- private Constant currentEntry() {
- return new Constant(address + jvmciHotSpotVMLongConstantEntryArrayStride * index);
- }
-
- /**
- * The last entry is identified by a NULL name.
- */
- public boolean hasNext() {
- Constant entry = currentEntry();
- return entry.getName() != null;
- }
-
- public Constant next() {
- Constant entry = currentEntry();
- index++;
- return entry;
- }
- };
- }
-
- final class Constant extends AbstractConstant {
-
- Constant(long address) {
- super(address, jvmciHotSpotVMLongConstantEntryNameOffset, jvmciHotSpotVMLongConstantEntryValueOffset);
- }
-
- @Override
- public long getValue() {
- return UNSAFE.getLong(address + valueOffset);
- }
-
- @Override
- public String toString() {
- return String.format("LongConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
- }
- }
- }
-
- /**
- * VMAddressEntry (see vmStructs.hpp).
- */
- @HotSpotVMData(index = 24) @Stable private long jvmciHotSpotVMAddresses;
- @HotSpotVMData(index = 25) @Stable private long jvmciHotSpotVMAddressEntryNameOffset;
- @HotSpotVMData(index = 26) @Stable private long jvmciHotSpotVMAddressEntryValueOffset;
- @HotSpotVMData(index = 27) @Stable private long jvmciHotSpotVMAddressEntryArrayStride;
-
- final class VMAddresses implements Iterable<VMAddresses.Address> {
-
- private final long address;
-
- VMAddresses(long address) {
- this.address = address;
- }
-
- public Iterator<VMAddresses.Address> iterator() {
- return new Iterator<VMAddresses.Address>() {
-
- private int index = 0;
-
- private Address currentEntry() {
- return new Address(address + jvmciHotSpotVMAddressEntryArrayStride * index);
- }
+ final boolean useDeferredInitBarriers = getFlag("ReduceInitialCardMarks", Boolean.class);
- /**
- * The last entry is identified by a NULL name.
- */
- public boolean hasNext() {
- Address entry = currentEntry();
- return entry.getName() != null;
- }
-
- public Address next() {
- Address entry = currentEntry();
- index++;
- return entry;
- }
- };
- }
-
- final class Address extends AbstractConstant {
-
- Address(long address) {
- super(address, jvmciHotSpotVMAddressEntryNameOffset, jvmciHotSpotVMAddressEntryValueOffset);
- }
-
- @Override
- public long getValue() {
- return UNSAFE.getLong(address + valueOffset);
- }
-
- @Override
- public String toString() {
- return String.format("Address[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
- }
- }
- }
-
- final class Flags implements Iterable<Flags.Flag> {
-
- private final long address;
- private final long entrySize;
- private final long typeOffset;
- private final long nameOffset;
- private final long addrOffset;
-
- Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
- address = vmStructs.get("Flag::flags").getValue();
- entrySize = vmTypes.get("Flag").getSize();
- typeOffset = vmStructs.get("Flag::_type").getOffset();
- nameOffset = vmStructs.get("Flag::_name").getOffset();
- addrOffset = vmStructs.get("Flag::_addr").getOffset();
-
- assert vmTypes.get("bool").getSize() == Byte.BYTES;
- assert vmTypes.get("intx").getSize() == Long.BYTES;
- assert vmTypes.get("uintx").getSize() == Long.BYTES;
- }
-
- public Iterator<Flags.Flag> iterator() {
- return new Iterator<Flags.Flag>() {
-
- private int index = 0;
-
- private Flag current() {
- return new Flag(address + entrySize * index);
- }
-
- /**
- * The last entry is identified by a NULL name.
- */
- public boolean hasNext() {
- Flag entry = current();
- return entry.getName() != null;
- }
-
- public Flag next() {
- Flag entry = current();
- index++;
- return entry;
- }
- };
- }
-
- final class Flag {
-
- private final long entryAddress;
-
- Flag(long address) {
- this.entryAddress = address;
- }
-
- public String getType() {
- long typeAddress = UNSAFE.getAddress(entryAddress + typeOffset);
- return readCString(UNSAFE, typeAddress);
- }
-
- public String getName() {
- long nameAddress = UNSAFE.getAddress(entryAddress + nameOffset);
- return readCString(UNSAFE, nameAddress);
- }
+ final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
- public long getAddr() {
- return UNSAFE.getAddress(entryAddress + addrOffset);
- }
-
- public Object getValue() {
- switch (getType()) {
- case "bool":
- return Boolean.valueOf(UNSAFE.getByte(getAddr()) != 0);
- case "intx":
- case "uintx":
- case "uint64_t":
- return Long.valueOf(UNSAFE.getLong(getAddr()));
- case "double":
- return Double.valueOf(UNSAFE.getDouble(getAddr()));
- case "ccstr":
- case "ccstrlist":
- return readCString(UNSAFE, getAddr());
- default:
- throw new JVMCIError(getType());
- }
- }
-
- @Override
- public String toString() {
- return String.format("Flag[type=%s, name=%s, value=%s]", getType(), getName(), getValue());
- }
- }
- }
-
- @HotSpotVMConstant(name = "ASSERT") @Stable public boolean cAssertions;
- public final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows");
- public final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux");
-
- @HotSpotVMFlag(name = "CodeEntryAlignment") @Stable public int codeEntryAlignment;
- @HotSpotVMFlag(name = "VerifyOops") @Stable public boolean verifyOops;
- @HotSpotVMFlag(name = "CITime") @Stable public boolean ciTime;
- @HotSpotVMFlag(name = "CITimeEach") @Stable public boolean ciTimeEach;
- @HotSpotVMFlag(name = "CompileTheWorldStartAt", optional = true) @Stable public int compileTheWorldStartAt;
- @HotSpotVMFlag(name = "CompileTheWorldStopAt", optional = true) @Stable public int compileTheWorldStopAt;
- @HotSpotVMFlag(name = "DontCompileHugeMethods") @Stable public boolean dontCompileHugeMethods;
- @HotSpotVMFlag(name = "HugeMethodLimit") @Stable public int hugeMethodLimit;
- @HotSpotVMFlag(name = "PrintInlining") @Stable public boolean printInlining;
- @HotSpotVMFlag(name = "Inline") @Stable public boolean inline;
- @HotSpotVMFlag(name = "JVMCIUseFastLocking") @Stable public boolean useFastLocking;
- @HotSpotVMFlag(name = "ForceUnreachable") @Stable public boolean forceUnreachable;
- @HotSpotVMFlag(name = "CodeCacheSegmentSize") @Stable public int codeSegmentSize;
- @HotSpotVMFlag(name = "FoldStableValues") @Stable public boolean foldStableValues;
-
- @HotSpotVMFlag(name = "UseTLAB") @Stable public boolean useTLAB;
- @HotSpotVMFlag(name = "UseBiasedLocking") @Stable public boolean useBiasedLocking;
- @HotSpotVMFlag(name = "UsePopCountInstruction") @Stable public boolean usePopCountInstruction;
- @HotSpotVMFlag(name = "UseCountLeadingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountLeadingZerosInstruction;
- @HotSpotVMFlag(name = "UseCountTrailingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountTrailingZerosInstruction;
- @HotSpotVMFlag(name = "UseAESIntrinsics") @Stable public boolean useAESIntrinsics;
- @HotSpotVMFlag(name = "UseCRC32Intrinsics") @Stable public boolean useCRC32Intrinsics;
- @HotSpotVMFlag(name = "UseG1GC") @Stable public boolean useG1GC;
- @HotSpotVMFlag(name = "UseConcMarkSweepGC") @Stable public boolean useCMSGC;
-
- @HotSpotVMFlag(name = "AllocatePrefetchStyle") @Stable public int allocatePrefetchStyle;
- @HotSpotVMFlag(name = "AllocatePrefetchInstr") @Stable public int allocatePrefetchInstr;
- @HotSpotVMFlag(name = "AllocatePrefetchLines") @Stable public int allocatePrefetchLines;
- @HotSpotVMFlag(name = "AllocateInstancePrefetchLines") @Stable public int allocateInstancePrefetchLines;
- @HotSpotVMFlag(name = "AllocatePrefetchStepSize") @Stable public int allocatePrefetchStepSize;
- @HotSpotVMFlag(name = "AllocatePrefetchDistance") @Stable public int allocatePrefetchDistance;
-
- @HotSpotVMFlag(name = "FlightRecorder", optional = true) @Stable public boolean flightRecorder;
-
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_collectedHeap", type = "CollectedHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long universeCollectedHeap;
- @HotSpotVMField(name = "CollectedHeap::_total_collections", type = "unsigned int", get = HotSpotVMField.Type.OFFSET) @Stable private int collectedHeapTotalCollectionsOffset;
-
- public long gcTotalCollectionsAddress() {
- return universeCollectedHeap + collectedHeapTotalCollectionsOffset;
- }
-
- @HotSpotVMFlag(name = "ReduceInitialCardMarks") @Stable public boolean useDeferredInitBarriers;
-
- // Compressed Oops related values.
- @HotSpotVMFlag(name = "UseCompressedOops") @Stable public boolean useCompressedOops;
- @HotSpotVMFlag(name = "UseCompressedClassPointers") @Stable public boolean useCompressedClassPointers;
-
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_narrow_oop_base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowOopBase;
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_narrow_oop_shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowOopShift;
- @HotSpotVMFlag(name = "ObjectAlignmentInBytes") @Stable public int objectAlignment;
-
- public final int minObjAlignment() {
- return objectAlignment / heapWordSize;
- }
-
- public final int logMinObjAlignment() {
- return (int) (Math.log(objectAlignment) / Math.log(2));
- }
-
- @HotSpotVMType(name = "narrowKlass", get = HotSpotVMType.Type.SIZE) @Stable public int narrowKlassSize;
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_narrow_klass_base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowKlassBase;
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_narrow_klass_shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowKlassShift;
- @HotSpotVMConstant(name = "LogKlassAlignmentInBytes") @Stable public int logKlassAlignment;
-
- // CPU capabilities
- @HotSpotVMFlag(name = "UseSSE") @Stable public int useSSE;
- @HotSpotVMFlag(name = "UseAVX", archs = {"amd64"}) @Stable public int useAVX;
-
- @HotSpotVMField(name = "Abstract_VM_Version::_features", type = "uint64_t", get = HotSpotVMField.Type.VALUE) @Stable public long vmVersionFeatures;
-
- // AMD64 specific values
- @HotSpotVMConstant(name = "VM_Version::CPU_CX8", archs = {"amd64"}) @Stable public long amd64CX8;
- @HotSpotVMConstant(name = "VM_Version::CPU_CMOV", archs = {"amd64"}) @Stable public long amd64CMOV;
- @HotSpotVMConstant(name = "VM_Version::CPU_FXSR", archs = {"amd64"}) @Stable public long amd64FXSR;
- @HotSpotVMConstant(name = "VM_Version::CPU_HT", archs = {"amd64"}) @Stable public long amd64HT;
- @HotSpotVMConstant(name = "VM_Version::CPU_MMX", archs = {"amd64"}) @Stable public long amd64MMX;
- @HotSpotVMConstant(name = "VM_Version::CPU_3DNOW_PREFETCH", archs = {"amd64"}) @Stable public long amd643DNOWPREFETCH;
- @HotSpotVMConstant(name = "VM_Version::CPU_SSE", archs = {"amd64"}) @Stable public long amd64SSE;
- @HotSpotVMConstant(name = "VM_Version::CPU_SSE2", archs = {"amd64"}) @Stable public long amd64SSE2;
- @HotSpotVMConstant(name = "VM_Version::CPU_SSE3", archs = {"amd64"}) @Stable public long amd64SSE3;
- @HotSpotVMConstant(name = "VM_Version::CPU_SSSE3", archs = {"amd64"}) @Stable public long amd64SSSE3;
- @HotSpotVMConstant(name = "VM_Version::CPU_SSE4A", archs = {"amd64"}) @Stable public long amd64SSE4A;
- @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_1", archs = {"amd64"}) @Stable public long amd64SSE41;
- @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_2", archs = {"amd64"}) @Stable public long amd64SSE42;
- @HotSpotVMConstant(name = "VM_Version::CPU_POPCNT", archs = {"amd64"}) @Stable public long amd64POPCNT;
- @HotSpotVMConstant(name = "VM_Version::CPU_LZCNT", archs = {"amd64"}) @Stable public long amd64LZCNT;
- @HotSpotVMConstant(name = "VM_Version::CPU_TSC", archs = {"amd64"}) @Stable public long amd64TSC;
- @HotSpotVMConstant(name = "VM_Version::CPU_TSCINV", archs = {"amd64"}) @Stable public long amd64TSCINV;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX", archs = {"amd64"}) @Stable public long amd64AVX;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX2", archs = {"amd64"}) @Stable public long amd64AVX2;
- @HotSpotVMConstant(name = "VM_Version::CPU_AES", archs = {"amd64"}) @Stable public long amd64AES;
- @HotSpotVMConstant(name = "VM_Version::CPU_ERMS", archs = {"amd64"}) @Stable public long amd64ERMS;
- @HotSpotVMConstant(name = "VM_Version::CPU_CLMUL", archs = {"amd64"}) @Stable public long amd64CLMUL;
- @HotSpotVMConstant(name = "VM_Version::CPU_BMI1", archs = {"amd64"}) @Stable public long amd64BMI1;
- @HotSpotVMConstant(name = "VM_Version::CPU_BMI2", archs = {"amd64"}) @Stable public long amd64BMI2;
- @HotSpotVMConstant(name = "VM_Version::CPU_RTM", archs = {"amd64"}) @Stable public long amd64RTM;
- @HotSpotVMConstant(name = "VM_Version::CPU_ADX", archs = {"amd64"}) @Stable public long amd64ADX;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX512F", archs = {"amd64"}) @Stable public long amd64AVX512F;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX512DQ", archs = {"amd64"}) @Stable public long amd64AVX512DQ;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX512PF", archs = {"amd64"}) @Stable public long amd64AVX512PF;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX512ER", archs = {"amd64"}) @Stable public long amd64AVX512ER;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX512CD", archs = {"amd64"}) @Stable public long amd64AVX512CD;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX512BW", archs = {"amd64"}) @Stable public long amd64AVX512BW;
- @HotSpotVMConstant(name = "VM_Version::CPU_AVX512VL", archs = {"amd64"}) @Stable public long amd64AVX512VL;
- @HotSpotVMConstant(name = "VM_Version::CPU_SHA", archs = {"amd64"}) @Stable public long amd64SHA;
-
- // SPARC specific values
- @HotSpotVMConstant(name = "VM_Version::vis3_instructions_m", archs = {"sparc"}) @Stable public int sparcVis3Instructions;
- @HotSpotVMConstant(name = "VM_Version::vis2_instructions_m", archs = {"sparc"}) @Stable public int sparcVis2Instructions;
- @HotSpotVMConstant(name = "VM_Version::vis1_instructions_m", archs = {"sparc"}) @Stable public int sparcVis1Instructions;
- @HotSpotVMConstant(name = "VM_Version::cbcond_instructions_m", archs = {"sparc"}) @Stable public int sparcCbcondInstructions;
- @HotSpotVMConstant(name = "VM_Version::v8_instructions_m", archs = {"sparc"}) @Stable public int sparcV8Instructions;
- @HotSpotVMConstant(name = "VM_Version::hardware_mul32_m", archs = {"sparc"}) @Stable public int sparcHardwareMul32;
- @HotSpotVMConstant(name = "VM_Version::hardware_div32_m", archs = {"sparc"}) @Stable public int sparcHardwareDiv32;
- @HotSpotVMConstant(name = "VM_Version::hardware_fsmuld_m", archs = {"sparc"}) @Stable public int sparcHardwareFsmuld;
- @HotSpotVMConstant(name = "VM_Version::hardware_popc_m", archs = {"sparc"}) @Stable public int sparcHardwarePopc;
- @HotSpotVMConstant(name = "VM_Version::v9_instructions_m", archs = {"sparc"}) @Stable public int sparcV9Instructions;
- @HotSpotVMConstant(name = "VM_Version::sun4v_m", archs = {"sparc"}) @Stable public int sparcSun4v;
- @HotSpotVMConstant(name = "VM_Version::blk_init_instructions_m", archs = {"sparc"}) @Stable public int sparcBlkInitInstructions;
- @HotSpotVMConstant(name = "VM_Version::fmaf_instructions_m", archs = {"sparc"}) @Stable public int sparcFmafInstructions;
- @HotSpotVMConstant(name = "VM_Version::fmau_instructions_m", archs = {"sparc"}) @Stable public int sparcFmauInstructions;
- @HotSpotVMConstant(name = "VM_Version::sparc64_family_m", archs = {"sparc"}) @Stable public int sparcSparc64Family;
- @HotSpotVMConstant(name = "VM_Version::M_family_m", archs = {"sparc"}) @Stable public int sparcMFamily;
- @HotSpotVMConstant(name = "VM_Version::T_family_m", archs = {"sparc"}) @Stable public int sparcTFamily;
- @HotSpotVMConstant(name = "VM_Version::T1_model_m", archs = {"sparc"}) @Stable public int sparcT1Model;
- @HotSpotVMConstant(name = "VM_Version::sparc5_instructions_m", archs = {"sparc"}) @Stable public int sparcSparc5Instructions;
- @HotSpotVMConstant(name = "VM_Version::aes_instructions_m", archs = {"sparc"}) @Stable public int sparcAesInstructions;
- @HotSpotVMConstant(name = "VM_Version::sha1_instruction_m", archs = {"sparc"}) @Stable public int sparcSha1Instruction;
- @HotSpotVMConstant(name = "VM_Version::sha256_instruction_m", archs = {"sparc"}) @Stable public int sparcSha256Instruction;
- @HotSpotVMConstant(name = "VM_Version::sha512_instruction_m", archs = {"sparc"}) @Stable public int sparcSha512Instruction;
-
- @HotSpotVMFlag(name = "UseBlockZeroing", archs = {"sparc"}) @Stable public boolean useBlockZeroing;
- @HotSpotVMFlag(name = "BlockZeroingLowLimit", archs = {"sparc"}) @Stable public int blockZeroingLowLimit;
-
- @HotSpotVMFlag(name = "StackShadowPages") @Stable public int stackShadowPages;
- @HotSpotVMFlag(name = "StackReservedPages") @Stable public int stackReservedPages;
- @HotSpotVMFlag(name = "UseStackBanging") @Stable public boolean useStackBanging;
- @HotSpotVMConstant(name = "STACK_BIAS") @Stable public int stackBias;
- @HotSpotVMField(name = "CompilerToVM::Data::vm_page_size", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int vmPageSize;
-
- // offsets, ...
- @HotSpotVMField(name = "oopDesc::_mark", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int markOffset;
- @HotSpotVMField(name = "oopDesc::_metadata._klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int hubOffset;
-
- @HotSpotVMField(name = "Klass::_prototype_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int prototypeMarkWordOffset;
- @HotSpotVMField(name = "Klass::_subklass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int subklassOffset;
- @HotSpotVMField(name = "Klass::_next_sibling", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int nextSiblingOffset;
- @HotSpotVMField(name = "Klass::_super_check_offset", type = "juint", get = HotSpotVMField.Type.OFFSET) @Stable public int superCheckOffsetOffset;
- @HotSpotVMField(name = "Klass::_secondary_super_cache", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySuperCacheOffset;
- @HotSpotVMField(name = "Klass::_secondary_supers", type = "Array<Klass*>*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySupersOffset;
+ final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, "markOop");
+ final int subklassOffset = getFieldOffset("Klass::_subklass", Integer.class, "Klass*");
+ final int nextSiblingOffset = getFieldOffset("Klass::_next_sibling", Integer.class, "Klass*");
+ final int superCheckOffsetOffset = getFieldOffset("Klass::_super_check_offset", Integer.class, "juint");
+ final int secondarySuperCacheOffset = getFieldOffset("Klass::_secondary_super_cache", Integer.class, "Klass*");
/**
* The offset of the _java_mirror field (of type {@link Class}) in a Klass.
*/
- @HotSpotVMField(name = "Klass::_java_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int classMirrorOffset;
+ final int classMirrorOffset = getFieldOffset("Klass::_java_mirror", Integer.class, "oop");
- @HotSpotVMField(name = "Klass::_super", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int klassSuperKlassOffset;
- @HotSpotVMField(name = "Klass::_modifier_flags", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassModifierFlagsOffset;
- @HotSpotVMField(name = "Klass::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int klassAccessFlagsOffset;
- @HotSpotVMField(name = "Klass::_layout_helper", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassLayoutHelperOffset;
- @HotSpotVMField(name = "Klass::_name", type = "Symbol*", get = HotSpotVMField.Type.OFFSET) @Stable public int klassNameOffset;
+ final int klassAccessFlagsOffset = getFieldOffset("Klass::_access_flags", Integer.class, "AccessFlags");
+ final int klassLayoutHelperOffset = getFieldOffset("Klass::_layout_helper", Integer.class, "jint");
+
+ final int klassLayoutHelperNeutralValue = getConstant("Klass::_lh_neutral_value", Integer.class);
+ final int klassLayoutHelperInstanceSlowPathBit = getConstant("Klass::_lh_instance_slow_path_bit", Integer.class);
- @HotSpotVMConstant(name = "Klass::_lh_neutral_value") @Stable public int klassLayoutHelperNeutralValue;
- @HotSpotVMConstant(name = "Klass::_lh_instance_slow_path_bit") @Stable public int klassLayoutHelperInstanceSlowPathBit;
- @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_shift") @Stable public int layoutHelperLog2ElementSizeShift;
- @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_mask") @Stable public int layoutHelperLog2ElementSizeMask;
- @HotSpotVMConstant(name = "Klass::_lh_element_type_shift") @Stable public int layoutHelperElementTypeShift;
- @HotSpotVMConstant(name = "Klass::_lh_element_type_mask") @Stable public int layoutHelperElementTypeMask;
- @HotSpotVMConstant(name = "Klass::_lh_header_size_shift") @Stable public int layoutHelperHeaderSizeShift;
- @HotSpotVMConstant(name = "Klass::_lh_header_size_mask") @Stable public int layoutHelperHeaderSizeMask;
- @HotSpotVMConstant(name = "Klass::_lh_array_tag_shift") @Stable public int layoutHelperArrayTagShift;
- @HotSpotVMConstant(name = "Klass::_lh_array_tag_type_value") @Stable public int layoutHelperArrayTagTypeValue;
- @HotSpotVMConstant(name = "Klass::_lh_array_tag_obj_value") @Stable public int layoutHelperArrayTagObjectValue;
+ final int vtableEntrySize = getTypeSize("vtableEntry");
+ final int vtableEntryMethodOffset = getFieldOffset("vtableEntry::_method", Integer.class, "Method*");
- /**
- * This filters out the bit that differentiates a type array from an object array.
- */
- public int layoutHelperElementTypePrimitiveInPlace() {
- return (layoutHelperArrayTagTypeValue & ~layoutHelperArrayTagObjectValue) << layoutHelperArrayTagShift;
- }
-
- /**
- * Bit pattern in the klass layout helper that can be used to identify arrays.
- */
- public final int arrayKlassLayoutHelperIdentifier = 0x80000000;
-
- @HotSpotVMType(name = "vtableEntry", get = HotSpotVMType.Type.SIZE) @Stable public int vtableEntrySize;
- @HotSpotVMField(name = "vtableEntry::_method", type = "Method*", get = HotSpotVMField.Type.OFFSET) @Stable public int vtableEntryMethodOffset;
+ final int instanceKlassSourceFileNameIndexOffset = getFieldOffset("InstanceKlass::_source_file_name_index", Integer.class, "u2");
+ final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "u1");
+ final int instanceKlassConstantsOffset = getFieldOffset("InstanceKlass::_constants", Integer.class, "ConstantPool*");
+ final int instanceKlassFieldsOffset = getFieldOffset("InstanceKlass::_fields", Integer.class, "Array<u2>*");
+ final int klassVtableStartOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_start_offset", Integer.class, "int");
+ final int klassVtableLengthOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_length_offset", Integer.class, "int");
- @HotSpotVMType(name = "InstanceKlass", get = HotSpotVMType.Type.SIZE) @Stable public int instanceKlassSize;
- @HotSpotVMField(name = "InstanceKlass::_source_file_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassSourceFileNameIndexOffset;
- @HotSpotVMField(name = "InstanceKlass::_init_state", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassInitStateOffset;
- @HotSpotVMField(name = "InstanceKlass::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassConstantsOffset;
- @HotSpotVMField(name = "InstanceKlass::_fields", type = "Array<u2>*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassFieldsOffset;
- @HotSpotVMField(name = "CompilerToVM::Data::Klass_vtable_start_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassVtableStartOffset;
- @HotSpotVMField(name = "CompilerToVM::Data::Klass_vtable_length_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassVtableLengthOffset;
-
- @HotSpotVMConstant(name = "InstanceKlass::linked") @Stable public int instanceKlassStateLinked;
- @HotSpotVMConstant(name = "InstanceKlass::fully_initialized") @Stable public int instanceKlassStateFullyInitialized;
+ final int instanceKlassStateLinked = getConstant("InstanceKlass::linked", Integer.class);
+ final int instanceKlassStateFullyInitialized = getConstant("InstanceKlass::fully_initialized", Integer.class);
- @HotSpotVMType(name = "arrayOopDesc", get = HotSpotVMType.Type.SIZE) @Stable public int arrayOopDescSize;
-
- /**
- * The offset of the array length word in an array object's header.
- *
- * See {@code arrayOopDesc::length_offset_in_bytes()}.
- */
- public final int arrayOopDescLengthOffset() {
- return useCompressedClassPointers ? hubOffset + narrowKlassSize : arrayOopDescSize;
- }
+ final int arrayU1LengthOffset = getFieldOffset("Array<int>::_length", Integer.class, "int");
+ final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class);
+ final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class);
- @HotSpotVMField(name = "Array<int>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1LengthOffset;
- @HotSpotVMField(name = "Array<u1>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1DataOffset;
- @HotSpotVMField(name = "Array<u2>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU2DataOffset;
- @HotSpotVMField(name = "Array<Klass*>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayLengthOffset;
- @HotSpotVMField(name = "Array<Klass*>::_data[0]", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayBaseOffset;
-
- @HotSpotVMField(name = "ObjArrayKlass::_element_klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayClassElementOffset;
+ final int fieldInfoAccessFlagsOffset = getConstant("FieldInfo::access_flags_offset", Integer.class);
+ final int fieldInfoNameIndexOffset = getConstant("FieldInfo::name_index_offset", Integer.class);
+ final int fieldInfoSignatureIndexOffset = getConstant("FieldInfo::signature_index_offset", Integer.class);
+ final int fieldInfoLowPackedOffset = getConstant("FieldInfo::low_packed_offset", Integer.class);
+ final int fieldInfoHighPackedOffset = getConstant("FieldInfo::high_packed_offset", Integer.class);
+ final int fieldInfoFieldSlots = getConstant("FieldInfo::field_slots", Integer.class);
- @HotSpotVMConstant(name = "FieldInfo::access_flags_offset") @Stable public int fieldInfoAccessFlagsOffset;
- @HotSpotVMConstant(name = "FieldInfo::name_index_offset") @Stable public int fieldInfoNameIndexOffset;
- @HotSpotVMConstant(name = "FieldInfo::signature_index_offset") @Stable public int fieldInfoSignatureIndexOffset;
- @HotSpotVMConstant(name = "FieldInfo::initval_index_offset") @Stable public int fieldInfoInitvalIndexOffset;
- @HotSpotVMConstant(name = "FieldInfo::low_packed_offset") @Stable public int fieldInfoLowPackedOffset;
- @HotSpotVMConstant(name = "FieldInfo::high_packed_offset") @Stable public int fieldInfoHighPackedOffset;
- @HotSpotVMConstant(name = "FieldInfo::field_slots") @Stable public int fieldInfoFieldSlots;
+ final int fieldInfoTagSize = getConstant("FIELDINFO_TAG_SIZE", Integer.class);
- @HotSpotVMConstant(name = "FIELDINFO_TAG_SIZE") @Stable public int fieldInfoTagSize;
-
- @HotSpotVMConstant(name = "JVM_ACC_MONITOR_MATCH") @Stable public int jvmAccMonitorMatch;
- @HotSpotVMConstant(name = "JVM_ACC_HAS_MONITOR_BYTECODES") @Stable public int jvmAccHasMonitorBytecodes;
- @HotSpotVMConstant(name = "JVM_ACC_HAS_FINALIZER") @Stable public int jvmAccHasFinalizer;
- @HotSpotVMConstant(name = "JVM_ACC_FIELD_INTERNAL") @Stable public int jvmAccFieldInternal;
- @HotSpotVMConstant(name = "JVM_ACC_FIELD_STABLE") @Stable public int jvmAccFieldStable;
- @HotSpotVMConstant(name = "JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE") @Stable public int jvmAccFieldHasGenericSignature;
- @HotSpotVMConstant(name = "JVM_ACC_WRITTEN_FLAGS") @Stable public int jvmAccWrittenFlags;
- @HotSpotVMConstant(name = "JVM_ACC_IS_CLONEABLE_FAST") @Stable public int jvmAccIsCloneableFast;
+ final int jvmAccHasFinalizer = getConstant("JVM_ACC_HAS_FINALIZER", Integer.class);
+ final int jvmAccFieldInternal = getConstant("JVM_ACC_FIELD_INTERNAL", Integer.class);
+ final int jvmAccFieldStable = getConstant("JVM_ACC_FIELD_STABLE", Integer.class);
+ final int jvmAccFieldHasGenericSignature = getConstant("JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE", Integer.class);
+ final int jvmAccIsCloneableFast = getConstant("JVM_ACC_IS_CLONEABLE_FAST", Integer.class);
// Modifier.SYNTHETIC is not public so we get it via vmStructs.
- @HotSpotVMConstant(name = "JVM_ACC_SYNTHETIC") @Stable public int jvmAccSynthetic;
-
- /**
- * @see HotSpotResolvedObjectTypeImpl#createField
- */
- @HotSpotVMConstant(name = "JVM_RECOGNIZED_FIELD_MODIFIERS") @Stable public int recognizedFieldModifiers;
-
- @HotSpotVMField(name = "Thread::_tlab", type = "ThreadLocalAllocBuffer", get = HotSpotVMField.Type.OFFSET) @Stable public int threadTlabOffset;
-
- @HotSpotVMField(name = "JavaThread::_anchor", type = "JavaFrameAnchor", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadAnchorOffset;
- @HotSpotVMField(name = "JavaThread::_threadObj", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectOffset;
- @HotSpotVMField(name = "JavaThread::_osthread", type = "OSThread*", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadOffset;
- @HotSpotVMField(name = "JavaThread::_dirty_card_queue", type = "DirtyCardQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadDirtyCardQueueOffset;
- @HotSpotVMField(name = "JavaThread::_is_method_handle_return", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int threadIsMethodHandleReturnOffset;
- @HotSpotVMField(name = "JavaThread::_satb_mark_queue", type = "SATBMarkQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadSatbMarkQueueOffset;
- @HotSpotVMField(name = "JavaThread::_vm_result", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectResultOffset;
- @HotSpotVMField(name = "JavaThread::_jvmci_counters", type = "jlong*", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciCountersThreadOffset;
- @HotSpotVMField(name = "JavaThread::_reserved_stack_activation", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadReservedStackActivationOffset;
-
- /**
- * An invalid value for {@link #rtldDefault}.
- */
- public static final long INVALID_RTLD_DEFAULT_HANDLE = 0xDEADFACE;
-
- /**
- * Address of the library lookup routine. The C signature of this routine is:
- *
- * <pre>
- * void* (const char *filename, char *ebuf, int ebuflen)
- * </pre>
- */
- @HotSpotVMAddress(name = "os::dll_load") @Stable public long dllLoad;
-
- /**
- * Address of the library lookup routine. The C signature of this routine is:
- *
- * <pre>
- * void* (void* handle, const char* name)
- * </pre>
- */
- @HotSpotVMAddress(name = "os::dll_lookup") @Stable public long dllLookup;
-
- /**
- * A pseudo-handle which when used as the first argument to {@link #dllLookup} means lookup will
- * return the first occurrence of the desired symbol using the default library search order. If
- * this field is {@value #INVALID_RTLD_DEFAULT_HANDLE}, then this capability is not supported on
- * the current platform.
- */
- @HotSpotVMAddress(name = "RTLD_DEFAULT", os = {"bsd", "linux"}) @Stable public long rtldDefault = INVALID_RTLD_DEFAULT_HANDLE;
-
- /**
- * This field is used to pass exception objects into and out of the runtime system during
- * exception handling for compiled code.
- */
- @HotSpotVMField(name = "JavaThread::_exception_oop", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionOopOffset;
- @HotSpotVMField(name = "JavaThread::_exception_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionPcOffset;
- @HotSpotVMField(name = "ThreadShadow::_pending_exception", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingExceptionOffset;
+ final int jvmAccSynthetic = getConstant("JVM_ACC_SYNTHETIC", Integer.class);
- @HotSpotVMField(name = "JavaThread::_pending_deoptimization", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingDeoptimizationOffset;
- @HotSpotVMField(name = "JavaThread::_pending_failed_speculation", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingFailedSpeculationOffset;
- @HotSpotVMField(name = "JavaThread::_pending_transfer_to_interpreter", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingTransferToInterpreterOffset;
-
- @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_sp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaSpOffset;
- @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaPcOffset;
- @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_fp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET, archs = {"aarch64, amd64"}) @Stable private int javaFrameAnchorLastJavaFpOffset;
- @HotSpotVMField(name = "JavaFrameAnchor::_flags", type = "int", get = HotSpotVMField.Type.OFFSET, archs = {"sparc"}) @Stable private int javaFrameAnchorFlagsOffset;
-
- public int threadLastJavaSpOffset() {
- return javaThreadAnchorOffset + javaFrameAnchorLastJavaSpOffset;
- }
-
- public int threadLastJavaPcOffset() {
- return javaThreadAnchorOffset + javaFrameAnchorLastJavaPcOffset;
- }
-
- public int threadLastJavaFpOffset() {
- assert getHostArchitectureName().equals("aarch64") || getHostArchitectureName().equals("amd64");
- return javaThreadAnchorOffset + javaFrameAnchorLastJavaFpOffset;
- }
+ // This is only valid on AMD64.
+ final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, osArch.equals("amd64") ? null : 0);
- /**
- * This value is only valid on SPARC.
- */
- public int threadJavaFrameAnchorFlagsOffset() {
- // TODO add an assert for SPARC
- return javaThreadAnchorOffset + javaFrameAnchorFlagsOffset;
- }
-
- // These are only valid on AMD64.
- @HotSpotVMConstant(name = "frame::arg_reg_save_area_bytes", archs = {"amd64"}) @Stable public int runtimeCallStackSize;
- @HotSpotVMConstant(name = "frame::interpreter_frame_sender_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameSenderSpOffset;
- @HotSpotVMConstant(name = "frame::interpreter_frame_last_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameLastSpOffset;
-
- @HotSpotVMConstant(name = "dirtyCardQueueBufferOffset") @Stable private int dirtyCardQueueBufferOffset;
- @HotSpotVMConstant(name = "dirtyCardQueueIndexOffset") @Stable private int dirtyCardQueueIndexOffset;
-
- @HotSpotVMConstant(name = "satbMarkQueueBufferOffset") @Stable private int satbMarkQueueBufferOffset;
- @HotSpotVMConstant(name = "satbMarkQueueIndexOffset") @Stable private int satbMarkQueueIndexOffset;
- @HotSpotVMConstant(name = "satbMarkQueueActiveOffset") @Stable private int satbMarkQueueActiveOffset;
-
- @HotSpotVMField(name = "OSThread::_interrupted", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadInterruptedOffset;
-
- @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public long markOopDescHashShift;
-
- @HotSpotVMConstant(name = "markOopDesc::biased_lock_mask_in_place") @Stable public int biasedLockMaskInPlace;
- @HotSpotVMConstant(name = "markOopDesc::age_mask_in_place") @Stable public int ageMaskInPlace;
- @HotSpotVMConstant(name = "markOopDesc::epoch_mask_in_place") @Stable public int epochMaskInPlace;
- @HotSpotVMConstant(name = "markOopDesc::hash_mask") @Stable public long markOopDescHashMask;
- @HotSpotVMConstant(name = "markOopDesc::hash_mask_in_place") @Stable public long markOopDescHashMaskInPlace;
-
- @HotSpotVMConstant(name = "markOopDesc::unlocked_value") @Stable public int unlockedMask;
- @HotSpotVMConstant(name = "markOopDesc::biased_lock_pattern") @Stable public int biasedLockPattern;
-
- @HotSpotVMConstant(name = "markOopDesc::no_hash_in_place") @Stable public int markWordNoHashInPlace;
- @HotSpotVMConstant(name = "markOopDesc::no_lock_in_place") @Stable public int markWordNoLockInPlace;
+ private final int markWordNoHashInPlace = getConstant("markOopDesc::no_hash_in_place", Integer.class);
+ private final int markWordNoLockInPlace = getConstant("markOopDesc::no_lock_in_place", Integer.class);
/**
* See {@code markOopDesc::prototype()}.
*/
- public long arrayPrototypeMarkWord() {
+ long arrayPrototypeMarkWord() {
return markWordNoHashInPlace | markWordNoLockInPlace;
}
- /**
- * See {@code markOopDesc::copy_set_hash()}.
- */
- public long tlabIntArrayMarkWord() {
- long tmp = arrayPrototypeMarkWord() & (~markOopDescHashMaskInPlace);
- tmp |= ((0x2 & markOopDescHashMask) << markOopDescHashShift);
- return tmp;
- }
+ final int methodAccessFlagsOffset = getFieldOffset("Method::_access_flags", Integer.class, "AccessFlags");
+ final int methodConstMethodOffset = getFieldOffset("Method::_constMethod", Integer.class, "ConstMethod*");
+ final int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u2");
+ final int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u2");
+ final int methodVtableIndexOffset = getFieldOffset("Method::_vtable_index", Integer.class, "int");
+
+ final int methodDataOffset = getFieldOffset("Method::_method_data", Integer.class, "MethodData*");
+ final int methodCodeOffset = getFieldOffset("Method::_code", Integer.class, "CompiledMethod*");
+
+ final int methodFlagsCallerSensitive = getConstant("Method::_caller_sensitive", Integer.class);
+ final int methodFlagsForceInline = getConstant("Method::_force_inline", Integer.class);
+ final int methodFlagsDontInline = getConstant("Method::_dont_inline", Integer.class);
+ final int methodFlagsReservedStackAccess = getConstant("Method::_reserved_stack_access", Integer.class);
+ final int nonvirtualVtableIndex = getConstant("Method::nonvirtual_vtable_index", Integer.class);
+ final int invalidVtableIndex = getConstant("Method::invalid_vtable_index", Integer.class);
+
+ final int methodDataSize = getFieldOffset("MethodData::_size", Integer.class, "int");
+ final int methodDataDataSize = getFieldOffset("MethodData::_data_size", Integer.class, "int");
+ final int methodDataOopDataOffset = getFieldOffset("MethodData::_data[0]", Integer.class, "intptr_t");
+ 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 nmethodCompLevelOffset = getFieldOffset("nmethod::_comp_level", Integer.class, "int");
+
+ final int compilationLevelNone = getConstant("CompLevel_none", Integer.class);
+ final int compilationLevelSimple = getConstant("CompLevel_simple", Integer.class);
+ final int compilationLevelLimitedProfile = getConstant("CompLevel_limited_profile", Integer.class);
+ final int compilationLevelFullProfile = getConstant("CompLevel_full_profile", Integer.class);
+ final int compilationLevelFullOptimization = getConstant("CompLevel_full_optimization", Integer.class);
+
+ final int compLevelAdjustmentNone = getConstant("JVMCIRuntime::none", Integer.class);
+ final int compLevelAdjustmentByHolder = getConstant("JVMCIRuntime::by_holder", Integer.class);
+ final int compLevelAdjustmentByFullSignature = getConstant("JVMCIRuntime::by_full_signature", Integer.class);
+
+ final int invocationEntryBci = getConstant("InvocationEntryBci", Integer.class);
+
+ final int extraStackEntries = getFieldValue("CompilerToVM::Data::Method_extra_stack_entries", Integer.class, "int");
+
+ final int constMethodConstantsOffset = getFieldOffset("ConstMethod::_constants", Integer.class, "ConstantPool*");
+ final int constMethodFlagsOffset = getFieldOffset("ConstMethod::_flags", Integer.class, "u2");
+ final int constMethodCodeSizeOffset = getFieldOffset("ConstMethod::_code_size", Integer.class, "u2");
+ final int constMethodNameIndexOffset = getFieldOffset("ConstMethod::_name_index", Integer.class, "u2");
+ final int constMethodSignatureIndexOffset = getFieldOffset("ConstMethod::_signature_index", Integer.class, "u2");
+ final int constMethodMaxStackOffset = getFieldOffset("ConstMethod::_max_stack", Integer.class, "u2");
+ final int methodMaxLocalsOffset = getFieldOffset("ConstMethod::_max_locals", Integer.class, "u2");
+
+ final int constMethodHasLineNumberTable = getConstant("ConstMethod::_has_linenumber_table", Integer.class);
+ final int constMethodHasLocalVariableTable = getConstant("ConstMethod::_has_localvariable_table", Integer.class);
+ final int constMethodHasExceptionTable = getConstant("ConstMethod::_has_exception_table", Integer.class);
- /**
- * Mark word right shift to get identity hash code.
- */
- @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public int identityHashCodeShift;
+ final int exceptionTableElementSize = getTypeSize("ExceptionTableElement");
+ final int exceptionTableElementStartPcOffset = getFieldOffset("ExceptionTableElement::start_pc", Integer.class, "u2");
+ final int exceptionTableElementEndPcOffset = getFieldOffset("ExceptionTableElement::end_pc", Integer.class, "u2");
+ final int exceptionTableElementHandlerPcOffset = getFieldOffset("ExceptionTableElement::handler_pc", Integer.class, "u2");
+ final int exceptionTableElementCatchTypeIndexOffset = getFieldOffset("ExceptionTableElement::catch_type_index", Integer.class, "u2");
+
+ final int localVariableTableElementSize = getTypeSize("LocalVariableTableElement");
+ final int localVariableTableElementStartBciOffset = getFieldOffset("LocalVariableTableElement::start_bci", Integer.class, "u2");
+ final int localVariableTableElementLengthOffset = getFieldOffset("LocalVariableTableElement::length", Integer.class, "u2");
+ final int localVariableTableElementNameCpIndexOffset = getFieldOffset("LocalVariableTableElement::name_cp_index", Integer.class, "u2");
+ final int localVariableTableElementDescriptorCpIndexOffset = getFieldOffset("LocalVariableTableElement::descriptor_cp_index", Integer.class, "u2");
+ final int localVariableTableElementSlotOffset = getFieldOffset("LocalVariableTableElement::slot", Integer.class, "u2");
+
+ final int constantPoolSize = getTypeSize("ConstantPool");
+ final int constantPoolTagsOffset = getFieldOffset("ConstantPool::_tags", Integer.class, "Array<u1>*");
+ final int constantPoolHolderOffset = getFieldOffset("ConstantPool::_pool_holder", Integer.class, "InstanceKlass*");
+ final int constantPoolLengthOffset = getFieldOffset("ConstantPool::_length", Integer.class, "int");
+
+ final int constantPoolCpCacheIndexTag = getConstant("ConstantPool::CPCACHE_INDEX_TAG", Integer.class);
+
+ final int jvmConstantUtf8 = getConstant("JVM_CONSTANT_Utf8", Integer.class);
+ final int jvmConstantInteger = getConstant("JVM_CONSTANT_Integer", Integer.class);
+ final int jvmConstantLong = getConstant("JVM_CONSTANT_Long", Integer.class);
+ final int jvmConstantFloat = getConstant("JVM_CONSTANT_Float", Integer.class);
+ final int jvmConstantDouble = getConstant("JVM_CONSTANT_Double", Integer.class);
+ final int jvmConstantClass = getConstant("JVM_CONSTANT_Class", Integer.class);
+ final int jvmConstantUnresolvedClass = getConstant("JVM_CONSTANT_UnresolvedClass", Integer.class);
+ final int jvmConstantUnresolvedClassInError = getConstant("JVM_CONSTANT_UnresolvedClassInError", Integer.class);
+ final int jvmConstantString = getConstant("JVM_CONSTANT_String", Integer.class);
+ final int jvmConstantFieldref = getConstant("JVM_CONSTANT_Fieldref", Integer.class);
+ final int jvmConstantMethodref = getConstant("JVM_CONSTANT_Methodref", Integer.class);
+ final int jvmConstantInterfaceMethodref = getConstant("JVM_CONSTANT_InterfaceMethodref", Integer.class);
+ final int jvmConstantNameAndType = getConstant("JVM_CONSTANT_NameAndType", Integer.class);
+ final int jvmConstantMethodHandle = getConstant("JVM_CONSTANT_MethodHandle", Integer.class);
+ final int jvmConstantMethodHandleInError = getConstant("JVM_CONSTANT_MethodHandleInError", Integer.class);
+ final int jvmConstantMethodType = getConstant("JVM_CONSTANT_MethodType", Integer.class);
+ final int jvmConstantMethodTypeInError = getConstant("JVM_CONSTANT_MethodTypeInError", Integer.class);
+ final int jvmConstantInvokeDynamic = getConstant("JVM_CONSTANT_InvokeDynamic", Integer.class);
+
+ final int jvmConstantExternalMax = getConstant("JVM_CONSTANT_ExternalMax", Integer.class);
+ final int jvmConstantInternalMin = getConstant("JVM_CONSTANT_InternalMin", Integer.class);
+ final int jvmConstantInternalMax = getConstant("JVM_CONSTANT_InternalMax", Integer.class);
+
+ final int heapWordSize = getConstant("HeapWordSize", Integer.class);
+
+ final int symbolPointerSize = getTypeSize("Symbol*");
+
+ final long vmSymbolsSymbols = getFieldAddress("vmSymbols::_symbols[0]", "Symbol*");
+ final int vmSymbolsFirstSID = getConstant("vmSymbols::FIRST_SID", Integer.class);
+ final int vmSymbolsSIDLimit = getConstant("vmSymbols::SID_LIMIT", Integer.class);
/**
- * Identity hash code value when uninitialized.
+ * Returns the symbol in the {@code vmSymbols} table at position {@code index} as a
+ * {@link String}.
+ *
+ * @param index position in the symbol table
+ * @return the symbol at position id
*/
- @HotSpotVMConstant(name = "markOopDesc::no_hash") @Stable public int uninitializedIdentityHashCodeValue;
-
- @HotSpotVMField(name = "Method::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int methodAccessFlagsOffset;
- @HotSpotVMField(name = "Method::_constMethod", type = "ConstMethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodConstMethodOffset;
- @HotSpotVMField(name = "Method::_intrinsic_id", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodIntrinsicIdOffset;
- @HotSpotVMField(name = "Method::_flags", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodFlagsOffset;
- @HotSpotVMField(name = "Method::_vtable_index", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodVtableIndexOffset;
-
- @HotSpotVMField(name = "Method::_method_counters", type = "MethodCounters*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCountersOffset;
- @HotSpotVMField(name = "Method::_method_data", type = "MethodData*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOffset;
- @HotSpotVMField(name = "Method::_from_compiled_entry", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCompiledEntryOffset;
- @HotSpotVMField(name = "Method::_code", type = "CompiledMethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCodeOffset;
-
- @HotSpotVMConstant(name = "Method::_jfr_towrite") @Stable public int methodFlagsJfrTowrite;
- @HotSpotVMConstant(name = "Method::_caller_sensitive") @Stable public int methodFlagsCallerSensitive;
- @HotSpotVMConstant(name = "Method::_force_inline") @Stable public int methodFlagsForceInline;
- @HotSpotVMConstant(name = "Method::_dont_inline") @Stable public int methodFlagsDontInline;
- @HotSpotVMConstant(name = "Method::_hidden") @Stable public int methodFlagsHidden;
- @HotSpotVMConstant(name = "Method::_reserved_stack_access") @Stable public int methodFlagsReservedStackAccess;
- @HotSpotVMConstant(name = "Method::nonvirtual_vtable_index") @Stable public int nonvirtualVtableIndex;
- @HotSpotVMConstant(name = "Method::invalid_vtable_index") @Stable public int invalidVtableIndex;
-
- @HotSpotVMField(name = "MethodCounters::_invocation_counter", type = "InvocationCounter", get = HotSpotVMField.Type.OFFSET) @Stable public int invocationCounterOffset;
- @HotSpotVMField(name = "MethodCounters::_backedge_counter", type = "InvocationCounter", get = HotSpotVMField.Type.OFFSET) @Stable public int backedgeCounterOffset;
- @HotSpotVMConstant(name = "InvocationCounter::count_increment") @Stable public int invocationCounterIncrement;
- @HotSpotVMConstant(name = "InvocationCounter::count_shift") @Stable public int invocationCounterShift;
-
- @HotSpotVMField(name = "MethodData::_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataSize;
- @HotSpotVMField(name = "MethodData::_data_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataDataSize;
- @HotSpotVMField(name = "MethodData::_data[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopDataOffset;
- @HotSpotVMField(name = "MethodData::_trap_hist._array[0]", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopTrapHistoryOffset;
- @HotSpotVMField(name = "MethodData::_jvmci_ir_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataIRSizeOffset;
-
- @HotSpotVMField(name = "nmethod::_verified_entry_point", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodEntryOffset;
- @HotSpotVMField(name = "nmethod::_comp_level", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodCompLevelOffset;
-
- @HotSpotVMConstant(name = "CompLevel_none") @Stable public int compilationLevelNone;
- @HotSpotVMConstant(name = "CompLevel_simple") @Stable public int compilationLevelSimple;
- @HotSpotVMConstant(name = "CompLevel_limited_profile") @Stable public int compilationLevelLimitedProfile;
- @HotSpotVMConstant(name = "CompLevel_full_profile") @Stable public int compilationLevelFullProfile;
- @HotSpotVMConstant(name = "CompLevel_full_optimization") @Stable public int compilationLevelFullOptimization;
-
- @HotSpotVMConstant(name = "JVMCIRuntime::none") @Stable public int compLevelAdjustmentNone;
- @HotSpotVMConstant(name = "JVMCIRuntime::by_holder") @Stable public int compLevelAdjustmentByHolder;
- @HotSpotVMConstant(name = "JVMCIRuntime::by_full_signature") @Stable public int compLevelAdjustmentByFullSignature;
-
- @HotSpotVMConstant(name = "InvocationEntryBci") @Stable public int invocationEntryBci;
-
- @HotSpotVMField(name = "JVMCIEnv::_task", type = "CompileTask*", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvTaskOffset;
- @HotSpotVMField(name = "JVMCIEnv::_jvmti_can_hotswap_or_post_breakpoint", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset;
- @HotSpotVMField(name = "CompileTask::_num_inlined_bytecodes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int compileTaskNumInlinedBytecodesOffset;
-
- @HotSpotVMField(name = "CompilerToVM::Data::Method_extra_stack_entries", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int extraStackEntries;
-
- @HotSpotVMField(name = "ConstMethod::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodConstantsOffset;
- @HotSpotVMField(name = "ConstMethod::_flags", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodFlagsOffset;
- @HotSpotVMField(name = "ConstMethod::_code_size", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodCodeSizeOffset;
- @HotSpotVMField(name = "ConstMethod::_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodNameIndexOffset;
- @HotSpotVMField(name = "ConstMethod::_signature_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodSignatureIndexOffset;
- @HotSpotVMField(name = "ConstMethod::_max_stack", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodMaxStackOffset;
- @HotSpotVMField(name = "ConstMethod::_max_locals", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodMaxLocalsOffset;
+ String symbolAt(int index) {
+ HotSpotJVMCIRuntimeProvider runtime = runtime();
+ assert vmSymbolsFirstSID <= index && index < vmSymbolsSIDLimit : "index " + index + " is out of bounds";
+ assert symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken";
+ int offset = index * symbolPointerSize;
+ return runtime.getCompilerToVM().getSymbol(UNSAFE.getAddress(vmSymbolsSymbols + offset));
+ }
- @HotSpotVMConstant(name = "ConstMethod::_has_linenumber_table") @Stable public int constMethodHasLineNumberTable;
- @HotSpotVMConstant(name = "ConstMethod::_has_localvariable_table") @Stable public int constMethodHasLocalVariableTable;
- @HotSpotVMConstant(name = "ConstMethod::_has_exception_table") @Stable public int constMethodHasExceptionTable;
-
- @HotSpotVMType(name = "ExceptionTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int exceptionTableElementSize;
- @HotSpotVMField(name = "ExceptionTableElement::start_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementStartPcOffset;
- @HotSpotVMField(name = "ExceptionTableElement::end_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementEndPcOffset;
- @HotSpotVMField(name = "ExceptionTableElement::handler_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementHandlerPcOffset;
- @HotSpotVMField(name = "ExceptionTableElement::catch_type_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementCatchTypeIndexOffset;
-
- @HotSpotVMType(name = "LocalVariableTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int localVariableTableElementSize;
- @HotSpotVMField(name = "LocalVariableTableElement::start_bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementStartBciOffset;
- @HotSpotVMField(name = "LocalVariableTableElement::length", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementLengthOffset;
- @HotSpotVMField(name = "LocalVariableTableElement::name_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementNameCpIndexOffset;
- @HotSpotVMField(name = "LocalVariableTableElement::descriptor_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementDescriptorCpIndexOffset;
- @HotSpotVMField(name = "LocalVariableTableElement::signature_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSignatureCpIndexOffset;
- @HotSpotVMField(name = "LocalVariableTableElement::slot", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSlotOffset;
-
- @HotSpotVMType(name = "ConstantPool", get = HotSpotVMType.Type.SIZE) @Stable public int constantPoolSize;
- @HotSpotVMField(name = "ConstantPool::_tags", type = "Array<u1>*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolTagsOffset;
- @HotSpotVMField(name = "ConstantPool::_pool_holder", type = "InstanceKlass*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolHolderOffset;
- @HotSpotVMField(name = "ConstantPool::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolLengthOffset;
-
- @HotSpotVMConstant(name = "ConstantPool::CPCACHE_INDEX_TAG") @Stable public int constantPoolCpCacheIndexTag;
+ final int universeBaseVtableSize = getFieldValue("CompilerToVM::Data::Universe_base_vtable_size", Integer.class, "int");
- @HotSpotVMConstant(name = "JVM_CONSTANT_Utf8") @Stable public int jvmConstantUtf8;
- @HotSpotVMConstant(name = "JVM_CONSTANT_Integer") @Stable public int jvmConstantInteger;
- @HotSpotVMConstant(name = "JVM_CONSTANT_Long") @Stable public int jvmConstantLong;
- @HotSpotVMConstant(name = "JVM_CONSTANT_Float") @Stable public int jvmConstantFloat;
- @HotSpotVMConstant(name = "JVM_CONSTANT_Double") @Stable public int jvmConstantDouble;
- @HotSpotVMConstant(name = "JVM_CONSTANT_Class") @Stable public int jvmConstantClass;
- @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClass") @Stable public int jvmConstantUnresolvedClass;
- @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClassInError") @Stable public int jvmConstantUnresolvedClassInError;
- @HotSpotVMConstant(name = "JVM_CONSTANT_String") @Stable public int jvmConstantString;
- @HotSpotVMConstant(name = "JVM_CONSTANT_Fieldref") @Stable public int jvmConstantFieldref;
- @HotSpotVMConstant(name = "JVM_CONSTANT_Methodref") @Stable public int jvmConstantMethodref;
- @HotSpotVMConstant(name = "JVM_CONSTANT_InterfaceMethodref") @Stable public int jvmConstantInterfaceMethodref;
- @HotSpotVMConstant(name = "JVM_CONSTANT_NameAndType") @Stable public int jvmConstantNameAndType;
- @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandle") @Stable public int jvmConstantMethodHandle;
- @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandleInError") @Stable public int jvmConstantMethodHandleInError;
- @HotSpotVMConstant(name = "JVM_CONSTANT_MethodType") @Stable public int jvmConstantMethodType;
- @HotSpotVMConstant(name = "JVM_CONSTANT_MethodTypeInError") @Stable public int jvmConstantMethodTypeInError;
- @HotSpotVMConstant(name = "JVM_CONSTANT_InvokeDynamic") @Stable public int jvmConstantInvokeDynamic;
-
- @HotSpotVMConstant(name = "JVM_CONSTANT_ExternalMax") @Stable public int jvmConstantExternalMax;
- @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMin") @Stable public int jvmConstantInternalMin;
- @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMax") @Stable public int jvmConstantInternalMax;
-
- @HotSpotVMConstant(name = "HeapWordSize") @Stable public int heapWordSize;
-
- @HotSpotVMType(name = "Symbol*", get = HotSpotVMType.Type.SIZE) @Stable public int symbolPointerSize;
-
- @HotSpotVMField(name = "vmSymbols::_symbols[0]", type = "Symbol*", get = HotSpotVMField.Type.ADDRESS) @Stable public long vmSymbolsSymbols;
- @HotSpotVMConstant(name = "vmSymbols::FIRST_SID") @Stable public int vmSymbolsFirstSID;
- @HotSpotVMConstant(name = "vmSymbols::SID_LIMIT") @Stable public int vmSymbolsSIDLimit;
-
- /**
- * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
- * are allowed to look like (respectively) the high or low bits of a real oop.
- */
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_non_oop_bits", type = "void*", get = HotSpotVMField.Type.VALUE) @Stable public long nonOopBits;
-
- @HotSpotVMField(name = "StubRoutines::_verify_oop_count", type = "jint", get = HotSpotVMField.Type.ADDRESS) @Stable public long verifyOopCounterAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_verify_oop_mask", type = "uintptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long verifyOopMask;
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_verify_oop_bits", type = "uintptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long verifyOopBits;
- @HotSpotVMField(name = "CompilerToVM::Data::Universe_base_vtable_size", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int universeBaseVtableSize;
-
- public final int baseVtableLength() {
+ final int baseVtableLength() {
return universeBaseVtableSize / vtableEntrySize;
}
- @HotSpotVMField(name = "HeapRegion::LogOfHRGrainBytes", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int logOfHRGrainBytes;
-
- @HotSpotVMConstant(name = "CardTableModRefBS::dirty_card") @Stable public byte dirtyCardValue;
- @HotSpotVMConstant(name = "G1SATBCardTableModRefBS::g1_young_gen") @Stable public byte g1YoungCardValue;
-
- @HotSpotVMField(name = "CompilerToVM::Data::cardtable_start_address", type = "jbyte*", get = HotSpotVMField.Type.VALUE) @Stable private long cardtableStartAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::cardtable_shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable private int cardtableShift;
-
- public long cardtableStartAddress() {
- return cardtableStartAddress;
- }
-
- public int cardtableShift() {
- return cardtableShift;
- }
-
- @HotSpotVMField(name = "os::_polling_page", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long safepointPollingAddress;
-
- // G1 Collector Related Values.
-
- public int g1CardQueueIndexOffset() {
- return javaThreadDirtyCardQueueOffset + dirtyCardQueueIndexOffset;
- }
-
- public int g1CardQueueBufferOffset() {
- return javaThreadDirtyCardQueueOffset + dirtyCardQueueBufferOffset;
- }
-
- public int g1SATBQueueMarkingOffset() {
- return javaThreadSatbMarkQueueOffset + satbMarkQueueActiveOffset;
- }
-
- public int g1SATBQueueIndexOffset() {
- return javaThreadSatbMarkQueueOffset + satbMarkQueueIndexOffset;
- }
-
- public int g1SATBQueueBufferOffset() {
- return javaThreadSatbMarkQueueOffset + satbMarkQueueBufferOffset;
- }
-
- @HotSpotVMField(name = "java_lang_Class::_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassOffset;
- @HotSpotVMField(name = "java_lang_Class::_array_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int arrayKlassOffset;
-
- @HotSpotVMType(name = "BasicLock", get = HotSpotVMType.Type.SIZE) @Stable public int basicLockSize;
- @HotSpotVMField(name = "BasicLock::_displaced_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int basicLockDisplacedHeaderOffset;
-
- @HotSpotVMField(name = "Thread::_allocated_bytes", type = "jlong", get = HotSpotVMField.Type.OFFSET) @Stable public int threadAllocatedBytesOffset;
-
- @HotSpotVMFlag(name = "TLABWasteIncrement") @Stable public int tlabRefillWasteIncrement;
-
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_start", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferStartOffset;
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_end", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferEndOffset;
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferTopOffset;
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_pf_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferPfTopOffset;
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_slow_allocations", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferSlowAllocationsOffset;
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_fast_refill_waste", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferFastRefillWasteOffset;
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_number_of_refills", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferNumberOfRefillsOffset;
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_refill_waste_limit", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferRefillWasteLimitOffset;
- @HotSpotVMField(name = "ThreadLocalAllocBuffer::_desired_size", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferDesiredSizeOffset;
-
- public int tlabSlowAllocationsOffset() {
- return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset;
- }
-
- public int tlabFastRefillWasteOffset() {
- return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset;
- }
-
- public int tlabNumberOfRefillsOffset() {
- return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset;
- }
-
- public int tlabRefillWasteLimitOffset() {
- return threadTlabOffset + threadLocalAllocBufferRefillWasteLimitOffset;
- }
-
- public int threadTlabSizeOffset() {
- return threadTlabOffset + threadLocalAllocBufferDesiredSizeOffset;
- }
-
- public int threadTlabStartOffset() {
- return threadTlabOffset + threadLocalAllocBufferStartOffset;
- }
-
- public int threadTlabEndOffset() {
- return threadTlabOffset + threadLocalAllocBufferEndOffset;
- }
-
- public int threadTlabTopOffset() {
- return threadTlabOffset + threadLocalAllocBufferTopOffset;
- }
-
- public int threadTlabPfTopOffset() {
- return threadTlabOffset + threadLocalAllocBufferPfTopOffset;
- }
-
- @HotSpotVMField(name = "CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve", type = "size_t", get = HotSpotVMField.Type.VALUE) @Stable public int tlabAlignmentReserve;
-
- @HotSpotVMFlag(name = "TLABStats") @Stable public boolean tlabStats;
-
- // FIXME This is only temporary until the GC code is changed.
- @HotSpotVMField(name = "CompilerToVM::Data::_supports_inline_contig_alloc", type = "bool", get = HotSpotVMField.Type.VALUE) @Stable public boolean inlineContiguousAllocationSupported;
- @HotSpotVMField(name = "CompilerToVM::Data::_heap_end_addr", type = "HeapWord**", get = HotSpotVMField.Type.VALUE) @Stable public long heapEndAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::_heap_top_addr", type = "HeapWord**", get = HotSpotVMField.Type.VALUE) @Stable public long heapTopAddress;
+ final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int");
/**
* The DataLayout header size is the same as the cell size.
*/
- @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutHeaderSize;
- @HotSpotVMField(name = "DataLayout::_header._struct._tag", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutTagOffset;
- @HotSpotVMField(name = "DataLayout::_header._struct._flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutFlagsOffset;
- @HotSpotVMField(name = "DataLayout::_header._struct._bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutBCIOffset;
- @HotSpotVMField(name = "DataLayout::_cells[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutCellsOffset;
- @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutCellSize;
-
- @HotSpotVMConstant(name = "DataLayout::no_tag") @Stable public int dataLayoutNoTag;
- @HotSpotVMConstant(name = "DataLayout::bit_data_tag") @Stable public int dataLayoutBitDataTag;
- @HotSpotVMConstant(name = "DataLayout::counter_data_tag") @Stable public int dataLayoutCounterDataTag;
- @HotSpotVMConstant(name = "DataLayout::jump_data_tag") @Stable public int dataLayoutJumpDataTag;
- @HotSpotVMConstant(name = "DataLayout::receiver_type_data_tag") @Stable public int dataLayoutReceiverTypeDataTag;
- @HotSpotVMConstant(name = "DataLayout::virtual_call_data_tag") @Stable public int dataLayoutVirtualCallDataTag;
- @HotSpotVMConstant(name = "DataLayout::ret_data_tag") @Stable public int dataLayoutRetDataTag;
- @HotSpotVMConstant(name = "DataLayout::branch_data_tag") @Stable public int dataLayoutBranchDataTag;
- @HotSpotVMConstant(name = "DataLayout::multi_branch_data_tag") @Stable public int dataLayoutMultiBranchDataTag;
- @HotSpotVMConstant(name = "DataLayout::arg_info_data_tag") @Stable public int dataLayoutArgInfoDataTag;
- @HotSpotVMConstant(name = "DataLayout::call_type_data_tag") @Stable public int dataLayoutCallTypeDataTag;
- @HotSpotVMConstant(name = "DataLayout::virtual_call_type_data_tag") @Stable public int dataLayoutVirtualCallTypeDataTag;
- @HotSpotVMConstant(name = "DataLayout::parameters_type_data_tag") @Stable public int dataLayoutParametersTypeDataTag;
- @HotSpotVMConstant(name = "DataLayout::speculative_trap_data_tag") @Stable public int dataLayoutSpeculativeTrapDataTag;
-
- @HotSpotVMFlag(name = "BciProfileWidth") @Stable public int bciProfileWidth;
- @HotSpotVMFlag(name = "TypeProfileWidth") @Stable public int typeProfileWidth;
- @HotSpotVMFlag(name = "MethodProfileWidth") @Stable public int methodProfileWidth;
-
- @HotSpotVMField(name = "CompilerToVM::Data::SharedRuntime_ic_miss_stub", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long inlineCacheMissStub;
- @HotSpotVMField(name = "CompilerToVM::Data::SharedRuntime_handle_wrong_method_stub", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long handleWrongMethodStub;
-
- @HotSpotVMField(name = "CompilerToVM::Data::SharedRuntime_deopt_blob_unpack", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long handleDeoptStub;
- @HotSpotVMField(name = "CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long uncommonTrapStub;
-
- @HotSpotVMField(name = "CodeCache::_low_bound", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long codeCacheLowBound;
- @HotSpotVMField(name = "CodeCache::_high_bound", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long codeCacheHighBound;
+ final int dataLayoutHeaderSize = getConstant("DataLayout::cell_size", Integer.class);
+ final int dataLayoutTagOffset = getFieldOffset("DataLayout::_header._struct._tag", Integer.class, "u1");
+ final int dataLayoutFlagsOffset = getFieldOffset("DataLayout::_header._struct._flags", Integer.class, "u1");
+ final int dataLayoutBCIOffset = getFieldOffset("DataLayout::_header._struct._bci", Integer.class, "u2");
+ final int dataLayoutCellSize = getConstant("DataLayout::cell_size", Integer.class);
- @HotSpotVMField(name = "StubRoutines::_aescrypt_encryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptEncryptBlockStub;
- @HotSpotVMField(name = "StubRoutines::_aescrypt_decryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptDecryptBlockStub;
- @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_encryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingEncryptAESCryptStub;
- @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_decryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingDecryptAESCryptStub;
- @HotSpotVMField(name = "StubRoutines::_updateBytesCRC32", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long updateBytesCRC32Stub;
- @HotSpotVMField(name = "StubRoutines::_crc_table_adr", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long crcTableAddress;
-
- @HotSpotVMField(name = "StubRoutines::_throw_delayed_StackOverflowError_entry", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long throwDelayedStackOverflowErrorEntry;
+ final int dataLayoutNoTag = getConstant("DataLayout::no_tag", Integer.class);
+ final int dataLayoutBitDataTag = getConstant("DataLayout::bit_data_tag", Integer.class);
+ final int dataLayoutCounterDataTag = getConstant("DataLayout::counter_data_tag", Integer.class);
+ final int dataLayoutJumpDataTag = getConstant("DataLayout::jump_data_tag", Integer.class);
+ final int dataLayoutReceiverTypeDataTag = getConstant("DataLayout::receiver_type_data_tag", Integer.class);
+ final int dataLayoutVirtualCallDataTag = getConstant("DataLayout::virtual_call_data_tag", Integer.class);
+ final int dataLayoutRetDataTag = getConstant("DataLayout::ret_data_tag", Integer.class);
+ final int dataLayoutBranchDataTag = getConstant("DataLayout::branch_data_tag", Integer.class);
+ final int dataLayoutMultiBranchDataTag = getConstant("DataLayout::multi_branch_data_tag", Integer.class);
+ final int dataLayoutArgInfoDataTag = getConstant("DataLayout::arg_info_data_tag", Integer.class);
+ final int dataLayoutCallTypeDataTag = getConstant("DataLayout::call_type_data_tag", Integer.class);
+ final int dataLayoutVirtualCallTypeDataTag = getConstant("DataLayout::virtual_call_type_data_tag", Integer.class);
+ final int dataLayoutParametersTypeDataTag = getConstant("DataLayout::parameters_type_data_tag", Integer.class);
+ final int dataLayoutSpeculativeTrapDataTag = getConstant("DataLayout::speculative_trap_data_tag", Integer.class);
- @HotSpotVMField(name = "StubRoutines::_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteArraycopy;
- @HotSpotVMField(name = "StubRoutines::_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortArraycopy;
- @HotSpotVMField(name = "StubRoutines::_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintArraycopy;
- @HotSpotVMField(name = "StubRoutines::_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongArraycopy;
- @HotSpotVMField(name = "StubRoutines::_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopy;
- @HotSpotVMField(name = "StubRoutines::_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopyUninit;
- @HotSpotVMField(name = "StubRoutines::_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopyUninit;
- @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopyUninit;
- @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopy;
- @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopyUninit;
- @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopy;
- @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopyUninit;
- @HotSpotVMField(name = "StubRoutines::_unsafe_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long unsafeArraycopy;
- @HotSpotVMField(name = "StubRoutines::_generic_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long genericArraycopy;
-
- @HotSpotVMAddress(name = "JVMCIRuntime::new_instance") @Stable public long newInstanceAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::new_array") @Stable public long newArrayAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::new_multi_array") @Stable public long newMultiArrayAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::dynamic_new_array") @Stable public long dynamicNewArrayAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::dynamic_new_instance") @Stable public long dynamicNewInstanceAddress;
+ final int bciProfileWidth = getFlag("BciProfileWidth", Integer.class);
+ final int typeProfileWidth = getFlag("TypeProfileWidth", Integer.class);
+ final int methodProfileWidth = getFlag("MethodProfileWidth", Integer.class);
- @HotSpotVMAddress(name = "JVMCIRuntime::thread_is_interrupted") @Stable public long threadIsInterruptedAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::vm_message") @Stable public long vmMessageAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::identity_hash_code") @Stable public long identityHashCodeAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::exception_handler_for_pc") @Stable public long exceptionHandlerForPcAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::monitorenter") @Stable public long monitorenterAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::monitorexit") @Stable public long monitorexitAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::throw_and_post_jvmti_exception") @Stable public long throwAndPostJvmtiExceptionAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::throw_klass_external_name_exception") @Stable public long throwKlassExternalNameExceptionAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::throw_class_cast_exception") @Stable public long throwClassCastExceptionAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::log_primitive") @Stable public long logPrimitiveAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::log_object") @Stable public long logObjectAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::log_printf") @Stable public long logPrintfAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::vm_error") @Stable public long vmErrorAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::load_and_clear_exception") @Stable public long loadAndClearExceptionAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::write_barrier_pre") @Stable public long writeBarrierPreAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::write_barrier_post") @Stable public long writeBarrierPostAddress;
- @HotSpotVMAddress(name = "JVMCIRuntime::validate_object") @Stable public long validateObject;
-
- @HotSpotVMAddress(name = "JVMCIRuntime::test_deoptimize_call_int") @Stable public long testDeoptimizeCallInt;
-
- @HotSpotVMAddress(name = "SharedRuntime::register_finalizer") @Stable public long registerFinalizerAddress;
- @HotSpotVMAddress(name = "SharedRuntime::exception_handler_for_return_address") @Stable public long exceptionHandlerForReturnAddressAddress;
- @HotSpotVMAddress(name = "SharedRuntime::OSR_migration_end") @Stable public long osrMigrationEndAddress;
- @HotSpotVMAddress(name = "SharedRuntime::enable_stack_reserved_zone") @Stable public long enableStackReservedZoneAddress;
-
- @HotSpotVMAddress(name = "os::javaTimeMillis") @Stable public long javaTimeMillisAddress;
- @HotSpotVMAddress(name = "os::javaTimeNanos") @Stable public long javaTimeNanosAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::dsin", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticSinAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::dcos", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticCosAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::dtan", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticTanAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::dexp", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticExpAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::dlog", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticLogAddress;
- @HotSpotVMField(name = "CompilerToVM::Data::dlog10", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticLog10Address;
- @HotSpotVMField(name = "CompilerToVM::Data::dpow", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticPowAddress;
-
- @HotSpotVMFlag(name = "JVMCICounterSize") @Stable public int jvmciCountersSize;
-
- @HotSpotVMAddress(name = "Deoptimization::fetch_unroll_info") @Stable public long deoptimizationFetchUnrollInfo;
- @HotSpotVMAddress(name = "Deoptimization::uncommon_trap") @Stable public long deoptimizationUncommonTrap;
- @HotSpotVMAddress(name = "Deoptimization::unpack_frames") @Stable public long deoptimizationUnpackFrames;
+ final int deoptReasonNone = getConstant("Deoptimization::Reason_none", Integer.class);
+ final int deoptReasonNullCheck = getConstant("Deoptimization::Reason_null_check", Integer.class);
+ final int deoptReasonRangeCheck = getConstant("Deoptimization::Reason_range_check", Integer.class);
+ final int deoptReasonClassCheck = getConstant("Deoptimization::Reason_class_check", Integer.class);
+ final int deoptReasonArrayCheck = getConstant("Deoptimization::Reason_array_check", Integer.class);
+ final int deoptReasonUnreached0 = getConstant("Deoptimization::Reason_unreached0", Integer.class);
+ final int deoptReasonTypeCheckInlining = getConstant("Deoptimization::Reason_type_checked_inlining", Integer.class);
+ final int deoptReasonOptimizedTypeCheck = getConstant("Deoptimization::Reason_optimized_type_check", Integer.class);
+ final int deoptReasonNotCompiledExceptionHandler = getConstant("Deoptimization::Reason_not_compiled_exception_handler", Integer.class);
+ final int deoptReasonUnresolved = getConstant("Deoptimization::Reason_unresolved", Integer.class);
+ final int deoptReasonJsrMismatch = getConstant("Deoptimization::Reason_jsr_mismatch", Integer.class);
+ final int deoptReasonDiv0Check = getConstant("Deoptimization::Reason_div0_check", Integer.class);
+ final int deoptReasonConstraint = getConstant("Deoptimization::Reason_constraint", Integer.class);
+ final int deoptReasonLoopLimitCheck = getConstant("Deoptimization::Reason_loop_limit_check", Integer.class);
+ final int deoptReasonAliasing = getConstant("Deoptimization::Reason_aliasing", Integer.class);
+ final int deoptReasonTransferToInterpreter = getConstant("Deoptimization::Reason_transfer_to_interpreter", Integer.class);
+ final int deoptReasonOSROffset = getConstant("Deoptimization::Reason_LIMIT", Integer.class);
- @HotSpotVMConstant(name = "Deoptimization::Reason_none") @Stable public int deoptReasonNone;
- @HotSpotVMConstant(name = "Deoptimization::Reason_null_check") @Stable public int deoptReasonNullCheck;
- @HotSpotVMConstant(name = "Deoptimization::Reason_range_check") @Stable public int deoptReasonRangeCheck;
- @HotSpotVMConstant(name = "Deoptimization::Reason_class_check") @Stable public int deoptReasonClassCheck;
- @HotSpotVMConstant(name = "Deoptimization::Reason_array_check") @Stable public int deoptReasonArrayCheck;
- @HotSpotVMConstant(name = "Deoptimization::Reason_unreached0") @Stable public int deoptReasonUnreached0;
- @HotSpotVMConstant(name = "Deoptimization::Reason_type_checked_inlining") @Stable public int deoptReasonTypeCheckInlining;
- @HotSpotVMConstant(name = "Deoptimization::Reason_optimized_type_check") @Stable public int deoptReasonOptimizedTypeCheck;
- @HotSpotVMConstant(name = "Deoptimization::Reason_not_compiled_exception_handler") @Stable public int deoptReasonNotCompiledExceptionHandler;
- @HotSpotVMConstant(name = "Deoptimization::Reason_unresolved") @Stable public int deoptReasonUnresolved;
- @HotSpotVMConstant(name = "Deoptimization::Reason_jsr_mismatch") @Stable public int deoptReasonJsrMismatch;
- @HotSpotVMConstant(name = "Deoptimization::Reason_div0_check") @Stable public int deoptReasonDiv0Check;
- @HotSpotVMConstant(name = "Deoptimization::Reason_constraint") @Stable public int deoptReasonConstraint;
- @HotSpotVMConstant(name = "Deoptimization::Reason_loop_limit_check") @Stable public int deoptReasonLoopLimitCheck;
- @HotSpotVMConstant(name = "Deoptimization::Reason_aliasing") @Stable public int deoptReasonAliasing;
- @HotSpotVMConstant(name = "Deoptimization::Reason_transfer_to_interpreter") @Stable public int deoptReasonTransferToInterpreter;
- @HotSpotVMConstant(name = "Deoptimization::Reason_LIMIT") @Stable public int deoptReasonOSROffset;
+ final int deoptActionNone = getConstant("Deoptimization::Action_none", Integer.class);
+ final int deoptActionMaybeRecompile = getConstant("Deoptimization::Action_maybe_recompile", Integer.class);
+ final int deoptActionReinterpret = getConstant("Deoptimization::Action_reinterpret", Integer.class);
+ final int deoptActionMakeNotEntrant = getConstant("Deoptimization::Action_make_not_entrant", Integer.class);
+ final int deoptActionMakeNotCompilable = getConstant("Deoptimization::Action_make_not_compilable", Integer.class);
- @HotSpotVMConstant(name = "Deoptimization::Action_none") @Stable public int deoptActionNone;
- @HotSpotVMConstant(name = "Deoptimization::Action_maybe_recompile") @Stable public int deoptActionMaybeRecompile;
- @HotSpotVMConstant(name = "Deoptimization::Action_reinterpret") @Stable public int deoptActionReinterpret;
- @HotSpotVMConstant(name = "Deoptimization::Action_make_not_entrant") @Stable public int deoptActionMakeNotEntrant;
- @HotSpotVMConstant(name = "Deoptimization::Action_make_not_compilable") @Stable public int deoptActionMakeNotCompilable;
+ final int deoptimizationActionBits = getConstant("Deoptimization::_action_bits", Integer.class);
+ final int deoptimizationReasonBits = getConstant("Deoptimization::_reason_bits", Integer.class);
+ final int deoptimizationDebugIdBits = getConstant("Deoptimization::_debug_id_bits", Integer.class);
+ final int deoptimizationActionShift = getConstant("Deoptimization::_action_shift", Integer.class);
+ final int deoptimizationReasonShift = getConstant("Deoptimization::_reason_shift", Integer.class);
+ final int deoptimizationDebugIdShift = getConstant("Deoptimization::_debug_id_shift", Integer.class);
- @HotSpotVMConstant(name = "Deoptimization::_action_bits") @Stable public int deoptimizationActionBits;
- @HotSpotVMConstant(name = "Deoptimization::_reason_bits") @Stable public int deoptimizationReasonBits;
- @HotSpotVMConstant(name = "Deoptimization::_debug_id_bits") @Stable public int deoptimizationDebugIdBits;
- @HotSpotVMConstant(name = "Deoptimization::_action_shift") @Stable public int deoptimizationActionShift;
- @HotSpotVMConstant(name = "Deoptimization::_reason_shift") @Stable public int deoptimizationReasonShift;
- @HotSpotVMConstant(name = "Deoptimization::_debug_id_shift") @Stable public int deoptimizationDebugIdShift;
-
- @HotSpotVMConstant(name = "Deoptimization::Unpack_deopt") @Stable public int deoptimizationUnpackDeopt;
- @HotSpotVMConstant(name = "Deoptimization::Unpack_exception") @Stable public int deoptimizationUnpackException;
- @HotSpotVMConstant(name = "Deoptimization::Unpack_uncommon_trap") @Stable public int deoptimizationUnpackUncommonTrap;
- @HotSpotVMConstant(name = "Deoptimization::Unpack_reexecute") @Stable public int deoptimizationUnpackReexecute;
+ final int vmIntrinsicInvokeBasic = getConstant("vmIntrinsics::_invokeBasic", Integer.class);
+ final int vmIntrinsicLinkToVirtual = getConstant("vmIntrinsics::_linkToVirtual", Integer.class);
+ final int vmIntrinsicLinkToStatic = getConstant("vmIntrinsics::_linkToStatic", Integer.class);
+ final int vmIntrinsicLinkToSpecial = getConstant("vmIntrinsics::_linkToSpecial", Integer.class);
+ final int vmIntrinsicLinkToInterface = getConstant("vmIntrinsics::_linkToInterface", Integer.class);
- @HotSpotVMField(name = "Deoptimization::UnrollBlock::_size_of_deoptimized_frame", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockSizeOfDeoptimizedFrameOffset;
- @HotSpotVMField(name = "Deoptimization::UnrollBlock::_caller_adjustment", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockCallerAdjustmentOffset;
- @HotSpotVMField(name = "Deoptimization::UnrollBlock::_number_of_frames", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockNumberOfFramesOffset;
- @HotSpotVMField(name = "Deoptimization::UnrollBlock::_total_frame_sizes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockTotalFrameSizesOffset;
- @HotSpotVMField(name = "Deoptimization::UnrollBlock::_unpack_kind", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockUnpackKindOffset;
- @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_sizes", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFrameSizesOffset;
- @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_pcs", type = "address*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFramePcsOffset;
- @HotSpotVMField(name = "Deoptimization::UnrollBlock::_initial_info", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockInitialInfoOffset;
+ final int codeInstallResultOk = getConstant("JVMCIEnv::ok", Integer.class);
+ final int codeInstallResultDependenciesFailed = getConstant("JVMCIEnv::dependencies_failed", Integer.class);
+ final int codeInstallResultDependenciesInvalid = getConstant("JVMCIEnv::dependencies_invalid", Integer.class);
+ final int codeInstallResultCacheFull = getConstant("JVMCIEnv::cache_full", Integer.class);
+ final int codeInstallResultCodeTooLarge = getConstant("JVMCIEnv::code_too_large", Integer.class);
- @HotSpotVMConstant(name = "vmIntrinsics::_invokeBasic") @Stable public int vmIntrinsicInvokeBasic;
- @HotSpotVMConstant(name = "vmIntrinsics::_linkToVirtual") @Stable public int vmIntrinsicLinkToVirtual;
- @HotSpotVMConstant(name = "vmIntrinsics::_linkToStatic") @Stable public int vmIntrinsicLinkToStatic;
- @HotSpotVMConstant(name = "vmIntrinsics::_linkToSpecial") @Stable public int vmIntrinsicLinkToSpecial;
- @HotSpotVMConstant(name = "vmIntrinsics::_linkToInterface") @Stable public int vmIntrinsicLinkToInterface;
-
- @HotSpotVMConstant(name = "JVMCIEnv::ok") @Stable public int codeInstallResultOk;
- @HotSpotVMConstant(name = "JVMCIEnv::dependencies_failed") @Stable public int codeInstallResultDependenciesFailed;
- @HotSpotVMConstant(name = "JVMCIEnv::dependencies_invalid") @Stable public int codeInstallResultDependenciesInvalid;
- @HotSpotVMConstant(name = "JVMCIEnv::cache_full") @Stable public int codeInstallResultCacheFull;
- @HotSpotVMConstant(name = "JVMCIEnv::code_too_large") @Stable public int codeInstallResultCodeTooLarge;
-
- public String getCodeInstallResultDescription(int codeInstallResult) {
+ String getCodeInstallResultDescription(int codeInstallResult) {
if (codeInstallResult == codeInstallResultOk) {
return "ok";
}
@@ -1677,114 +348,17 @@
return "unknown";
}
- // Checkstyle: stop
- @HotSpotVMConstant(name = "CodeInstaller::VERIFIED_ENTRY") @Stable public int MARKID_VERIFIED_ENTRY;
- @HotSpotVMConstant(name = "CodeInstaller::UNVERIFIED_ENTRY") @Stable public int MARKID_UNVERIFIED_ENTRY;
- @HotSpotVMConstant(name = "CodeInstaller::OSR_ENTRY") @Stable public int MARKID_OSR_ENTRY;
- @HotSpotVMConstant(name = "CodeInstaller::EXCEPTION_HANDLER_ENTRY") @Stable public int MARKID_EXCEPTION_HANDLER_ENTRY;
- @HotSpotVMConstant(name = "CodeInstaller::DEOPT_HANDLER_ENTRY") @Stable public int MARKID_DEOPT_HANDLER_ENTRY;
- @HotSpotVMConstant(name = "CodeInstaller::INVOKEINTERFACE") @Stable public int MARKID_INVOKEINTERFACE;
- @HotSpotVMConstant(name = "CodeInstaller::INVOKEVIRTUAL") @Stable public int MARKID_INVOKEVIRTUAL;
- @HotSpotVMConstant(name = "CodeInstaller::INVOKESTATIC") @Stable public int MARKID_INVOKESTATIC;
- @HotSpotVMConstant(name = "CodeInstaller::INVOKESPECIAL") @Stable public int MARKID_INVOKESPECIAL;
- @HotSpotVMConstant(name = "CodeInstaller::INLINE_INVOKE") @Stable public int MARKID_INLINE_INVOKE;
- @HotSpotVMConstant(name = "CodeInstaller::POLL_NEAR") @Stable public int MARKID_POLL_NEAR;
- @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_NEAR") @Stable public int MARKID_POLL_RETURN_NEAR;
- @HotSpotVMConstant(name = "CodeInstaller::POLL_FAR") @Stable public int MARKID_POLL_FAR;
- @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_FAR") @Stable public int MARKID_POLL_RETURN_FAR;
- @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_SHIFT") @Stable public int MARKID_CARD_TABLE_SHIFT;
- @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_ADDRESS") @Stable public int MARKID_CARD_TABLE_ADDRESS;
- @HotSpotVMConstant(name = "CodeInstaller::HEAP_TOP_ADDRESS") @Stable public int MARKID_HEAP_TOP_ADDRESS;
- @HotSpotVMConstant(name = "CodeInstaller::HEAP_END_ADDRESS") @Stable public int MARKID_HEAP_END_ADDRESS;
- @HotSpotVMConstant(name = "CodeInstaller::NARROW_KLASS_BASE_ADDRESS") @Stable public int MARKID_NARROW_KLASS_BASE_ADDRESS;
- @HotSpotVMConstant(name = "CodeInstaller::CRC_TABLE_ADDRESS") @Stable public int MARKID_CRC_TABLE_ADDRESS;
- @HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int MARKID_INVOKE_INVALID;
-
- @HotSpotVMConstant(name = "BitData::exception_seen_flag") @Stable public int bitDataExceptionSeenFlag;
- @HotSpotVMConstant(name = "BitData::null_seen_flag") @Stable public int bitDataNullSeenFlag;
- @HotSpotVMConstant(name = "CounterData::count_off") @Stable public int methodDataCountOffset;
- @HotSpotVMConstant(name = "JumpData::taken_off_set") @Stable public int jumpDataTakenOffset;
- @HotSpotVMConstant(name = "JumpData::displacement_off_set") @Stable public int jumpDataDisplacementOffset;
- @HotSpotVMConstant(name = "ReceiverTypeData::nonprofiled_count_off_set") @Stable public int receiverTypeDataNonprofiledCountOffset;
- @HotSpotVMConstant(name = "ReceiverTypeData::receiver_type_row_cell_count") @Stable public int receiverTypeDataReceiverTypeRowCellCount;
- @HotSpotVMConstant(name = "ReceiverTypeData::receiver0_offset") @Stable public int receiverTypeDataReceiver0Offset;
- @HotSpotVMConstant(name = "ReceiverTypeData::count0_offset") @Stable public int receiverTypeDataCount0Offset;
- @HotSpotVMConstant(name = "BranchData::not_taken_off_set") @Stable public int branchDataNotTakenOffset;
- @HotSpotVMConstant(name = "ArrayData::array_len_off_set") @Stable public int arrayDataArrayLenOffset;
- @HotSpotVMConstant(name = "ArrayData::array_start_off_set") @Stable public int arrayDataArrayStartOffset;
- @HotSpotVMConstant(name = "MultiBranchData::per_case_cell_count") @Stable public int multiBranchDataPerCaseCellCount;
-
- // Checkstyle: resume
-
- private boolean check() {
- for (Field f : getClass().getDeclaredFields()) {
- int modifiers = f.getModifiers();
- if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
- assert Modifier.isFinal(modifiers) || f.getAnnotation(Stable.class) != null : "field should either be final or @Stable: " + f;
- }
- }
-
- assert codeEntryAlignment > 0 : codeEntryAlignment;
- assert (layoutHelperArrayTagObjectValue & (1 << (Integer.SIZE - 1))) != 0 : "object array must have first bit set";
- assert (layoutHelperArrayTagTypeValue & (1 << (Integer.SIZE - 1))) != 0 : "type array must have first bit set";
-
- return true;
- }
-
- /**
- * A compact representation of the different encoding strategies for Objects and metadata.
- */
- public static class CompressEncoding {
- public final long base;
- public final int shift;
- public final int alignment;
-
- CompressEncoding(long base, int shift, int alignment) {
- this.base = base;
- this.shift = shift;
- this.alignment = alignment;
- }
-
- public int compress(long ptr) {
- if (ptr == 0L) {
- return 0;
- } else {
- return (int) ((ptr - base) >>> shift);
- }
- }
-
- public long uncompress(int ptr) {
- if (ptr == 0) {
- return 0L;
- } else {
- return ((ptr & 0xFFFFFFFFL) << shift) + base;
- }
- }
-
- @Override
- public String toString() {
- return "base: " + base + " shift: " + shift + " alignment: " + alignment;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + alignment;
- result = prime * result + (int) (base ^ (base >>> 32));
- result = prime * result + shift;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof CompressEncoding) {
- CompressEncoding other = (CompressEncoding) obj;
- return alignment == other.alignment && base == other.base && shift == other.shift;
- } else {
- return false;
- }
- }
- }
-
+ final int bitDataExceptionSeenFlag = getConstant("BitData::exception_seen_flag", Integer.class);
+ final int bitDataNullSeenFlag = getConstant("BitData::null_seen_flag", Integer.class);
+ final int methodDataCountOffset = getConstant("CounterData::count_off", Integer.class);
+ final int jumpDataTakenOffset = getConstant("JumpData::taken_off_set", Integer.class);
+ final int jumpDataDisplacementOffset = getConstant("JumpData::displacement_off_set", Integer.class);
+ final int receiverTypeDataNonprofiledCountOffset = getConstant("ReceiverTypeData::nonprofiled_count_off_set", Integer.class);
+ final int receiverTypeDataReceiverTypeRowCellCount = getConstant("ReceiverTypeData::receiver_type_row_cell_count", Integer.class);
+ final int receiverTypeDataReceiver0Offset = getConstant("ReceiverTypeData::receiver0_offset", Integer.class);
+ final int receiverTypeDataCount0Offset = getConstant("ReceiverTypeData::count0_offset", Integer.class);
+ final int branchDataNotTakenOffset = getConstant("BranchData::not_taken_off_set", Integer.class);
+ final int arrayDataArrayLenOffset = getConstant("ArrayData::array_len_off_set", Integer.class);
+ final int arrayDataArrayStartOffset = getConstant("ArrayData::array_start_off_set", Integer.class);
+ final int multiBranchDataPerCaseCellCount = getConstant("MultiBranchData::per_case_cell_count", Integer.class);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,327 @@
+/*
+ * 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.hotspot;
+
+import jdk.vm.ci.common.JVMCIError;
+
+/**
+ * Access to VM configuration data.
+ */
+public class HotSpotVMConfigAccess {
+
+ /**
+ * Gets the address of a C++ symbol.
+ *
+ * @param name name of C++ symbol
+ * @param notPresent if non-null and the symbol is not present then this value is returned
+ * @return the address of the symbol
+ * @throws JVMCIError if the symbol is not present and {@code notPresent == null}
+ */
+ public long getAddress(String name, Long notPresent) {
+ Long entry = store.vmAddresses.get(name);
+ if (entry == null) {
+ if (notPresent != null) {
+ return notPresent;
+ }
+ throw new JVMCIError("expected VM symbol not found: " + name);
+ }
+ return entry;
+ }
+
+ /**
+ * Gets the address of a C++ symbol.
+ *
+ * @param name name of C++ symbol
+ * @return the address of the symbol
+ * @throws JVMCIError if the symbol is not present
+ */
+ public long getAddress(String name) {
+ return getAddress(name, null);
+ }
+
+ /**
+ * Gets the size of a C++ type.
+ *
+ * @param name name of the type
+ * @return the size in bytes of the requested field
+ * @throws JVMCIError if the field is not present and {@code notPresent} is null
+ */
+ public int getTypeSize(String name) {
+ Long entry = store.vmTypeSizes.get(name);
+ if (entry == null) {
+ throw new JVMCIError("expected VM type not found: " + name);
+ }
+ return (int) (long) entry;
+ }
+
+ /**
+ * Gets the value of a C++ constant.
+ *
+ * @param name name of the constant (e.g., {@code "frame::arg_reg_save_area_bytes"})
+ * @param type the boxed type to which the constant value will be converted
+ * @param notPresent if non-null and the constant is not present then this value is returned
+ * @return the constant value converted to {@code type}
+ * @throws JVMCIError if the constant is not present and {@code notPresent == null}
+ */
+ public <T> T getConstant(String name, Class<T> type, T notPresent) {
+ Long c = store.vmConstants.get(name);
+ if (c == null) {
+ if (notPresent != null) {
+ return notPresent;
+ }
+ throw new JVMCIError("expected VM constant not found: " + name);
+ }
+ return type.cast(convertValue(name, type, c, null));
+ }
+
+ /**
+ * Gets the value of a C++ constant.
+ *
+ * @param name name of the constant (e.g., {@code "frame::arg_reg_save_area_bytes"})
+ * @param type the boxed type to which the constant value will be converted
+ * @return the constant value converted to {@code type}
+ * @throws JVMCIError if the constant is not present
+ */
+ public <T> T getConstant(String name, Class<T> type) {
+ return getConstant(name, type, null);
+ }
+
+ /**
+ * Gets the offset of a non-static C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param type the boxed type to which the offset value will be converted (must be
+ * {@link Integer} or {@link Long})
+ * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"})
+ * @param notPresent if non-null and the field is not present then this value is returned
+ * @return the offset in bytes of the requested field
+ * @throws JVMCIError if the field is static or not present and {@code notPresent} is null
+ */
+ public <T> T getFieldOffset(String name, Class<T> type, String cppType, T notPresent) {
+ assert type == Integer.class || type == Long.class;
+ VMField entry = getField(name, cppType, notPresent == null);
+ if (entry == null) {
+ return notPresent;
+ }
+ if (entry.address != 0) {
+ throw new JVMCIError("cannot get offset of static field " + name);
+ }
+ return type.cast(convertValue(name, type, entry.offset, cppType));
+ }
+
+ /**
+ * Gets the offset of a non-static C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param type the boxed type to which the offset value will be converted (must be
+ * {@link Integer} or {@link Long})
+ * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"})
+ * @return the offset in bytes of the requested field
+ * @throws JVMCIError if the field is static or not present
+ */
+ public <T> T getFieldOffset(String name, Class<T> type, String cppType) {
+ return getFieldOffset(name, type, cppType, null);
+ }
+
+ /**
+ * Gets the offset of a non-static C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param type the boxed type to which the offset value will be converted (must be
+ * {@link Integer} or {@link Long})
+ * @return the offset in bytes of the requested field
+ * @throws JVMCIError if the field is static or not present
+ */
+ public <T> T getFieldOffset(String name, Class<T> type) {
+ return getFieldOffset(name, type, null, null);
+ }
+
+ /**
+ * Gets the address of a static C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"})
+ * @param notPresent if non-null and the field is not present then this value is returned
+ * @return the address of the requested field
+ * @throws JVMCIError if the field is not static or not present and {@code notPresent} is null
+ */
+ public long getFieldAddress(String name, String cppType, Long notPresent) {
+ VMField entry = getField(name, cppType, notPresent == null);
+ if (entry == null) {
+ return notPresent;
+ }
+ if (entry.address == 0) {
+ throw new JVMCIError(name + " is not a static field");
+ }
+ return entry.address;
+ }
+
+ /**
+ * Gets the address of a static C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"})
+ * @return the address of the requested field
+ * @throws JVMCIError if the field is not static or not present
+ */
+ public long getFieldAddress(String name, String cppType) {
+ return getFieldAddress(name, cppType, null);
+ }
+
+ /**
+ * Gets the value of a static C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param type the boxed type to which the constant value will be converted
+ * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"})
+ * @param notPresent if non-null and the field is not present then this value is returned
+ * @return the value of the requested field
+ * @throws JVMCIError if the field is not static or not present and {@code notPresent} is null
+ */
+ public <T> T getFieldValue(String name, Class<T> type, String cppType, T notPresent) {
+ VMField entry = getField(name, cppType, notPresent == null);
+ if (entry == null) {
+ return notPresent;
+ }
+ if (entry.value == null) {
+ throw new JVMCIError(name + " is not a static field");
+ }
+ return type.cast(convertValue(name, type, entry.value, cppType));
+ }
+
+ /**
+ * Gets the value of a static C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param type the boxed type to which the constant value will be converted
+ * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"})
+ * @return the value of the requested field
+ * @throws JVMCIError if the field is not static or not present
+ */
+ public <T> T getFieldValue(String name, Class<T> type, String cppType) {
+ return getFieldValue(name, type, cppType, null);
+ }
+
+ /**
+ * Gets the value of a static C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param type the boxed type to which the constant value will be converted
+ * @return the value of the requested field
+ * @throws JVMCIError if the field is not static or not present
+ */
+ public <T> T getFieldValue(String name, Class<T> type) {
+ return getFieldValue(name, type, null, null);
+ }
+
+ /**
+ * Gets a C++ field.
+ *
+ * @param name fully qualified name of the field
+ * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"})
+ * @param required specifies if the field must be present
+ * @return the field
+ * @throws JVMCIError if the field is not present and {@code required == true}
+ */
+ private VMField getField(String name, String cppType, boolean required) {
+ VMField entry = store.vmFields.get(name);
+ if (entry == null) {
+ if (!required) {
+ return null;
+ }
+ throw new JVMCIError("expected VM field not found: " + name);
+ }
+
+ // Make sure the native type is still the type we expect.
+ if (cppType != null && !cppType.equals(entry.type)) {
+ throw new JVMCIError("expected type " + cppType + " but VM field " + name + " is of type " + entry.type);
+ }
+ return entry;
+ }
+
+ /**
+ * Gets a VM flag value.
+ *
+ * @param name name of the flag (e.g., {@code "CompileTheWorldStartAt"})
+ * @param type the boxed type to which the flag's value will be converted
+ * @return the flag's value converted to {@code type} or {@code notPresent} if the flag is not
+ * present
+ * @throws JVMCIError if the flag is not present
+ */
+ public <T> T getFlag(String name, Class<T> type) {
+ return getFlag(name, type, null);
+ }
+
+ /**
+ * Gets a VM flag value.
+ *
+ * @param name name of the flag (e.g., {@code "CompileTheWorldStartAt"})
+ * @param type the boxed type to which the flag's value will be converted
+ * @param notPresent if non-null and the flag is not present then this value is returned
+ * @return the flag's value converted to {@code type} or {@code notPresent} if the flag is not
+ * present
+ * @throws JVMCIError if the flag is not present and {@code notPresent == null}
+ */
+ public <T> T getFlag(String name, Class<T> type, T notPresent) {
+ VMFlag entry = store.vmFlags.get(name);
+ if (entry == null) {
+ if (notPresent != null) {
+ return notPresent;
+ }
+ throw new JVMCIError("expected VM flag not found: " + name);
+ }
+ return type.cast(convertValue(name, type, entry.value, entry.type));
+ }
+
+ private static <T> Object convertValue(String name, Class<T> toType, Object value, String cppType) throws JVMCIError {
+ if (toType == Boolean.class) {
+ if (value instanceof String) {
+ return Boolean.valueOf((String) value);
+ } else if (value instanceof Boolean) {
+ return value;
+ } else if (value instanceof Long) {
+ return ((long) value) != 0;
+ }
+ } else if (toType == Byte.class) {
+ if (value instanceof Long) {
+ return (byte) (long) value;
+ }
+ } else if (toType == Integer.class) {
+ if (value instanceof Integer) {
+ return value;
+ } else if (value instanceof Long) {
+ return (int) (long) value;
+ }
+ } else if (toType == Long.class) {
+ return value;
+ }
+
+ throw new JVMCIError("cannot convert " + name + " of type " + value.getClass().getSimpleName() + (cppType == null ? "" : " [" + cppType + "]") + " to " + toType.getSimpleName());
+ }
+
+ private final HotSpotVMConfigStore store;
+
+ public HotSpotVMConfigAccess(HotSpotVMConfigStore store) {
+ this.store = store;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigStore.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,153 @@
+/*
+ * 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.hotspot;
+
+import static jdk.vm.ci.common.InitTimer.timer;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import jdk.vm.ci.common.InitTimer;
+
+/**
+ * Access to VM configuration data.
+ */
+public final class HotSpotVMConfigStore {
+
+ /**
+ * Gets the C++ symbols whose addresses are exposed by this object.
+ *
+ * @return an unmodifiable map from the symbol names to their addresses
+ */
+ public Map<String, Long> getAddresses() {
+ return Collections.unmodifiableMap(vmAddresses);
+ }
+
+ /**
+ * Gets the C++ type sizes exposed by this object.
+ *
+ * @return an unmodifiable map from C++ type names to their sizes in bytes
+ */
+ public Map<String, Long> getTypeSizes() {
+ return Collections.unmodifiableMap(vmTypeSizes);
+ }
+
+ /**
+ * Gets the C++ constants exposed by this object.
+ *
+ * @return an unmodifiable map from the names of C++ constants to their values
+ */
+ public Map<String, Long> getConstants() {
+ return Collections.unmodifiableMap(vmConstants);
+ }
+
+ /**
+ * Gets the VM flags exposed by this object.
+ *
+ * @return an unmodifiable map from VM flag names to {@link VMFlag} objects
+ */
+ public Map<String, VMFlag> getFlags() {
+ return Collections.unmodifiableMap(vmFlags);
+ }
+
+ /**
+ * Gets the C++ fields exposed by this object.
+ *
+ * @return an unmodifiable map from VM field names to {@link VMField} objects
+ */
+ public Map<String, VMField> getFields() {
+ return Collections.unmodifiableMap(vmFields);
+ }
+
+ final HashMap<String, VMField> vmFields;
+ final HashMap<String, Long> vmTypeSizes;
+ final HashMap<String, Long> vmConstants;
+ final HashMap<String, Long> vmAddresses;
+ final HashMap<String, VMFlag> vmFlags;
+
+ /**
+ * Reads the database of VM info. The return value encodes the info in a nested object array
+ * that is described by the pseudo Java object {@code info} below:
+ *
+ * <pre>
+ * info = [
+ * VMField[] vmFields,
+ * [String name, Long size, ...] vmTypeSizes,
+ * [String name, Long value, ...] vmConstants,
+ * [String name, Long value, ...] vmAddresses,
+ * VMFlag[] vmFlags
+ * ]
+ * </pre>
+ */
+ @SuppressWarnings("try")
+ HotSpotVMConfigStore(CompilerToVM compilerToVm) {
+ Object[] data;
+ try (InitTimer t = timer("CompilerToVm readConfiguration")) {
+ data = compilerToVm.readConfiguration();
+ }
+ assert data.length == 5 : data.length;
+
+ // @formatter:off
+ VMField[] vmFieldsInfo = (VMField[]) data[0];
+ Object[] vmTypesSizesInfo = (Object[]) data[1];
+ Object[] vmConstantsInfo = (Object[]) data[2];
+ Object[] vmAddressesInfo = (Object[]) data[3];
+ VMFlag[] vmFlagsInfo = (VMFlag[]) data[4];
+
+ vmFields = new HashMap<>(vmFieldsInfo.length);
+ vmTypeSizes = new HashMap<>(vmTypesSizesInfo.length);
+ vmConstants = new HashMap<>(vmConstantsInfo.length);
+ vmAddresses = new HashMap<>(vmAddressesInfo.length);
+ vmFlags = new HashMap<>(vmFlagsInfo.length);
+ // @formatter:on
+
+ try (InitTimer t = timer("HotSpotVMConfigStore<init> fill maps")) {
+ for (VMField vmField : vmFieldsInfo) {
+ vmFields.put(vmField.name, vmField);
+ }
+
+ for (int i = 0; i < vmTypesSizesInfo.length / 2; i++) {
+ String name = (String) vmTypesSizesInfo[i * 2];
+ Long size = (Long) vmTypesSizesInfo[i * 2 + 1];
+ vmTypeSizes.put(name, size);
+ }
+
+ for (int i = 0; i < vmConstantsInfo.length / 2; i++) {
+ String name = (String) vmConstantsInfo[i * 2];
+ Long value = (Long) vmConstantsInfo[i * 2 + 1];
+ vmConstants.put(name, value);
+ }
+
+ for (int i = 0; i < vmAddressesInfo.length / 2; i++) {
+ String name = (String) vmAddressesInfo[i * 2];
+ Long value = (Long) vmAddressesInfo[i * 2 + 1];
+ vmAddresses.put(name, value);
+ }
+
+ for (VMFlag vmFlag : vmFlagsInfo) {
+ vmFlags.put(vmFlag.name, vmFlag);
+ }
+ }
+ }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigVerifier.java Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * 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.
- */
-package jdk.vm.ci.hotspot;
-
-import static java.lang.String.format;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Executable;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.Objects;
-
-import jdk.vm.ci.common.JVMCIError;
-import jdk.internal.org.objectweb.asm.ClassReader;
-import jdk.internal.org.objectweb.asm.ClassVisitor;
-import jdk.internal.org.objectweb.asm.Label;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
-import jdk.internal.org.objectweb.asm.Opcodes;
-import jdk.internal.org.objectweb.asm.Type;
-import jdk.internal.misc.Unsafe;
-
-/**
- * A {@link ClassVisitor} that verifies {@link HotSpotVMConfig} does not access {@link Unsafe} from
- * any of its non-static, non-constructor methods. This ensures that a deserialized
- * {@link HotSpotVMConfig} object does not perform any unsafe reads on addresses that are only valid
- * in the context in which the object was serialized. Note that this does not catch cases where a
- * client uses an address stored in a {@link HotSpotVMConfig} field.
- */
-final class HotSpotVMConfigVerifier extends ClassVisitor {
-
- public static boolean check() {
- Class<?> cls = HotSpotVMConfig.class;
- String classFilePath = "/" + cls.getName().replace('.', '/') + ".class";
- try {
- InputStream classfile = cls.getResourceAsStream(classFilePath);
- ClassReader cr = new ClassReader(Objects.requireNonNull(classfile, "Could not find class file for " + cls.getName()));
- ClassVisitor cv = new HotSpotVMConfigVerifier();
- cr.accept(cv, 0);
- return true;
- } catch (IOException e) {
- throw new JVMCIError(e);
- }
- }
-
- /**
- * Source file context for error reporting.
- */
- String sourceFile = null;
-
- /**
- * Line number for error reporting.
- */
- int lineNo = -1;
-
- private static Class<?> resolve(String name) {
- try {
- return Class.forName(name.replace('/', '.'));
- } catch (ClassNotFoundException e) {
- throw new JVMCIError(e);
- }
- }
-
- HotSpotVMConfigVerifier() {
- super(Opcodes.ASM5);
- }
-
- @Override
- public void visitSource(String source, String debug) {
- this.sourceFile = source;
- }
-
- void verify(boolean condition, String message) {
- if (!condition) {
- error(message);
- }
- }
-
- void error(String message) {
- String errorMessage = format("%s:%d: %s is not allowed in the context of compilation replay. The unsafe access should be moved into the %s constructor and the result cached in a field",
- sourceFile, lineNo, message, HotSpotVMConfig.class.getSimpleName());
- throw new JVMCIError(errorMessage);
-
- }
-
- @Override
- public MethodVisitor visitMethod(int access, String name, String d, String signature, String[] exceptions) {
- if (!Modifier.isStatic(access) && Modifier.isPublic(access) && !name.equals("<init>")) {
- return new MethodVisitor(Opcodes.ASM5) {
-
- @Override
- public void visitLineNumber(int line, Label start) {
- lineNo = line;
- }
-
- private Executable resolveMethod(String owner, String methodName, String methodDesc) {
- Class<?> declaringClass = resolve(owner);
- while (declaringClass != null) {
- if (methodName.equals("<init>")) {
- for (Constructor<?> c : declaringClass.getDeclaredConstructors()) {
- if (methodDesc.equals(Type.getConstructorDescriptor(c))) {
- return c;
- }
- }
- } else {
- Type[] argumentTypes = Type.getArgumentTypes(methodDesc);
- for (Method m : declaringClass.getDeclaredMethods()) {
- if (m.getName().equals(methodName)) {
- if (Arrays.equals(argumentTypes, Type.getArgumentTypes(m))) {
- if (Type.getReturnType(methodDesc).equals(Type.getReturnType(m))) {
- return m;
- }
- }
- }
- }
- }
- declaringClass = declaringClass.getSuperclass();
- }
- throw new NoSuchMethodError(owner + "." + methodName + methodDesc);
- }
-
- /**
- * Checks whether a given method is allowed to be called.
- */
- private boolean checkInvokeTarget(Executable method) {
- if (method.getDeclaringClass().equals(Unsafe.class)) {
- return false;
- }
- return true;
- }
-
- @Override
- public void visitMethodInsn(int opcode, String owner, String methodName, String methodDesc, boolean itf) {
- Executable callee = resolveMethod(owner, methodName, methodDesc);
- verify(checkInvokeTarget(callee), "invocation of " + callee);
- }
- };
- } else {
- return null;
- }
- }
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVmSymbols.java Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.hotspot;
-
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
-import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import jdk.internal.misc.Unsafe;
-
-/**
- * Class to access the C++ {@code vmSymbols} table.
- */
-final class HotSpotVmSymbols {
-
- /**
- * Returns the symbol in the {@code vmSymbols} table at position {@code index} as {@link String}
- * .
- *
- * @param index position in the symbol table
- * @return the symbol at position id
- */
- static String symbolAt(int index) {
- HotSpotJVMCIRuntimeProvider runtime = runtime();
- HotSpotVMConfig config = runtime.getConfig();
- assert config.vmSymbolsFirstSID <= index && index < config.vmSymbolsSIDLimit : "index " + index + " is out of bounds";
- assert config.symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken";
- return runtime.getCompilerToVM().getSymbol(UNSAFE.getAddress(config.vmSymbolsSymbols + index * config.symbolPointerSize));
- }
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,7 +23,8 @@
package jdk.vm.ci.hotspot;
/**
- * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object.
+ * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object that
+ * requires GC interaction to keep alive.
*
* It would preferable if this were the base class containing the pointer but that would require
* mixins since most of the wrapper types have complex supertype hierarchies.
@@ -31,4 +32,18 @@
interface MetaspaceWrapperObject {
long getMetaspacePointer();
+
+ /**
+ * Check if this object is properly registered for metadata tracking. All classes which
+ * implement this interface must be registered with the
+ * {@link HotSpotJVMCIMetaAccessContext#add} unless they are kept alive through other means.
+ * Currently the only type which doesn't require explicit registration is
+ * {@link HotSpotResolvedObjectTypeImpl} since it's kept alive by references to the
+ * {@link Class}.
+ *
+ * @return true if this object is properly registered for meta data tracking.
+ */
+ default boolean isRegistered() {
+ return HotSpotJVMCIRuntime.runtime().metaAccessContext.isRegistered(this);
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/VMField.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,92 @@
+/*
+ * 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.hotspot;
+
+/**
+ * Describes a C++ field exposed via {@link HotSpotVMConfigAccess}.
+ */
+public final class VMField {
+
+ /**
+ * Fully qualified name of the represented field (e.g., "Klass::_name").
+ */
+ public final String name;
+
+ /**
+ * The represented field's type (e.g., "Symbol*"). This may be {@code null}.
+ */
+ public final String type;
+
+ /**
+ * If represented field is non-static, this is its offset within the containing structure.
+ */
+ public final long offset;
+
+ /**
+ * If represented field is static, this is its address. Otherwise, this field is 0.
+ */
+ public final long address;
+
+ /**
+ * Value of the field represented as a boxed long; only valid for non-oop static fields. This
+ * value is only captured once, during JVMCI initialization. If {@link #type} cannot be
+ * meaningfully (e.g., a struct) or safely (e.g., an oop) expressed as a boxed long, this is
+ * {@code null}.
+ */
+ public final Long value;
+
+ /**
+ * Determines if the represented field is static.
+ */
+ public boolean isStatic() {
+ return address != 0;
+ }
+
+ /**
+ * Creates a description of a non-static field.
+ */
+ public VMField(String name, String type, long offset) {
+ this.name = name;
+ this.type = type;
+ this.offset = offset;
+ this.address = 0;
+ this.value = null;
+ }
+
+ /**
+ * Creates a description of a static field.
+ */
+ public VMField(String name, String type, long address, Long value) {
+ this.name = name;
+ this.type = type;
+ this.offset = 0;
+ this.address = address;
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ String val = value == null ? "null" : String.format("0x%x", value);
+ return String.format("Field[name=%s, type=%s, offset=%d, address=0x%x, value=%s]", name, type, offset, address, val);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/VMFlag.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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.hotspot;
+
+/**
+ * Describes a VM flag exposed via {@link HotSpotVMConfigAccess}.
+ */
+public final class VMFlag {
+
+ /**
+ * The name of the flag.
+ */
+ public final String name;
+
+ /**
+ * The C++ type of the flag.
+ */
+ public final String type;
+
+ /**
+ * The flag's value.
+ */
+ public final Object value;
+
+ VMFlag(String name, String type, Object value) {
+ this.name = name;
+ this.type = type;
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("Flag[type=%s, name=%s, value=%s]", type, name, value);
+ }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,6 @@
*/
package jdk.vm.ci.hotspot.services;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.runtime.services.JVMCICompilerFactory;
/**
@@ -42,35 +41,54 @@
return null;
}
+ public enum CompilationLevelAdjustment {
+ /**
+ * No adjustment.
+ */
+ None,
+
+ /**
+ * Adjust based on declaring class of method.
+ */
+ ByHolder,
+
+ /**
+ * Adjust based on declaring class, name and signature of method.
+ */
+ ByFullSignature
+ }
+
/**
* Determines if this object may want to adjust the compilation level for a method that is being
- * scheduled by the VM for compilation. The legal return values and their meanings are:
- * <ul>
- * <li>0 - no adjustment</li>
- * <li>1 - adjust based on declaring class of method</li>
- * <li>2 - adjust based on declaring class, name and signature of method</li>
- * </ul>
+ * scheduled by the VM for compilation.
*/
- public int getCompilationLevelAdjustment(HotSpotVMConfig config) {
- return config.compLevelAdjustmentNone;
+ public CompilationLevelAdjustment getCompilationLevelAdjustment() {
+ return CompilationLevelAdjustment.None;
+ }
+
+ public enum CompilationLevel {
+ None,
+ Simple,
+ LimitedProfile,
+ FullProfile,
+ FullOptimization
}
/**
* Potentially modifies the compilation level currently selected by the VM compilation policy
* for a method.
*
- * @param config object for reading HotSpot {@code CompLevel} enum values
* @param declaringClass the class in which the method is declared
* @param name the name of the method or {@code null} depending on the value that was returned
- * by {@link #getCompilationLevelAdjustment(HotSpotVMConfig)}
+ * by {@link #getCompilationLevelAdjustment()}
* @param signature the signature of the method or {@code null} depending on the value that was
- * returned by {@link #getCompilationLevelAdjustment(HotSpotVMConfig)}
+ * returned by {@link #getCompilationLevelAdjustment()}
* @param isOsr specifies if the compilation being scheduled in an OSR compilation
* @param level the compilation level currently selected by the VM compilation policy
* @return the compilation level to use for the compilation being scheduled (must be a valid
* {@code CompLevel} enum value)
*/
- public int adjustCompilationLevel(HotSpotVMConfig config, Class<?> declaringClass, String name, String signature, boolean isOsr, int level) {
+ public CompilationLevel adjustCompilationLevel(Class<?> declaringClass, String name, String signature, boolean isOsr, CompilationLevel level) {
throw new InternalError("Should not reach here");
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMAddress.java Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +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.
- */
-package jdk.vm.ci.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a C++ address in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMAddress {
-
- /**
- * Returns the name of the symbol this address is referring to.
- *
- * @return name of symbol of this address
- */
- String name();
-
- /**
- * List of architectures where this constant is required. Names are derived from
- * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
- * required on all architectures.
- */
- @SuppressWarnings("javadoc")
- String[] archs() default {};
-
- /**
- * List of operating systems where this constant is required. Names are derived from
- * {@link HotSpotVMConfig#getHostOSName()}. An empty list implies that the constant is required
- * on all operating systems.
- */
- @SuppressWarnings("javadoc")
- String[] os() default {};
-
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMConstant.java Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package jdk.vm.ci.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a C++ constant in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMConstant {
-
- /**
- * Returns the name of the constant.
- *
- * @return name of constant
- */
- String name();
-
- /**
- * List of architectures where this constant is required. Names are derived from
- * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
- * required on all architectures.
- */
- @SuppressWarnings("javadoc")
- String[] archs() default {};
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMData.java Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +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.
- */
-package jdk.vm.ci.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a entry in {@code gHotSpotVMData}.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMData {
-
- /**
- * Returns the array index of this field.
- *
- * @return array index of field
- */
- int index();
-
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMField.java Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-package jdk.vm.ci.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a C++ field in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMField {
-
- /**
- * Types of information this annotation can return.
- */
- enum Type {
- /**
- * Returns the offset of this field within the type. Only valid for instance fields.
- */
- OFFSET,
-
- /**
- * Returns the absolute address of this field. Only valid for static fields.
- */
- ADDRESS,
-
- /**
- * Returns the value of this field. Only valid for static fields.
- */
- VALUE;
- }
-
- /**
- * Specifies what type of information to return.
- *
- * @see Type
- */
- Type get();
-
- /**
- * Returns the type name containing this field.
- *
- * @return name of containing type
- */
- String type();
-
- /**
- * Returns the name of this field.
- *
- * @return name of field
- */
- String name();
-
- /**
- * List of architectures where this constant is required. Names are derived from
- * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
- * required on all architectures.
- */
- @SuppressWarnings("javadoc")
- String[] archs() default {};
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMFlag.java Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-package jdk.vm.ci.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a C++ flag in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMFlag {
-
- /**
- * Returns the name of this flag.
- *
- * @return name of flag.
- */
- String name();
-
- /**
- * List of architectures where this constant is required. Names are derived from
- * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
- * required on all architectures.
- */
- @SuppressWarnings("javadoc")
- String[] archs() default {};
-
- boolean optional() default false;
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMType.java Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-package jdk.vm.ci.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a C++ type in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMType {
-
- /**
- * Types of information this annotation can return.
- */
- enum Type {
- /**
- * Returns the size of the type (C++ {@code sizeof()}).
- */
- SIZE;
- }
-
- /**
- * Specifies what type of information to return.
- *
- * @see Type
- */
- Type get();
-
- /**
- * Returns the name of the type.
- *
- * @return name of type
- */
- String name();
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/AbstractJavaProfile.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/AbstractJavaProfile.java Fri Jul 01 16:50:34 2016 -0700
@@ -37,6 +37,12 @@
private final double notRecordedProbability;
private final T[] pitems;
+ /**
+ *
+ * @param notRecordedProbability
+ * @param pitems
+ */
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of the `pitems` array parameter")
public AbstractJavaProfile(double notRecordedProbability, T[] pitems) {
this.pitems = pitems;
assert !Double.isNaN(notRecordedProbability);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/AbstractProfiledItem.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/AbstractProfiledItem.java Fri Jul 01 16:50:34 2016 -0700
@@ -51,14 +51,14 @@
return probability;
}
+ /**
+ * Returns -1 if the {@linkplain #getProbability() probability} of this item is greater than
+ * {@code o}'s probability, 0 if there are equal otherwise 1.
+ */
@Override
public int compareTo(AbstractProfiledItem<?> o) {
- if (getProbability() > o.getProbability()) {
- return -1;
- } else if (getProbability() < o.getProbability()) {
- return 1;
- }
- return 0;
+ // Need to swap the order of operands so that higher probabilities are sorted first
+ return Double.compare(o.getProbability(), getProbability());
}
@Override
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantPool.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantPool.java Fri Jul 01 16:50:34 2016 -0700
@@ -48,16 +48,18 @@
/**
* Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks
- * specific to the bytecode it denotes are performed if the field is already resolved. Should
+ * specific to the bytecode it denotes are performed if the field is already resolved. Checks
+ * for some bytecodes require the method that contains the bytecode to be specified. Should
* any of these checks fail, an unresolved field reference is returned.
*
* @param cpi the constant pool index
* @param opcode the opcode of the instruction for which the lookup is being performed or
* {@code -1}
+ * @param method the method for which the lookup is being performed
* @return a reference to the field at {@code cpi} in this pool
* @throws ClassFormatError if the entry at {@code cpi} is not a field
*/
- JavaField lookupField(int cpi, int opcode);
+ JavaField lookupField(int cpi, ResolvedJavaMethod method, int opcode);
/**
* Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,24 +22,34 @@
*/
package jdk.vm.ci.meta;
+/**
+ * Maps bytecode indexes to source line numbers.
+ *
+ * @see "https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.12"
+ */
public class LineNumberTable {
private final int[] lineNumbers;
private final int[] bci;
+ /**
+ *
+ * @param lineNumbers an array or source line numbers. This array is now owned by this object
+ * and should not be mutated by the caller.
+ * @param bci an array of bytecode indexes the same length at {@code lineNumbers} whose entries
+ * are sorted in ascending order. This array is now owned by this object and must not
+ * be mutated by the caller.
+ */
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `lineNumbers` and `bcis`")
public LineNumberTable(int[] lineNumbers, int[] bci) {
+ assert bci.length == lineNumbers.length;
this.lineNumbers = lineNumbers;
this.bci = bci;
}
- public int[] getLineNumberEntries() {
- return lineNumbers;
- }
-
- public int[] getBciEntries() {
- return bci;
- }
-
+ /**
+ * Gets a source line number for {@code atBci}.
+ */
public int getLineNumber(int atBci) {
for (int i = 0; i < this.bci.length - 1; i++) {
if (this.bci[i] <= atBci && atBci < this.bci[i + 1]) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Local.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Local.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,6 +22,9 @@
*/
package jdk.vm.ci.meta;
+/**
+ * Describes the type and bytecode index range in which a local variable is live.
+ */
public class Local {
private final String name;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,10 +25,19 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * @see "https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.13"
+ */
public class LocalVariableTable {
private final Local[] locals;
+ /**
+ *
+ * @param locals array of objects describing local variables. This array is now owned by this
+ * object and must not be mutated by the caller.
+ */
+ @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `locals`")
public LocalVariableTable(Local[] locals) {
this.locals = locals;
}
@@ -47,10 +56,6 @@
return result;
}
- public Local[] getLocals() {
- return locals;
- }
-
public Local[] getLocalsAt(int bci) {
List<Local> result = new ArrayList<>();
for (Local l : locals) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SuppressFBWarnings.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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.meta;
+
+/**
+ * Used to suppress <a href="http://findbugs.sourceforge.net">FindBugs</a> warnings.
+ */
+@interface SuppressFBWarnings {
+ /**
+ * The set of FindBugs
+ * <a href="http://findbugs.sourceforge.net/bugDescriptions.html">warnings</a> that are to be
+ * suppressed in annotated element. The value can be a bug category, kind or pattern.
+ */
+ String[] value();
+
+ /**
+ * Reason why the warning is suppressed.
+ */
+ String justification();
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Value.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Value.java Fri Jul 01 16:50:34 2016 -0700
@@ -65,7 +65,7 @@
* {@link #toString()} implementation of subclasses.
*/
protected final String getKindSuffix() {
- return "|" + getPlatformKind().getTypeChar();
+ return "|" + valueKind.getKindSuffix();
}
public final ValueKind<?> getValueKind() {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ValueKind.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ValueKind.java Fri Jul 01 16:50:34 2016 -0700
@@ -60,6 +60,11 @@
public IllegalValueKind changeType(PlatformKind newPlatformKind) {
return this;
}
+
+ @Override
+ public String toString() {
+ return "ILLEGAL";
+ }
}
/**
@@ -82,4 +87,13 @@
* override this to preserve the additional information added by the compiler.
*/
public abstract K changeType(PlatformKind newPlatformKind);
+
+ /**
+ * Returns a String representation of the kind, which will be included at the end of
+ * {@link Value#toString()} implementation. Defaults to {@link #toString()} but can be
+ * overridden to provide something more specific.
+ */
+ public String getKindSuffix() {
+ return toString();
+ }
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,6 +32,7 @@
import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.Register.RegisterCategory;
+import jdk.vm.ci.code.RegisterArray;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.PlatformKind;
@@ -179,35 +180,35 @@
public static final Register q60 = new Register(111, getQuadncoding(60), "q60", FPUq);
// @formatter:off
- public static final Register[] cpuRegisters = {
+ public static final RegisterArray cpuRegisters = new RegisterArray(
g0, g1, g2, g3, g4, g5, g6, g7,
o0, o1, o2, o3, o4, o5, o6, o7,
l0, l1, l2, l3, l4, l5, l6, l7,
i0, i1, i2, i3, i4, i5, i6, i7
- };
+ );
- public static final Register[] fpusRegisters = {
+ public static final RegisterArray fpusRegisters = new RegisterArray(
f0, f1, f2, f3, f4, f5, f6, f7,
f8, f9, f10, f11, f12, f13, f14, f15,
f16, f17, f18, f19, f20, f21, f22, f23,
f24, f25, f26, f27, f28, f29, f30, f31
- };
+ );
- public static final Register[] fpudRegisters = {
+ public static final RegisterArray fpudRegisters = new RegisterArray(
d0, d2, d4, d6, d8, d10, d12, d14,
d16, d18, d20, d22, d24, d26, d28, d30,
d32, d34, d36, d38, d40, d42, d44, d46,
d48, d50, d52, d54, d56, d58, d60, d62
- };
+ );
- public static final Register[] fpuqRegisters = {
+ public static final RegisterArray fpuqRegisters = new RegisterArray(
q0, q4, q8, q12,
q16, q20, q24, q28,
q32, q36, q40, q44,
- q48, q52, q56, q60,
- };
+ q48, q52, q56, q60
+ );
- public static final Register[] allRegisters = {
+ public static final RegisterArray allRegisters = new RegisterArray(
g0, g1, g2, g3, g4, g5, g6, g7,
o0, o1, o2, o3, o4, o5, o6, o7,
l0, l1, l2, l3, l4, l5, l6, l7,
@@ -226,8 +227,8 @@
q0, q4, q8, q12,
q16, q20, q24, q28,
q32, q36, q40, q44,
- q48, q52, q56, q60,
- };
+ q48, q52, q56, q60
+ );
// @formatter:on
/**
@@ -248,7 +249,7 @@
}
@Override
- public Register[] getAvailableValueRegisters() {
+ public RegisterArray getAvailableValueRegisters() {
return allRegisters;
}
--- a/hotspot/src/os/aix/vm/os_aix.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -156,8 +156,6 @@
// SS - service pack, if known, 0 otherwise
uint32_t os::Aix::_os_version = 0;
-int os::Aix::_stack_page_size = -1;
-
// -1 = uninitialized, 0 - no, 1 - yes
int os::Aix::_xpg_sus_mode = -1;
@@ -1499,7 +1497,6 @@
g_multipage_support.error);
st->cr();
st->print_cr(" os::vm_page_size: %s", describe_pagesize(os::vm_page_size()));
- // not used in OpenJDK st->print_cr(" os::stack_page_size: %s", describe_pagesize(os::stack_page_size()));
// print out LDR_CNTRL because it affects the default page sizes
const char* const ldr_cntrl = ::getenv("LDR_CNTRL");
@@ -3451,10 +3448,6 @@
FLAG_SET_ERGO(bool, Use64KPages, true);
}
- // Short-wire stack page size to base page size; if that works, we just remove
- // that stack page size altogether.
- Aix::_stack_page_size = Aix::_page_size;
-
// For now UseLargePages is just ignored.
FLAG_SET_ERGO(bool, UseLargePages, false);
_page_sizes[0] = 0;
@@ -3589,15 +3582,15 @@
// Check minimum allowable stack size for thread creation and to initialize
// the java system classes, including StackOverflowError - depends on page
- // size. Add a page for compiler2 recursion in main thread.
- // Add in 2*BytesPerWord times page size to account for VM stack during
+ // size. Add two 4K pages for compiler2 recursion in main thread.
+ // Add in 4*BytesPerWord 4K pages to account for VM stack during
// class initialization depending on 32 or 64 bit VM.
os::Aix::min_stack_allowed = MAX2(os::Aix::min_stack_allowed,
JavaThread::stack_guard_zone_size() +
JavaThread::stack_shadow_zone_size() +
- (2*BytesPerWord COMPILER2_PRESENT(+1)) * Aix::vm_default_page_size());
-
- os::Aix::min_stack_allowed = align_size_up(os::Aix::min_stack_allowed, os::Aix::page_size());
+ (4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
+
+ os::Aix::min_stack_allowed = align_size_up(os::Aix::min_stack_allowed, os::vm_page_size());
size_t threadStackSizeInBytes = ThreadStackSize * K;
if (threadStackSizeInBytes != 0 &&
--- a/hotspot/src/os/aix/vm/os_aix.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/aix/vm/os_aix.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -49,9 +49,6 @@
static Mutex* _createThread_lock;
static int _page_size;
- // Page size of newly created pthreads.
- static int _stack_page_size;
-
// -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE)
static int _on_pase;
@@ -113,15 +110,6 @@
return _page_size;
}
- // Accessor methods for stack page size which may be different from usual page size.
- static int stack_page_size(void) {
- assert(_stack_page_size != -1, "not initialized");
- return _stack_page_size;
- }
-
- // This is used to scale stack space (guard pages etc.). The name is somehow misleading.
- static int vm_default_page_size(void ) { return 8*K; }
-
static address ucontext_get_pc(const ucontext_t* uc);
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
static intptr_t* ucontext_get_fp(const ucontext_t* uc);
--- a/hotspot/src/os/aix/vm/os_aix.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/aix/vm/os_aix.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -52,7 +52,7 @@
// Whether or not calling code should/can commit/uncommit stack pages
// before guarding them. Answer for AIX is definitly no, because memory
// is automatically committed on touch.
-inline bool os::allocate_stack_guard_pages() {
+inline bool os::must_commit_stack_guard_pages() {
assert(uses_stack_guard_pages(), "sanity check");
return false;
}
@@ -65,7 +65,7 @@
}
// Bang the shadow pages if they need to be touched to be mapped.
-inline void os::map_stack_shadow_pages() {
+inline void os::map_stack_shadow_pages(address sp) {
}
inline void os::dll_unload(void *lib) {
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -3491,13 +3491,15 @@
// Check minimum allowable stack size for thread creation and to initialize
// the java system classes, including StackOverflowError - depends on page
- // size. Add a page for compiler2 recursion in main thread.
- // Add in 2*BytesPerWord times page size to account for VM stack during
+ // size. Add two 4K pages for compiler2 recursion in main thread.
+ // Add in 4*BytesPerWord 4K pages to account for VM stack during
// class initialization depending on 32 or 64 bit VM.
os::Bsd::min_stack_allowed = MAX2(os::Bsd::min_stack_allowed,
JavaThread::stack_guard_zone_size() +
JavaThread::stack_shadow_zone_size() +
- (2*BytesPerWord COMPILER2_PRESENT(+1)) * Bsd::page_size());
+ (4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
+
+ os::Bsd::min_stack_allowed = align_size_up(os::Bsd::min_stack_allowed, os::vm_page_size());
size_t threadStackSizeInBytes = ThreadStackSize * K;
if (threadStackSizeInBytes != 0 &&
--- a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -47,7 +47,7 @@
return true;
}
-inline bool os::allocate_stack_guard_pages() {
+inline bool os::must_commit_stack_guard_pages() {
assert(uses_stack_guard_pages(), "sanity check");
#if !defined(__FreeBSD__) || __FreeBSD__ < 5
// Since FreeBSD 4 uses malloc() for allocating the thread stack
@@ -68,7 +68,7 @@
// Bang the shadow pages if they need to be touched to be mapped.
-inline void os::map_stack_shadow_pages() {
+inline void os::map_stack_shadow_pages(address sp) {
}
inline void os::dll_unload(void *lib) {
--- a/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -142,7 +142,6 @@
Mutex* os::Linux::_createThread_lock = NULL;
pthread_t os::Linux::_main_thread;
int os::Linux::_page_size = -1;
-const int os::Linux::_vm_default_page_size = (8 * K);
bool os::Linux::_supports_fast_thread_cpu_time = false;
uint32_t os::Linux::_os_version = 0;
const char * os::Linux::_glibc_version = NULL;
@@ -4784,13 +4783,15 @@
// Check minimum allowable stack size for thread creation and to initialize
// the java system classes, including StackOverflowError - depends on page
- // size. Add a page for compiler2 recursion in main thread.
- // Add in 2*BytesPerWord times page size to account for VM stack during
+ // size. Add two 4K pages for compiler2 recursion in main thread.
+ // Add in 4*BytesPerWord 4K pages to account for VM stack during
// class initialization depending on 32 or 64 bit VM.
os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed,
JavaThread::stack_guard_zone_size() +
JavaThread::stack_shadow_zone_size() +
- (2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::vm_default_page_size());
+ (4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
+
+ os::Linux::min_stack_allowed = align_size_up(os::Linux::min_stack_allowed, os::vm_page_size());
size_t threadStackSizeInBytes = ThreadStackSize * K;
if (threadStackSizeInBytes != 0 &&
--- a/hotspot/src/os/linux/vm/os_linux.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -71,7 +71,6 @@
static pthread_t _main_thread;
static Mutex* _createThread_lock;
static int _page_size;
- static const int _vm_default_page_size;
static julong available_memory();
static julong physical_memory() { return _physical_memory; }
@@ -130,8 +129,6 @@
static int page_size(void) { return _page_size; }
static void set_page_size(int val) { _page_size = val; }
- static int vm_default_page_size(void) { return _vm_default_page_size; }
-
static address ucontext_get_pc(const ucontext_t* uc);
static void ucontext_set_pc(ucontext_t* uc, address pc);
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
--- a/hotspot/src/os/linux/vm/os_linux.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -47,7 +47,7 @@
return true;
}
-inline bool os::allocate_stack_guard_pages() {
+inline bool os::must_commit_stack_guard_pages() {
assert(uses_stack_guard_pages(), "sanity check");
return true;
}
@@ -60,7 +60,7 @@
// Bang the shadow pages if they need to be touched to be mapped.
-inline void os::map_stack_shadow_pages() {
+inline void os::map_stack_shadow_pages(address sp) {
}
inline void os::dll_unload(void *lib) {
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -4477,13 +4477,15 @@
// Check minimum allowable stack size for thread creation and to initialize
// the java system classes, including StackOverflowError - depends on page
- // size. Add a page for compiler2 recursion in main thread.
- // Add in 2*BytesPerWord times page size to account for VM stack during
+ // size. Add two 4K pages for compiler2 recursion in main thread.
+ // Add in 4*BytesPerWord 4K pages to account for VM stack during
// class initialization depending on 32 or 64 bit VM.
os::Solaris::min_stack_allowed = MAX2(os::Solaris::min_stack_allowed,
JavaThread::stack_guard_zone_size() +
JavaThread::stack_shadow_zone_size() +
- (2*BytesPerWord COMPILER2_PRESENT(+1)) * page_size);
+ (4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
+
+ os::Solaris::min_stack_allowed = align_size_up(os::Solaris::min_stack_allowed, os::vm_page_size());
size_t threadStackSizeInBytes = ThreadStackSize * K;
if (threadStackSizeInBytes != 0 &&
--- a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -46,7 +46,7 @@
return true;
}
-inline bool os::allocate_stack_guard_pages() {
+inline bool os::must_commit_stack_guard_pages() {
assert(uses_stack_guard_pages(), "sanity check");
int r = thr_main() ;
guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
@@ -61,8 +61,9 @@
// Bang the shadow pages if they need to be touched to be mapped.
-inline void os::map_stack_shadow_pages() {
+inline void os::map_stack_shadow_pages(address sp) {
}
+
inline void os::dll_unload(void *lib) { ::dlclose(lib); }
inline const int os::default_file_open_flags() { return 0;}
--- a/hotspot/src/os/windows/vm/os_windows.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -4183,13 +4183,16 @@
// Check minimum allowable stack size for thread creation and to initialize
// the java system classes, including StackOverflowError - depends on page
- // size. Add a page for compiler2 recursion in main thread.
- // Add in 2*BytesPerWord times page size to account for VM stack during
+ // size. Add two 4K pages for compiler2 recursion in main thread.
+ // Add in 4*BytesPerWord 4K pages to account for VM stack during
// class initialization depending on 32 or 64 bit VM.
size_t min_stack_allowed =
- (size_t)(JavaThread::stack_yellow_zone_size() + JavaThread::stack_red_zone_size() +
+ (size_t)(JavaThread::stack_guard_zone_size() +
JavaThread::stack_shadow_zone_size() +
- (2*BytesPerWord COMPILER2_PRESENT(+1)) * os::vm_page_size());
+ (4*BytesPerWord COMPILER2_PRESENT(+2)) * 4 * K);
+
+ min_stack_allowed = align_size_up(min_stack_allowed, os::vm_page_size());
+
if (actual_reserve_size < min_stack_allowed) {
tty->print_cr("\nThe stack size specified is too small, "
"Specify at least %dk",
@@ -5247,6 +5250,12 @@
static int mallocDebugIntervalCounter = 0;
static int mallocDebugCounter = 0;
+
+// For debugging possible bugs inside HeapWalk (a ring buffer)
+#define SAVE_COUNT 8
+static PROCESS_HEAP_ENTRY saved_heap_entries[SAVE_COUNT];
+static int saved_heap_entry_index;
+
bool os::check_heap(bool force) {
if (++mallocDebugCounter < MallocVerifyStart && !force) return true;
if (++mallocDebugIntervalCounter >= MallocVerifyInterval || force) {
@@ -5267,13 +5276,28 @@
if (HeapLock(heap) != 0) {
PROCESS_HEAP_ENTRY phe;
phe.lpData = NULL;
+ memset(saved_heap_entries, 0, sizeof(saved_heap_entries));
+ saved_heap_entry_index = 0;
+ int count = 0;
+
while (HeapWalk(heap, &phe) != 0) {
+ count ++;
if ((phe.wFlags & PROCESS_HEAP_ENTRY_BUSY) &&
!HeapValidate(heap, 0, phe.lpData)) {
tty->print_cr("C heap has been corrupted (time: %d allocations)", mallocDebugCounter);
- tty->print_cr("corrupted block near address %#x, length %d", phe.lpData, phe.cbData);
+ tty->print_cr("corrupted block near address %#x, length %d, count %d", phe.lpData, phe.cbData, count);
HeapUnlock(heap);
fatal("corrupted C heap");
+ } else {
+ // Save previous seen entries in a ring buffer. We have seen strange
+ // heap corruption fatal errors that produced mdmp files, but when we load
+ // these mdmp files in WinDBG, "!heap -triage" shows no error.
+ // We can examine the saved_heap_entries[] array in the mdmp file to
+ // diagnose such seemingly spurious errors reported by HeapWalk.
+ saved_heap_entries[saved_heap_entry_index++] = phe;
+ if (saved_heap_entry_index >= SAVE_COUNT) {
+ saved_heap_entry_index = 0;
+ }
}
}
DWORD err = GetLastError();
--- a/hotspot/src/os/windows/vm/os_windows.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os/windows/vm/os_windows.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -53,7 +53,7 @@
return true;
}
-inline bool os::allocate_stack_guard_pages() {
+inline bool os::must_commit_stack_guard_pages() {
return true;
}
@@ -66,14 +66,16 @@
}
// Bang the shadow pages if they need to be touched to be mapped.
-inline void os::map_stack_shadow_pages() {
+inline void os::map_stack_shadow_pages(address sp) {
// Write to each page of our new frame to force OS mapping.
// If we decrement stack pointer more than one page
// the OS may not map an intervening page into our space
// and may fault on a memory access to interior of our frame.
- address sp = current_stack_pointer();
- for (size_t pages = 1; pages <= (JavaThread::stack_shadow_zone_size() / os::vm_page_size()); pages++) {
- *((int *)(sp - (pages * vm_page_size()))) = 0;
+ const int page_size = os::win32::vm_page_size();
+ const size_t n_pages = JavaThread::stack_shadow_zone_size() / page_size;
+ for (size_t pages = 1; pages <= n_pages; pages++) {
+ sp -= page_size;
+ *sp = 0;
}
}
--- a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -291,12 +291,30 @@
return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
}
+inline void cmpxchg_pre_membar(cmpxchg_memory_order order) {
+ if (order != memory_order_relaxed) {
+ __asm__ __volatile__ (
+ /* fence */
+ strasm_sync
+ );
+ }
+}
+
+inline void cmpxchg_post_membar(cmpxchg_memory_order order) {
+ if (order != memory_order_relaxed) {
+ __asm__ __volatile__ (
+ /* fence */
+ strasm_sync
+ );
+ }
+}
+
#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
// Note that cmpxchg guarantees a two-way memory barrier across
- // the cmpxchg, so it's really a a 'fence_cmpxchg_acquire'
- // (see atomic.hpp).
+ // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+ // specified otherwise (see atomic.hpp).
// Using 32 bit internally.
volatile int *dest_base = (volatile int*)((uintptr_t)dest & ~3);
@@ -312,9 +330,9 @@
unsigned int old_value, value32;
+ cmpxchg_pre_membar(order);
+
__asm__ __volatile__ (
- /* fence */
- strasm_sync
/* simple guard */
" lbz %[old_value], 0(%[dest]) \n"
" cmpw %[masked_compare_val], %[old_value] \n"
@@ -331,8 +349,6 @@
" xor %[value32], %[xor_value], %[value32] \n"
" stwcx. %[value32], 0, %[dest_base] \n"
" bne- 1b \n"
- /* acquire */
- strasm_sync
/* exit */
"2: \n"
/* out */
@@ -353,21 +369,23 @@
"memory"
);
+ cmpxchg_post_membar(order);
+
return (jbyte)(unsigned char)old_value;
}
-inline jint Atomic::cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
// Note that cmpxchg guarantees a two-way memory barrier across
- // the cmpxchg, so it's really a a 'fence_cmpxchg_acquire'
- // (see atomic.hpp).
+ // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+ // specified otherwise (see atomic.hpp).
unsigned int old_value;
const uint64_t zero = 0;
+ cmpxchg_pre_membar(order);
+
__asm__ __volatile__ (
- /* fence */
- strasm_sync
/* simple guard */
" lwz %[old_value], 0(%[dest]) \n"
" cmpw %[compare_value], %[old_value] \n"
@@ -379,8 +397,6 @@
" bne- 2f \n"
" stwcx. %[exchange_value], %[dest], %[zero] \n"
" bne- 1b \n"
- /* acquire */
- strasm_sync
/* exit */
"2: \n"
/* out */
@@ -397,21 +413,23 @@
"memory"
);
+ cmpxchg_post_membar(order);
+
return (jint) old_value;
}
-inline jlong Atomic::cmpxchg(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg(jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
// Note that cmpxchg guarantees a two-way memory barrier across
- // the cmpxchg, so it's really a a 'fence_cmpxchg_acquire'
- // (see atomic.hpp).
+ // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+ // specified otherwise (see atomic.hpp).
long old_value;
const uint64_t zero = 0;
+ cmpxchg_pre_membar(order);
+
__asm__ __volatile__ (
- /* fence */
- strasm_sync
/* simple guard */
" ld %[old_value], 0(%[dest]) \n"
" cmpd %[compare_value], %[old_value] \n"
@@ -423,8 +441,6 @@
" bne- 2f \n"
" stdcx. %[exchange_value], %[dest], %[zero] \n"
" bne- 1b \n"
- /* acquire */
- strasm_sync
/* exit */
"2: \n"
/* out */
@@ -441,15 +457,17 @@
"memory"
);
+ cmpxchg_post_membar(order);
+
return (jlong) old_value;
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
#undef strasm_sync
--- a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -89,7 +89,7 @@
}
#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
int mp = os::is_MP();
__asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
: "=a" (exchange_value)
@@ -98,7 +98,7 @@
return exchange_value;
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
int mp = os::is_MP();
__asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
: "=a" (exchange_value)
@@ -149,7 +149,7 @@
return exchange_value;
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
bool mp = os::is_MP();
__asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
: "=a" (exchange_value)
@@ -158,12 +158,12 @@
return exchange_value;
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
inline jlong Atomic::load(volatile jlong* src) { return *src; }
@@ -197,16 +197,16 @@
void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, os::is_MP());
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
inline jlong Atomic::load(volatile jlong* src) {
--- a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -270,7 +270,8 @@
inline jint Atomic::cmpxchg(jint exchange_value,
volatile jint* dest,
- jint compare_value) {
+ jint compare_value,
+ cmpxchg_memory_order order) {
#ifdef ARM
return arm_compare_and_swap(dest, compare_value, exchange_value);
#else
@@ -284,14 +285,16 @@
inline jlong Atomic::cmpxchg(jlong exchange_value,
volatile jlong* dest,
- jlong compare_value) {
+ jlong compare_value,
+ cmpxchg_memory_order order) {
return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
}
inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value,
volatile intptr_t* dest,
- intptr_t compare_value) {
+ intptr_t compare_value,
+ cmpxchg_memory_order order) {
#ifdef ARM
return arm_compare_and_swap(dest, compare_value, exchange_value);
#else
@@ -305,11 +308,13 @@
inline void* Atomic::cmpxchg_ptr(void* exchange_value,
volatile void* dest,
- void* compare_value) {
+ void* compare_value,
+ cmpxchg_memory_order order) {
return (void *) cmpxchg_ptr((intptr_t) exchange_value,
(volatile intptr_t*) dest,
- (intptr_t) compare_value);
+ (intptr_t) compare_value,
+ order);
}
inline jlong Atomic::load(volatile jlong* src) {
--- a/hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -87,10 +87,28 @@
(volatile intptr_t*) dest);
}
+template <typename T> T generic_cmpxchg(T exchange_value, volatile T* dest,
+ T compare_value, cmpxchg_memory_order order)
+{
+ if (order == memory_order_relaxed) {
+ T value = compare_value;
+ __atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false,
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+ return value;
+ } else {
+ return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+ }
+}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value)
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order)
{
- return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+ return generic_cmpxchg(exchange_value, dest, compare_value, order);
+}
+
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order)
+{
+ return generic_cmpxchg(exchange_value, dest, compare_value, order);
}
inline void Atomic::store (jlong store_value, jlong* dest) { *dest = store_value; }
@@ -123,21 +141,22 @@
return res;
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value)
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order)
{
- return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+ return generic_cmpxchg(exchange_value, dest, compare_value, order);
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value)
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order)
{
- return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
+ return generic_cmpxchg(exchange_value, dest, compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value)
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order)
{
return (void *) cmpxchg_ptr((intptr_t) exchange_value,
(volatile intptr_t*) dest,
- (intptr_t) compare_value);
+ (intptr_t) compare_value,
+ order);
}
inline jlong Atomic::load(volatile jlong* src) { return *src; }
--- a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -291,12 +291,30 @@
return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
}
+inline void cmpxchg_pre_membar(cmpxchg_memory_order order) {
+ if (order != memory_order_relaxed) {
+ __asm__ __volatile__ (
+ /* fence */
+ strasm_sync
+ );
+ }
+}
+
+inline void cmpxchg_post_membar(cmpxchg_memory_order order) {
+ if (order != memory_order_relaxed) {
+ __asm__ __volatile__ (
+ /* fence */
+ strasm_sync
+ );
+ }
+}
+
#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
// Note that cmpxchg guarantees a two-way memory barrier across
- // the cmpxchg, so it's really a a 'fence_cmpxchg_acquire'
- // (see atomic.hpp).
+ // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+ // specified otherwise (see atomic.hpp).
// Using 32 bit internally.
volatile int *dest_base = (volatile int*)((uintptr_t)dest & ~3);
@@ -312,9 +330,9 @@
unsigned int old_value, value32;
+ cmpxchg_pre_membar(order);
+
__asm__ __volatile__ (
- /* fence */
- strasm_sync
/* simple guard */
" lbz %[old_value], 0(%[dest]) \n"
" cmpw %[masked_compare_val], %[old_value] \n"
@@ -331,8 +349,6 @@
" xor %[value32], %[xor_value], %[value32] \n"
" stwcx. %[value32], 0, %[dest_base] \n"
" bne- 1b \n"
- /* acquire */
- strasm_sync
/* exit */
"2: \n"
/* out */
@@ -353,21 +369,23 @@
"memory"
);
+ cmpxchg_post_membar(order);
+
return (jbyte)(unsigned char)old_value;
}
-inline jint Atomic::cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg(jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
// Note that cmpxchg guarantees a two-way memory barrier across
- // the cmpxchg, so it's really a a 'fence_cmpxchg_acquire'
- // (see atomic.hpp).
+ // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+ // specified otherwise (see atomic.hpp).
unsigned int old_value;
const uint64_t zero = 0;
+ cmpxchg_pre_membar(order);
+
__asm__ __volatile__ (
- /* fence */
- strasm_sync
/* simple guard */
" lwz %[old_value], 0(%[dest]) \n"
" cmpw %[compare_value], %[old_value] \n"
@@ -379,8 +397,6 @@
" bne- 2f \n"
" stwcx. %[exchange_value], %[dest], %[zero] \n"
" bne- 1b \n"
- /* acquire */
- strasm_sync
/* exit */
"2: \n"
/* out */
@@ -397,21 +413,23 @@
"memory"
);
+ cmpxchg_post_membar(order);
+
return (jint) old_value;
}
-inline jlong Atomic::cmpxchg(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg(jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
// Note that cmpxchg guarantees a two-way memory barrier across
- // the cmpxchg, so it's really a a 'fence_cmpxchg_acquire'
- // (see atomic.hpp).
+ // the cmpxchg, so it's really a a 'fence_cmpxchg_fence' if not
+ // specified otherwise (see atomic.hpp).
long old_value;
const uint64_t zero = 0;
+ cmpxchg_pre_membar(order);
+
__asm__ __volatile__ (
- /* fence */
- strasm_sync
/* simple guard */
" ld %[old_value], 0(%[dest]) \n"
" cmpd %[compare_value], %[old_value] \n"
@@ -423,8 +441,6 @@
" bne- 2f \n"
" stdcx. %[exchange_value], %[dest], %[zero] \n"
" bne- 1b \n"
- /* acquire */
- strasm_sync
/* exit */
"2: \n"
/* out */
@@ -441,15 +457,17 @@
"memory"
);
+ cmpxchg_post_membar(order);
+
return (jlong) old_value;
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
#undef strasm_sync
--- a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -148,7 +148,7 @@
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
jint rv;
__asm__ volatile(
" cas [%2], %3, %0"
@@ -158,7 +158,7 @@
return rv;
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
#ifdef _LP64
jlong rv;
__asm__ volatile(
@@ -190,7 +190,7 @@
#endif
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
intptr_t rv;
#ifdef _LP64
__asm__ volatile(
@@ -208,8 +208,8 @@
return rv;
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value, order);
}
#endif // OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP
--- a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -89,7 +89,7 @@
}
#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
int mp = os::is_MP();
__asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
: "=a" (exchange_value)
@@ -98,7 +98,7 @@
return exchange_value;
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
int mp = os::is_MP();
__asm__ volatile (LOCK_IF_MP(%4) "cmpxchgl %1,(%3)"
: "=a" (exchange_value)
@@ -149,7 +149,7 @@
return exchange_value;
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
bool mp = os::is_MP();
__asm__ __volatile__ (LOCK_IF_MP(%4) "cmpxchgq %1,(%3)"
: "=a" (exchange_value)
@@ -158,12 +158,12 @@
return exchange_value;
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
inline jlong Atomic::load(volatile jlong* src) { return *src; }
@@ -197,16 +197,16 @@
void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, os::is_MP());
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
inline jlong Atomic::load(volatile jlong* src) {
--- a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -264,7 +264,8 @@
inline jint Atomic::cmpxchg(jint exchange_value,
volatile jint* dest,
- jint compare_value) {
+ jint compare_value,
+ cmpxchg_memory_order order) {
#ifdef ARM
return arm_compare_and_swap(dest, compare_value, exchange_value);
#else
@@ -278,14 +279,16 @@
inline jlong Atomic::cmpxchg(jlong exchange_value,
volatile jlong* dest,
- jlong compare_value) {
+ jlong compare_value,
+ cmpxchg_memory_order order) {
return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
}
inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value,
volatile intptr_t* dest,
- intptr_t compare_value) {
+ intptr_t compare_value,
+ cmpxchg_memory_order order) {
#ifdef ARM
return arm_compare_and_swap(dest, compare_value, exchange_value);
#else
@@ -299,11 +302,13 @@
inline void* Atomic::cmpxchg_ptr(void* exchange_value,
volatile void* dest,
- void* compare_value) {
+ void* compare_value,
+ cmpxchg_memory_order order) {
return (void *) cmpxchg_ptr((intptr_t) exchange_value,
(volatile intptr_t*) dest,
- (intptr_t) compare_value);
+ (intptr_t) compare_value,
+ order);
}
inline jlong Atomic::load(volatile jlong* src) {
--- a/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -177,7 +177,7 @@
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
jint rv;
__asm__ volatile(
" cas [%2], %3, %0"
@@ -187,7 +187,7 @@
return rv;
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
#ifdef _LP64
jlong rv;
__asm__ volatile(
@@ -219,7 +219,7 @@
#endif //_LP64
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
intptr_t rv;
#ifdef _LP64
__asm__ volatile(
@@ -237,8 +237,8 @@
return rv;
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value, order);
}
#else // _GNU_SOURCE
@@ -296,11 +296,11 @@
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
return _Atomic_cas32(exchange_value, dest, compare_value);
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
#ifdef _LP64
// Return 64 bit value in %o0
return _Atomic_cas64((intptr_t)exchange_value, (intptr_t *)dest, (intptr_t)compare_value);
@@ -310,7 +310,7 @@
#endif // _LP64
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
#ifdef _LP64
return _Atomic_cas64(exchange_value, dest, compare_value);
#else // _LP64
@@ -318,8 +318,8 @@
#endif // _LP64
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest, (intptr_t)compare_value, order);
}
@@ -354,20 +354,20 @@
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value);
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value);
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
#endif // _LP64 || COMPILER2
--- a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -85,15 +85,15 @@
}
#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
return _Atomic_cmpxchg_byte(exchange_value, dest, compare_value IS_MP_ARG());
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
return _Atomic_cmpxchg_long(exchange_value, dest, compare_value IS_MP_ARG());
}
@@ -120,11 +120,11 @@
return (void*)_Atomic_xchg_long((jlong)exchange_value, (volatile jlong*)dest);
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
return (intptr_t)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
return (void*)_Atomic_cmpxchg_long((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
}
@@ -148,12 +148,12 @@
return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
extern "C" void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
--- a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -119,25 +119,25 @@
return (void *)(os::atomic_xchg_ptr_func)((intptr_t)exchange_value, (volatile intptr_t*)dest);
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value);
}
#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
return (*os::atomic_cmpxchg_byte_func)(exchange_value, dest, compare_value);
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value);
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value, order);
}
inline jlong Atomic::load(volatile jlong* src) { return *src; }
@@ -218,7 +218,7 @@
}
#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+inline jbyte Atomic::cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order) {
// alternative for InterlockedCompareExchange
int mp = os::is_MP();
__asm {
@@ -230,7 +230,7 @@
}
}
-inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) {
+inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order) {
// alternative for InterlockedCompareExchange
int mp = os::is_MP();
__asm {
@@ -242,7 +242,7 @@
}
}
-inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value) {
+inline jlong Atomic::cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order) {
int mp = os::is_MP();
jint ex_lo = (jint)exchange_value;
jint ex_hi = *( ((jint*)&exchange_value) + 1 );
@@ -263,12 +263,12 @@
}
}
-inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value) {
- return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline intptr_t Atomic::cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order) {
+ return (intptr_t)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
-inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value) {
- return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
+inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order) {
+ return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value, order);
}
inline jlong Atomic::load(volatile jlong* src) {
--- a/hotspot/src/share/vm/adlc/formssel.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/adlc/formssel.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1246,8 +1246,7 @@
!is_short_branch() && // Don't match another short branch variant
reduce_result() != NULL &&
strcmp(reduce_result(), short_branch->reduce_result()) == 0 &&
- _matrule->equivalent(AD.globalNames(), short_branch->_matrule) &&
- equivalent_predicates(this, short_branch)) {
+ _matrule->equivalent(AD.globalNames(), short_branch->_matrule)) {
// The instructions are equivalent.
// Now verify that both instructions have the same parameters and
@@ -3491,13 +3490,13 @@
"LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
"LoadPLocked",
"StorePConditional", "StoreIConditional", "StoreLConditional",
- "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
- "WeakCompareAndSwapI", "WeakCompareAndSwapL", "WeakCompareAndSwapP", "WeakCompareAndSwapN",
- "CompareAndExchangeI", "CompareAndExchangeL", "CompareAndExchangeP", "CompareAndExchangeN",
+ "CompareAndSwapB", "CompareAndSwapS", "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN",
+ "WeakCompareAndSwapB", "WeakCompareAndSwapS", "WeakCompareAndSwapI", "WeakCompareAndSwapL", "WeakCompareAndSwapP", "WeakCompareAndSwapN",
+ "CompareAndExchangeB", "CompareAndExchangeS", "CompareAndExchangeI", "CompareAndExchangeL", "CompareAndExchangeP", "CompareAndExchangeN",
"StoreCM",
"ClearArray",
- "GetAndAddI", "GetAndSetI", "GetAndSetP",
- "GetAndAddL", "GetAndSetL", "GetAndSetN",
+ "GetAndSetB", "GetAndSetS", "GetAndAddI", "GetAndSetI", "GetAndSetP",
+ "GetAndAddB", "GetAndAddS", "GetAndAddL", "GetAndSetL", "GetAndSetN",
};
int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
if( strcmp(_opType,"PrefetchAllocation")==0 )
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1600,7 +1600,7 @@
ValueType* type = as_ValueType(field_type);
// call will_link again to determine if the field is valid.
const bool needs_patching = !holder->is_loaded() ||
- !field->will_link(method()->holder(), code) ||
+ !field->will_link(method(), code) ||
PatchALot;
ValueStack* state_before = NULL;
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -759,10 +759,10 @@
// This can be static or non-static field access
Bytecodes::Code code = field_access.code();
- // We must load class, initialize class and resolvethe field
+ // We must load class, initialize class and resolve the field
fieldDescriptor result; // initialize class if needed
constantPoolHandle constants(THREAD, caller->constants());
- LinkResolver::resolve_field_access(result, constants, field_access.index(), Bytecodes::java_code(code), CHECK_NULL);
+ LinkResolver::resolve_field_access(result, constants, field_access.index(), caller, Bytecodes::java_code(code), CHECK_NULL);
return result.field_holder();
}
@@ -879,7 +879,7 @@
fieldDescriptor result; // initialize class if needed
Bytecodes::Code code = field_access.code();
constantPoolHandle constants(THREAD, caller_method->constants());
- LinkResolver::resolve_field_access(result, constants, field_access.index(), Bytecodes::java_code(code), CHECK);
+ LinkResolver::resolve_field_access(result, constants, field_access.index(), caller_method, Bytecodes::java_code(code), CHECK);
patch_field_offset = result.offset();
// If we're patching a field which is volatile then at compile it
--- a/hotspot/src/share/vm/ci/ciField.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciField.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -66,7 +66,8 @@
// ------------------------------------------------------------------
// ciField::ciField
-ciField::ciField(ciInstanceKlass* klass, int index): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
+ciField::ciField(ciInstanceKlass* klass, int index) :
+ _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
ASSERT_IN_VM;
CompilerThread *thread = CompilerThread::current();
@@ -173,7 +174,8 @@
initialize_from(&field_desc);
}
-ciField::ciField(fieldDescriptor *fd): _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
+ciField::ciField(fieldDescriptor *fd) :
+ _known_to_link_with_put(NULL), _known_to_link_with_get(NULL) {
ASSERT_IN_VM;
// Get the field's name, signature, and type.
@@ -237,7 +239,7 @@
// Check to see if the field is constant.
Klass* k = _holder->get_Klass();
bool is_stable_field = FoldStableValues && is_stable();
- if (is_final() || is_stable_field) {
+ if ((is_final() && !has_initialized_final_update()) || is_stable_field) {
if (is_static()) {
// This field just may be constant. The only case where it will
// not be constant is when the field is a *special* static & final field
@@ -265,6 +267,7 @@
assert(SystemDictionary::CallSite_klass() != NULL, "should be already initialized");
if (k == SystemDictionary::CallSite_klass() &&
_offset == java_lang_invoke_CallSite::target_offset_in_bytes()) {
+ assert(!has_initialized_final_update(), "CallSite is not supposed to have writes to final fields outside initializers");
_is_constant = true;
} else {
// Non-final & non-stable fields are not constants.
@@ -340,7 +343,7 @@
//
// Can a specific access to this field be made without causing
// link errors?
-bool ciField::will_link(ciInstanceKlass* accessing_klass,
+bool ciField::will_link(ciMethod* accessing_method,
Bytecodes::Code bc) {
VM_ENTRY_MARK;
assert(bc == Bytecodes::_getstatic || bc == Bytecodes::_putstatic ||
@@ -363,27 +366,27 @@
// Get and put can have different accessibility rules
bool is_put = (bc == Bytecodes::_putfield || bc == Bytecodes::_putstatic);
if (is_put) {
- if (_known_to_link_with_put == accessing_klass) {
+ if (_known_to_link_with_put == accessing_method) {
return true;
}
} else {
- if (_known_to_link_with_get == accessing_klass) {
+ if (_known_to_link_with_get == accessing_method->holder()) {
return true;
}
}
LinkInfo link_info(_holder->get_instanceKlass(),
_name->get_symbol(), _signature->get_symbol(),
- accessing_klass->get_Klass());
+ accessing_method->get_Method());
fieldDescriptor result;
LinkResolver::resolve_field(result, link_info, bc, false, KILL_COMPILE_ON_FATAL_(false));
// update the hit-cache, unless there is a problem with memory scoping:
- if (accessing_klass->is_shared() || !is_shared()) {
+ if (accessing_method->holder()->is_shared() || !is_shared()) {
if (is_put) {
- _known_to_link_with_put = accessing_klass;
+ _known_to_link_with_put = accessing_method;
} else {
- _known_to_link_with_get = accessing_klass;
+ _known_to_link_with_get = accessing_method->holder();
}
}
--- a/hotspot/src/share/vm/ci/ciField.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciField.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -48,7 +48,7 @@
ciType* _type;
int _offset;
bool _is_constant;
- ciInstanceKlass* _known_to_link_with_put;
+ ciMethod* _known_to_link_with_put;
ciInstanceKlass* _known_to_link_with_get;
ciConstant _constant_value;
@@ -131,8 +131,12 @@
// non-constant fields. These are java.lang.System.in
// and java.lang.System.out. Abomination.
//
- // A field is also considered constant if it is marked @Stable
- // and is non-null (or non-zero, if a primitive).
+ // A field is also considered constant if
+ // - it is marked @Stable and is non-null (or non-zero, if a primitive) or
+ // - it is trusted or
+ // - it is the target field of a CallSite object.
+ //
+ // See ciField::initialize_from() for more details.
//
// A user should also check the field value (constant_value().is_valid()), since
// constant fields of non-initialized classes don't have values yet.
@@ -150,25 +154,28 @@
ciConstant constant_value_of(ciObject* object);
// Check for link time errors. Accessing a field from a
- // certain class via a certain bytecode may or may not be legal.
+ // certain method via a certain bytecode may or may not be legal.
// This call checks to see if an exception may be raised by
// an access of this field.
//
// Usage note: if the same field is accessed multiple times
// in the same compilation, will_link will need to be checked
// at each point of access.
- bool will_link(ciInstanceKlass* accessing_klass,
+ bool will_link(ciMethod* accessing_method,
Bytecodes::Code bc);
// Java access flags
- bool is_public () const { return flags().is_public(); }
- bool is_private () const { return flags().is_private(); }
- bool is_protected () const { return flags().is_protected(); }
- bool is_static () const { return flags().is_static(); }
- bool is_final () const { return flags().is_final(); }
- bool is_stable () const { return flags().is_stable(); }
- bool is_volatile () const { return flags().is_volatile(); }
- bool is_transient () const { return flags().is_transient(); }
+ bool is_public () const { return flags().is_public(); }
+ bool is_private () const { return flags().is_private(); }
+ bool is_protected () const { return flags().is_protected(); }
+ bool is_static () const { return flags().is_static(); }
+ bool is_final () const { return flags().is_final(); }
+ bool is_stable () const { return flags().is_stable(); }
+ bool is_volatile () const { return flags().is_volatile(); }
+ bool is_transient () const { return flags().is_transient(); }
+ // The field is modified outside of instance initializer methods
+ // (or class/initializer methods if the field is static).
+ bool has_initialized_final_update() const { return flags().has_initialized_final_update(); }
bool is_call_site_target() {
ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass();
--- a/hotspot/src/share/vm/ci/ciFlags.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciFlags.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -47,20 +47,25 @@
public:
// Java access flags
- bool is_public () const { return (_flags & JVM_ACC_PUBLIC ) != 0; }
- bool is_private () const { return (_flags & JVM_ACC_PRIVATE ) != 0; }
- bool is_protected () const { return (_flags & JVM_ACC_PROTECTED ) != 0; }
- bool is_static () const { return (_flags & JVM_ACC_STATIC ) != 0; }
- bool is_final () const { return (_flags & JVM_ACC_FINAL ) != 0; }
- bool is_synchronized() const { return (_flags & JVM_ACC_SYNCHRONIZED) != 0; }
- bool is_super () const { return (_flags & JVM_ACC_SUPER ) != 0; }
- bool is_volatile () const { return (_flags & JVM_ACC_VOLATILE ) != 0; }
- bool is_transient () const { return (_flags & JVM_ACC_TRANSIENT ) != 0; }
- bool is_native () const { return (_flags & JVM_ACC_NATIVE ) != 0; }
- bool is_interface () const { return (_flags & JVM_ACC_INTERFACE ) != 0; }
- bool is_abstract () const { return (_flags & JVM_ACC_ABSTRACT ) != 0; }
- bool is_strict () const { return (_flags & JVM_ACC_STRICT ) != 0; }
- bool is_stable () const { return (_flags & JVM_ACC_FIELD_STABLE) != 0; }
+ bool is_public () const { return (_flags & JVM_ACC_PUBLIC ) != 0; }
+ bool is_private () const { return (_flags & JVM_ACC_PRIVATE ) != 0; }
+ bool is_protected () const { return (_flags & JVM_ACC_PROTECTED ) != 0; }
+ bool is_static () const { return (_flags & JVM_ACC_STATIC ) != 0; }
+ bool is_final () const { return (_flags & JVM_ACC_FINAL ) != 0; }
+ bool is_synchronized () const { return (_flags & JVM_ACC_SYNCHRONIZED ) != 0; }
+ bool is_super () const { return (_flags & JVM_ACC_SUPER ) != 0; }
+ bool is_volatile () const { return (_flags & JVM_ACC_VOLATILE ) != 0; }
+ bool is_transient () const { return (_flags & JVM_ACC_TRANSIENT ) != 0; }
+ bool is_native () const { return (_flags & JVM_ACC_NATIVE ) != 0; }
+ bool is_interface () const { return (_flags & JVM_ACC_INTERFACE ) != 0; }
+ bool is_abstract () const { return (_flags & JVM_ACC_ABSTRACT ) != 0; }
+ bool is_strict () const { return (_flags & JVM_ACC_STRICT ) != 0; }
+ bool is_stable () const { return (_flags & JVM_ACC_FIELD_STABLE ) != 0; }
+ // In case the current object represents a field, return true if
+ // the field is modified outside of instance initializer methods
+ // (or class/initializer methods if the field is static) and false
+ // otherwise.
+ bool has_initialized_final_update() const { return (_flags & JVM_ACC_FIELD_INITIALIZED_FINAL_UPDATE) != 0; };
// Conversion
jint as_int() { return _flags; }
--- a/hotspot/src/share/vm/ci/ciStreams.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciStreams.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -278,7 +278,7 @@
// or put_static, get the referenced field.
ciField* ciBytecodeStream::get_field(bool& will_link) {
ciField* f = CURRENT_ENV->get_field_by_index(_holder, get_field_index());
- will_link = f->will_link(_holder, _bc);
+ will_link = f->will_link(_method, _bc);
return f;
}
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1377,7 +1377,6 @@
int java_lang_ThreadGroup::_maxPriority_offset = 0;
int java_lang_ThreadGroup::_destroyed_offset = 0;
int java_lang_ThreadGroup::_daemon_offset = 0;
-int java_lang_ThreadGroup::_vmAllowSuspension_offset = 0;
int java_lang_ThreadGroup::_nthreads_offset = 0;
int java_lang_ThreadGroup::_ngroups_offset = 0;
@@ -1435,11 +1434,6 @@
return java_thread_group->bool_field(_daemon_offset) != 0;
}
-bool java_lang_ThreadGroup::is_vmAllowSuspension(oop java_thread_group) {
- assert(java_thread_group->is_oop(), "thread group must be oop");
- return java_thread_group->bool_field(_vmAllowSuspension_offset) != 0;
-}
-
void java_lang_ThreadGroup::compute_offsets() {
assert(_parent_offset == 0, "offsets should be initialized only once");
@@ -1452,7 +1446,6 @@
compute_offset(_maxPriority_offset, k, vmSymbols::maxPriority_name(), vmSymbols::int_signature());
compute_offset(_destroyed_offset, k, vmSymbols::destroyed_name(), vmSymbols::bool_signature());
compute_offset(_daemon_offset, k, vmSymbols::daemon_name(), vmSymbols::bool_signature());
- compute_offset(_vmAllowSuspension_offset, k, vmSymbols::vmAllowSuspension_name(), vmSymbols::bool_signature());
compute_offset(_nthreads_offset, k, vmSymbols::nthreads_name(), vmSymbols::int_signature());
compute_offset(_ngroups_offset, k, vmSymbols::ngroups_name(), vmSymbols::int_signature());
}
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -413,7 +413,6 @@
static int _maxPriority_offset;
static int _destroyed_offset;
static int _daemon_offset;
- static int _vmAllowSuspension_offset;
static int _nthreads_offset;
static int _ngroups_offset;
@@ -439,8 +438,6 @@
static bool is_destroyed(oop java_thread_group);
// Daemon
static bool is_daemon(oop java_thread_group);
- // vmAllowSuspension
- static bool is_vmAllowSuspension(oop java_thread_group);
// Debugging
friend class JavaClasses;
};
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -354,7 +354,6 @@
template(groups_name, "groups") \
template(maxPriority_name, "maxPriority") \
template(destroyed_name, "destroyed") \
- template(vmAllowSuspension_name, "vmAllowSuspension") \
template(nthreads_name, "nthreads") \
template(ngroups_name, "ngroups") \
template(shutdown_method_name, "shutdown") \
@@ -1239,6 +1238,10 @@
do_signature(compareAndExchangeLong_signature, "(Ljava/lang/Object;JJJ)J") \
do_signature(compareAndSwapInt_signature, "(Ljava/lang/Object;JII)Z") \
do_signature(compareAndExchangeInt_signature, "(Ljava/lang/Object;JII)I") \
+ do_signature(compareAndSwapByte_signature, "(Ljava/lang/Object;JBB)Z") \
+ do_signature(compareAndExchangeByte_signature, "(Ljava/lang/Object;JBB)B") \
+ do_signature(compareAndSwapShort_signature, "(Ljava/lang/Object;JSS)Z") \
+ do_signature(compareAndExchangeShort_signature, "(Ljava/lang/Object;JSS)S") \
\
do_name(compareAndSwapObject_name, "compareAndSwapObject") \
do_name(compareAndExchangeObjectVolatile_name, "compareAndExchangeObjectVolatile") \
@@ -1252,6 +1255,14 @@
do_name(compareAndExchangeIntVolatile_name, "compareAndExchangeIntVolatile") \
do_name(compareAndExchangeIntAcquire_name, "compareAndExchangeIntAcquire") \
do_name(compareAndExchangeIntRelease_name, "compareAndExchangeIntRelease") \
+ do_name(compareAndSwapByte_name, "compareAndSwapByte") \
+ do_name(compareAndExchangeByteVolatile_name, "compareAndExchangeByteVolatile") \
+ do_name(compareAndExchangeByteAcquire_name, "compareAndExchangeByteAcquire") \
+ do_name(compareAndExchangeByteRelease_name, "compareAndExchangeByteRelease") \
+ do_name(compareAndSwapShort_name, "compareAndSwapShort") \
+ do_name(compareAndExchangeShortVolatile_name, "compareAndExchangeShortVolatile") \
+ do_name(compareAndExchangeShortAcquire_name, "compareAndExchangeShortAcquire") \
+ do_name(compareAndExchangeShortRelease_name, "compareAndExchangeShortRelease") \
\
do_name(weakCompareAndSwapObject_name, "weakCompareAndSwapObject") \
do_name(weakCompareAndSwapObjectAcquire_name, "weakCompareAndSwapObjectAcquire") \
@@ -1265,6 +1276,14 @@
do_name(weakCompareAndSwapIntAcquire_name, "weakCompareAndSwapIntAcquire") \
do_name(weakCompareAndSwapIntRelease_name, "weakCompareAndSwapIntRelease") \
do_name(weakCompareAndSwapIntVolatile_name, "weakCompareAndSwapIntVolatile") \
+ do_name(weakCompareAndSwapByte_name, "weakCompareAndSwapByte") \
+ do_name(weakCompareAndSwapByteAcquire_name, "weakCompareAndSwapByteAcquire") \
+ do_name(weakCompareAndSwapByteRelease_name, "weakCompareAndSwapByteRelease") \
+ do_name(weakCompareAndSwapByteVolatile_name, "weakCompareAndSwapByteVolatile") \
+ do_name(weakCompareAndSwapShort_name, "weakCompareAndSwapShort") \
+ do_name(weakCompareAndSwapShortAcquire_name, "weakCompareAndSwapShortAcquire") \
+ do_name(weakCompareAndSwapShortRelease_name, "weakCompareAndSwapShortRelease") \
+ do_name(weakCompareAndSwapShortVolatile_name, "weakCompareAndSwapShortVolatile") \
\
do_intrinsic(_compareAndSwapObject, jdk_internal_misc_Unsafe, compareAndSwapObject_name, compareAndSwapObject_signature, F_RN) \
do_intrinsic(_compareAndExchangeObjectVolatile, jdk_internal_misc_Unsafe, compareAndExchangeObjectVolatile_name, compareAndExchangeObject_signature, F_RN) \
@@ -1278,7 +1297,15 @@
do_intrinsic(_compareAndExchangeIntVolatile, jdk_internal_misc_Unsafe, compareAndExchangeIntVolatile_name, compareAndExchangeInt_signature, F_RN) \
do_intrinsic(_compareAndExchangeIntAcquire, jdk_internal_misc_Unsafe, compareAndExchangeIntAcquire_name, compareAndExchangeInt_signature, F_R) \
do_intrinsic(_compareAndExchangeIntRelease, jdk_internal_misc_Unsafe, compareAndExchangeIntRelease_name, compareAndExchangeInt_signature, F_R) \
- \
+ do_intrinsic(_compareAndSwapByte, jdk_internal_misc_Unsafe, compareAndSwapByte_name, compareAndSwapByte_signature, F_R) \
+ do_intrinsic(_compareAndExchangeByteVolatile, jdk_internal_misc_Unsafe, compareAndExchangeByteVolatile_name, compareAndExchangeByte_signature, F_R) \
+ do_intrinsic(_compareAndExchangeByteAcquire, jdk_internal_misc_Unsafe, compareAndExchangeByteAcquire_name, compareAndExchangeByte_signature, F_R) \
+ do_intrinsic(_compareAndExchangeByteRelease, jdk_internal_misc_Unsafe, compareAndExchangeByteRelease_name, compareAndExchangeByte_signature, F_R) \
+ do_intrinsic(_compareAndSwapShort, jdk_internal_misc_Unsafe, compareAndSwapShort_name, compareAndSwapShort_signature, F_R) \
+ do_intrinsic(_compareAndExchangeShortVolatile, jdk_internal_misc_Unsafe, compareAndExchangeShortVolatile_name, compareAndExchangeShort_signature, F_R) \
+ do_intrinsic(_compareAndExchangeShortAcquire, jdk_internal_misc_Unsafe, compareAndExchangeShortAcquire_name, compareAndExchangeShort_signature, F_R) \
+ do_intrinsic(_compareAndExchangeShortRelease, jdk_internal_misc_Unsafe, compareAndExchangeShortRelease_name, compareAndExchangeShort_signature, F_R) \
+ \
do_intrinsic(_weakCompareAndSwapObject, jdk_internal_misc_Unsafe, weakCompareAndSwapObject_name, compareAndSwapObject_signature, F_R) \
do_intrinsic(_weakCompareAndSwapObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectAcquire_name, compareAndSwapObject_signature, F_R) \
do_intrinsic(_weakCompareAndSwapObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectRelease_name, compareAndSwapObject_signature, F_R) \
@@ -1291,19 +1318,39 @@
do_intrinsic(_weakCompareAndSwapIntAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapIntAcquire_name, compareAndSwapInt_signature, F_R) \
do_intrinsic(_weakCompareAndSwapIntRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapIntRelease_name, compareAndSwapInt_signature, F_R) \
do_intrinsic(_weakCompareAndSwapIntVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapIntVolatile_name, compareAndSwapInt_signature, F_R) \
- \
+ do_intrinsic(_weakCompareAndSwapByte, jdk_internal_misc_Unsafe, weakCompareAndSwapByte_name, compareAndSwapByte_signature, F_R) \
+ do_intrinsic(_weakCompareAndSwapByteAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapByteAcquire_name, compareAndSwapByte_signature, F_R) \
+ do_intrinsic(_weakCompareAndSwapByteRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapByteRelease_name, compareAndSwapByte_signature, F_R) \
+ do_intrinsic(_weakCompareAndSwapByteVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapByteVolatile_name, compareAndSwapByte_signature, F_R) \
+ do_intrinsic(_weakCompareAndSwapShort, jdk_internal_misc_Unsafe, weakCompareAndSwapShort_name, compareAndSwapShort_signature, F_R) \
+ do_intrinsic(_weakCompareAndSwapShortAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapShortAcquire_name, compareAndSwapShort_signature, F_R) \
+ do_intrinsic(_weakCompareAndSwapShortRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapShortRelease_name, compareAndSwapShort_signature, F_R) \
+ do_intrinsic(_weakCompareAndSwapShortVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapShortVolatile_name, compareAndSwapShort_signature, F_R) \
+ \
do_intrinsic(_getAndAddInt, jdk_internal_misc_Unsafe, getAndAddInt_name, getAndAddInt_signature, F_R) \
do_name( getAndAddInt_name, "getAndAddInt") \
do_signature(getAndAddInt_signature, "(Ljava/lang/Object;JI)I" ) \
do_intrinsic(_getAndAddLong, jdk_internal_misc_Unsafe, getAndAddLong_name, getAndAddLong_signature, F_R) \
do_name( getAndAddLong_name, "getAndAddLong") \
do_signature(getAndAddLong_signature, "(Ljava/lang/Object;JJ)J" ) \
+ do_intrinsic(_getAndAddByte, jdk_internal_misc_Unsafe, getAndAddByte_name, getAndAddByte_signature, F_R) \
+ do_name( getAndAddByte_name, "getAndAddByte") \
+ do_signature(getAndAddByte_signature, "(Ljava/lang/Object;JB)B" ) \
+ do_intrinsic(_getAndAddShort, jdk_internal_misc_Unsafe, getAndAddShort_name, getAndAddShort_signature, F_R) \
+ do_name( getAndAddShort_name, "getAndAddShort") \
+ do_signature(getAndAddShort_signature, "(Ljava/lang/Object;JS)S" ) \
do_intrinsic(_getAndSetInt, jdk_internal_misc_Unsafe, getAndSetInt_name, getAndSetInt_signature, F_R) \
do_name( getAndSetInt_name, "getAndSetInt") \
do_alias( getAndSetInt_signature, /*"(Ljava/lang/Object;JI)I"*/ getAndAddInt_signature) \
do_intrinsic(_getAndSetLong, jdk_internal_misc_Unsafe, getAndSetLong_name, getAndSetLong_signature, F_R) \
do_name( getAndSetLong_name, "getAndSetLong") \
do_alias( getAndSetLong_signature, /*"(Ljava/lang/Object;JJ)J"*/ getAndAddLong_signature) \
+ do_intrinsic(_getAndSetByte, jdk_internal_misc_Unsafe, getAndSetByte_name, getAndSetByte_signature, F_R) \
+ do_name( getAndSetByte_name, "getAndSetByte") \
+ do_alias( getAndSetByte_signature, /*"(Ljava/lang/Object;JB)B"*/ getAndAddByte_signature) \
+ do_intrinsic(_getAndSetShort, jdk_internal_misc_Unsafe, getAndSetShort_name, getAndSetShort_signature, F_R) \
+ do_name( getAndSetShort_name, "getAndSetShort") \
+ do_alias( getAndSetShort_signature, /*"(Ljava/lang/Object;JS)S"*/ getAndAddShort_signature) \
do_intrinsic(_getAndSetObject, jdk_internal_misc_Unsafe, getAndSetObject_name, getAndSetObject_signature, F_R)\
do_name( getAndSetObject_name, "getAndSetObject") \
do_signature(getAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \
--- a/hotspot/src/share/vm/code/compiledMethod.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/code/compiledMethod.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -63,7 +63,7 @@
bool CompiledMethod::is_deopt_entry(address pc) {
return pc == deopt_handler_begin()
#if INCLUDE_JVMCI
- || pc == (deopt_handler_begin() + NativeCall::instruction_size)
+ || (is_compiled_by_jvmci() && pc == (deopt_handler_begin() + NativeCall::instruction_size))
#endif
;
}
--- a/hotspot/src/share/vm/code/dependencies.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/code/dependencies.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -168,7 +168,7 @@
LG2_TYPE_LIMIT = 4, // assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT))
// handy categorizations of dependency types:
- all_types = ((1 << TYPE_LIMIT) - 1) & ((-1) << FIRST_TYPE),
+ all_types = ((1 << TYPE_LIMIT) - 1) & ((~0u) << FIRST_TYPE),
non_klass_types = (1 << call_site_target_value),
klass_types = all_types & ~non_klass_types,
--- a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -36,11 +36,6 @@
#include "gc/shared/gcCause.hpp"
#include "utilities/pair.hpp"
-// A G1Policy makes policy decisions that determine the
-// characteristics of the collector. Examples include:
-// * choice of collection set.
-// * when to collect.
-
class HeapRegion;
class G1CollectionSet;
class CollectionSetChooser;
@@ -109,11 +104,8 @@
const G1Predictions& predictor() const { return _predictor; }
const G1Analytics* analytics() const { return const_cast<const G1Analytics*>(_analytics); }
- // Add the given number of bytes to the total number of allocated bytes in the old gen.
void add_bytes_allocated_in_old_since_last_gc(size_t bytes) { _bytes_allocated_in_old_since_last_gc += bytes; }
- // Accessors
-
void set_region_eden(HeapRegion* hr) {
hr->set_eden();
hr->install_surv_rate_group(_short_lived_surv_rate_group);
@@ -164,8 +156,6 @@
return _mmu_tracker->max_gc_time() * 1000.0;
}
- // Returns an estimate of the survival rate of the region at yg-age
- // "yg_age".
double predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) const;
double predict_yg_surv_rate(int age) const;
@@ -250,16 +240,9 @@
public:
size_t pending_cards() const { return _pending_cards; }
- // Calculate the minimum number of old regions we'll add to the CSet
- // during a mixed GC.
uint calc_min_old_cset_length() const;
-
- // Calculate the maximum number of old regions we'll add to the CSet
- // during a mixed GC.
uint calc_max_old_cset_length() const;
- // Returns the given amount of uncollected reclaimable space
- // as a percentage of the current heap capacity.
double reclaimable_bytes_perc(size_t reclaimable_bytes) const;
private:
@@ -293,12 +276,8 @@
G1GCPhaseTimes* phase_times() const { return _phase_times; }
- // Check the current value of the young list RSet lengths and
- // compare it against the last prediction. If the current value is
- // higher, recalculate the young list target length prediction.
void revise_young_list_target_length_if_necessary(size_t rs_lengths);
- // This should be called after the heap is resized.
void record_new_heap_size(uint new_number_of_regions);
void init(G1CollectedHeap* g1h, G1CollectionSet* collection_set);
@@ -309,42 +288,31 @@
bool about_to_start_mixed_phase() const;
- // Record the start and end of an evacuation pause.
void record_collection_pause_start(double start_time_sec);
void record_collection_pause_end(double pause_time_ms, size_t cards_scanned, size_t heap_used_bytes_before_gc);
- // Record the start and end of a full collection.
void record_full_collection_start();
void record_full_collection_end();
- // Must currently be called while the world is stopped.
void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms);
- // Record start and end of remark.
void record_concurrent_mark_remark_start();
void record_concurrent_mark_remark_end();
- // Record start, end, and completion of cleanup.
void record_concurrent_mark_cleanup_start();
void record_concurrent_mark_cleanup_end();
void record_concurrent_mark_cleanup_completed();
virtual void print_phases();
- // Record how much space we copied during a GC. This is typically
- // called when a GC alloc region is being retired.
void record_bytes_copied_during_gc(size_t bytes) {
_bytes_copied_during_gc += bytes;
}
- // The amount of space we copied during a GC.
size_t bytes_copied_during_gc() const {
return _bytes_copied_during_gc;
}
- // Determine whether there are candidate regions so that the
- // next GC should be mixed. The two action strings are used
- // in the ergo output when the method returns true or false.
bool next_gc_should_be_mixed(const char* true_action_str,
const char* false_action_str) const;
@@ -356,18 +324,8 @@
void initiate_conc_mark();
public:
- // This sets the initiate_conc_mark_if_possible() flag to start a
- // new cycle, as long as we are not already in one. It's best if it
- // is called during a safepoint when the test whether a cycle is in
- // progress or not is stable.
bool force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause);
- // This is called at the very beginning of an evacuation pause (it
- // has to be the first thing that the pause does). If
- // initiate_conc_mark_if_possible() is true, and the concurrent
- // marking thread has completed its work during the previous cycle,
- // it will set during_initial_mark_pause() to so that the pause does
- // the initial-mark work and start a marking cycle.
void decide_on_conc_mark_initiation();
void finished_recalculating_age_indexes(bool is_survivors) {
@@ -431,7 +389,6 @@
void update_max_gc_locker_expansion();
- // Calculates survivor space parameters.
void update_survivors_policy();
};
--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -137,7 +137,9 @@
do {
// Drain the overflow stack first, so other threads can steal.
while (_refs->pop_overflow(ref)) {
- dispatch_reference(ref);
+ if (!_refs->try_push_to_taskqueue(ref)) {
+ dispatch_reference(ref);
+ }
}
while (_refs->pop_local(ref)) {
--- a/hotspot/src/share/vm/gc/g1/g1StringDedupTable.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1StringDedupTable.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -37,16 +37,16 @@
#include "runtime/mutexLocker.hpp"
//
-// Freelist in the deduplication table entry cache. Links table
+// List of deduplication table entries. Links table
// entries together using their _next fields.
//
-class G1StringDedupEntryFreeList : public CHeapObj<mtGC> {
+class G1StringDedupEntryList : public CHeapObj<mtGC> {
private:
G1StringDedupEntry* _list;
size_t _length;
public:
- G1StringDedupEntryFreeList() :
+ G1StringDedupEntryList() :
_list(NULL),
_length(0) {
}
@@ -66,6 +66,12 @@
return entry;
}
+ G1StringDedupEntry* remove_all() {
+ G1StringDedupEntry* list = _list;
+ _list = NULL;
+ return list;
+ }
+
size_t length() {
return _length;
}
@@ -87,43 +93,53 @@
//
class G1StringDedupEntryCache : public CHeapObj<mtGC> {
private:
- // One freelist per GC worker to allow lock less freeing of
- // entries while doing a parallel scan of the table. Using
- // PaddedEnd to avoid false sharing.
- PaddedEnd<G1StringDedupEntryFreeList>* _lists;
- size_t _nlists;
+ // One cache/overflow list per GC worker to allow lock less freeing of
+ // entries while doing a parallel scan of the table. Using PaddedEnd to
+ // avoid false sharing.
+ size_t _nlists;
+ size_t _max_list_length;
+ PaddedEnd<G1StringDedupEntryList>* _cached;
+ PaddedEnd<G1StringDedupEntryList>* _overflowed;
public:
- G1StringDedupEntryCache();
+ G1StringDedupEntryCache(size_t max_size);
~G1StringDedupEntryCache();
- // Get a table entry from the cache freelist, or allocate a new
- // entry if the cache is empty.
+ // Set max number of table entries to cache.
+ void set_max_size(size_t max_size);
+
+ // Get a table entry from the cache, or allocate a new entry if the cache is empty.
G1StringDedupEntry* alloc();
- // Insert a table entry into the cache freelist.
+ // Insert a table entry into the cache.
void free(G1StringDedupEntry* entry, uint worker_id);
// Returns current number of entries in the cache.
size_t size();
- // If the cache has grown above the given max size, trim it down
- // and deallocate the memory occupied by trimmed of entries.
- void trim(size_t max_size);
+ // Deletes overflowed entries.
+ void delete_overflowed();
};
-G1StringDedupEntryCache::G1StringDedupEntryCache() {
- _nlists = ParallelGCThreads;
- _lists = PaddedArray<G1StringDedupEntryFreeList, mtGC>::create_unfreeable((uint)_nlists);
+G1StringDedupEntryCache::G1StringDedupEntryCache(size_t max_size) :
+ _nlists(ParallelGCThreads),
+ _max_list_length(0),
+ _cached(PaddedArray<G1StringDedupEntryList, mtGC>::create_unfreeable((uint)_nlists)),
+ _overflowed(PaddedArray<G1StringDedupEntryList, mtGC>::create_unfreeable((uint)_nlists)) {
+ set_max_size(max_size);
}
G1StringDedupEntryCache::~G1StringDedupEntryCache() {
ShouldNotReachHere();
}
+void G1StringDedupEntryCache::set_max_size(size_t size) {
+ _max_list_length = size / _nlists;
+}
+
G1StringDedupEntry* G1StringDedupEntryCache::alloc() {
for (size_t i = 0; i < _nlists; i++) {
- G1StringDedupEntry* entry = _lists[i].remove();
+ G1StringDedupEntry* entry = _cached[i].remove();
if (entry != NULL) {
return entry;
}
@@ -134,31 +150,53 @@
void G1StringDedupEntryCache::free(G1StringDedupEntry* entry, uint worker_id) {
assert(entry->obj() != NULL, "Double free");
assert(worker_id < _nlists, "Invalid worker id");
+
entry->set_obj(NULL);
entry->set_hash(0);
- _lists[worker_id].add(entry);
+
+ if (_cached[worker_id].length() < _max_list_length) {
+ // Cache is not full
+ _cached[worker_id].add(entry);
+ } else {
+ // Cache is full, add to overflow list for later deletion
+ _overflowed[worker_id].add(entry);
+ }
}
size_t G1StringDedupEntryCache::size() {
size_t size = 0;
for (size_t i = 0; i < _nlists; i++) {
- size += _lists[i].length();
+ size += _cached[i].length();
}
return size;
}
-void G1StringDedupEntryCache::trim(size_t max_size) {
- size_t cache_size = 0;
+void G1StringDedupEntryCache::delete_overflowed() {
+ double start = os::elapsedTime();
+ uintx count = 0;
+
for (size_t i = 0; i < _nlists; i++) {
- G1StringDedupEntryFreeList* list = &_lists[i];
- cache_size += list->length();
- while (cache_size > max_size) {
- G1StringDedupEntry* entry = list->remove();
- assert(entry != NULL, "Should not be null");
- cache_size--;
+ G1StringDedupEntry* entry;
+
+ {
+ // The overflow list can be modified during safepoints, therefore
+ // we temporarily join the suspendible thread set while removing
+ // all entries from the list.
+ SuspendibleThreadSetJoiner sts_join;
+ entry = _overflowed[i].remove_all();
+ }
+
+ // Delete all entries
+ while (entry != NULL) {
+ G1StringDedupEntry* next = entry->next();
delete entry;
+ entry = next;
+ count++;
}
}
+
+ double end = os::elapsedTime();
+ log_trace(gc, stringdedup)("Deleted " UINTX_FORMAT " entries, " G1_STRDEDUP_TIME_FORMAT, count, end - start);
}
G1StringDedupTable* G1StringDedupTable::_table = NULL;
@@ -195,7 +233,7 @@
void G1StringDedupTable::create() {
assert(_table == NULL, "One string deduplication table allowed");
- _entry_cache = new G1StringDedupEntryCache();
+ _entry_cache = new G1StringDedupEntryCache(_min_size * _max_cache_factor);
_table = new G1StringDedupTable(_min_size);
}
@@ -389,6 +427,9 @@
// Update statistics
_resize_count++;
+ // Update max cache size
+ _entry_cache->set_max_size(size * _max_cache_factor);
+
// Allocate the new table. The new table will be populated by workers
// calling unlink_or_oops_do() and finally installed by finish_resize().
return new G1StringDedupTable(size, _table->_hash_seed);
@@ -441,7 +482,7 @@
removed += unlink_or_oops_do(cl, table_half + partition_begin, table_half + partition_end, worker_id);
}
- // Delayed update avoid contention on the table lock
+ // Delayed update to avoid contention on the table lock
if (removed > 0) {
MutexLockerEx ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
_table->_entries -= removed;
@@ -563,10 +604,8 @@
}
}
-void G1StringDedupTable::trim_entry_cache() {
- MutexLockerEx ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
- size_t max_cache_size = (size_t)(_table->_size * _max_cache_factor);
- _entry_cache->trim(max_cache_size);
+void G1StringDedupTable::clean_entry_cache() {
+ _entry_cache->delete_overflowed();
}
void G1StringDedupTable::print_statistics() {
--- a/hotspot/src/share/vm/gc/g1/g1StringDedupTable.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1StringDedupTable.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -229,8 +229,8 @@
// and deletes the previously active table.
static void finish_rehash(G1StringDedupTable* rehashed_table);
- // If the table entry cache has grown too large, trim it down according to policy
- static void trim_entry_cache();
+ // If the table entry cache has grown too large, delete overflowed entries.
+ static void clean_entry_cache();
static void unlink_or_oops_do(G1StringDedupUnlinkOrOopsDoClosure* cl, uint worker_id);
--- a/hotspot/src/share/vm/gc/g1/g1StringDedupThread.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1StringDedupThread.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -121,16 +121,15 @@
}
}
- G1StringDedupTable::trim_entry_cache();
-
stat.mark_done();
// Print statistics
total_stat.add(stat);
print(stat, total_stat);
}
+
+ G1StringDedupTable::clean_entry_cache();
}
-
}
void G1StringDedupThread::stop_service() {
--- a/hotspot/src/share/vm/gc/shared/taskqueue.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -330,6 +330,8 @@
// Push task t onto the queue or onto the overflow stack. Return true.
inline bool push(E t);
+ // Try to push task t onto the queue only. Returns true if successful, false otherwise.
+ inline bool try_push_to_taskqueue(E t);
// Attempt to pop from the overflow stack; return true if anything was popped.
inline bool pop_overflow(E& t);
--- a/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -103,6 +103,11 @@
return true;
}
+template <class E, MEMFLAGS F, unsigned int N>
+inline bool OverflowTaskQueue<E, F, N>::try_push_to_taskqueue(E t) {
+ return taskqueue_t::push(t);
+}
+
// pop_local_slow() is done by the owning thread and is trying to
// get the last task in the queue. It will compete with pop_global()
// that will be used by other threads. The tag age is incremented
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -558,6 +558,7 @@
// resolve field
fieldDescriptor info;
constantPoolHandle pool(thread, method(thread)->constants());
+ methodHandle m(thread, method(thread));
bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_nofast_putfield ||
bytecode == Bytecodes::_putstatic);
bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
@@ -565,7 +566,7 @@
{
JvmtiHideSingleStepping jhss(thread);
LinkResolver::resolve_field_access(info, pool, get_index_u2_cpcache(thread, bytecode),
- bytecode, CHECK);
+ m, bytecode, CHECK);
} // end JvmtiHideSingleStepping
// check if link resolution caused cpCache to be updated
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -223,6 +223,22 @@
//------------------------------------------------------------------------------------------------------------------------
// Implementation of LinkInfo
+LinkInfo::LinkInfo(const constantPoolHandle& pool, int index, methodHandle current_method, TRAPS) {
+ // resolve klass
+ Klass* result = pool->klass_ref_at(index, CHECK);
+ _resolved_klass = KlassHandle(THREAD, result);
+
+ // Get name, signature, and static klass
+ _name = pool->name_ref_at(index);
+ _signature = pool->signature_ref_at(index);
+ _tag = pool->tag_ref_at(index);
+ _current_klass = KlassHandle(THREAD, pool->pool_holder());
+ _current_method = current_method;
+
+ // Coming from the constant pool always checks access
+ _check_access = true;
+}
+
LinkInfo::LinkInfo(const constantPoolHandle& pool, int index, TRAPS) {
// resolve klass
Klass* result = pool->klass_ref_at(index, CHECK);
@@ -233,6 +249,7 @@
_signature = pool->signature_ref_at(index);
_tag = pool->tag_ref_at(index);
_current_klass = KlassHandle(THREAD, pool->pool_holder());
+ _current_method = methodHandle();
// Coming from the constant pool always checks access
_check_access = true;
@@ -577,7 +594,7 @@
return resolve_method(link_info, code, THREAD);
}
- LinkInfo link_info(pool, index, CHECK_NULL);
+ LinkInfo link_info(pool, index, methodHandle(), CHECK_NULL);
resolved_klass = link_info.resolved_klass();
if (pool->has_preresolution()
@@ -875,8 +892,8 @@
}
}
-void LinkResolver::resolve_field_access(fieldDescriptor& fd, const constantPoolHandle& pool, int index, Bytecodes::Code byte, TRAPS) {
- LinkInfo link_info(pool, index, CHECK);
+void LinkResolver::resolve_field_access(fieldDescriptor& fd, const constantPoolHandle& pool, int index, const methodHandle& method, Bytecodes::Code byte, TRAPS) {
+ LinkInfo link_info(pool, index, method, CHECK);
resolve_field(fd, link_info, byte, true, CHECK);
}
@@ -925,9 +942,39 @@
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
}
- // Final fields can only be accessed from its own class.
- if (is_put && fd.access_flags().is_final() && sel_klass() != current_klass()) {
- THROW(vmSymbols::java_lang_IllegalAccessError());
+ // A final field can be modified only
+ // (1) by methods declared in the class declaring the field and
+ // (2) by the <clinit> method (in case of a static field)
+ // or by the <init> method (in case of an instance field).
+ if (is_put && fd.access_flags().is_final()) {
+ ResourceMark rm(THREAD);
+ stringStream ss;
+
+ if (sel_klass() != current_klass()) {
+ ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
+ is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string(),
+ current_klass()->external_name());
+ THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
+ }
+
+ if (fd.constants()->pool_holder()->major_version() >= 53) {
+ methodHandle m = link_info.current_method();
+ assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
+ bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
+ fd.is_static() &&
+ !m()->is_static_initializer());
+ bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
+ !fd.is_static() &&
+ !m->is_object_initializer());
+
+ if (is_initialized_static_final_update || is_initialized_instance_final_update) {
+ ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
+ is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string(),
+ current_klass()->external_name(),
+ is_static ? "<clinit>" : "<init>");
+ THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
+ }
+ }
}
// initialize resolved_klass if necessary
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -131,19 +131,23 @@
// resolved_klass = specified class (i.e., static receiver class)
// current_klass = sending method holder (i.e., class containing the method
// containing the call being resolved)
+// current_method = sending method (relevant for field resolution)
class LinkInfo : public StackObj {
Symbol* _name; // extracted from JVM_CONSTANT_NameAndType
Symbol* _signature;
KlassHandle _resolved_klass; // class that the constant pool entry points to
KlassHandle _current_klass; // class that owns the constant pool
+ methodHandle _current_method; // sending method
bool _check_access;
constantTag _tag;
+
public:
enum AccessCheck {
- needs_access_check,
- skip_access_check
+ needs_access_check,
+ skip_access_check
};
+ LinkInfo(const constantPoolHandle& pool, int index, methodHandle current_method, TRAPS);
LinkInfo(const constantPoolHandle& pool, int index, TRAPS);
// Condensed information from other call sites within the vm.
@@ -151,13 +155,20 @@
AccessCheck check_access = needs_access_check,
constantTag tag = JVM_CONSTANT_Invalid) :
_resolved_klass(resolved_klass),
- _name(name), _signature(signature), _current_klass(current_klass),
+ _name(name), _signature(signature), _current_klass(current_klass), _current_method(NULL),
+ _check_access(check_access == needs_access_check), _tag(tag) {}
+
+ LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, methodHandle current_method,
+ AccessCheck check_access = needs_access_check,
+ constantTag tag = JVM_CONSTANT_Invalid) :
+ _resolved_klass(resolved_klass),
+ _name(name), _signature(signature), _current_klass(current_method->method_holder()), _current_method(current_method),
_check_access(check_access == needs_access_check), _tag(tag) {}
// Case where we just find the method and don't check access against the current class
LinkInfo(KlassHandle resolved_klass, Symbol*name, Symbol* signature) :
_resolved_klass(resolved_klass),
- _name(name), _signature(signature), _current_klass(NULL),
+ _name(name), _signature(signature), _current_klass(NULL), _current_method(NULL),
_check_access(false), _tag(JVM_CONSTANT_Invalid) {}
// accessors
@@ -165,6 +176,7 @@
Symbol* signature() const { return _signature; }
KlassHandle resolved_klass() const { return _resolved_klass; }
KlassHandle current_klass() const { return _current_klass; }
+ methodHandle current_method() const { return _current_method; }
constantTag tag() const { return _tag; }
bool check_access() const { return _check_access; }
char* method_string() const;
@@ -266,7 +278,9 @@
static void resolve_field_access(fieldDescriptor& result,
const constantPoolHandle& pool,
- int index, Bytecodes::Code byte, TRAPS);
+ int index,
+ const methodHandle& method,
+ Bytecodes::Code byte, TRAPS);
static void resolve_field(fieldDescriptor& result, const LinkInfo& link_info,
Bytecodes::Code access_kind,
bool initialize_class, TRAPS);
--- a/hotspot/src/share/vm/interpreter/rewriter.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/rewriter.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -406,10 +406,45 @@
break;
}
+ case Bytecodes::_putstatic :
+ case Bytecodes::_putfield : {
+ if (!reverse) {
+ // Check if any final field of the class given as parameter is modified
+ // outside of initializer methods of the class. Fields that are modified
+ // are marked with a flag. For marked fields, the compilers do not perform
+ // constant folding (as the field can be changed after initialization).
+ //
+ // The check is performed after verification and only if verification has
+ // succeeded. Therefore, the class is guaranteed to be well-formed.
+ InstanceKlass* klass = method->method_holder();
+ u2 bc_index = Bytes::get_Java_u2(bcp + prefix_length + 1);
+ constantPoolHandle cp(method->constants());
+ Symbol* field_name = cp->name_ref_at(bc_index);
+ Symbol* field_sig = cp->signature_ref_at(bc_index);
+ Symbol* ref_class_name = cp->klass_name_at(cp->klass_ref_index_at(bc_index));
+
+ if (klass->name() == ref_class_name) {
+ fieldDescriptor fd;
+ klass->find_field(field_name, field_sig, &fd);
+ if (fd.access_flags().is_final()) {
+ if (fd.access_flags().is_static()) {
+ assert(c == Bytecodes::_putstatic, "must be putstatic");
+ if (!method->is_static_initializer()) {
+ fd.set_has_initialized_final_update(true);
+ }
+ } else {
+ assert(c == Bytecodes::_putfield, "must be putfield");
+ if (!method->is_object_initializer()) {
+ fd.set_has_initialized_final_update(true);
+ }
+ }
+ }
+ }
+ }
+ }
+ // fall through
case Bytecodes::_getstatic : // fall through
- case Bytecodes::_putstatic : // fall through
case Bytecodes::_getfield : // fall through
- case Bytecodes::_putfield : // fall through
case Bytecodes::_invokevirtual : // fall through
case Bytecodes::_invokestatic :
case Bytecodes::_invokeinterface:
--- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -108,8 +108,7 @@
void generate_fixed_frame(bool native_call);
#ifdef SPARC
- void generate_stack_overflow_check(Register Rframe_size, Register Rscratch,
- Register Rscratch2);
+ void generate_stack_overflow_check(Register Rframe_size, Register Rscratch);
void save_native_result(void);
void restore_native_result(void);
#endif // SPARC
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -91,7 +91,19 @@
} else {
// stack slot
if (offset % 4 == 0) {
- return VMRegImpl::stack2reg(offset / 4);
+ VMReg vmReg = VMRegImpl::stack2reg(offset / 4);
+ if (!OopMapValue::legal_vm_reg_name(vmReg)) {
+ // This restriction only applies to VMRegs that are used in OopMap but
+ // since that's the only use of VMRegs it's simplest to put this test
+ // here. This test should also be equivalent legal_vm_reg_name but JVMCI
+ // clients can use max_oop_map_stack_stack_offset to detect this problem
+ // directly. The asserts just ensure that the tests are in agreement.
+ assert(offset > CompilerToVM::Data::max_oop_map_stack_offset(), "illegal VMReg");
+ JVMCI_ERROR_NULL("stack offset %d is too large to be encoded in OopMap (max %d)",
+ offset, CompilerToVM::Data::max_oop_map_stack_offset());
+ }
+ assert(OopMapValue::legal_vm_reg_name(vmReg), "illegal VMReg");
+ return vmReg;
} else {
JVMCI_ERROR_NULL("unaligned stack offset %d in oop map", offset);
}
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -88,41 +88,6 @@
return NULL;
}
-extern "C" {
-extern VMStructEntry* jvmciHotSpotVMStructs;
-extern uint64_t jvmciHotSpotVMStructEntryTypeNameOffset;
-extern uint64_t jvmciHotSpotVMStructEntryFieldNameOffset;
-extern uint64_t jvmciHotSpotVMStructEntryTypeStringOffset;
-extern uint64_t jvmciHotSpotVMStructEntryIsStaticOffset;
-extern uint64_t jvmciHotSpotVMStructEntryOffsetOffset;
-extern uint64_t jvmciHotSpotVMStructEntryAddressOffset;
-extern uint64_t jvmciHotSpotVMStructEntryArrayStride;
-
-extern VMTypeEntry* jvmciHotSpotVMTypes;
-extern uint64_t jvmciHotSpotVMTypeEntryTypeNameOffset;
-extern uint64_t jvmciHotSpotVMTypeEntrySuperclassNameOffset;
-extern uint64_t jvmciHotSpotVMTypeEntryIsOopTypeOffset;
-extern uint64_t jvmciHotSpotVMTypeEntryIsIntegerTypeOffset;
-extern uint64_t jvmciHotSpotVMTypeEntryIsUnsignedOffset;
-extern uint64_t jvmciHotSpotVMTypeEntrySizeOffset;
-extern uint64_t jvmciHotSpotVMTypeEntryArrayStride;
-
-extern VMIntConstantEntry* jvmciHotSpotVMIntConstants;
-extern uint64_t jvmciHotSpotVMIntConstantEntryNameOffset;
-extern uint64_t jvmciHotSpotVMIntConstantEntryValueOffset;
-extern uint64_t jvmciHotSpotVMIntConstantEntryArrayStride;
-
-extern VMLongConstantEntry* jvmciHotSpotVMLongConstants;
-extern uint64_t jvmciHotSpotVMLongConstantEntryNameOffset;
-extern uint64_t jvmciHotSpotVMLongConstantEntryValueOffset;
-extern uint64_t jvmciHotSpotVMLongConstantEntryArrayStride;
-
-extern VMAddressEntry* jvmciHotSpotVMAddresses;
-extern uint64_t jvmciHotSpotVMAddressEntryNameOffset;
-extern uint64_t jvmciHotSpotVMAddressEntryValueOffset;
-extern uint64_t jvmciHotSpotVMAddressEntryArrayStride;
-}
-
int CompilerToVM::Data::Klass_vtable_start_offset;
int CompilerToVM::Data::Klass_vtable_length_offset;
@@ -148,6 +113,7 @@
bool CompilerToVM::Data::_supports_inline_contig_alloc;
HeapWord** CompilerToVM::Data::_heap_end_addr;
HeapWord** CompilerToVM::Data::_heap_top_addr;
+int CompilerToVM::Data::_max_oop_map_stack_offset;
jbyte* CompilerToVM::Data::cardtable_start_address;
int CompilerToVM::Data::cardtable_shift;
@@ -189,6 +155,11 @@
_heap_end_addr = _supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1;
_heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord**) -1;
+ _max_oop_map_stack_offset = (OopMapValue::register_mask - VMRegImpl::stack2reg(0)->value()) * VMRegImpl::stack_slot_size;
+ int max_oop_map_stack_index = _max_oop_map_stack_offset / VMRegImpl::stack_slot_size;
+ assert(OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index)), "should be valid");
+ assert(!OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index + 1)), "should be invalid");
+
BarrierSet* bs = Universe::heap()->barrier_set();
switch (bs->kind()) {
case BarrierSet::CardTableModRef:
@@ -232,48 +203,151 @@
#undef SET_TRIGFUNC
}
-/**
- * We put all jvmciHotSpotVM values in an array so we can read them easily from Java.
- */
-static uintptr_t ciHotSpotVMData[28];
-
-C2V_VMENTRY(jlong, initializeConfiguration, (JNIEnv *env, jobject))
- ciHotSpotVMData[0] = (uintptr_t) jvmciHotSpotVMStructs;
- ciHotSpotVMData[1] = jvmciHotSpotVMStructEntryTypeNameOffset;
- ciHotSpotVMData[2] = jvmciHotSpotVMStructEntryFieldNameOffset;
- ciHotSpotVMData[3] = jvmciHotSpotVMStructEntryTypeStringOffset;
- ciHotSpotVMData[4] = jvmciHotSpotVMStructEntryIsStaticOffset;
- ciHotSpotVMData[5] = jvmciHotSpotVMStructEntryOffsetOffset;
- ciHotSpotVMData[6] = jvmciHotSpotVMStructEntryAddressOffset;
- ciHotSpotVMData[7] = jvmciHotSpotVMStructEntryArrayStride;
-
- ciHotSpotVMData[8] = (uintptr_t) jvmciHotSpotVMTypes;
- ciHotSpotVMData[9] = jvmciHotSpotVMTypeEntryTypeNameOffset;
- ciHotSpotVMData[10] = jvmciHotSpotVMTypeEntrySuperclassNameOffset;
- ciHotSpotVMData[11] = jvmciHotSpotVMTypeEntryIsOopTypeOffset;
- ciHotSpotVMData[12] = jvmciHotSpotVMTypeEntryIsIntegerTypeOffset;
- ciHotSpotVMData[13] = jvmciHotSpotVMTypeEntryIsUnsignedOffset;
- ciHotSpotVMData[14] = jvmciHotSpotVMTypeEntrySizeOffset;
- ciHotSpotVMData[15] = jvmciHotSpotVMTypeEntryArrayStride;
-
- ciHotSpotVMData[16] = (uintptr_t) jvmciHotSpotVMIntConstants;
- ciHotSpotVMData[17] = jvmciHotSpotVMIntConstantEntryNameOffset;
- ciHotSpotVMData[18] = jvmciHotSpotVMIntConstantEntryValueOffset;
- ciHotSpotVMData[19] = jvmciHotSpotVMIntConstantEntryArrayStride;
-
- ciHotSpotVMData[20] = (uintptr_t) jvmciHotSpotVMLongConstants;
- ciHotSpotVMData[21] = jvmciHotSpotVMLongConstantEntryNameOffset;
- ciHotSpotVMData[22] = jvmciHotSpotVMLongConstantEntryValueOffset;
- ciHotSpotVMData[23] = jvmciHotSpotVMLongConstantEntryArrayStride;
-
- ciHotSpotVMData[24] = (uintptr_t) jvmciHotSpotVMAddresses;
- ciHotSpotVMData[25] = jvmciHotSpotVMAddressEntryNameOffset;
- ciHotSpotVMData[26] = jvmciHotSpotVMAddressEntryValueOffset;
- ciHotSpotVMData[27] = jvmciHotSpotVMAddressEntryArrayStride;
+C2V_VMENTRY(jobjectArray, readConfiguration, (JNIEnv *env))
+#define BOXED_LONG(name, value) oop name; do { jvalue p; p.j = (jlong) (value); name = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL);} while(0)
+#define BOXED_DOUBLE(name, value) oop name; do { jvalue p; p.d = (jdouble) (value); name = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL);} while(0)
+ ResourceMark rm;
+ HandleMark hm;
CompilerToVM::Data::initialize();
- return (jlong) (address) &ciHotSpotVMData;
+ VMField::klass()->initialize(thread);
+ VMFlag::klass()->initialize(thread);
+
+ int len = JVMCIVMStructs::localHotSpotVMStructs_count();
+ objArrayHandle vmFields = oopFactory::new_objArray(VMField::klass(), len, CHECK_NULL);
+ for (int i = 0; i < len ; i++) {
+ VMStructEntry vmField = JVMCIVMStructs::localHotSpotVMStructs[i];
+ instanceHandle vmFieldObj = InstanceKlass::cast(VMField::klass())->allocate_instance_handle(CHECK_NULL);
+ size_t name_buf_len = strlen(vmField.typeName) + strlen(vmField.fieldName) + 2 /* "::" */;
+ char* name_buf = NEW_RESOURCE_ARRAY(char, name_buf_len + 1);
+ sprintf(name_buf, "%s::%s", vmField.typeName, vmField.fieldName);
+ Handle name = java_lang_String::create_from_str(name_buf, CHECK_NULL);
+ Handle type = java_lang_String::create_from_str(vmField.typeString, CHECK_NULL);
+ VMField::set_name(vmFieldObj, name());
+ VMField::set_type(vmFieldObj, type());
+ VMField::set_offset(vmFieldObj, vmField.offset);
+ VMField::set_address(vmFieldObj, (jlong) vmField.address);
+ if (vmField.isStatic) {
+ if (strcmp(vmField.typeString, "bool") == 0) {
+ BOXED_LONG(value, *(jbyte*) vmField.address);
+ VMField::set_value(vmFieldObj, value);
+ } else if (strcmp(vmField.typeString, "int") == 0 ||
+ strcmp(vmField.typeString, "jint") == 0) {
+ BOXED_LONG(value, *(jint*) vmField.address);
+ VMField::set_value(vmFieldObj, value);
+ } else if (strcmp(vmField.typeString, "uint64_t") == 0) {
+ BOXED_LONG(value, *(uint64_t*) vmField.address);
+ VMField::set_value(vmFieldObj, value);
+ } else if (strcmp(vmField.typeString, "address") == 0 ||
+ strcmp(vmField.typeString, "intptr_t") == 0 ||
+ strcmp(vmField.typeString, "uintptr_t") == 0 ||
+ strcmp(vmField.typeString, "size_t") == 0 ||
+ // All foo* types are addresses.
+ vmField.typeString[strlen(vmField.typeString) - 1] == '*') {
+ BOXED_LONG(value, *((address*) vmField.address));
+ VMField::set_value(vmFieldObj, value);
+ } else {
+ JVMCI_ERROR_NULL("VM field %s has unsupported type %s", name_buf, vmField.typeString);
+ }
+ }
+ vmFields->obj_at_put(i, vmFieldObj());
+ }
+
+ len = JVMCIVMStructs::localHotSpotVMTypes_count();
+ objArrayHandle vmTypes = oopFactory::new_objArray(SystemDictionary::Object_klass(), len * 2, CHECK_NULL);
+ for (int i = 0; i < len ; i++) {
+ VMTypeEntry vmType = JVMCIVMStructs::localHotSpotVMTypes[i];
+ Handle name = java_lang_String::create_from_str(vmType.typeName, CHECK_NULL);
+ BOXED_LONG(size, vmType.size);
+ vmTypes->obj_at_put(i * 2, name());
+ vmTypes->obj_at_put(i * 2 + 1, size);
+ }
+
+ int ints_len = JVMCIVMStructs::localHotSpotVMIntConstants_count();
+ int longs_len = JVMCIVMStructs::localHotSpotVMLongConstants_count();
+ len = ints_len + longs_len;
+ objArrayHandle vmConstants = oopFactory::new_objArray(SystemDictionary::Object_klass(), len * 2, CHECK_NULL);
+ int insert = 0;
+ for (int i = 0; i < ints_len ; i++) {
+ VMIntConstantEntry c = JVMCIVMStructs::localHotSpotVMIntConstants[i];
+ Handle name = java_lang_String::create_from_str(c.name, CHECK_NULL);
+ BOXED_LONG(value, c.value);
+ vmConstants->obj_at_put(insert++, name());
+ vmConstants->obj_at_put(insert++, value);
+ }
+ for (int i = 0; i < longs_len ; i++) {
+ VMLongConstantEntry c = JVMCIVMStructs::localHotSpotVMLongConstants[i];
+ Handle name = java_lang_String::create_from_str(c.name, CHECK_NULL);
+ BOXED_LONG(value, c.value);
+ vmConstants->obj_at_put(insert++, name());
+ vmConstants->obj_at_put(insert++, value);
+ }
+ assert(insert == len * 2, "must be");
+
+ len = JVMCIVMStructs::localHotSpotVMAddresses_count();
+ objArrayHandle vmAddresses = oopFactory::new_objArray(SystemDictionary::Object_klass(), len * 2, CHECK_NULL);
+ for (int i = 0; i < len ; i++) {
+ VMAddressEntry a = JVMCIVMStructs::localHotSpotVMAddresses[i];
+ Handle name = java_lang_String::create_from_str(a.name, CHECK_NULL);
+ BOXED_LONG(value, a.value);
+ vmAddresses->obj_at_put(i * 2, name());
+ vmAddresses->obj_at_put(i * 2 + 1, value);
+ }
+
+ // The last entry is the null entry.
+ len = (int) Flag::numFlags - 1;
+ objArrayHandle vmFlags = oopFactory::new_objArray(VMFlag::klass(), len, CHECK_NULL);
+ for (int i = 0; i < len; i++) {
+ Flag* flag = &Flag::flags[i];
+ instanceHandle vmFlagObj = InstanceKlass::cast(VMFlag::klass())->allocate_instance_handle(CHECK_NULL);
+ Handle name = java_lang_String::create_from_str(flag->_name, CHECK_NULL);
+ Handle type = java_lang_String::create_from_str(flag->_type, CHECK_NULL);
+ VMFlag::set_name(vmFlagObj, name());
+ VMFlag::set_type(vmFlagObj, type());
+ if (flag->is_bool()) {
+ BOXED_LONG(value, flag->get_bool());
+ VMFlag::set_value(vmFlagObj, value);
+ } else if (flag->is_ccstr()) {
+ Handle value = java_lang_String::create_from_str(flag->get_ccstr(), CHECK_NULL);
+ VMFlag::set_value(vmFlagObj, value());
+ } else if (flag->is_int()) {
+ BOXED_LONG(value, flag->get_int());
+ VMFlag::set_value(vmFlagObj, value);
+ } else if (flag->is_intx()) {
+ BOXED_LONG(value, flag->get_intx());
+ VMFlag::set_value(vmFlagObj, value);
+ } else if (flag->is_uint()) {
+ BOXED_LONG(value, flag->get_uint());
+ VMFlag::set_value(vmFlagObj, value);
+ } else if (flag->is_uint64_t()) {
+ BOXED_LONG(value, flag->get_uint64_t());
+ VMFlag::set_value(vmFlagObj, value);
+ } else if (flag->is_uintx()) {
+ BOXED_LONG(value, flag->get_uintx());
+ VMFlag::set_value(vmFlagObj, value);
+ } else if (flag->is_double()) {
+ BOXED_DOUBLE(value, flag->get_double());
+ VMFlag::set_value(vmFlagObj, value);
+ } else if (flag->is_size_t()) {
+ BOXED_LONG(value, flag->get_size_t());
+ VMFlag::set_value(vmFlagObj, value);
+ } else {
+ JVMCI_ERROR_NULL("VM flag %s has unsupported type %s", flag->_name, flag->_type);
+ }
+ vmFlags->obj_at_put(i, vmFlagObj());
+ }
+
+ objArrayOop data = oopFactory::new_objArray(SystemDictionary::Object_klass(), 5, CHECK_NULL);
+ data->obj_at_put(0, vmFields());
+ data->obj_at_put(1, vmTypes());
+ data->obj_at_put(2, vmConstants());
+ data->obj_at_put(3, vmAddresses());
+ data->obj_at_put(4, vmFlags());
+
+ return (jobjectArray) JNIHandles::make_local(THREAD, data);
+#undef BOXED_LONG
+#undef BOXED_DOUBLE
C2V_END
C2V_VMENTRY(jbyteArray, getBytecode, (JNIEnv *, jobject, jobject jvmci_method))
@@ -621,12 +695,12 @@
return cp->remap_instruction_operand_from_cache(index);
C2V_END
-C2V_VMENTRY(jobject, resolveFieldInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode, jlongArray info_handle))
+C2V_VMENTRY(jobject, resolveFieldInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jobject jvmci_method, jbyte opcode, jlongArray info_handle))
ResourceMark rm;
constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF);
fieldDescriptor fd;
- LinkInfo link_info(cp, index, CHECK_0);
+ LinkInfo link_info(cp, index, (jvmci_method != NULL) ? CompilerToVM::asMethod(jvmci_method) : NULL, CHECK_0);
LinkResolver::resolve_field(fd, link_info, Bytecodes::java_code(code), false, CHECK_0);
typeArrayOop info = (typeArrayOop) JNIHandles::resolve(info_handle);
assert(info != NULL && info->length() == 2, "must be");
@@ -1438,7 +1512,7 @@
{CC "resolveConstantInPool", CC "(" HS_CONSTANT_POOL "I)" OBJECT, FN_PTR(resolveConstantInPool)},
{CC "resolvePossiblyCachedConstantInPool", CC "(" HS_CONSTANT_POOL "I)" OBJECT, FN_PTR(resolvePossiblyCachedConstantInPool)},
{CC "resolveTypeInPool", CC "(" HS_CONSTANT_POOL "I)" HS_RESOLVED_KLASS, FN_PTR(resolveTypeInPool)},
- {CC "resolveFieldInPool", CC "(" HS_CONSTANT_POOL "IB[J)" HS_RESOLVED_KLASS, FN_PTR(resolveFieldInPool)},
+ {CC "resolveFieldInPool", CC "(" HS_CONSTANT_POOL "I" HS_RESOLVED_METHOD "B[J)" HS_RESOLVED_KLASS, FN_PTR(resolveFieldInPool)},
{CC "resolveInvokeDynamicInPool", CC "(" HS_CONSTANT_POOL "I)V", FN_PTR(resolveInvokeDynamicInPool)},
{CC "resolveInvokeHandleInPool", CC "(" HS_CONSTANT_POOL "I)V", FN_PTR(resolveInvokeHandleInPool)},
{CC "resolveMethod", CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD HS_RESOLVED_KLASS ")" HS_RESOLVED_METHOD, FN_PTR(resolveMethod)},
@@ -1450,7 +1524,7 @@
{CC "getResolvedJavaMethod", CC "(Ljava/lang/Object;J)" HS_RESOLVED_METHOD, FN_PTR(getResolvedJavaMethod)},
{CC "getConstantPool", CC "(Ljava/lang/Object;J)" HS_CONSTANT_POOL, FN_PTR(getConstantPool)},
{CC "getResolvedJavaType", CC "(Ljava/lang/Object;JZ)" HS_RESOLVED_KLASS, FN_PTR(getResolvedJavaType)},
- {CC "initializeConfiguration", CC "(" HS_CONFIG ")J", FN_PTR(initializeConfiguration)},
+ {CC "readConfiguration", CC "()[" OBJECT, FN_PTR(readConfiguration)},
{CC "installCode", CC "(" TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG ")I", FN_PTR(installCode)},
{CC "getMetadata", CC "(" TARGET_DESCRIPTION HS_COMPILED_CODE HS_METADATA ")I", FN_PTR(getMetadata)},
{CC "resetCompilationStatistics", CC "()V", FN_PTR(resetCompilationStatistics)},
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -59,6 +59,7 @@
static bool _supports_inline_contig_alloc;
static HeapWord** _heap_end_addr;
static HeapWord** _heap_top_addr;
+ static int _max_oop_map_stack_offset;
static jbyte* cardtable_start_address;
static int cardtable_shift;
@@ -75,6 +76,11 @@
public:
static void initialize();
+
+ static int max_oop_map_stack_offset() {
+ assert(_max_oop_map_stack_offset > 0, "must be initialized");
+ return Data::_max_oop_map_stack_offset;
+ }
};
public:
--- a/hotspot/src/share/vm/jvmci/jvmciJavaClasses.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciJavaClasses.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -112,6 +112,18 @@
start_class(HotSpotForeignCallTarget) \
long_field(HotSpotForeignCallTarget, address) \
end_class \
+ start_class(VMField) \
+ oop_field(VMField, name, "Ljava/lang/String;") \
+ oop_field(VMField, type, "Ljava/lang/String;") \
+ long_field(VMField, offset) \
+ long_field(VMField, address) \
+ oop_field(VMField, value, "Ljava/lang/Long;") \
+ end_class \
+ start_class(VMFlag) \
+ oop_field(VMFlag, name, "Ljava/lang/String;") \
+ oop_field(VMFlag, type, "Ljava/lang/String;") \
+ oop_field(VMFlag, value, "Ljava/lang/Object;") \
+ end_class \
start_class(Assumptions_NoFinalizableSubclass) \
oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Ljdk/vm/ci/meta/ResolvedJavaType;") \
end_class \
--- a/hotspot/src/share/vm/jvmci/systemDictionary_jvmci.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/systemDictionary_jvmci.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -49,6 +49,8 @@
do_klass(HotSpotJVMCIRuntime_klass, jdk_vm_ci_hotspot_HotSpotJVMCIRuntime, Jvmci) \
do_klass(HotSpotSpeculationLog_klass, jdk_vm_ci_hotspot_HotSpotSpeculationLog, Jvmci) \
do_klass(HotSpotCompilationRequestResult_klass, jdk_vm_ci_hotspot_HotSpotCompilationRequestResult, Jvmci) \
+ do_klass(VMField_klass, jdk_vm_ci_hotspot_VMField, Jvmci) \
+ do_klass(VMFlag_klass, jdk_vm_ci_hotspot_VMFlag, Jvmci) \
do_klass(Assumptions_ConcreteMethod_klass, jdk_vm_ci_meta_Assumptions_ConcreteMethod, Jvmci) \
do_klass(Assumptions_NoFinalizableSubclass_klass, jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass, Jvmci) \
do_klass(Assumptions_ConcreteSubtype_klass, jdk_vm_ci_meta_Assumptions_ConcreteSubtype, Jvmci) \
--- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -71,6 +71,8 @@
static_field(CompilerToVM::Data, _heap_end_addr, HeapWord**) \
static_field(CompilerToVM::Data, _heap_top_addr, HeapWord**) \
\
+ static_field(CompilerToVM::Data, _max_oop_map_stack_offset, int) \
+ \
static_field(CompilerToVM::Data, cardtable_start_address, jbyte*) \
static_field(CompilerToVM::Data, cardtable_shift, int) \
\
@@ -539,6 +541,8 @@
declare_function(SharedRuntime::exception_handler_for_return_address) \
declare_function(SharedRuntime::OSR_migration_end) \
declare_function(SharedRuntime::enable_stack_reserved_zone) \
+ declare_function(SharedRuntime::frem) \
+ declare_function(SharedRuntime::drem) \
\
declare_function(os::dll_load) \
declare_function(os::dll_lookup) \
@@ -733,22 +737,6 @@
#endif
-// whole purpose of this function is to work around bug c++/27724 in gcc 4.1.1
-// with optimization turned on it doesn't affect produced code
-static inline uint64_t cast_uint64_t(size_t x)
-{
- return x;
-}
-
-#define ASSIGN_CONST_TO_64BIT_VAR(var, expr) \
- JNIEXPORT uint64_t var = cast_uint64_t(expr);
-
-#define ASSIGN_OFFSET_TO_64BIT_VAR(var, type, field) \
- ASSIGN_CONST_TO_64BIT_VAR(var, offset_of(type, field))
-
-#define ASSIGN_STRIDE_TO_64BIT_VAR(var, array) \
- ASSIGN_CONST_TO_64BIT_VAR(var, (char*)&array[1] - (char*)&array[0])
-
//
// Instantiation of VMStructEntries, VMTypeEntries and VMIntConstantEntries
//
@@ -871,37 +859,31 @@
GENERATE_VM_ADDRESS_LAST_ENTRY()
};
+int JVMCIVMStructs::localHotSpotVMStructs_count() {
+ // Ignore sentinel entry at the end
+ return (sizeof(localHotSpotVMStructs) / sizeof(VMStructEntry)) - 1;
+}
+int JVMCIVMStructs::localHotSpotVMTypes_count() {
+ // Ignore sentinel entry at the end
+ return (sizeof(localHotSpotVMTypes) / sizeof(VMTypeEntry)) - 1;
+}
+int JVMCIVMStructs::localHotSpotVMIntConstants_count() {
+ // Ignore sentinel entry at the end
+ return (sizeof(localHotSpotVMIntConstants) / sizeof(VMIntConstantEntry)) - 1;
+}
+int JVMCIVMStructs::localHotSpotVMLongConstants_count() {
+ // Ignore sentinel entry at the end
+ return (sizeof(localHotSpotVMLongConstants) / sizeof(VMLongConstantEntry)) - 1;
+}
+int JVMCIVMStructs::localHotSpotVMAddresses_count() {
+ // Ignore sentinel entry at the end
+ return (sizeof(localHotSpotVMAddresses) / sizeof(VMAddressEntry)) - 1;
+}
+
extern "C" {
JNIEXPORT VMStructEntry* jvmciHotSpotVMStructs = JVMCIVMStructs::localHotSpotVMStructs;
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMStructEntryTypeNameOffset, VMStructEntry, typeName);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMStructEntryFieldNameOffset, VMStructEntry, fieldName);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMStructEntryTypeStringOffset, VMStructEntry, typeString);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMStructEntryIsStaticOffset, VMStructEntry, isStatic);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMStructEntryOffsetOffset, VMStructEntry, offset);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMStructEntryAddressOffset, VMStructEntry, address);
-ASSIGN_STRIDE_TO_64BIT_VAR(jvmciHotSpotVMStructEntryArrayStride, jvmciHotSpotVMStructs);
-
JNIEXPORT VMTypeEntry* jvmciHotSpotVMTypes = JVMCIVMStructs::localHotSpotVMTypes;
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMTypeEntryTypeNameOffset, VMTypeEntry, typeName);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMTypeEntrySuperclassNameOffset, VMTypeEntry, superclassName);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMTypeEntryIsOopTypeOffset, VMTypeEntry, isOopType);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMTypeEntryIsIntegerTypeOffset, VMTypeEntry, isIntegerType);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMTypeEntryIsUnsignedOffset, VMTypeEntry, isUnsigned);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMTypeEntrySizeOffset, VMTypeEntry, size);
-ASSIGN_STRIDE_TO_64BIT_VAR(jvmciHotSpotVMTypeEntryArrayStride, jvmciHotSpotVMTypes);
-
JNIEXPORT VMIntConstantEntry* jvmciHotSpotVMIntConstants = JVMCIVMStructs::localHotSpotVMIntConstants;
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMIntConstantEntryNameOffset, VMIntConstantEntry, name);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMIntConstantEntryValueOffset, VMIntConstantEntry, value);
-ASSIGN_STRIDE_TO_64BIT_VAR(jvmciHotSpotVMIntConstantEntryArrayStride, jvmciHotSpotVMIntConstants);
-
JNIEXPORT VMLongConstantEntry* jvmciHotSpotVMLongConstants = JVMCIVMStructs::localHotSpotVMLongConstants;
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMLongConstantEntryNameOffset, VMLongConstantEntry, name);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMLongConstantEntryValueOffset, VMLongConstantEntry, value);
-ASSIGN_STRIDE_TO_64BIT_VAR(jvmciHotSpotVMLongConstantEntryArrayStride, jvmciHotSpotVMLongConstants);
-
JNIEXPORT VMAddressEntry* jvmciHotSpotVMAddresses = JVMCIVMStructs::localHotSpotVMAddresses;
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMAddressEntryNameOffset, VMAddressEntry, name);
-ASSIGN_OFFSET_TO_64BIT_VAR(jvmciHotSpotVMAddressEntryValueOffset, VMAddressEntry, value);
-ASSIGN_STRIDE_TO_64BIT_VAR(jvmciHotSpotVMAddressEntryArrayStride, jvmciHotSpotVMAddresses);
}
--- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, 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
@@ -55,6 +55,12 @@
* Table of addresses.
*/
static VMAddressEntry localHotSpotVMAddresses[];
+
+ static int localHotSpotVMStructs_count();
+ static int localHotSpotVMTypes_count();
+ static int localHotSpotVMIntConstants_count();
+ static int localHotSpotVMLongConstants_count();
+ static int localHotSpotVMAddresses_count();
};
#endif // SHARE_VM_JVMCI_VMSTRUCTS_JVMCI_HPP
--- a/hotspot/src/share/vm/jvmci/vmSymbols_jvmci.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/vmSymbols_jvmci.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -50,6 +50,8 @@
template(jdk_vm_ci_hotspot_HotSpotJVMCIRuntime, "jdk/vm/ci/hotspot/HotSpotJVMCIRuntime") \
template(jdk_vm_ci_hotspot_HotSpotSpeculationLog, "jdk/vm/ci/hotspot/HotSpotSpeculationLog") \
template(jdk_vm_ci_hotspot_HotSpotCompilationRequestResult, "jdk/vm/ci/hotspot/HotSpotCompilationRequestResult") \
+ template(jdk_vm_ci_hotspot_VMField, "jdk/vm/ci/hotspot/VMField") \
+ template(jdk_vm_ci_hotspot_VMFlag, "jdk/vm/ci/hotspot/VMFlag") \
template(jdk_vm_ci_meta_JavaConstant, "jdk/vm/ci/meta/JavaConstant") \
template(jdk_vm_ci_meta_PrimitiveConstant, "jdk/vm/ci/meta/PrimitiveConstant") \
template(jdk_vm_ci_meta_RawConstant, "jdk/vm/ci/meta/RawConstant") \
--- a/hotspot/src/share/vm/memory/allocation.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/memory/allocation.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -28,6 +28,7 @@
#include "runtime/atomic.inline.hpp"
#include "runtime/os.hpp"
#include "services/memTracker.hpp"
+#include "utilities/globalDefinitions.hpp"
// Explicit C-heap memory management
@@ -63,18 +64,12 @@
return p;
}
-#ifdef __GNUC__
-__attribute__((always_inline))
-#endif
-inline char* AllocateHeap(size_t size, MEMFLAGS flags,
+ALWAYSINLINE char* AllocateHeap(size_t size, MEMFLAGS flags,
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
return AllocateHeap(size, flags, CURRENT_PC, alloc_failmode);
}
-#ifdef __GNUC__
-__attribute__((always_inline))
-#endif
-inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag,
+ALWAYSINLINE char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag,
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
char* p = (char*) os::realloc(old, size, flag, CURRENT_PC);
#ifdef ASSERT
--- a/hotspot/src/share/vm/memory/universe.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/memory/universe.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1070,13 +1070,13 @@
}
void Universe::print_on(outputStream* st) {
+ GCMutexLocker hl(Heap_lock); // Heap_lock might be locked by caller thread.
st->print_cr("Heap");
heap()->print_on(st);
}
void Universe::print_heap_at_SIGBREAK() {
if (PrintHeapAtSIGBREAK) {
- MutexLocker hl(Heap_lock);
print_on(tty);
tty->cr();
tty->flush();
--- a/hotspot/src/share/vm/oops/constantPool.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/oops/constantPool.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -691,16 +691,21 @@
ref_kind, index, this_cp->method_handle_index_at(index),
callee_index, name->as_C_string(), signature->as_C_string());
}
- KlassHandle callee;
- { Klass* k = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
- callee = KlassHandle(THREAD, k);
- }
+
+ Klass* k = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
+ KlassHandle callee(THREAD, k);
+
+ // Check constant pool method consistency
if ((callee->is_interface() && m_tag.is_method()) ||
- (!callee->is_interface() && m_tag.is_interface_method())) {
+ ((!callee->is_interface() && m_tag.is_interface_method()))) {
ResourceMark rm(THREAD);
- char buf[200];
- jio_snprintf(buf, sizeof(buf), "Inconsistent constant data for %s.%s%s at index %d",
- callee->name()->as_C_string(), name->as_C_string(), signature->as_C_string(), index);
+ char buf[400];
+ jio_snprintf(buf, sizeof(buf),
+ "Inconsistent constant pool data in classfile for class %s. "
+ "Method %s%s at index %d is %s and should be %s",
+ callee->name()->as_C_string(), name->as_C_string(), signature->as_C_string(), index,
+ callee->is_interface() ? "CONSTANT_MethodRef" : "CONSTANT_InterfaceMethodRef",
+ callee->is_interface() ? "CONSTANT_InterfaceMethodRef" : "CONSTANT_MethodRef");
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
}
--- a/hotspot/src/share/vm/oops/cpCache.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/oops/cpCache.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -193,7 +193,7 @@
field_index_mask = right_n_bits(field_index_bits),
parameter_size_bits = 8, // subset of field_index_mask, range is 0..255
parameter_size_mask = right_n_bits(parameter_size_bits),
- option_bits_mask = ~(((-1) << tos_state_shift) | (field_index_mask | parameter_size_mask))
+ option_bits_mask = ~(((~0u) << tos_state_shift) | (field_index_mask | parameter_size_mask))
};
// specific bit definitions for the indices field:
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1961,6 +1961,11 @@
m->remove_unshareable_info();
}
+ // cached_class_file might be pointing to a malloc'ed buffer allocated by
+ // event-based tracing code at CDS dump time. It's not usable at runtime
+ // so let's clear it.
+ set_cached_class_file(NULL);
+
// do array classes also.
array_klasses_do(remove_unshareable_in_class);
}
--- a/hotspot/src/share/vm/oops/klass.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/oops/klass.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -482,6 +482,7 @@
void Klass::remove_unshareable_info() {
assert (DumpSharedSpaces, "only called for DumpSharedSpaces");
+ TRACE_REMOVE_KLASS_ID(this);
set_subklass(NULL);
set_next_sibling(NULL);
@@ -494,7 +495,8 @@
}
void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
- TRACE_INIT_KLASS_ID(this);
+ TRACE_RESTORE_KLASS_ID(this);
+
// If an exception happened during CDS restore, some of these fields may already be
// set. We leave the class on the CLD list, even if incomplete so that we don't
// modify the CLD list outside a safepoint.
--- a/hotspot/src/share/vm/oops/method.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/oops/method.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -627,7 +627,7 @@
}
bool Method::is_initializer() const {
- return name() == vmSymbols::object_initializer_name() || is_static_initializer();
+ return is_object_initializer() || is_static_initializer();
}
bool Method::has_valid_initializer_flags() const {
@@ -643,6 +643,9 @@
has_valid_initializer_flags();
}
+bool Method::is_object_initializer() const {
+ return name() == vmSymbols::object_initializer_name();
+}
objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {
int length = method->checked_exceptions_length();
--- a/hotspot/src/share/vm/oops/method.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/oops/method.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -638,6 +638,9 @@
// valid static initializer flags.
bool is_static_initializer() const;
+ // returns true if the method name is <init>
+ bool is_object_initializer() const;
+
// compiled code support
// NOTE: code() is inherently racy as deopt can be clearing code
// simultaneously. Use with caution.
--- a/hotspot/src/share/vm/opto/c2_globals.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -73,10 +73,10 @@
constraint, \
writeable) \
\
- develop(bool, StressLCM, false, \
+ diagnostic(bool, StressLCM, false, \
"Randomize instruction scheduling in LCM") \
\
- develop(bool, StressGCM, false, \
+ diagnostic(bool, StressGCM, false, \
"Randomize instruction scheduling in GCM") \
\
develop(intx, OptoPrologueNops, 0, \
--- a/hotspot/src/share/vm/opto/c2compiler.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -256,6 +256,7 @@
case vmIntrinsics::_weakCompareAndSwapObject:
case vmIntrinsics::_weakCompareAndSwapObjectAcquire:
case vmIntrinsics::_weakCompareAndSwapObjectRelease:
+ case vmIntrinsics::_weakCompareAndSwapObjectVolatile:
#ifdef _LP64
if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false;
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false;
@@ -270,6 +271,7 @@
case vmIntrinsics::_weakCompareAndSwapLong:
case vmIntrinsics::_weakCompareAndSwapLongAcquire:
case vmIntrinsics::_weakCompareAndSwapLongRelease:
+ case vmIntrinsics::_weakCompareAndSwapLongVolatile:
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false;
break;
@@ -280,9 +282,32 @@
case vmIntrinsics::_weakCompareAndSwapInt:
case vmIntrinsics::_weakCompareAndSwapIntAcquire:
case vmIntrinsics::_weakCompareAndSwapIntRelease:
+ case vmIntrinsics::_weakCompareAndSwapIntVolatile:
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false;
break;
+ /* CompareAndSwap, Byte: */
+ case vmIntrinsics::_compareAndSwapByte:
+ if (!Matcher::match_rule_supported(Op_CompareAndSwapB)) return false;
+ break;
+ case vmIntrinsics::_weakCompareAndSwapByte:
+ case vmIntrinsics::_weakCompareAndSwapByteAcquire:
+ case vmIntrinsics::_weakCompareAndSwapByteRelease:
+ case vmIntrinsics::_weakCompareAndSwapByteVolatile:
+ if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapB)) return false;
+ break;
+
+ /* CompareAndSwap, Short: */
+ case vmIntrinsics::_compareAndSwapShort:
+ if (!Matcher::match_rule_supported(Op_CompareAndSwapS)) return false;
+ break;
+ case vmIntrinsics::_weakCompareAndSwapShort:
+ case vmIntrinsics::_weakCompareAndSwapShortAcquire:
+ case vmIntrinsics::_weakCompareAndSwapShortRelease:
+ case vmIntrinsics::_weakCompareAndSwapShortVolatile:
+ if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapS)) return false;
+ break;
+
/* CompareAndExchange, Object: */
case vmIntrinsics::_compareAndExchangeObjectVolatile:
case vmIntrinsics::_compareAndExchangeObjectAcquire:
@@ -309,12 +334,39 @@
if (!Matcher::match_rule_supported(Op_CompareAndExchangeI)) return false;
break;
+ /* CompareAndExchange, Byte: */
+ case vmIntrinsics::_compareAndExchangeByteVolatile:
+ case vmIntrinsics::_compareAndExchangeByteAcquire:
+ case vmIntrinsics::_compareAndExchangeByteRelease:
+ if (!Matcher::match_rule_supported(Op_CompareAndExchangeB)) return false;
+ break;
+
+ /* CompareAndExchange, Short: */
+ case vmIntrinsics::_compareAndExchangeShortVolatile:
+ case vmIntrinsics::_compareAndExchangeShortAcquire:
+ case vmIntrinsics::_compareAndExchangeShortRelease:
+ if (!Matcher::match_rule_supported(Op_CompareAndExchangeS)) return false;
+ break;
+
+ case vmIntrinsics::_getAndAddByte:
+ if (!Matcher::match_rule_supported(Op_GetAndAddB)) return false;
+ break;
+ case vmIntrinsics::_getAndAddShort:
+ if (!Matcher::match_rule_supported(Op_GetAndAddS)) return false;
+ break;
case vmIntrinsics::_getAndAddInt:
if (!Matcher::match_rule_supported(Op_GetAndAddI)) return false;
break;
case vmIntrinsics::_getAndAddLong:
if (!Matcher::match_rule_supported(Op_GetAndAddL)) return false;
break;
+
+ case vmIntrinsics::_getAndSetByte:
+ if (!Matcher::match_rule_supported(Op_GetAndSetB)) return false;
+ break;
+ case vmIntrinsics::_getAndSetShort:
+ if (!Matcher::match_rule_supported(Op_GetAndSetS)) return false;
+ break;
case vmIntrinsics::_getAndSetInt:
if (!Matcher::match_rule_supported(Op_GetAndSetI)) return false;
break;
--- a/hotspot/src/share/vm/opto/classes.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/classes.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -81,20 +81,30 @@
macro(CmpLTMask)
macro(CmpP)
macro(CmpU)
+macro(CompareAndSwapB)
+macro(CompareAndSwapS)
macro(CompareAndSwapI)
macro(CompareAndSwapL)
macro(CompareAndSwapP)
macro(CompareAndSwapN)
+macro(WeakCompareAndSwapB)
+macro(WeakCompareAndSwapS)
macro(WeakCompareAndSwapI)
macro(WeakCompareAndSwapL)
macro(WeakCompareAndSwapP)
macro(WeakCompareAndSwapN)
+macro(CompareAndExchangeB)
+macro(CompareAndExchangeS)
macro(CompareAndExchangeI)
macro(CompareAndExchangeL)
macro(CompareAndExchangeP)
macro(CompareAndExchangeN)
+macro(GetAndAddB)
+macro(GetAndAddS)
macro(GetAndAddI)
macro(GetAndAddL)
+macro(GetAndSetB)
+macro(GetAndSetS)
macro(GetAndSetI)
macro(GetAndSetL)
macro(GetAndSetP)
--- a/hotspot/src/share/vm/opto/compile.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/compile.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -778,7 +778,7 @@
}
if (failing()) return;
if (cg == NULL) {
- record_method_not_compilable_all_tiers("cannot parse method");
+ record_method_not_compilable("cannot parse method");
return;
}
JVMState* jvms = build_start_state(start(), tf());
@@ -2794,20 +2794,30 @@
case Op_StoreL:
case Op_StoreIConditional:
case Op_StoreLConditional:
+ case Op_CompareAndSwapB:
+ case Op_CompareAndSwapS:
case Op_CompareAndSwapI:
case Op_CompareAndSwapL:
case Op_CompareAndSwapP:
case Op_CompareAndSwapN:
+ case Op_WeakCompareAndSwapB:
+ case Op_WeakCompareAndSwapS:
case Op_WeakCompareAndSwapI:
case Op_WeakCompareAndSwapL:
case Op_WeakCompareAndSwapP:
case Op_WeakCompareAndSwapN:
+ case Op_CompareAndExchangeB:
+ case Op_CompareAndExchangeS:
case Op_CompareAndExchangeI:
case Op_CompareAndExchangeL:
case Op_CompareAndExchangeP:
case Op_CompareAndExchangeN:
+ case Op_GetAndAddS:
+ case Op_GetAndAddB:
case Op_GetAndAddI:
case Op_GetAndAddL:
+ case Op_GetAndSetS:
+ case Op_GetAndSetB:
case Op_GetAndSetI:
case Op_GetAndSetL:
case Op_GetAndSetP:
--- a/hotspot/src/share/vm/opto/compile.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/compile.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -823,16 +823,12 @@
}
void record_failure(const char* reason);
- void record_method_not_compilable(const char* reason, bool all_tiers = false) {
- // All bailouts cover "all_tiers" when TieredCompilation is off.
- if (!TieredCompilation) all_tiers = true;
- env()->record_method_not_compilable(reason, all_tiers);
+ void record_method_not_compilable(const char* reason) {
+ // Bailouts cover "all_tiers" when TieredCompilation is off.
+ env()->record_method_not_compilable(reason, !TieredCompilation);
// Record failure reason.
record_failure(reason);
}
- void record_method_not_compilable_all_tiers(const char* reason) {
- record_method_not_compilable(reason, true);
- }
bool check_node_count(uint margin, const char* reason) {
if (live_nodes() + margin > max_node_limit()) {
record_method_not_compilable(reason);
--- a/hotspot/src/share/vm/opto/library_call.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/library_call.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -645,6 +645,8 @@
case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false);
case vmIntrinsics::_compareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile);
+ case vmIntrinsics::_compareAndSwapByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile);
+ case vmIntrinsics::_compareAndSwapShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSwapLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile);
@@ -652,6 +654,14 @@
case vmIntrinsics::_weakCompareAndSwapObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSwapObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSwapObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
+ case vmIntrinsics::_weakCompareAndSwapByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed);
+ case vmIntrinsics::_weakCompareAndSwapByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire);
+ case vmIntrinsics::_weakCompareAndSwapByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release);
+ case vmIntrinsics::_weakCompareAndSwapByteVolatile: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile);
+ case vmIntrinsics::_weakCompareAndSwapShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed);
+ case vmIntrinsics::_weakCompareAndSwapShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire);
+ case vmIntrinsics::_weakCompareAndSwapShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release);
+ case vmIntrinsics::_weakCompareAndSwapShortVolatile: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSwapIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSwapIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release);
@@ -664,6 +674,12 @@
case vmIntrinsics::_compareAndExchangeObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Release);
+ case vmIntrinsics::_compareAndExchangeByteVolatile: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile);
+ case vmIntrinsics::_compareAndExchangeByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Acquire);
+ case vmIntrinsics::_compareAndExchangeByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Release);
+ case vmIntrinsics::_compareAndExchangeShortVolatile: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile);
+ case vmIntrinsics::_compareAndExchangeShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Acquire);
+ case vmIntrinsics::_compareAndExchangeShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeIntVolatile: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Release);
@@ -671,8 +687,13 @@
case vmIntrinsics::_compareAndExchangeLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Release);
+ case vmIntrinsics::_getAndAddByte: return inline_unsafe_load_store(T_BYTE, LS_get_add, Volatile);
+ case vmIntrinsics::_getAndAddShort: return inline_unsafe_load_store(T_SHORT, LS_get_add, Volatile);
case vmIntrinsics::_getAndAddInt: return inline_unsafe_load_store(T_INT, LS_get_add, Volatile);
case vmIntrinsics::_getAndAddLong: return inline_unsafe_load_store(T_LONG, LS_get_add, Volatile);
+
+ case vmIntrinsics::_getAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_get_set, Volatile);
+ case vmIntrinsics::_getAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_get_set, Volatile);
case vmIntrinsics::_getAndSetInt: return inline_unsafe_load_store(T_INT, LS_get_set, Volatile);
case vmIntrinsics::_getAndSetLong: return inline_unsafe_load_store(T_LONG, LS_get_set, Volatile);
case vmIntrinsics::_getAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_get_set, Volatile);
@@ -2849,6 +2870,48 @@
// longs, and Object. Adding others should be straightforward.
Node* load_store = NULL;
switch(type) {
+ case T_BYTE:
+ switch(kind) {
+ case LS_get_add:
+ load_store = _gvn.transform(new GetAndAddBNode(control(), mem, adr, newval, adr_type));
+ break;
+ case LS_get_set:
+ load_store = _gvn.transform(new GetAndSetBNode(control(), mem, adr, newval, adr_type));
+ break;
+ case LS_cmp_swap_weak:
+ load_store = _gvn.transform(new WeakCompareAndSwapBNode(control(), mem, adr, newval, oldval, mo));
+ break;
+ case LS_cmp_swap:
+ load_store = _gvn.transform(new CompareAndSwapBNode(control(), mem, adr, newval, oldval, mo));
+ break;
+ case LS_cmp_exchange:
+ load_store = _gvn.transform(new CompareAndExchangeBNode(control(), mem, adr, newval, oldval, adr_type, mo));
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ break;
+ case T_SHORT:
+ switch(kind) {
+ case LS_get_add:
+ load_store = _gvn.transform(new GetAndAddSNode(control(), mem, adr, newval, adr_type));
+ break;
+ case LS_get_set:
+ load_store = _gvn.transform(new GetAndSetSNode(control(), mem, adr, newval, adr_type));
+ break;
+ case LS_cmp_swap_weak:
+ load_store = _gvn.transform(new WeakCompareAndSwapSNode(control(), mem, adr, newval, oldval, mo));
+ break;
+ case LS_cmp_swap:
+ load_store = _gvn.transform(new CompareAndSwapSNode(control(), mem, adr, newval, oldval, mo));
+ break;
+ case LS_cmp_exchange:
+ load_store = _gvn.transform(new CompareAndExchangeSNode(control(), mem, adr, newval, oldval, adr_type, mo));
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ break;
case T_INT:
switch(kind) {
case LS_get_add:
--- a/hotspot/src/share/vm/opto/loopTransform.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -868,7 +868,7 @@
Node *bol = iff->in(1);
if (bol->req() != 2) continue; // dead constant test
if (!bol->is_Bool()) {
- assert(UseLoopPredicate && bol->Opcode() == Op_Conv2B, "predicate check only");
+ assert(bol->Opcode() == Op_Conv2B, "predicate check only");
continue;
}
if (bol->as_Bool()->_test._test == BoolTest::ne)
@@ -1760,14 +1760,6 @@
}
}
-//------------------------------dominates_backedge---------------------------------
-// Returns true if ctrl is executed on every complete iteration
-bool IdealLoopTree::dominates_backedge(Node* ctrl) {
- assert(ctrl->is_CFG(), "must be control");
- Node* backedge = _head->as_Loop()->in(LoopNode::LoopBackControl);
- return _phase->dom_lca_internal(ctrl, backedge) == ctrl;
-}
-
//------------------------------adjust_limit-----------------------------------
// Helper function for add_constraint().
Node* PhaseIdealLoop::adjust_limit(int stride_con, Node * scale, Node *offset, Node *rc_limit, Node *loop_limit, Node *pre_ctrl) {
@@ -2187,10 +2179,8 @@
if( b_test._test == BoolTest::lt ) { // Range checks always use lt
// The underflow and overflow limits: 0 <= scale*I+offset < limit
add_constraint( stride_con, scale_con, offset, zero, limit, pre_ctrl, &pre_limit, &main_limit );
- if (!conditional_rc) {
- // (0-offset)/scale could be outside of loop iterations range.
- conditional_rc = !loop->dominates_backedge(iff);
- }
+ // (0-offset)/scale could be outside of loop iterations range.
+ conditional_rc = true;
} else {
if (PrintOpto) {
tty->print_cr("missed RCE opportunity");
@@ -2221,12 +2211,10 @@
// Note: (MIN_INT+1 == -MAX_INT) is used instead of MIN_INT here
// to avoid problem with scale == -1: MIN_INT/(-1) == MIN_INT.
add_constraint( stride_con, scale_con, offset, mini, limit, pre_ctrl, &pre_limit, &main_limit );
- if (!conditional_rc) {
- // ((MIN_INT+1)-offset)/scale could be outside of loop iterations range.
- // Note: negative offset is replaced with 0 but (MIN_INT+1)/scale could
- // still be outside of loop range.
- conditional_rc = !loop->dominates_backedge(iff);
- }
+ // ((MIN_INT+1)-offset)/scale could be outside of loop iterations range.
+ // Note: negative offset is replaced with 0 but (MIN_INT+1)/scale could
+ // still be outside of loop range.
+ conditional_rc = true;
break;
default:
if (PrintOpto) {
@@ -2484,14 +2472,20 @@
((bol->in(1)->Opcode() == Op_StorePConditional ) ||
(bol->in(1)->Opcode() == Op_StoreIConditional ) ||
(bol->in(1)->Opcode() == Op_StoreLConditional ) ||
+ (bol->in(1)->Opcode() == Op_CompareAndExchangeB ) ||
+ (bol->in(1)->Opcode() == Op_CompareAndExchangeS ) ||
(bol->in(1)->Opcode() == Op_CompareAndExchangeI ) ||
(bol->in(1)->Opcode() == Op_CompareAndExchangeL ) ||
(bol->in(1)->Opcode() == Op_CompareAndExchangeP ) ||
(bol->in(1)->Opcode() == Op_CompareAndExchangeN ) ||
+ (bol->in(1)->Opcode() == Op_WeakCompareAndSwapB ) ||
+ (bol->in(1)->Opcode() == Op_WeakCompareAndSwapS ) ||
(bol->in(1)->Opcode() == Op_WeakCompareAndSwapI ) ||
(bol->in(1)->Opcode() == Op_WeakCompareAndSwapL ) ||
(bol->in(1)->Opcode() == Op_WeakCompareAndSwapP ) ||
(bol->in(1)->Opcode() == Op_WeakCompareAndSwapN ) ||
+ (bol->in(1)->Opcode() == Op_CompareAndSwapB ) ||
+ (bol->in(1)->Opcode() == Op_CompareAndSwapS ) ||
(bol->in(1)->Opcode() == Op_CompareAndSwapI ) ||
(bol->in(1)->Opcode() == Op_CompareAndSwapL ) ||
(bol->in(1)->Opcode() == Op_CompareAndSwapP ) ||
--- a/hotspot/src/share/vm/opto/loopnode.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/loopnode.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -2225,9 +2225,7 @@
// Some parser-inserted loop predicates could never be used by loop
// predication or they were moved away from loop during some optimizations.
// For example, peeling. Eliminate them before next loop optimizations.
- if (UseLoopPredicate) {
- eliminate_useless_predicates();
- }
+ eliminate_useless_predicates();
#ifndef PRODUCT
C->verify_graph_edges();
--- a/hotspot/src/share/vm/opto/loopnode.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/loopnode.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -468,9 +468,6 @@
// Check for Node being a loop-breaking test
Node *is_loop_exit(Node *iff) const;
- // Returns true if ctrl is executed on every complete iteration
- bool dominates_backedge(Node* ctrl);
-
// Remove simplistic dead code from loop body
void DCE_loop_body();
--- a/hotspot/src/share/vm/opto/matcher.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/matcher.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -124,7 +124,7 @@
_in_arg_limit = OptoReg::add(warped, 1); // Bump max stack slot seen
if (!RegMask::can_represent_arg(warped)) {
// the compiler cannot represent this method's calling sequence
- C->record_method_not_compilable_all_tiers("unsupported incoming calling sequence");
+ C->record_method_not_compilable("unsupported incoming calling sequence");
return OptoReg::Bad;
}
return warped;
@@ -1120,7 +1120,7 @@
if( warped >= out_arg_limit_per_call )
out_arg_limit_per_call = OptoReg::add(warped,1);
if (!RegMask::can_represent_arg(warped)) {
- C->record_method_not_compilable_all_tiers("unsupported calling sequence");
+ C->record_method_not_compilable("unsupported calling sequence");
return OptoReg::Bad;
}
return warped;
@@ -1300,7 +1300,7 @@
uint r_cnt = mcall->tf()->range()->cnt();
MachProjNode *proj = new MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj );
if (!RegMask::can_represent_arg(OptoReg::Name(out_arg_limit_per_call-1))) {
- C->record_method_not_compilable_all_tiers("unsupported outgoing calling sequence");
+ C->record_method_not_compilable("unsupported outgoing calling sequence");
} else {
for (int i = begin_out_arg_area; i < out_arg_limit_per_call; i++)
proj->_rout.Insert(OptoReg::Name(i));
@@ -1488,7 +1488,7 @@
// out of stack space. See bugs 6272980 & 6227033 for more info.
LabelRootDepth++;
if (LabelRootDepth > MaxLabelRootDepth) {
- C->record_method_not_compilable_all_tiers("Out of stack space, increase MaxLabelRootDepth");
+ C->record_method_not_compilable("Out of stack space, increase MaxLabelRootDepth");
return NULL;
}
uint care = 0; // Edges matcher cares about
@@ -2228,14 +2228,20 @@
case Op_StorePConditional:
case Op_StoreIConditional:
case Op_StoreLConditional:
+ case Op_CompareAndExchangeB:
+ case Op_CompareAndExchangeS:
case Op_CompareAndExchangeI:
case Op_CompareAndExchangeL:
case Op_CompareAndExchangeP:
case Op_CompareAndExchangeN:
+ case Op_WeakCompareAndSwapB:
+ case Op_WeakCompareAndSwapS:
case Op_WeakCompareAndSwapI:
case Op_WeakCompareAndSwapL:
case Op_WeakCompareAndSwapP:
case Op_WeakCompareAndSwapN:
+ case Op_CompareAndSwapB:
+ case Op_CompareAndSwapS:
case Op_CompareAndSwapI:
case Op_CompareAndSwapL:
case Op_CompareAndSwapP:
@@ -2453,14 +2459,20 @@
// that a monitor exit operation contains a serializing instruction.
if (xop == Op_MemBarVolatile ||
+ xop == Op_CompareAndExchangeB ||
+ xop == Op_CompareAndExchangeS ||
xop == Op_CompareAndExchangeI ||
xop == Op_CompareAndExchangeL ||
xop == Op_CompareAndExchangeP ||
xop == Op_CompareAndExchangeN ||
+ xop == Op_WeakCompareAndSwapB ||
+ xop == Op_WeakCompareAndSwapS ||
xop == Op_WeakCompareAndSwapL ||
xop == Op_WeakCompareAndSwapP ||
xop == Op_WeakCompareAndSwapN ||
xop == Op_WeakCompareAndSwapI ||
+ xop == Op_CompareAndSwapB ||
+ xop == Op_CompareAndSwapS ||
xop == Op_CompareAndSwapL ||
xop == Op_CompareAndSwapP ||
xop == Op_CompareAndSwapN ||
--- a/hotspot/src/share/vm/opto/memnode.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/memnode.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -885,13 +885,19 @@
}
};
-//------------------------------CompareAndSwapLNode---------------------------
-class CompareAndSwapLNode : public CompareAndSwapNode {
+//------------------------------CompareAndSwapBNode---------------------------
+class CompareAndSwapBNode : public CompareAndSwapNode {
public:
- CompareAndSwapLNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, MemNode::MemOrd mem_ord) : CompareAndSwapNode(c, mem, adr, val, ex, mem_ord) { }
+ CompareAndSwapBNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, MemNode::MemOrd mem_ord) : CompareAndSwapNode(c, mem, adr, val, ex, mem_ord) { }
virtual int Opcode() const;
};
+//------------------------------CompareAndSwapSNode---------------------------
+class CompareAndSwapSNode : public CompareAndSwapNode {
+public:
+ CompareAndSwapSNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, MemNode::MemOrd mem_ord) : CompareAndSwapNode(c, mem, adr, val, ex, mem_ord) { }
+ virtual int Opcode() const;
+};
//------------------------------CompareAndSwapINode---------------------------
class CompareAndSwapINode : public CompareAndSwapNode {
@@ -900,6 +906,12 @@
virtual int Opcode() const;
};
+//------------------------------CompareAndSwapLNode---------------------------
+class CompareAndSwapLNode : public CompareAndSwapNode {
+public:
+ CompareAndSwapLNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, MemNode::MemOrd mem_ord) : CompareAndSwapNode(c, mem, adr, val, ex, mem_ord) { }
+ virtual int Opcode() const;
+};
//------------------------------CompareAndSwapPNode---------------------------
class CompareAndSwapPNode : public CompareAndSwapNode {
@@ -915,14 +927,19 @@
virtual int Opcode() const;
};
-
-//------------------------------WeakCompareAndSwapLNode---------------------------
-class WeakCompareAndSwapLNode : public CompareAndSwapNode {
+//------------------------------WeakCompareAndSwapBNode---------------------------
+class WeakCompareAndSwapBNode : public CompareAndSwapNode {
public:
- WeakCompareAndSwapLNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, MemNode::MemOrd mem_ord) : CompareAndSwapNode(c, mem, adr, val, ex, mem_ord) { }
+ WeakCompareAndSwapBNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, MemNode::MemOrd mem_ord) : CompareAndSwapNode(c, mem, adr, val, ex, mem_ord) { }
virtual int Opcode() const;
};
+//------------------------------WeakCompareAndSwapSNode---------------------------
+class WeakCompareAndSwapSNode : public CompareAndSwapNode {
+public:
+ WeakCompareAndSwapSNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, MemNode::MemOrd mem_ord) : CompareAndSwapNode(c, mem, adr, val, ex, mem_ord) { }
+ virtual int Opcode() const;
+};
//------------------------------WeakCompareAndSwapINode---------------------------
class WeakCompareAndSwapINode : public CompareAndSwapNode {
@@ -931,6 +948,12 @@
virtual int Opcode() const;
};
+//------------------------------WeakCompareAndSwapLNode---------------------------
+class WeakCompareAndSwapLNode : public CompareAndSwapNode {
+public:
+ WeakCompareAndSwapLNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, MemNode::MemOrd mem_ord) : CompareAndSwapNode(c, mem, adr, val, ex, mem_ord) { }
+ virtual int Opcode() const;
+};
//------------------------------WeakCompareAndSwapPNode---------------------------
class WeakCompareAndSwapPNode : public CompareAndSwapNode {
@@ -946,6 +969,21 @@
virtual int Opcode() const;
};
+//------------------------------CompareAndExchangeBNode---------------------------
+class CompareAndExchangeBNode : public CompareAndExchangeNode {
+public:
+ CompareAndExchangeBNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, const TypePtr* at, MemNode::MemOrd mem_ord) : CompareAndExchangeNode(c, mem, adr, val, ex, mem_ord, at, TypeInt::BYTE) { }
+ virtual int Opcode() const;
+};
+
+
+//------------------------------CompareAndExchangeSNode---------------------------
+class CompareAndExchangeSNode : public CompareAndExchangeNode {
+public:
+ CompareAndExchangeSNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex, const TypePtr* at, MemNode::MemOrd mem_ord) : CompareAndExchangeNode(c, mem, adr, val, ex, mem_ord, at, TypeInt::SHORT) { }
+ virtual int Opcode() const;
+};
+
//------------------------------CompareAndExchangeLNode---------------------------
class CompareAndExchangeLNode : public CompareAndExchangeNode {
public:
@@ -976,6 +1014,20 @@
virtual int Opcode() const;
};
+//------------------------------GetAndAddBNode---------------------------
+class GetAndAddBNode : public LoadStoreNode {
+public:
+ GetAndAddBNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeInt::BYTE, 4) { }
+ virtual int Opcode() const;
+};
+
+//------------------------------GetAndAddSNode---------------------------
+class GetAndAddSNode : public LoadStoreNode {
+public:
+ GetAndAddSNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeInt::SHORT, 4) { }
+ virtual int Opcode() const;
+};
+
//------------------------------GetAndAddINode---------------------------
class GetAndAddINode : public LoadStoreNode {
public:
@@ -990,6 +1042,19 @@
virtual int Opcode() const;
};
+//------------------------------GetAndSetBNode---------------------------
+class GetAndSetBNode : public LoadStoreNode {
+public:
+ GetAndSetBNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeInt::BYTE, 4) { }
+ virtual int Opcode() const;
+};
+
+//------------------------------GetAndSetSNode---------------------------
+class GetAndSetSNode : public LoadStoreNode {
+public:
+ GetAndSetSNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeInt::SHORT, 4) { }
+ virtual int Opcode() const;
+};
//------------------------------GetAndSetINode---------------------------
class GetAndSetINode : public LoadStoreNode {
@@ -998,7 +1063,7 @@
virtual int Opcode() const;
};
-//------------------------------GetAndSetINode---------------------------
+//------------------------------GetAndSetLNode---------------------------
class GetAndSetLNode : public LoadStoreNode {
public:
GetAndSetLNode( Node *c, Node *mem, Node *adr, Node *val, const TypePtr* at ) : LoadStoreNode(c, mem, adr, val, at, TypeLong::LONG, 4) { }
--- a/hotspot/src/share/vm/opto/parse1.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/parse1.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -425,7 +425,7 @@
_iter.reset_to_method(method());
_flow = method()->get_flow_analysis();
if (_flow->failing()) {
- C->record_method_not_compilable_all_tiers(_flow->failure_reason());
+ C->record_method_not_compilable(_flow->failure_reason());
}
#ifndef PRODUCT
@@ -662,7 +662,7 @@
// (Note that dead locals do not get phis built, ever.)
ensure_phis_everywhere();
- if (block->is_SEL_head() && UseLoopPredicate) {
+ if (block->is_SEL_head()) {
// Add predicate to single entry (not irreducible) loop head.
assert(!block->has_merged_backedge(), "only entry paths should be merged for now");
// Need correct bci for predicate.
@@ -1118,7 +1118,7 @@
// Check for really stupid bail-out cases.
uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
if (len >= 32760) {
- C->record_method_not_compilable_all_tiers("too many local variables");
+ C->record_method_not_compilable("too many local variables");
return NULL;
}
--- a/hotspot/src/share/vm/opto/parse3.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/parse3.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -109,7 +109,7 @@
return;
}
- assert(field->will_link(method()->holder(), bc()), "getfield: typeflow responsibility");
+ assert(field->will_link(method(), bc()), "getfield: typeflow responsibility");
// Note: We do not check for an unloaded field type here any more.
--- a/hotspot/src/share/vm/opto/stringopts.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/opto/stringopts.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -1958,6 +1958,12 @@
// Initialize the string
kit.store_String_value(kit.control(), result, dst_array);
kit.store_String_coder(kit.control(), result, coder);
+
+ // The value field is final. Emit a barrier here to ensure that the effect
+ // of the initialization is committed to memory before any code publishes
+ // a reference to the newly constructed object (see Parse::do_exits()).
+ assert(AllocateNode::Ideal_allocation(result, _gvn) != NULL, "should be newly allocated");
+ kit.insert_mem_bar(Op_MemBarRelease, result);
} else {
result = C->top();
}
--- a/hotspot/src/share/vm/runtime/atomic.cpp Wed Jul 05 21:55:11 2017 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "runtime/atomic.inline.hpp"
-
-/*
- * This is the default implementation of byte-sized cmpxchg. It emulates jbyte-sized cmpxchg
- * in terms of jint-sized cmpxchg. Platforms may override this by defining their own inline definition
- * as well as defining VM_HAS_SPECIALIZED_CMPXCHG_BYTE. This will cause the platform specific
- * implementation to be used instead.
- */
-jbyte Atomic::cmpxchg_general(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
- assert(sizeof(jbyte) == 1, "assumption.");
- uintptr_t dest_addr = (uintptr_t)dest;
- uintptr_t offset = dest_addr % sizeof(jint);
- volatile jint* dest_int = (volatile jint*)(dest_addr - offset);
- jint cur = *dest_int;
- jbyte* cur_as_bytes = (jbyte*)(&cur);
- jint new_val = cur;
- jbyte* new_val_as_bytes = (jbyte*)(&new_val);
- new_val_as_bytes[offset] = exchange_value;
- while (cur_as_bytes[offset] == compare_value) {
- jint res = cmpxchg(new_val, dest_int, cur);
- if (res == cur) break;
- cur = res;
- new_val = cur;
- new_val_as_bytes[offset] = exchange_value;
- }
- return cur_as_bytes[offset];
-}
-
-unsigned Atomic::xchg(unsigned int exchange_value, volatile unsigned int* dest) {
- assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
- return (unsigned int)Atomic::xchg((jint)exchange_value, (volatile jint*)dest);
-}
-
-unsigned Atomic::cmpxchg(unsigned int exchange_value,
- volatile unsigned int* dest, unsigned int compare_value) {
- assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
- return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest,
- (jint)compare_value);
-}
-
-jlong Atomic::add(jlong add_value, volatile jlong* dest) {
- jlong old = load(dest);
- jlong new_value = old + add_value;
- while (old != cmpxchg(new_value, dest, old)) {
- old = load(dest);
- new_value = old + add_value;
- }
- return old;
-}
-
-void Atomic::inc(volatile short* dest) {
- // Most platforms do not support atomic increment on a 2-byte value. However,
- // if the value occupies the most significant 16 bits of an aligned 32-bit
- // word, then we can do this with an atomic add of 0x10000 to the 32-bit word.
- //
- // The least significant parts of this 32-bit word will never be affected, even
- // in case of overflow/underflow.
- //
- // Use the ATOMIC_SHORT_PAIR macro to get the desired alignment.
-#ifdef VM_LITTLE_ENDIAN
- assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
- (void)Atomic::add(0x10000, (volatile int*)(dest-1));
-#else
- assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
- (void)Atomic::add(0x10000, (volatile int*)(dest));
-#endif
-}
-
-void Atomic::dec(volatile short* dest) {
-#ifdef VM_LITTLE_ENDIAN
- assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
- (void)Atomic::add(-0x10000, (volatile int*)(dest-1));
-#else
- assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
- (void)Atomic::add(-0x10000, (volatile int*)(dest));
-#endif
-}
-
--- a/hotspot/src/share/vm/runtime/atomic.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/atomic.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -27,10 +27,13 @@
#include "memory/allocation.hpp"
+enum cmpxchg_memory_order {
+ memory_order_relaxed,
+ // Use value which doesn't interfere with C++2011. We need to be more conservative.
+ memory_order_conservative = 8
+};
+
class Atomic : AllStatic {
- private:
- static jbyte cmpxchg_general(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
-
public:
// Atomic operations on jlong types are not available on all 32-bit
// platforms. If atomic ops on jlongs are defined here they must only
@@ -77,12 +80,12 @@
inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest);
inline static void* add_ptr(intptr_t add_value, volatile void* dest);
// See comment above about using jlong atomics on 32-bit platforms
- static jlong add (jlong add_value, volatile jlong* dest);
+ inline static jlong add (jlong add_value, volatile jlong* dest);
// Atomically increment location. inc*() provide:
// <fence> increment-dest <membar StoreLoad|StoreStore>
inline static void inc (volatile jint* dest);
- static void inc (volatile jshort* dest);
+ inline static void inc (volatile jshort* dest);
inline static void inc (volatile size_t* dest);
inline static void inc_ptr(volatile intptr_t* dest);
inline static void inc_ptr(volatile void* dest);
@@ -90,7 +93,7 @@
// Atomically decrement a location. dec*() provide:
// <fence> decrement-dest <membar StoreLoad|StoreStore>
inline static void dec (volatile jint* dest);
- static void dec (volatile jshort* dest);
+ inline static void dec (volatile jshort* dest);
inline static void dec (volatile size_t* dest);
inline static void dec_ptr(volatile intptr_t* dest);
inline static void dec_ptr(volatile void* dest);
@@ -98,22 +101,22 @@
// Performs atomic exchange of *dest with exchange_value. Returns old
// prior value of *dest. xchg*() provide:
// <fence> exchange-value-with-dest <membar StoreLoad|StoreStore>
- inline static jint xchg (jint exchange_value, volatile jint* dest);
- static unsigned int xchg (unsigned int exchange_value, volatile unsigned int* dest);
- inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest);
- inline static void* xchg_ptr(void* exchange_value, volatile void* dest);
+ inline static jint xchg (jint exchange_value, volatile jint* dest);
+ inline static unsigned int xchg (unsigned int exchange_value, volatile unsigned int* dest);
+ inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest);
+ inline static void* xchg_ptr(void* exchange_value, volatile void* dest);
// Performs atomic compare of *dest and compare_value, and exchanges
// *dest with exchange_value if the comparison succeeded. Returns prior
// value of *dest. cmpxchg*() provide:
// <fence> compare-and-exchange <membar StoreLoad|StoreStore>
- inline static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
- inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value);
+ inline static jbyte cmpxchg (jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, cmpxchg_memory_order order = memory_order_conservative);
+ inline static jint cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value, cmpxchg_memory_order order = memory_order_conservative);
// See comment above about using jlong atomics on 32-bit platforms
- inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value);
- static unsigned int cmpxchg (unsigned int exchange_value, volatile unsigned int* dest, unsigned int compare_value);
- inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value);
- inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value);
+ inline static jlong cmpxchg (jlong exchange_value, volatile jlong* dest, jlong compare_value, cmpxchg_memory_order order = memory_order_conservative);
+ inline static unsigned int cmpxchg (unsigned int exchange_value, volatile unsigned int* dest, unsigned int compare_value, cmpxchg_memory_order order = memory_order_conservative);
+ inline static intptr_t cmpxchg_ptr(intptr_t exchange_value, volatile intptr_t* dest, intptr_t compare_value, cmpxchg_memory_order order = memory_order_conservative);
+ inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value, cmpxchg_memory_order order = memory_order_conservative);
};
// To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially
--- a/hotspot/src/share/vm/runtime/atomic.inline.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/atomic.inline.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -91,11 +91,83 @@
}
#ifndef VM_HAS_SPECIALIZED_CMPXCHG_BYTE
-// See comment in atomic.cpp how to override.
-inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte *dest, jbyte comparand)
+/*
+ * This is the default implementation of byte-sized cmpxchg. It emulates jbyte-sized cmpxchg
+ * in terms of jint-sized cmpxchg. Platforms may override this by defining their own inline definition
+ * as well as defining VM_HAS_SPECIALIZED_CMPXCHG_BYTE. This will cause the platform specific
+ * implementation to be used instead.
+ */
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte *dest, jbyte comparand, cmpxchg_memory_order order)
{
- return cmpxchg_general(exchange_value, dest, comparand);
+ assert(sizeof(jbyte) == 1, "assumption.");
+ uintptr_t dest_addr = (uintptr_t)dest;
+ uintptr_t offset = dest_addr % sizeof(jint);
+ volatile jint* dest_int = (volatile jint*)(dest_addr - offset);
+ jint cur = *dest_int;
+ jbyte* cur_as_bytes = (jbyte*)(&cur);
+ jint new_val = cur;
+ jbyte* new_val_as_bytes = (jbyte*)(&new_val);
+ new_val_as_bytes[offset] = exchange_value;
+ while (cur_as_bytes[offset] == comparand) {
+ jint res = cmpxchg(new_val, dest_int, cur, order);
+ if (res == cur) break;
+ cur = res;
+ new_val = cur;
+ new_val_as_bytes[offset] = exchange_value;
+ }
+ return cur_as_bytes[offset];
}
#endif // VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline unsigned Atomic::xchg(unsigned int exchange_value, volatile unsigned int* dest) {
+ assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
+ return (unsigned int)Atomic::xchg((jint)exchange_value, (volatile jint*)dest);
+}
+
+inline unsigned Atomic::cmpxchg(unsigned int exchange_value,
+ volatile unsigned int* dest, unsigned int compare_value,
+ cmpxchg_memory_order order) {
+ assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
+ return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest,
+ (jint)compare_value, order);
+}
+
+inline jlong Atomic::add(jlong add_value, volatile jlong* dest) {
+ jlong old = load(dest);
+ jlong new_value = old + add_value;
+ while (old != cmpxchg(new_value, dest, old)) {
+ old = load(dest);
+ new_value = old + add_value;
+ }
+ return old;
+}
+
+inline void Atomic::inc(volatile short* dest) {
+ // Most platforms do not support atomic increment on a 2-byte value. However,
+ // if the value occupies the most significant 16 bits of an aligned 32-bit
+ // word, then we can do this with an atomic add of 0x10000 to the 32-bit word.
+ //
+ // The least significant parts of this 32-bit word will never be affected, even
+ // in case of overflow/underflow.
+ //
+ // Use the ATOMIC_SHORT_PAIR macro to get the desired alignment.
+#ifdef VM_LITTLE_ENDIAN
+ assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
+ (void)Atomic::add(0x10000, (volatile int*)(dest-1));
+#else
+ assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
+ (void)Atomic::add(0x10000, (volatile int*)(dest));
+#endif
+}
+
+inline void Atomic::dec(volatile short* dest) {
+#ifdef VM_LITTLE_ENDIAN
+ assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
+ (void)Atomic::add(-0x10000, (volatile int*)(dest-1));
+#else
+ assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
+ (void)Atomic::add(-0x10000, (volatile int*)(dest));
+#endif
+}
+
#endif // SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -106,6 +106,7 @@
bool is_field_access_watched() const { return access_flags().is_field_access_watched(); }
bool is_field_modification_watched() const
{ return access_flags().is_field_modification_watched(); }
+ bool has_initialized_final_update() const { return access_flags().has_field_initialized_final_update(); }
bool has_generic_signature() const { return access_flags().field_has_generic_signature(); }
void set_is_field_access_watched(const bool value) {
@@ -118,6 +119,11 @@
update_klass_field_access_flag();
}
+ void set_has_initialized_final_update(const bool value) {
+ _access_flags.set_has_field_initialized_final_update(value);
+ update_klass_field_access_flag();
+ }
+
// Initialization
void reinitialize(InstanceKlass* ik, int index);
--- a/hotspot/src/share/vm/runtime/globals.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/globals.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -463,6 +463,29 @@
~SizeTFlagSetting() { *flag = val; }
};
+// Helper class for temporarily saving the value of a flag during a scope.
+template <size_t SIZE>
+class FlagGuard {
+ unsigned char _value[SIZE];
+ void* const _addr;
+
+ // Hide operator new, this class should only be allocated on the stack.
+ // NOTE: Cannot include memory/allocation.hpp here due to circular
+ // dependencies.
+ void* operator new(size_t size) throw();
+ void* operator new [](size_t size) throw();
+
+ public:
+ FlagGuard(void* flag_addr) : _addr(flag_addr) {
+ memcpy(_value, _addr, SIZE);
+ }
+
+ ~FlagGuard() {
+ memcpy(_addr, _value, SIZE);
+ }
+};
+
+#define FLAG_GUARD(f) FlagGuard<sizeof(f)> f ## _guard(&f)
class CommandLineFlags {
public:
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -372,14 +372,16 @@
}
// Check that there are shadow pages available before changing thread state
- // to Java
- if (!os::stack_shadow_pages_available(THREAD, method)) {
+ // to Java. Calculate current_stack_pointer here to make sure
+ // stack_shadow_pages_available() and bang_stack_shadow_pages() use the same sp.
+ address sp = os::current_stack_pointer();
+ if (!os::stack_shadow_pages_available(THREAD, method, sp)) {
// Throw stack overflow exception with preinitialized exception.
Exceptions::throw_stack_overflow_exception(THREAD, __FILE__, __LINE__, method);
return;
} else {
// Touch pages checked if the OS needs them to be touched to be mapped.
- os::map_stack_shadow_pages();
+ os::map_stack_shadow_pages(sp);
}
#if INCLUDE_JVMCI
--- a/hotspot/src/share/vm/runtime/os.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/os.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1325,9 +1325,8 @@
// Returns true if the current stack pointer is above the stack shadow
// pages, false otherwise.
-bool os::stack_shadow_pages_available(Thread *thread, const methodHandle& method) {
+bool os::stack_shadow_pages_available(Thread *thread, const methodHandle& method, address sp) {
if (!thread->is_Java_thread()) return false;
- address sp = current_stack_pointer();
// Check if we have StackShadowPages above the yellow zone. This parameter
// is dependent on the depth of the maximum VM call stack possible from
// the handler for stack overflow. 'instanceof' in the stack overflow
--- a/hotspot/src/share/vm/runtime/os.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/os.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -260,9 +260,9 @@
// exception processing) There are guard pages, and above that shadow
// pages for stack overflow checking.
static bool uses_stack_guard_pages();
- static bool allocate_stack_guard_pages();
- static void map_stack_shadow_pages();
- static bool stack_shadow_pages_available(Thread *thread, const methodHandle& method);
+ static bool must_commit_stack_guard_pages();
+ static void map_stack_shadow_pages(address sp);
+ static bool stack_shadow_pages_available(Thread *thread, const methodHandle& method, address sp);
// OS interface to Virtual Memory
--- a/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -2493,10 +2493,10 @@
address low_addr = stack_end();
size_t len = stack_guard_zone_size();
- int allocate = os::allocate_stack_guard_pages();
+ int must_commit = os::must_commit_stack_guard_pages();
// warning("Guarding at " PTR_FORMAT " for len " SIZE_FORMAT "\n", low_addr, len);
- if (allocate && !os::create_stack_guard_pages((char *) low_addr, len)) {
+ if (must_commit && !os::create_stack_guard_pages((char *) low_addr, len)) {
log_warning(os, thread)("Attempt to allocate stack guard pages failed.");
return;
}
@@ -2515,7 +2515,6 @@
log_debug(os, thread)("Thread " UINTX_FORMAT " stack guard pages activated: "
PTR_FORMAT "-" PTR_FORMAT ".",
os::current_thread_id(), p2i(low_addr), p2i(low_addr + len));
-
}
void JavaThread::remove_stack_guard_pages() {
@@ -2524,7 +2523,7 @@
address low_addr = stack_end();
size_t len = stack_guard_zone_size();
- if (os::allocate_stack_guard_pages()) {
+ if (os::must_commit_stack_guard_pages()) {
if (os::remove_stack_guard_pages((char *) low_addr, len)) {
_stack_guard_state = stack_guard_unused;
} else {
@@ -2546,7 +2545,6 @@
log_debug(os, thread)("Thread " UINTX_FORMAT " stack guard pages removed: "
PTR_FORMAT "-" PTR_FORMAT ".",
os::current_thread_id(), p2i(low_addr), p2i(low_addr + len));
-
}
void JavaThread::enable_stack_reserved_zone() {
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -2024,15 +2024,21 @@
declare_c2_type(StorePConditionalNode, LoadStoreNode) \
declare_c2_type(StoreLConditionalNode, LoadStoreNode) \
declare_c2_type(CompareAndSwapNode, LoadStoreConditionalNode) \
+ declare_c2_type(CompareAndSwapBNode, CompareAndSwapNode) \
+ declare_c2_type(CompareAndSwapSNode, CompareAndSwapNode) \
declare_c2_type(CompareAndSwapLNode, CompareAndSwapNode) \
declare_c2_type(CompareAndSwapINode, CompareAndSwapNode) \
declare_c2_type(CompareAndSwapPNode, CompareAndSwapNode) \
declare_c2_type(CompareAndSwapNNode, CompareAndSwapNode) \
+ declare_c2_type(WeakCompareAndSwapBNode, CompareAndSwapNode) \
+ declare_c2_type(WeakCompareAndSwapSNode, CompareAndSwapNode) \
declare_c2_type(WeakCompareAndSwapLNode, CompareAndSwapNode) \
declare_c2_type(WeakCompareAndSwapINode, CompareAndSwapNode) \
declare_c2_type(WeakCompareAndSwapPNode, CompareAndSwapNode) \
declare_c2_type(WeakCompareAndSwapNNode, CompareAndSwapNode) \
declare_c2_type(CompareAndExchangeNode, LoadStoreNode) \
+ declare_c2_type(CompareAndExchangeBNode, CompareAndExchangeNode) \
+ declare_c2_type(CompareAndExchangeSNode, CompareAndExchangeNode) \
declare_c2_type(CompareAndExchangeLNode, CompareAndExchangeNode) \
declare_c2_type(CompareAndExchangeINode, CompareAndExchangeNode) \
declare_c2_type(CompareAndExchangePNode, CompareAndExchangeNode) \
--- a/hotspot/src/share/vm/services/diagnosticArgument.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -280,7 +280,7 @@
size_t len, TRAPS) {
if (str == NULL) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
- "Integer parsing error nanotime value: syntax error");
+ "Parsing error memory size value: syntax error, value is null");
}
if (*str == '-') {
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -413,6 +413,7 @@
}
void HeapInfoDCmd::execute(DCmdSource source, TRAPS) {
+ MutexLocker hl(Heap_lock);
Universe::heap()->print_on(output());
}
--- a/hotspot/src/share/vm/trace/traceMacros.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/trace/traceMacros.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -33,6 +33,9 @@
#define TRACE_KLASS_DEFINITION(k, t)
#define TRACE_INIT_KLASS_ID(k)
+#define TRACE_REMOVE_KLASS_ID(k)
+#define TRACE_RESTORE_KLASS_ID(k)
+
#define TRACE_INIT_MODULE_ID(m)
#define TRACE_INIT_PACKAGE_ID(p)
#define TRACE_INIT_THREAD_ID(td)
--- a/hotspot/src/share/vm/utilities/accessFlags.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/utilities/accessFlags.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -77,11 +77,12 @@
// These bits must not conflict with any other field-related access flags
// (e.g., ACC_ENUM).
// Note that the class-related ACC_ANNOTATION bit conflicts with these flags.
- JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI
- JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000, // field modification is watched by JVMTI
- JVM_ACC_FIELD_INTERNAL = 0x00000400, // internal field, same as JVM_ACC_ABSTRACT
- JVM_ACC_FIELD_STABLE = 0x00000020, // @Stable field, same as JVM_ACC_SYNCHRONIZED
- JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE = 0x00000800, // field has generic signature
+ JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI
+ JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000, // field modification is watched by JVMTI
+ JVM_ACC_FIELD_INTERNAL = 0x00000400, // internal field, same as JVM_ACC_ABSTRACT
+ JVM_ACC_FIELD_STABLE = 0x00000020, // @Stable field, same as JVM_ACC_SYNCHRONIZED and JVM_ACC_SUPER
+ JVM_ACC_FIELD_INITIALIZED_FINAL_UPDATE = 0x00000100, // (static) final field updated outside (class) initializer, same as JVM_ACC_NATIVE
+ JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE = 0x00000800, // field has generic signature
JVM_ACC_FIELD_INTERNAL_FLAGS = JVM_ACC_FIELD_ACCESS_WATCHED |
JVM_ACC_FIELD_MODIFICATION_WATCHED |
@@ -154,6 +155,8 @@
bool is_field_access_watched() const { return (_flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; }
bool is_field_modification_watched() const
{ return (_flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; }
+ bool has_field_initialized_final_update() const
+ { return (_flags & JVM_ACC_FIELD_INITIALIZED_FINAL_UPDATE) != 0; }
bool on_stack() const { return (_flags & JVM_ACC_ON_STACK) != 0; }
bool is_internal() const { return (_flags & JVM_ACC_FIELD_INTERNAL) != 0; }
bool is_stable() const { return (_flags & JVM_ACC_FIELD_STABLE) != 0; }
@@ -232,6 +235,15 @@
atomic_clear_bits(JVM_ACC_FIELD_MODIFICATION_WATCHED);
}
}
+
+ void set_has_field_initialized_final_update(const bool value) {
+ if (value) {
+ atomic_set_bits(JVM_ACC_FIELD_INITIALIZED_FINAL_UPDATE);
+ } else {
+ atomic_clear_bits(JVM_ACC_FIELD_INITIALIZED_FINAL_UPDATE);
+ }
+ }
+
void set_field_has_generic_signature()
{
atomic_set_bits(JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE);
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -324,6 +324,6 @@
// Inlining support
#define NOINLINE __attribute__ ((noinline))
-#define ALWAYSINLINE __attribute__ ((always_inline))
+#define ALWAYSINLINE inline __attribute__ ((always_inline))
#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_GCC_HPP
--- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -279,6 +279,6 @@
// Inlining support
#define NOINLINE
-#define ALWAYSINLINE __attribute__((always_inline))
+#define ALWAYSINLINE inline __attribute__((always_inline))
#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_SPARCWORKS_HPP
--- a/hotspot/src/share/vm/utilities/vmError.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/src/share/vm/utilities/vmError.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -908,6 +908,7 @@
// STEP("printing heap information")
if (Universe::is_fully_initialized()) {
+ MutexLocker hl(Heap_lock);
Universe::heap()->print_on_error(st);
st->cr();
st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page()));
--- a/hotspot/test/TEST.ROOT Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/TEST.ROOT Fri Jul 01 16:50:34 2016 -0700
@@ -33,8 +33,18 @@
# Source files for classes that will be used at the beginning of each test suite run,
# to determine additional characteristics of the system for use with the @requires tag.
+# Note: compiled bootlibs code will be located in the folder 'bootClasses'
requires.extraPropDefns = ../../test/jtreg-ext/requires/VMProps.java
-requires.properties=sun.arch.data.model vm.simpleArch vm.flightRecorder
+requires.extraPropDefns.bootlibs = ../../test/lib/sun
+requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:bootClasses
+requires.properties= \
+ sun.arch.data.model \
+ vm.simpleArch \
+ vm.flightRecorder \
+ vm.gc.G1 \
+ vm.gc.Serial \
+ vm.gc.Parallel \
+ vm.gc.ConcMarkSweep
# Tests using jtreg 4.2 b02 features
requiredVersion=4.2 b02
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,19 +25,17 @@
* @test
* @bug 8072016
* @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
- * @library /testlibrary /test/lib /compiler/whitebox /
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestArrayCopyNoInitDeopt
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main ClassFileInstaller jdk.test.lib.Platform
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * jdk.test.lib.Platform
* @run main/othervm -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020
* TestArrayCopyNoInitDeopt
- *
*/
-
import sun.hotspot.WhiteBox;
import sun.hotspot.code.NMethod;
import jdk.test.lib.Platform;
--- a/hotspot/test/compiler/c1/7103261/Test7103261.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/c1/7103261/Test7103261.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -44,6 +44,7 @@
char c;
short s;
boolean z;
+ Object o;
public static void main(String[] args) {
constantStore();
@@ -51,7 +52,7 @@
valueTest(true);
}
static void constantStore() {
- for (int field = 0; field < 8; field++) {
+ for (int field = 0; field < 9; field++) {
try {
Test7103261 o = nonnull_value;
for (int i = 0; i < 100000; i++) {
@@ -64,6 +65,7 @@
case 5: o.c = 0; break;
case 6: o.s = 0; break;
case 7: o.z = false; break;
+ case 8: o.o = null; break;
default: throw new InternalError();
}
if (i == 90000) {
@@ -76,7 +78,7 @@
}
}
static void valueTest(boolean store) {
- for (int field = 0; field < 8; field++) {
+ for (int field = 0; field < 9; field++) {
try {
Test7103261 o = nonnull_value;
Test7103261 o2 = nonnull_value2;
@@ -90,6 +92,7 @@
case 5: o.c = o2.c; break;
case 6: o.s = o2.s; break;
case 7: o.z = o2.z; break;
+ case 8: o.o = o2.o; break;
default: throw new InternalError();
}
if (i == 90000) {
--- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,8 +32,8 @@
* @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeOrdered
*/
-import sun.misc.Unsafe;
-import java.lang.reflect.*;
+import jdk.internal.misc.Unsafe;
+import java.lang.reflect.Field;
public class TestIntUnsafeOrdered {
private static final int ARRLEN = 97;
@@ -47,10 +47,10 @@
private static final int BASE;
static {
try {
- Class c = TestIntUnsafeOrdered.class.getClassLoader().loadClass("sun.misc.Unsafe");
+ Class<?> c = Unsafe.class;
Field f = c.getDeclaredField("theUnsafe");
f.setAccessible(true);
- unsafe = (Unsafe)f.get(c);
+ unsafe = (Unsafe) f.get(c);
BASE = unsafe.arrayBaseOffset(int[].class);
} catch (Exception e) {
InternalError err = new InternalError();
@@ -771,213 +771,213 @@
static void test_ci(int[] a) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), -123);
+ unsafe.putIntRelease(a, byte_offset(i), -123);
}
}
static void test_vi(int[] a, int b, int old) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), b);
+ unsafe.putIntRelease(a, byte_offset(i), b);
}
}
static void test_cp(int[] a, int[] b) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), b[i]);
+ unsafe.putIntRelease(a, byte_offset(i), b[i]);
}
}
static void test_2ci(int[] a, int[] b) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), -123);
- unsafe.putOrderedInt(b, byte_offset(i), -103);
+ unsafe.putIntRelease(a, byte_offset(i), -123);
+ unsafe.putIntRelease(b, byte_offset(i), -103);
}
}
static void test_2vi(int[] a, int[] b, int c, int d) {
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), c);
- unsafe.putOrderedInt(b, byte_offset(i), d);
+ unsafe.putIntRelease(a, byte_offset(i), c);
+ unsafe.putIntRelease(b, byte_offset(i), d);
}
}
static void test_ci_neg(int[] a, int old) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.putOrderedInt(a, byte_offset(i), -123);
+ unsafe.putIntRelease(a, byte_offset(i), -123);
}
}
static void test_vi_neg(int[] a, int b, int old) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.putOrderedInt(a, byte_offset(i), b);
+ unsafe.putIntRelease(a, byte_offset(i), b);
}
}
static void test_cp_neg(int[] a, int[] b) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.putOrderedInt(a, byte_offset(i), b[i]);
+ unsafe.putIntRelease(a, byte_offset(i), b[i]);
}
}
static void test_2ci_neg(int[] a, int[] b) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.putOrderedInt(a, byte_offset(i), -123);
- unsafe.putOrderedInt(b, byte_offset(i), -103);
+ unsafe.putIntRelease(a, byte_offset(i), -123);
+ unsafe.putIntRelease(b, byte_offset(i), -103);
}
}
static void test_2vi_neg(int[] a, int[] b, int c, int d) {
for (int i = ARRLEN-1; i >= 0; i-=1) {
- unsafe.putOrderedInt(a, byte_offset(i), c);
- unsafe.putOrderedInt(b, byte_offset(i), d);
+ unsafe.putIntRelease(a, byte_offset(i), c);
+ unsafe.putIntRelease(b, byte_offset(i), d);
}
}
static void test_ci_oppos(int[] a, int old) {
int limit = ARRLEN-1;
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(limit-i), -123);
+ unsafe.putIntRelease(a, byte_offset(limit-i), -123);
}
}
static void test_vi_oppos(int[] a, int b, int old) {
int limit = ARRLEN-1;
for (int i = limit; i >= 0; i-=1) {
- unsafe.putOrderedInt(a, byte_offset(limit-i), b);
+ unsafe.putIntRelease(a, byte_offset(limit-i), b);
}
}
static void test_cp_oppos(int[] a, int[] b) {
int limit = ARRLEN-1;
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), b[limit-i]);
+ unsafe.putIntRelease(a, byte_offset(i), b[limit-i]);
}
}
static void test_2ci_oppos(int[] a, int[] b) {
int limit = ARRLEN-1;
for (int i = 0; i < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(limit-i), -123);
- unsafe.putOrderedInt(b, byte_offset(i), -103);
+ unsafe.putIntRelease(a, byte_offset(limit-i), -123);
+ unsafe.putIntRelease(b, byte_offset(i), -103);
}
}
static void test_2vi_oppos(int[] a, int[] b, int c, int d) {
int limit = ARRLEN-1;
for (int i = limit; i >= 0; i-=1) {
- unsafe.putOrderedInt(a, byte_offset(i), c);
- unsafe.putOrderedInt(b, byte_offset(limit-i), d);
+ unsafe.putIntRelease(a, byte_offset(i), c);
+ unsafe.putIntRelease(b, byte_offset(limit-i), d);
}
}
static void test_ci_off(int[] a, int old) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+OFFSET), -123);
+ unsafe.putIntRelease(a, byte_offset(i+OFFSET), -123);
}
}
static void test_vi_off(int[] a, int b, int old) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+OFFSET), b);
+ unsafe.putIntRelease(a, byte_offset(i+OFFSET), b);
}
}
static void test_cp_off(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+OFFSET), b[i+OFFSET]);
+ unsafe.putIntRelease(a, byte_offset(i+OFFSET), b[i+OFFSET]);
}
}
static void test_2ci_off(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+OFFSET), -123);
- unsafe.putOrderedInt(b, byte_offset(i+OFFSET), -103);
+ unsafe.putIntRelease(a, byte_offset(i+OFFSET), -123);
+ unsafe.putIntRelease(b, byte_offset(i+OFFSET), -103);
}
}
static void test_2vi_off(int[] a, int[] b, int c, int d) {
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+OFFSET), c);
- unsafe.putOrderedInt(b, byte_offset(i+OFFSET), d);
+ unsafe.putIntRelease(a, byte_offset(i+OFFSET), c);
+ unsafe.putIntRelease(b, byte_offset(i+OFFSET), d);
}
}
static void test_ci_inv(int[] a, int k, int old) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+k), -123);
+ unsafe.putIntRelease(a, byte_offset(i+k), -123);
}
}
static void test_vi_inv(int[] a, int b, int k, int old) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+k), b);
+ unsafe.putIntRelease(a, byte_offset(i+k), b);
}
}
static void test_cp_inv(int[] a, int[] b, int k) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+k), b[i+k]);
+ unsafe.putIntRelease(a, byte_offset(i+k), b[i+k]);
}
}
static void test_2ci_inv(int[] a, int[] b, int k) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+k), -123);
- unsafe.putOrderedInt(b, byte_offset(i+k), -103);
+ unsafe.putIntRelease(a, byte_offset(i+k), -123);
+ unsafe.putIntRelease(b, byte_offset(i+k), -103);
}
}
static void test_2vi_inv(int[] a, int[] b, int c, int d, int k) {
for (int i = 0; i < ARRLEN-k; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+k), c);
- unsafe.putOrderedInt(b, byte_offset(i+k), d);
+ unsafe.putIntRelease(a, byte_offset(i+k), c);
+ unsafe.putIntRelease(b, byte_offset(i+k), d);
}
}
static void test_ci_scl(int[] a, int old) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i*SCALE), -123);
+ unsafe.putIntRelease(a, byte_offset(i*SCALE), -123);
}
}
static void test_vi_scl(int[] a, int b, int old) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i*SCALE), b);
+ unsafe.putIntRelease(a, byte_offset(i*SCALE), b);
}
}
static void test_cp_scl(int[] a, int[] b) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i*SCALE), b[i*SCALE]);
+ unsafe.putIntRelease(a, byte_offset(i*SCALE), b[i*SCALE]);
}
}
static void test_2ci_scl(int[] a, int[] b) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i*SCALE), -123);
- unsafe.putOrderedInt(b, byte_offset(i*SCALE), -103);
+ unsafe.putIntRelease(a, byte_offset(i*SCALE), -123);
+ unsafe.putIntRelease(b, byte_offset(i*SCALE), -103);
}
}
static void test_2vi_scl(int[] a, int[] b, int c, int d) {
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i*SCALE), c);
- unsafe.putOrderedInt(b, byte_offset(i*SCALE), d);
+ unsafe.putIntRelease(a, byte_offset(i*SCALE), c);
+ unsafe.putIntRelease(b, byte_offset(i*SCALE), d);
}
}
static void test_cp_alndst(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+ALIGN_OFF), b[i]);
+ unsafe.putIntRelease(a, byte_offset(i+ALIGN_OFF), b[i]);
}
}
static void test_cp_alnsrc(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), b[i+ALIGN_OFF]);
+ unsafe.putIntRelease(a, byte_offset(i), b[i+ALIGN_OFF]);
}
}
static void test_2ci_aln(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+ALIGN_OFF), -123);
- unsafe.putOrderedInt(b, byte_offset(i), -103);
+ unsafe.putIntRelease(a, byte_offset(i+ALIGN_OFF), -123);
+ unsafe.putIntRelease(b, byte_offset(i), -103);
}
}
static void test_2vi_aln(int[] a, int[] b, int c, int d) {
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), c);
- unsafe.putOrderedInt(b, byte_offset(i+ALIGN_OFF), d);
+ unsafe.putIntRelease(a, byte_offset(i), c);
+ unsafe.putIntRelease(b, byte_offset(i+ALIGN_OFF), d);
}
}
static void test_cp_unalndst(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+UNALIGN_OFF), b[i]);
+ unsafe.putIntRelease(a, byte_offset(i+UNALIGN_OFF), b[i]);
}
}
static void test_cp_unalnsrc(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), b[i+UNALIGN_OFF]);
+ unsafe.putIntRelease(a, byte_offset(i), b[i+UNALIGN_OFF]);
}
}
static void test_2ci_unaln(int[] a, int[] b) {
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i+UNALIGN_OFF), -123);
- unsafe.putOrderedInt(b, byte_offset(i), -103);
+ unsafe.putIntRelease(a, byte_offset(i+UNALIGN_OFF), -123);
+ unsafe.putIntRelease(b, byte_offset(i), -103);
}
}
static void test_2vi_unaln(int[] a, int[] b, int c, int d) {
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
- unsafe.putOrderedInt(a, byte_offset(i), c);
- unsafe.putOrderedInt(b, byte_offset(i+UNALIGN_OFF), d);
+ unsafe.putIntRelease(a, byte_offset(i), c);
+ unsafe.putIntRelease(b, byte_offset(i+UNALIGN_OFF), d);
}
}
--- a/hotspot/test/compiler/ciReplay/TestSA.sh Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/ciReplay/TestSA.sh Fri Jul 01 16:50:34 2016 -0700
@@ -29,6 +29,7 @@
## @ignore 8029528
## @summary testing of ciReplay with using generated by SA replay.txt
## @author igor.ignatyev@oracle.com
+## @requires vm.flightRecorder != true
## @run shell TestSA.sh
##
--- a/hotspot/test/compiler/ciReplay/TestVM.sh Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/ciReplay/TestVM.sh Fri Jul 01 16:50:34 2016 -0700
@@ -28,6 +28,7 @@
## @bug 8011675
## @summary testing of ciReplay with using generated by VM replay.txt
## @author igor.ignatyev@oracle.com
+## @requires vm.flightRecorder != true
## @run shell TestVM.sh
##
--- a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh Fri Jul 01 16:50:34 2016 -0700
@@ -28,6 +28,7 @@
## @bug 8011675
## @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level
## @author igor.ignatyev@oracle.com
+## @requires vm.flightRecorder != true
## @run shell TestVM_no_comp_level.sh
##
--- a/hotspot/test/compiler/codegen/8011901/Test8011901.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/codegen/8011901/Test8011901.java Fri Jul 01 16:50:34 2016 -0700
@@ -30,21 +30,21 @@
*
*/
-import java.lang.reflect.*;
-import sun.misc.*;
+import java.lang.reflect.Field;
+import jdk.internal.misc.Unsafe;
public class Test8011901 {
private long ctl;
- private static final sun.misc.Unsafe U;
+ private static final Unsafe U;
private static final long CTL;
static {
try {
- Field unsafe = sun.misc.Unsafe.class.getDeclaredField("theUnsafe");
+ Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
unsafe.setAccessible(true);
- U = (sun.misc.Unsafe) unsafe.get(null);
+ U = (Unsafe) unsafe.get(null);
CTL = U.objectFieldOffset(Test8011901.class.getDeclaredField("ctl"));
} catch (Exception e) {
throw new Error(e);
--- a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests CompileCommand=compileonly
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.commandfile.CompileOnlyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.commandfile.CompileOnlyTest
*/
--- a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests CompileCommand=exclude
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.commandfile.ExcludeTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.commandfile.ExcludeTest
*/
--- a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests CompileCommand=log
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.commandfile.LogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.commandfile.LogTest
*/
--- a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests CompileCommand=print
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.commandfile.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.commandfile.PrintTest
*/
--- a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests CompileCommand=compileonly
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.commands.CompileOnlyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.commands.CompileOnlyTest
*/
--- a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests CompileCommand=exclude
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.commands.ExcludeTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.commands.ExcludeTest
*/
--- a/hotspot/test/compiler/compilercontrol/commands/LogTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commands/LogTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests CompileCommand=log
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.commands.LogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.commands.LogTest
*/
--- a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests CompileCommand=print
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.commands.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.commands.PrintTest
*/
--- a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests directives to be able to compile only specified methods
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.directives.CompileOnlyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.directives.CompileOnlyTest
*/
--- a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests directives to be able to exclude methods from compilation
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.directives.ExcludeTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.directives.ExcludeTest
*/
--- a/hotspot/test/compiler/compilercontrol/directives/LogTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/directives/LogTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests directives to be able to turn on LogCompilation
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.directives.LogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.directives.LogTest
*/
--- a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests directives to be able to turn on print_assembly
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.directives.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.directives.PrintTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests directives to be able to add and remove directives
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.jcmd.AddAndRemoveTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.AddAndRemoveTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests jcmd to be able to add a directive to compile only specified methods
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.jcmd.AddCompileOnlyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.AddCompileOnlyTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests jcmd to be able to add a directive to exclude only specified methods
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.jcmd.AddExcludeTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.AddExcludeTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests jcmd to be able to add a directive to log only specified methods
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.jcmd.AddLogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.AddLogTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @summary Tests jcmd to be able to add a directive to print assembly
* only for specified methods
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.jcmd.AddPrintAssemblyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.AddPrintAssemblyTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @ignore 8140405
* @summary Tests jcmd to be able to clear directives added via options
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Tests clear JCMD command
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.jcmd.ClearDirectivesStackTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.ClearDirectivesStackTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,13 @@
* @bug 8137167
* @summary Tests jcmd to be able to add a directive to compile only specified methods
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
+ * @requires vm.flavor != "minimal"
* @build compiler.compilercontrol.jcmd.PrintDirectivesTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.PrintDirectivesTest
*/
--- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,13 +27,13 @@
* @summary Tests jcmd to be able to add a lot of huge directive files with
* parallel executed jcmds until timeout has reached
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.jcmd.StressAddMultiThreadedTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils
* compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.StressAddMultiThreadedTest
*/
--- a/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,14 +26,13 @@
* @bug 8137167
* @summary Tests LogCompilation executed standalone without log commands or directives
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.logcompilation.LogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- * -XX:+UnlockDiagnosticVMOptions compiler.compilercontrol.logcompilation.LogTest
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver compiler.compilercontrol.logcompilation.LogTest
*/
package compiler.compilercontrol.logcompilation;
@@ -45,6 +44,8 @@
public static void main(String[] args) {
Scenario.Builder builder = Scenario.getBuilder();
builder.addFlag("-XX:+UnlockDiagnosticVMOptions");
+ builder.addFlag("-Xbootclasspath/a:.");
+ builder.addFlag("-XX:+WhiteBoxAPI");
builder.addFlag("-XX:+LogCompilation");
builder.addFlag("-XX:LogFile=" + LogProcessor.LOG_FILE);
Scenario scenario = builder.build();
--- a/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,6 +21,19 @@
* questions.
*/
+/*
+ * @test
+ * @bug 8135068
+ * @summary Tests CompilerCommand's method matcher
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary /test/lib ../share /
+ * @build compiler.compilercontrol.matcher.MethodMatcherTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI compiler.compilercontrol.matcher.MethodMatcherTest
+ */
+
package compiler.compilercontrol.matcher;
import jdk.test.lib.Pair;
@@ -36,18 +49,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-/*
- * @test
- * @bug 8135068
- * @summary Tests CompilerCommand's method matcher
- * @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/whitebox ../share /
- * @build compiler.compilercontrol.matcher.MethodMatcherTest
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI compiler.compilercontrol.matcher.MethodMatcherTest
- */
public class MethodMatcherTest {
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final PoolHelper POOL = new PoolHelper();
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @bug 8137167
* @summary Randomly generates commands with random types
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.mixed.RandomCommandsTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver/timeout=600 compiler.compilercontrol.mixed.RandomCommandsTest
*/
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,13 +26,13 @@
* @bug 8137167
* @summary Randomly generates valid commands with random types
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib ../share /
* @build compiler.compilercontrol.mixed.RandomValidCommandsTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=600 compiler.compilercontrol.mixed.RandomValidCommandsTest
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver/timeout=600 compiler.compilercontrol.mixed.RandomValidCommandsTest
*/
package compiler.compilercontrol.mixed;
--- a/hotspot/test/compiler/compilercontrol/share/MultiCommand.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/share/MultiCommand.java Fri Jul 01 16:50:34 2016 -0700
@@ -73,6 +73,7 @@
public void test() {
Scenario.Builder builder = Scenario.getBuilder();
builder.addFlag("-Xmixed");
+ builder.addFlag("-XX:+UnlockDiagnosticVMOptions");
builder.addFlag("-XX:CompilerDirectivesLimit=101");
for (CompileCommand cc : testCases) {
cc.print();
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,24 +21,25 @@
* questions.
*
*/
+
+/*
+ * @test
+ * @library /testlibrary /test/lib /compiler/codegen/7184394 /
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ * @ignore 8146128
+ * @build TestAESIntrinsicsOnSupportedConfig TestAESMain
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -Xbatch
+ * TestAESIntrinsicsOnSupportedConfig
+ */
+
import jdk.test.lib.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.ProcessTools;
-/*
- * @test
- * @library /testlibrary /test/lib /compiler/whitebox
- * /compiler/testlibrary /compiler/codegen/7184394
- * @modules java.base/jdk.internal.misc
- * java.management
- * @ignore 8146128
- * @build TestAESIntrinsicsOnSupportedConfig TestAESMain
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI -Xbatch
- * TestAESIntrinsicsOnSupportedConfig
- */
public class TestAESIntrinsicsOnSupportedConfig extends AESIntrinsicsBase {
/**
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,22 +22,22 @@
*
*/
+/*
+ * @test
+ * @library /testlibrary /test/lib /compiler/codegen/7184394 /
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ * @build TestAESIntrinsicsOnUnsupportedConfig TestAESMain
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -Xbatch TestAESIntrinsicsOnUnsupportedConfig
+ */
+
import jdk.test.lib.cli.predicate.NotPredicate;
import jdk.test.lib.OutputAnalyzer;
import jdk.test.lib.ProcessTools;
-/*
- * @test
- * @library /testlibrary /test/lib /compiler/whitebox
- * /compiler/testlibrary /compiler/codegen/7184394
- * @modules java.base/jdk.internal.misc
- * java.management
- * @build TestAESIntrinsicsOnUnsupportedConfig TestAESMain
- * @run main ClassFileInstaller
- * sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI -Xbatch TestAESIntrinsicsOnUnsupportedConfig
- */
public class TestAESIntrinsicsOnUnsupportedConfig extends AESIntrinsicsBase {
private static final String INTRINSICS_NOT_AVAILABLE_MSG = "warning: AES "
--- a/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/exceptions/TestRecursiveReplacedException.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8054224
* @summary Recursive method compiled by C1 is unable to catch StackOverflowError
- * @run main/othervm -Xcomp -XX:CompileOnly=Test.run -XX:+TieredCompilation -XX:TieredStopAtLevel=2 -Xss392K TestRecursiveReplacedException
+ * @run main/othervm -Xcomp -XX:CompileOnly=Test.run -XX:+TieredCompilation -XX:TieredStopAtLevel=2 -Xss512K TestRecursiveReplacedException
*
*/
--- a/hotspot/test/compiler/floatingpoint/TestPow2.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/floatingpoint/TestPow2.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,11 +25,12 @@
* @test
* @bug 8063086
* @summary X^2 special case for C2 yields different result than interpreter
- * @library /testlibrary /test/lib /compiler/whitebox /
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* @modules java.management
* @build TestPow2
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestPow2
*
--- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -20,20 +20,15 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-import java.lang.reflect.Executable;
-import java.util.concurrent.Callable;
-import java.util.Objects;
-import jdk.test.lib.*;
-import compiler.whitebox.CompilerWhiteBoxTest;
/*
* @test
* @bug 8130832
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/whitebox /compiler/testlibrary /
+ * @library /testlibrary /test/lib /
* @build IntrinsicAvailableTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
@@ -45,6 +40,14 @@
* -XX:-UseCRC32Intrinsics
* IntrinsicAvailableTest
*/
+
+import java.lang.reflect.Executable;
+import java.util.concurrent.Callable;
+import java.util.Objects;
+
+import jdk.test.lib.*;
+import compiler.whitebox.CompilerWhiteBoxTest;
+
public class IntrinsicAvailableTest extends CompilerWhiteBoxTest {
protected String VMName;
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build AndnTestI
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestI
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build AndnTestL
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestL
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build BlsiTestI
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsiTestI
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build BlsiTestL
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsiTestL
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build BlsmskTestI
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsmskTestI
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build BlsmskTestL
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsmskTestL
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build BlsrTestI
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsrTestI
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build BlsrTestL
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions BlsrTestL
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build LZcntTestI
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestI
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build LZcntTestL
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountLeadingZerosInstruction LZcntTestL
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build TZcntTestI
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestI
*/
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,12 +24,12 @@
/*
* @test
* @bug 8031321
- * @library /testlibrary /test/lib /compiler/whitebox / ..
+ * @library /testlibrary /test/lib / ..
* @modules java.base/jdk.internal.misc
* java.management
* @build TZcntTestL
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountTrailingZerosInstruction TZcntTestL
*/
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build AddExactIntTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics AddExactIntTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class AddExactIntTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build AddExactLongTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics AddExactLongTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class AddExactLongTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build DecrementExactIntTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics DecrementExactIntTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class DecrementExactIntTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build DecrementExactLongTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics DecrementExactLongTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class DecrementExactLongTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build IncrementExactIntTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics IncrementExactIntTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class IncrementExactIntTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build IncrementExactLongTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics IncrementExactLongTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class IncrementExactLongTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,12 +22,13 @@
*/
import jdk.test.lib.Platform;
-import intrinsics.Verifier;
import java.io.FileOutputStream;
import java.lang.reflect.Executable;
import java.util.Properties;
+
import compiler.whitebox.CompilerWhiteBoxTest;
+import compiler.testlibrary.intrinsics.Verifier;
public abstract class IntrinsicBase extends CompilerWhiteBoxTest {
protected String javaVmName;
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build MultiplyExactIntTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics MultiplyExactIntTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class MultiplyExactIntTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build MultiplyExactLongTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics MultiplyExactLongTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class MultiplyExactLongTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build NegateExactIntTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics NegateExactIntTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class NegateExactIntTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build NegateExactLongTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics NegateExactLongTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class NegateExactLongTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build SubtractExactIntTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,8 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics SubtractExactIntTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
-
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class SubtractExactIntTest {
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test
- * @library /testlibrary /test/lib /compiler/whitebox / /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build SubtractExactLongTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
@@ -37,7 +37,7 @@
* -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,MathIntrinsic*::execMathMethod
* -XX:LogFile=hs.log -XX:+UseMathExactIntrinsics SubtractExactLongTest
- * @run main intrinsics.Verifier hs_neg.log hs.log
+ * @run driver compiler.testlibrary.intrinsics.Verifier hs_neg.log hs.log
*/
public class SubtractExactLongTest {
--- a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java Fri Jul 01 16:50:34 2016 -0700
@@ -23,7 +23,7 @@
import jdk.test.lib.Platform;
import jdk.test.lib.cli.CommandLineOptionTest;
-import sha.predicate.IntrinsicPredicates;
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
import java.util.function.BooleanSupplier;
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,13 +24,13 @@
/**
* @test
* @bug 8035968
- * @summary Verify UseSHA1Intrinsics option processing on supported CPU,
- * @library /testlibrary /test/lib /compiler/testlibrary testcases
+ * @summary Verify UseSHA1Intrinsics option processing on supported CPU.
+ * @library /testlibrary /test/lib testcases /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseSHA1IntrinsicsOptionOnSupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseSHA1IntrinsicsOptionOnSupportedCPU
*/
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,13 +24,13 @@
/**
* @test
* @bug 8035968
- * @summary Verify UseSHA1Intrinsics option processing on unsupported CPU,
- * @library /testlibrary /test/lib /compiler/testlibrary testcases
+ * @summary Verify UseSHA1Intrinsics option processing on unsupported CPU.
+ * @library /testlibrary /test/lib testcases /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,13 +24,13 @@
/**
* @test
* @bug 8035968
- * @summary Verify UseSHA256Intrinsics option processing on supported CPU,
- * @library /testlibrary /test/lib /compiler/testlibrary testcases
+ * @summary Verify UseSHA256Intrinsics option processing on supported CPU.
+ * @library /testlibrary /test/lib testcases /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseSHA256IntrinsicsOptionOnSupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA256IntrinsicsOptionOnSupportedCPU
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,13 +24,13 @@
/**
* @test
* @bug 8035968
- * @summary Verify UseSHA256Intrinsics option processing on unsupported CPU,
- * @library /testlibrary /test/lib /compiler/testlibrary testcases
+ * @summary Verify UseSHA256Intrinsics option processing on unsupported CPU.
+ * @library /testlibrary /test/lib testcases /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,12 +25,12 @@
* @test
* @bug 8035968
* @summary Verify UseSHA512Intrinsics option processing on supported CPU.
- * @library /testlibrary /test/lib /compiler/testlibrary testcases
+ * @library /testlibrary /test/lib testcases /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseSHA512IntrinsicsOptionOnSupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA512IntrinsicsOptionOnSupportedCPU
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,13 +24,13 @@
/**
* @test
* @bug 8035968
- * @summary Verify UseSHA512Intrinsics option processing on unsupported CPU,
- * @library /testlibrary /test/lib /compiler/testlibrary testcases
+ * @summary Verify UseSHA512Intrinsics option processing on unsupported CPU.
+ * @library /testlibrary /test/lib testcases /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,13 +24,13 @@
/**
* @test
* @bug 8035968
- * @summary Verify UseSHA option processing on supported CPU,
- * @library /testlibrary /test/lib /compiler/testlibrary testcases
+ * @summary Verify UseSHA option processing on supported CPU.
+ * @library /testlibrary /test/lib testcases /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseSHAOptionOnSupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseSHAOptionOnSupportedCPU
*/
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,12 +25,12 @@
* @test
* @bug 8035968
* @summary Verify UseSHA option processing on unsupported CPU.
- * @library /testlibrary /test/lib /compiler/testlibrary testcases
+ * @library /testlibrary /test/lib testcases /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseSHAOptionOnUnsupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseSHAOptionOnUnsupportedCPU
*/
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,7 +27,7 @@
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.OrPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import sha.predicate.IntrinsicPredicates;
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
/**
* Test case specific to UseSHA*Intrinsics options targeted to SPARC and AArch64
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,7 +27,7 @@
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.OrPredicate;
-import sha.predicate.IntrinsicPredicates;
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
/**
* UseSHA specific test case targeted to SPARC and AArch64 CPUs which
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,7 +28,7 @@
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.OrPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import sha.predicate.IntrinsicPredicates;
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
/**
* UseSHA specific test case targeted to SPARC and AArch64 CPUs which don't
--- a/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/SHASanityTestBase.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,7 +21,6 @@
* questions.
*/
-import intrinsics.Verifier;
import sun.hotspot.WhiteBox;
import java.io.FileOutputStream;
@@ -30,6 +29,8 @@
import java.util.Properties;
import java.util.function.BooleanSupplier;
+import compiler.testlibrary.intrinsics.Verifier;
+
/**
* Base class for sanity tests on SHA intrinsics support.
*/
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,12 +25,12 @@
* @test
* @bug 8035968
* @summary Verify that SHA-1 intrinsic is actually used.
- * @library /testlibrary /test/lib /compiler/testlibrary ../
+ * @library /testlibrary /test/lib / ../
* @modules java.base/jdk.internal.misc
* java.management
- * @build TestSHA intrinsics.Verifier TestSHA1Intrinsics
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA1Intrinsics
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
@@ -48,9 +48,10 @@
* -XX:-UseSHA1Intrinsics
* -Dalgorithm=SHA-1 TestSHA1Intrinsics
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
- * intrinsics.Verifier positive.log negative.log
+ * compiler.testlibrary.intrinsics.Verifier positive.log negative.log
*/
-import sha.predicate.IntrinsicPredicates;
+
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
public class TestSHA1Intrinsics {
public static void main(String args[]) throws Exception {
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,18 +21,16 @@
* questions.
*/
-import sha.predicate.IntrinsicPredicates;
-
/**
* @test
* @bug 8035968
* @summary Verify that SHA-1 multi block intrinsic is actually used.
- * @library /testlibrary /test/lib /compiler/testlibrary ../
+ * @library /testlibrary /test/lib / ../
* @modules java.base/jdk.internal.misc
* java.management
- * @build TestSHA intrinsics.Verifier TestSHA1MultiBlockIntrinsics
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA1MultiBlockIntrinsics
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
@@ -58,9 +56,12 @@
* -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA
* -Dalgorithm=SHA-1 TestSHA1MultiBlockIntrinsics
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
- * intrinsics.Verifier positive.log positive_def.log
+ * compiler.testlibrary.intrinsics.Verifier positive.log positive_def.log
* negative.log
*/
+
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
+
public class TestSHA1MultiBlockIntrinsics {
public static void main(String args[]) throws Exception {
new SHASanityTestBase(IntrinsicPredicates.SHA1_INTRINSICS_AVAILABLE,
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,18 +21,16 @@
* questions.
*/
-import sha.predicate.IntrinsicPredicates;
-
/**
* @test
* @bug 8035968
* @summary Verify that SHA-256 intrinsic is actually used.
- * @library /testlibrary /test/lib /compiler/testlibrary ../
+ * @library /testlibrary /test/lib / ../
* @modules java.base/jdk.internal.misc
* java.management
- * @build TestSHA intrinsics.Verifier TestSHA256Intrinsics
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA256Intrinsics
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
@@ -66,9 +64,12 @@
* -XX:-UseSHA256Intrinsics
* -Dalgorithm=SHA-256 TestSHA256Intrinsics
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
- * intrinsics.Verifier positive_224.log positive_256.log
+ * compiler.testlibrary.intrinsics.Verifier positive_224.log positive_256.log
* negative_224.log negative_256.log
*/
+
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
+
public class TestSHA256Intrinsics {
public static void main(String args[]) throws Exception {
new SHASanityTestBase(IntrinsicPredicates.SHA256_INTRINSICS_AVAILABLE,
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,18 +21,16 @@
* questions.
*/
-import sha.predicate.IntrinsicPredicates;
-
/**
* @test
* @bug 8035968
* @summary Verify that SHA-256 multi block intrinsic is actually used.
- * @library /testlibrary /test/lib /compiler/testlibrary ../
+ * @library /testlibrary /test/lib / ../
* @modules java.base/jdk.internal.misc
* java.management
- * @build TestSHA intrinsics.Verifier TestSHA256MultiBlockIntrinsics
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA256MultiBlockIntrinsics
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
@@ -82,10 +80,13 @@
* -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA
* -Dalgorithm=SHA-256 TestSHA256MultiBlockIntrinsics
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
- * intrinsics.Verifier positive_224.log positive_256.log
+ * compiler.testlibrary.intrinsics.Verifier positive_224.log positive_256.log
* positive_224_def.log positive_256_def.log negative_224.log
* negative_256.log
*/
+
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
+
public class TestSHA256MultiBlockIntrinsics {
public static void main(String args[]) throws Exception {
new SHASanityTestBase(IntrinsicPredicates.SHA256_INTRINSICS_AVAILABLE,
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,18 +21,16 @@
* questions.
*/
-import sha.predicate.IntrinsicPredicates;
-
/**
* @test
* @bug 8035968
* @summary Verify that SHA-512 intrinsic is actually used.
- * @library /testlibrary /test/lib /compiler/testlibrary ../
+ * @library /testlibrary /test/lib / ../
* @modules java.base/jdk.internal.misc
* java.management
- * @build TestSHA intrinsics.Verifier TestSHA512Intrinsics
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA512Intrinsics
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
@@ -66,9 +64,12 @@
* -XX:-UseSHA512Intrinsics
* -Dalgorithm=SHA-512 TestSHA512Intrinsics
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
- * intrinsics.Verifier positive_384.log positive_512.log
+ * compiler.testlibrary.intrinsics.Verifier positive_384.log positive_512.log
* negative_384.log negative_512.log
*/
+
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
+
public class TestSHA512Intrinsics {
public static void main(String args[]) throws Exception {
new SHASanityTestBase(IntrinsicPredicates.SHA512_INTRINSICS_AVAILABLE,
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,18 +21,16 @@
* questions.
*/
-import sha.predicate.IntrinsicPredicates;
-
/**
* @test
* @bug 8035968
* @summary Verify that SHA-512 multi block intrinsic is actually used.
- * @library /testlibrary /test/lib /compiler/testlibrary ../
+ * @library /testlibrary /test/lib / ../
* @modules java.base/jdk.internal.misc
* java.management
- * @build TestSHA intrinsics.Verifier TestSHA512MultiBlockIntrinsics
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build TestSHA compiler.testlibrary.intrinsics.Verifier TestSHA512MultiBlockIntrinsics
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
@@ -82,10 +80,13 @@
* -XX:CompileOnly=sun/security/provider/SHA -XX:-UseSHA
* -Dalgorithm=SHA-512 TestSHA512MultiBlockIntrinsics
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
- * intrinsics.Verifier positive_384.log positive_512.log
+ * compiler.testlibrary.intrinsics.Verifier positive_384.log positive_512.log
* positive_384_def.log positive_512_def.log negative_384.log
* negative_512.log
*/
+
+import compiler.testlibrary.sha.predicate.IntrinsicPredicates;
+
public class TestSHA512MultiBlockIntrinsics {
public static void main(String args[]) throws Exception {
new SHASanityTestBase(IntrinsicPredicates.SHA512_INTRINSICS_AVAILABLE,
--- a/hotspot/test/compiler/jsr292/InvokerGC.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jsr292/InvokerGC.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8067247
* @modules java.base/jdk.internal.misc
- * @library /test/lib /compiler/whitebox /
+ * @library /test/lib /
* @run main/bootclasspath/othervm -Xcomp -Xbatch
* -XX:CompileCommand=compileonly,InvokerGC::test
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
--- a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,6 +28,7 @@
* java.base/jdk.internal.misc
* java.base/jdk.internal.vm.annotation
* @library /testlibrary /test/lib / ../patches
+ * @requires vm.flavor != "minimal"
* @build sun.hotspot.WhiteBox
* @build java.base/java.lang.invoke.MethodHandleHelper
* @build compiler.jsr292.NonInlinedCall.RedefineTest
--- a/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/common/patches/jdk.vm.ci/jdk/vm/ci/hotspot/CompilerToVMHelper.java Fri Jul 01 16:50:34 2016 -0700
@@ -124,8 +124,8 @@
}
public static HotSpotResolvedObjectType resolveFieldInPool(
- ConstantPool constantPool, int cpi, byte opcode, long[] info) {
- return CTVM.resolveFieldInPool((HotSpotConstantPool) constantPool, cpi, opcode, info);
+ ConstantPool constantPool, int cpi, ResolvedJavaMethod method, byte opcode, long[] info) {
+ return CTVM.resolveFieldInPool((HotSpotConstantPool) constantPool, cpi, (HotSpotResolvedJavaMethodImpl) method, opcode, info);
}
public static int constantPoolRemapInstructionOperandFromCache(
@@ -152,8 +152,8 @@
CTVM.resetCompilationStatistics();
}
- public static long initializeConfiguration(HotSpotVMConfig config) {
- return CTVM.initializeConfiguration(config);
+ public static Object[] readConfiguration() {
+ return CTVM.readConfiguration();
}
public static HotSpotResolvedJavaMethod resolveMethod(
--- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,6 +27,7 @@
import java.util.HashMap;
import java.util.Map;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
import sun.hotspot.WhiteBox;
import jdk.internal.reflect.ConstantPool;
import jdk.internal.reflect.ConstantPool.Tag;
@@ -184,13 +185,24 @@
public final String klass;
public final String name;
public final String type;
+ public final ResolvedJavaMethod[] methods;
public final byte[] opcodes;
public final long accFlags;
public TestedCPEntry(String klass, String name, String type, byte[] opcodes, long accFlags) {
+ this(klass, name, type, null, opcodes, accFlags);
+ }
+
+ public TestedCPEntry(String klass, String name, String type, ResolvedJavaMethod[] methods, byte[] opcodes, long accFlags) {
this.klass = klass;
this.name = name;
this.type = type;
+ if (methods != null) {
+ this.methods = new ResolvedJavaMethod[methods.length];
+ System.arraycopy(methods, 0, this.methods, 0, methods.length);
+ } else {
+ this.methods = null;
+ }
if (opcodes != null) {
this.opcodes = new byte[opcodes.length];
System.arraycopy(opcodes, 0, this.opcodes, 0, opcodes.length);
--- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java Fri Jul 01 16:50:34 2016 -0700
@@ -31,6 +31,10 @@
import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry;
import java.util.HashMap;
import java.util.Map;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.runtime.JVMCI;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.org.objectweb.asm.Opcodes;
import sun.hotspot.WhiteBox;
@@ -44,6 +48,7 @@
public class ConstantPoolTestsHelper {
public static final int NO_CP_CACHE_PRESENT = Integer.MAX_VALUE;
+ private static final MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
public enum DummyClasses {
DUMMY_CLASS(MultipleImplementer2.class, CP_MAP_FOR_CLASS),
@@ -76,6 +81,45 @@
}
}
+ /**
+ * Obtain a resolved Java method declared by a given type.
+ *
+ * @param type the declaring type
+ * @param the method's name
+ *
+ * Currently, the lookup is based only on the method's name
+ * but not on the method's signature (i.e., the first method
+ * with a matching name declared on {@code type} is returned).
+ */
+ private static ResolvedJavaMethod getMethod(ResolvedJavaType type, String methodName) {
+ if (methodName.equals("<clinit>")) {
+ return type.getClassInitializer();
+ }
+
+ if (methodName.equals("<init>")) {
+ ResolvedJavaMethod[] initializers = type.getDeclaredConstructors();
+ if (initializers.length >= 0) {
+ return initializers[0];
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
+ if (method.getName().equals(methodName)) {
+ return method;
+ }
+ }
+
+ throw new IllegalArgumentException();
+ }
+
+ private static ResolvedJavaType getType(Class<?> clazz) {
+ ResolvedJavaType type = metaAccess.lookupJavaType(clazz);
+ type.initialize();
+ return type;
+ }
+
private static final Map<ConstantTypes, TestedCPEntry[]> CP_MAP_FOR_CLASS = new HashMap<>();
static {
CP_MAP_FOR_CLASS.put(CONSTANT_CLASS,
@@ -141,6 +185,7 @@
new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
"objectField",
"Ljava/lang/Object;",
+ new ResolvedJavaMethod[] { getMethod(getType(MultipleImplementer2.class), "<init>"), null },
new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
Opcodes.ACC_FINAL),
new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementer2",
@@ -296,6 +341,7 @@
new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
"objectField",
"Ljava/lang/Object;",
+ new ResolvedJavaMethod[] { getMethod(getType(MultipleAbstractImplementer.class), "<init>"), null },
new byte[] {(byte) Opcodes.PUTFIELD | (byte) Opcodes.GETFIELD},
Opcodes.ACC_FINAL),
new TestedCPEntry("compiler/jvmci/common/testcases/MultipleAbstractImplementer",
@@ -401,6 +447,7 @@
new TestedCPEntry("compiler/jvmci/common/testcases/MultipleImplementersInterface",
"OBJECT_CONSTANT",
"Ljava/lang/Object;",
+ new ResolvedJavaMethod[] { getMethod(getType(MultipleImplementersInterface.class), "<clinit>"), null },
new byte[] {(byte) Opcodes.PUTSTATIC, (byte) Opcodes.GETSTATIC},
Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_PUBLIC),
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -45,188 +45,30 @@
import java.util.function.Consumer;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
+import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
+import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.internal.misc.Unsafe;
public class InitializeConfigurationTest {
- private static final Unsafe UNSAFE = Utils.getUnsafe();
-
public static void main(String args[]) {
- new InitializeConfigurationTest().runTest(generateTestCases());
- }
-
- private static List<TestCase> generateTestCases() {
- List<TestCase> result = new ArrayList<>();
- result.add(new TestCase("CodeCache", "_high_bound", "address",
- InitializeConfigurationTest::verifyLongIsNotZero));
- result.add(new TestCase("StubRoutines", "_jint_arraycopy", "address",
- InitializeConfigurationTest::verifyLongIsNotZero));
- return result;
- }
-
- private static void verifyLongIsNotZero(Object o) {
- Asserts.assertNotNull(o, "Got null value");
- Asserts.assertEQ(o.getClass(), Long.class, "Unexpected value type");
- Asserts.assertNE(o, 0L, "Got null address");
- }
-
- private void runTest(List<TestCase> tcases) {
- VMStructDataReader reader = new VMStructDataReader(
- CompilerToVMHelper.initializeConfiguration(HotSpotJVMCIRuntime.runtime().getConfig()));
- while (reader.hasNext()) {
- VMFieldData data = reader.next();
- for (TestCase tcase : tcases) {
- tcase.check(data);
- }
- }
- // now check if all passed
- for (TestCase tcase: tcases) {
- Asserts.assertTrue(tcase.isFound(), "Case failed: " + tcase);
- }
+ new InitializeConfigurationTest().runTest();
}
- private static class VMStructDataReader implements Iterator<VMFieldData> {
- // see jvmciCompilerToVM:105 static uintptr_t ciHotSpotVMData[28];
- private static final int HOTSPOT_VM_DATA_INDEX_COUNT = 28;
- private final long addresses[];
- private final long vmStructsBase;
- private final long entityNameFieldOffset;
- private final long nameFieldOffset;
- private final long typeStringFieldOffset;
- private final long addressOffset;
- private final long entrySize;
- private long nextElementAddress;
- private VMFieldData nextElement;
+ private void runTest() {
+ TestHotSpotVMConfig config = new TestHotSpotVMConfig(HotSpotJVMCIRuntime.runtime().getConfigStore());
+ Asserts.assertNE(config.codeCacheHighBound, 0L, "Got null address");
+ Asserts.assertNE(config.stubRoutineJintArrayCopy, 0L, "Got null address");
+ }
- public VMStructDataReader(long gHotSpotVMData) {
- Asserts.assertNE(gHotSpotVMData, 0L, "Got null base address");
- addresses = new long[HOTSPOT_VM_DATA_INDEX_COUNT];
- for (int i = 0; i < HOTSPOT_VM_DATA_INDEX_COUNT; i++) {
- addresses[i] = UNSAFE.getAddress(
- gHotSpotVMData + Unsafe.ADDRESS_SIZE * i);
- }
- vmStructsBase = addresses[0];
- entityNameFieldOffset = addresses[1];
- nameFieldOffset = addresses[2];
- typeStringFieldOffset = addresses[3];
- addressOffset = addresses[6];
- entrySize = addresses[7];
- nextElementAddress = vmStructsBase;
- nextElement = read();
- }
+ private static class TestHotSpotVMConfig extends HotSpotVMConfigAccess {
- @Override
- public boolean hasNext() {
- return nextElement != null;
- }
-
- @Override
- public VMFieldData next() {
- if (nextElement == null) {
- throw new NoSuchElementException("Next element is null");
- }
- VMFieldData toReturn = nextElement;
- nextElementAddress += entrySize;
- nextElement = read();
- return toReturn;
+ private TestHotSpotVMConfig(HotSpotVMConfigStore store) {
+ super(store);
}
- private VMFieldData read() {
- String entityFieldName = readCString(
- UNSAFE.getAddress(nextElementAddress + nameFieldOffset));
- if (entityFieldName == null) {
- return null;
- }
- String fieldType = readCString(UNSAFE.getAddress(
- nextElementAddress + typeStringFieldOffset));
- String entityName = readCString(UNSAFE.getAddress(
- nextElementAddress + entityNameFieldOffset));
- Object value;
- if ("address".equals(fieldType)) {
- long address = UNSAFE.getAddress(
- nextElementAddress + addressOffset);
- value = address;
- } else {
- // non-address cases are not supported
- value = null;
- }
- return new VMFieldData(entityName, entityFieldName, fieldType,
- value);
- }
-
- private static String readCString(long address) {
- if (address == 0) {
- return null;
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0;; i++) {
- char c = (char) UNSAFE.getByte(address + i);
- if (c == 0) {
- break;
- }
- sb.append(c);
- }
- return sb.toString();
- }
- }
-
- private static class VMFieldData {
- public final String entityFieldName;
- public final String entityName;
- public final String fieldType;
- public final Object value;
-
- private VMFieldData(String entityName, String entityFieldName,
- String fieldType, Object value) {
- this.entityName = entityName;
- this.entityFieldName = entityFieldName;
- this.fieldType = fieldType;
- this.value = value;
- }
- }
-
- private static class TestCase {
- public final String entityName;
- public final String fieldType;
- public final String entityFieldName;
- public final Consumer consumer;
- private boolean found;
-
- public TestCase(String entityName, String entityFieldName,
- String fieldType, Consumer predicate) {
- Objects.requireNonNull(entityName, "Got null entityName");
- Objects.requireNonNull(entityFieldName, "Got null entityFieldName");
- Objects.requireNonNull(fieldType, "Got null type");
- if (!"address".equals(fieldType)) {
- throw new Error("TESTBUG: unsupported testcase with fieldType="
- + fieldType);
- }
- this.entityName = entityName;
- this.fieldType = fieldType;
- this.entityFieldName = entityFieldName;
- this.consumer = predicate;
- this.found = false;
- }
-
- public void check(VMFieldData data) {
- if (entityFieldName.equals(data.entityFieldName)
- && entityName.equals(data.entityName)
- && fieldType.equals(data.fieldType)) {
- Asserts.assertFalse(found, "Found 2 entries of " + this);
- found = true;
- consumer.accept(data.value);
- }
- }
-
- @Override
- public String toString() {
- return "CASE: entityName=" + entityName + " entityFieldName="
- + entityFieldName + " fieldType=" + fieldType;
- }
-
- public boolean isFound() {
- return found;
- }
+ final long codeCacheHighBound = getFieldValue("CodeCache::_high_bound", Long.class);
+ final long stubRoutineJintArrayCopy = getFieldValue("StubRoutines::_jint_arraycopy", Long.class);
}
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -74,11 +74,16 @@
}
methodData = WB.getMethodData(method);
isMature = CompilerToVMHelper.isMature(methodData);
- Asserts.assertNE(methodData, 0L,
- "Multiple times invoked method should have method data");
- /* a method is not mature for -Xcomp and -Tiered,
- see NonTieredCompPolicy::is_mature */
- Asserts.assertEQ(isMature, !(IS_XCOMP && !TIERED),
- "Unexpected isMature state for multiple times invoked method");
+ int compLevel = WB.getMethodCompilationLevel(method);
+ // methodData doesn't necessarily exist for interpreter and compilation level 1
+ if (compLevel != CompilerWhiteBoxTest.COMP_LEVEL_NONE
+ && compLevel != CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE) {
+ Asserts.assertNE(methodData, 0L,
+ "Multiple times invoked method should have method data");
+ /* a method is not mature in Xcomp mode with tiered compilation disabled,
+ see NonTieredCompPolicy::is_mature */
+ Asserts.assertEQ(isMature, !(IS_XCOMP && !TIERED),
+ "Unexpected isMature state for multiple times invoked method");
+ }
}
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -34,6 +34,7 @@
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
* jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.meta
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -33,6 +33,7 @@
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
* jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.meta
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -34,6 +34,7 @@
* java.base/jdk.internal.org.objectweb.asm.tree
* jdk.vm.ci/jdk.vm.ci.hotspot
* jdk.vm.ci/jdk.vm.ci.meta
+ * jdk.vm.ci/jdk.vm.ci.runtime
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
* compiler.jvmci.compilerToVM.LookupMethodInPoolTest
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -33,6 +33,7 @@
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
* jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.meta
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -33,6 +33,7 @@
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
* jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.meta
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -33,6 +33,7 @@
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
* jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.meta
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -34,6 +34,7 @@
* jdk.vm.ci/jdk.vm.ci.hotspot
* jdk.vm.ci/jdk.vm.ci.code
* jdk.vm.ci/jdk.vm.ci.meta
+ * @ignore 8157861
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
* @build compiler.jvmci.compilerToVM.ReprofileTest
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,6 +32,7 @@
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.meta
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -34,6 +34,7 @@
* java.base/jdk.internal.org.objectweb.asm.tree
* jdk.vm.ci/jdk.vm.ci.hotspot
* jdk.vm.ci/jdk.vm.ci.meta
+ * jdk.vm.ci/jdk.vm.ci.runtime
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
* compiler.jvmci.compilerToVM.ResolveFieldInPoolTest
@@ -107,6 +108,7 @@
HotSpotResolvedObjectType fieldToVerify
= CompilerToVMHelper.resolveFieldInPool(constantPoolCTVM,
index,
+ entry.methods == null ? null : entry.methods[j],
entry.opcodes[j],
info);
String msg = String.format("Object returned by resolveFieldInPool method"
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -33,6 +33,7 @@
* java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.org.objectweb.asm.tree
* jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.meta
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -33,6 +33,7 @@
* java.base/jdk.internal.reflect
* java.base/jdk.internal.org.objectweb.asm
* jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.meta
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
* @build sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,6 +28,7 @@
import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterArray;
import jdk.vm.ci.code.StackSlot;
import jdk.vm.ci.code.site.DataPatch;
import jdk.vm.ci.code.site.Site;
@@ -80,11 +81,11 @@
protected Register getRegister(PlatformKind kind, int index) {
int idx = index;
- Register[] allRegs = arch.getAvailableValueRegisters();
- for (int i = 0; i < allRegs.length; i++) {
- if (arch.canStoreValue(allRegs[i].getRegisterCategory(), kind)) {
+ RegisterArray allRegs = arch.getAvailableValueRegisters();
+ for (Register reg : allRegs) {
+ if (arch.canStoreValue(reg.getRegisterCategory(), kind)) {
if (idx-- == 0) {
- return allRegs[i];
+ return reg;
}
}
}
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java Fri Jul 01 16:50:34 2016 -0700
@@ -49,7 +49,6 @@
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment;
import jdk.vm.ci.hotspot.HotSpotReferenceMap;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.Assumptions.Assumption;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.PlatformKind;
@@ -112,21 +111,4 @@
test(new HotSpotReferenceMap(oops, base, size, 8));
}
-
- @Test(expected = JVMCIError.class)
- public void testInvalidNarrowDerivedOop() {
- if (!HotSpotVMConfig.config().useCompressedOops) {
- throw new JVMCIError("skipping test");
- }
-
- PlatformKind kind = arch.getPlatformKind(JavaKind.Int);
- Register reg = getRegister(kind, 0);
- Register baseReg = getRegister(arch.getPlatformKind(JavaKind.Object), 1);
-
- Location[] oops = new Location[]{Location.register(reg)};
- Location[] base = new Location[]{Location.register(baseReg)};
- int[] size = new int[]{kind.getSizeInBytes()};
-
- test(new HotSpotReferenceMap(oops, base, size, 8));
- }
}
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -34,6 +34,7 @@
import jdk.vm.ci.code.test.amd64.AMD64TestAssembler;
import jdk.vm.ci.code.test.sparc.SPARCTestAssembler;
import jdk.vm.ci.hotspot.HotSpotCompiledCode;
+import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.meta.MetaAccessProvider;
@@ -50,6 +51,7 @@
protected final CodeCacheProvider codeCache;
protected final TargetDescription target;
protected final ConstantReflectionProvider constantReflection;
+ protected final TestHotSpotVMConfig config;
public CodeInstallationTest() {
JVMCIBackend backend = JVMCI.getRuntime().getHostJVMCIBackend();
@@ -57,6 +59,7 @@
codeCache = backend.getCodeCache();
target = backend.getTarget();
constantReflection = backend.getConstantReflection();
+ config = new TestHotSpotVMConfig(HotSpotJVMCIRuntime.runtime().getConfigStore());
}
protected interface TestCompiler {
@@ -67,9 +70,9 @@
private TestAssembler createAssembler() {
Architecture arch = codeCache.getTarget().arch;
if (arch instanceof AMD64) {
- return new AMD64TestAssembler(codeCache);
+ return new AMD64TestAssembler(codeCache, config);
} else if (arch instanceof SPARC) {
- return new SPARCTestAssembler(codeCache);
+ return new SPARCTestAssembler(codeCache, config);
} else {
Assert.fail("unsupported architecture");
return null;
@@ -86,17 +89,17 @@
}
protected void test(TestCompiler compiler, Method method, Object... args) {
- HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
- TestAssembler asm = createAssembler();
+ try {
+ HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) metaAccess.lookupJavaMethod(method);
+ TestAssembler asm = createAssembler();
- asm.emitPrologue();
- compiler.compile(asm);
- asm.emitEpilogue();
+ asm.emitPrologue();
+ compiler.compile(asm);
+ asm.emitEpilogue();
- HotSpotCompiledCode code = asm.finish(resolvedMethod);
- InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null);
+ HotSpotCompiledCode code = asm.finish(resolvedMethod);
+ InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null);
- try {
Object expected = method.invoke(null, args);
Object actual = installed.executeVarargs(args);
Assert.assertEquals(expected, actual);
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,22 +32,20 @@
* jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc
- * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
+ * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.DataPatchTest
*/
package jdk.vm.ci.code.test;
+import org.junit.Assume;
+import org.junit.Test;
+
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.site.DataSectionReference;
import jdk.vm.ci.hotspot.HotSpotConstant;
-import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.ResolvedJavaType;
-import org.junit.Assume;
-import org.junit.Test;
-
/**
* Test code installation with data patches.
*/
@@ -73,12 +71,12 @@
@Test
public void testInlineNarrowObject() {
- Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
+ Assume.assumeTrue(config.useCompressedOops);
test(asm -> {
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type);
Register compressed = asm.emitLoadPointer((HotSpotConstant) c.compress());
- Register ret = asm.emitUncompressPointer(compressed, HotSpotVMConfig.config().narrowOopBase, HotSpotVMConfig.config().narrowOopShift);
+ Register ret = asm.emitUncompressPointer(compressed, config.narrowOopBase, config.narrowOopShift);
asm.emitPointerRet(ret);
});
}
@@ -96,14 +94,14 @@
@Test
public void testNarrowDataSectionReference() {
- Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
+ Assume.assumeTrue(config.useCompressedOops);
test(asm -> {
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
HotSpotConstant c = (HotSpotConstant) constantReflection.asJavaClass(type);
HotSpotConstant cCompressed = (HotSpotConstant) c.compress();
DataSectionReference ref = asm.emitDataItem(cCompressed);
Register compressed = asm.emitLoadNarrowPointer(ref);
- Register ret = asm.emitUncompressPointer(compressed, HotSpotVMConfig.config().narrowOopBase, HotSpotVMConfig.config().narrowOopShift);
+ Register ret = asm.emitUncompressPointer(compressed, config.narrowOopBase, config.narrowOopShift);
asm.emitPointerRet(ret);
});
}
@@ -113,20 +111,20 @@
test(asm -> {
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
Register klass = asm.emitLoadPointer((HotSpotConstant) constantReflection.asObjectHub(type));
- Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset);
+ Register ret = asm.emitLoadPointer(klass, config.classMirrorOffset);
asm.emitPointerRet(ret);
});
}
@Test
public void testInlineNarrowMetadata() {
- Assume.assumeTrue(HotSpotVMConfig.config().useCompressedClassPointers);
+ Assume.assumeTrue(config.useCompressedClassPointers);
test(asm -> {
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type);
Register narrowKlass = asm.emitLoadPointer((HotSpotConstant) hub.compress());
- Register klass = asm.emitUncompressPointer(narrowKlass, HotSpotVMConfig.config().narrowKlassBase, HotSpotVMConfig.config().narrowKlassShift);
- Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset);
+ Register klass = asm.emitUncompressPointer(narrowKlass, config.narrowKlassBase, config.narrowKlassShift);
+ Register ret = asm.emitLoadPointer(klass, config.classMirrorOffset);
asm.emitPointerRet(ret);
});
}
@@ -138,22 +136,22 @@
HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type);
DataSectionReference ref = asm.emitDataItem(hub);
Register klass = asm.emitLoadPointer(ref);
- Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset);
+ Register ret = asm.emitLoadPointer(klass, config.classMirrorOffset);
asm.emitPointerRet(ret);
});
}
@Test
public void testNarrowMetadataInDataSection() {
- Assume.assumeTrue(HotSpotVMConfig.config().useCompressedClassPointers);
+ Assume.assumeTrue(config.useCompressedClassPointers);
test(asm -> {
ResolvedJavaType type = metaAccess.lookupJavaType(getConstClass());
HotSpotConstant hub = (HotSpotConstant) constantReflection.asObjectHub(type);
HotSpotConstant narrowHub = (HotSpotConstant) hub.compress();
DataSectionReference ref = asm.emitDataItem(narrowHub);
Register narrowKlass = asm.emitLoadNarrowPointer(ref);
- Register klass = asm.emitUncompressPointer(narrowKlass, HotSpotVMConfig.config().narrowKlassBase, HotSpotVMConfig.config().narrowKlassShift);
- Register ret = asm.emitLoadPointer(klass, HotSpotVMConfig.config().classMirrorOffset);
+ Register klass = asm.emitUncompressPointer(narrowKlass, config.narrowKlassBase, config.narrowKlassShift);
+ Register ret = asm.emitLoadPointer(klass, config.classMirrorOffset);
asm.emitPointerRet(ret);
});
}
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -44,6 +44,10 @@
}
protected void test(DebugInfoCompiler compiler, Method method, int bci, JavaKind... slotKinds) {
+ test(compiler, method, bci, new Location[0], new Location[0], new int[0], slotKinds);
+ }
+
+ protected void test(DebugInfoCompiler compiler, Method method, int bci, Location[] objects, Location[] derivedBase, int[] sizeInBytes, JavaKind... slotKinds) {
ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(method);
int numLocals = resolvedMethod.getMaxLocals();
@@ -54,7 +58,7 @@
BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0);
DebugInfo info = new DebugInfo(frame, vobjs);
- info.setReferenceMap(new HotSpotReferenceMap(new Location[0], new Location[0], new int[0], 8));
+ info.setReferenceMap(new HotSpotReferenceMap(objects, derivedBase, sizeInBytes, 8));
asm.emitTrap(info);
}, method);
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,7 +32,7 @@
* jdk.vm.ci/jdk.vm.ci.common
* jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc
- * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
+ * @compile CodeInstallationTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.InterpreterFrameSizeTest
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,90 @@
+/*
+ * 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
+ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @library /
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ * jdk.vm.ci/jdk.vm.ci.meta
+ * jdk.vm.ci/jdk.vm.ci.code
+ * jdk.vm.ci/jdk.vm.ci.code.site
+ * jdk.vm.ci/jdk.vm.ci.common
+ * jdk.vm.ci/jdk.vm.ci.runtime
+ * jdk.vm.ci/jdk.vm.ci.amd64
+ * jdk.vm.ci/jdk.vm.ci.sparc
+ * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
+ * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.MaxOopMapStackOffsetTest
+ */
+
+package jdk.vm.ci.code.test;
+
+import org.junit.Test;
+
+import jdk.vm.ci.code.Location;
+import jdk.vm.ci.code.Register;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+
+public class MaxOopMapStackOffsetTest extends DebugInfoTest {
+
+ public static int pass() {
+ return 42;
+ }
+
+ public static int fail() {
+ return 42;
+ }
+
+ private void test(String name, int offset) {
+ Location location = Location.stack(offset);
+ DebugInfoCompiler compiler = (asm, values) -> {
+ asm.growFrame(offset);
+ Register v = asm.emitLoadInt(0);
+ asm.emitIntToStack(v);
+ values[0] = JavaConstant.forInt(42);
+ return null;
+ };
+ test(compiler, getMethod(name), 2, new Location[]{location}, new Location[1], new int[]{4}, JavaKind.Int);
+ }
+
+ private int maxOffset() {
+ return config.maxOopMapStackOffset;
+ }
+
+ private int wordSize() {
+ return config.heapWordSize;
+ }
+
+ @Test(expected = JVMCIError.class)
+ public void failTooLargeOffset() {
+ // This should throw a JVMCIError during installation because the offset is too large.
+ test("fail", maxOffset() + wordSize());
+ }
+
+ @Test
+ public void passWithLargeOffset() {
+ test("pass", maxOffset());
+ }
+}
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,7 +32,7 @@
* jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc
- * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
+ * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleCodeInstallationTest
*/
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,7 +32,7 @@
* jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc
- * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
+ * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleDebugInfoTest
*/
@@ -43,7 +43,6 @@
import jdk.vm.ci.code.Register;
import jdk.vm.ci.hotspot.HotSpotConstant;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaType;
@@ -255,7 +254,7 @@
@Test
public void testRegNarrowObject() {
- Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
+ Assume.assumeTrue(config.useCompressedOops);
ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
DebugInfoCompiler compiler = (asm, values) -> {
HotSpotConstant wide = (HotSpotConstant) constantReflection.asJavaClass(type);
@@ -269,7 +268,7 @@
@Test
public void testStackNarrowObject() {
- Assume.assumeTrue(HotSpotVMConfig.config().useCompressedOops);
+ Assume.assumeTrue(config.useCompressedOops);
ResolvedJavaType type = metaAccess.lookupJavaType(objectOnStack());
DebugInfoCompiler compiler = (asm, values) -> {
HotSpotConstant wide = (HotSpotConstant) constantReflection.asJavaClass(type);
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java Fri Jul 01 16:50:34 2016 -0700
@@ -182,6 +182,7 @@
private final ArrayList<DataPatch> dataPatches;
protected final CodeCacheProvider codeCache;
+ protected final TestHotSpotVMConfig config;
private final Register[] registers;
private int nextRegister;
@@ -204,7 +205,7 @@
}
}
- protected TestAssembler(CodeCacheProvider codeCache, int initialFrameSize, int stackAlignment, PlatformKind narrowOopKind, Register... registers) {
+ protected TestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config, int initialFrameSize, int stackAlignment, PlatformKind narrowOopKind, Register... registers) {
this.narrowOopKind = new TestValueKind(narrowOopKind);
this.code = new Buffer();
@@ -213,6 +214,7 @@
this.dataPatches = new ArrayList<>();
this.codeCache = codeCache;
+ this.config = config;
this.registers = registers;
this.nextRegister = 0;
@@ -231,7 +233,12 @@
}
protected StackSlot newStackSlot(PlatformKind kind) {
- curStackSlot += kind.getSizeInBytes();
+ growFrame(kind.getSizeInBytes());
+ return StackSlot.get(new TestValueKind(kind), -curStackSlot, true);
+ }
+
+ protected void growFrame(int sizeInBytes) {
+ curStackSlot += sizeInBytes;
if (curStackSlot > frameSize) {
int newFrameSize = curStackSlot;
if (newFrameSize % stackAlignment != 0) {
@@ -240,7 +247,6 @@
emitGrowStack(newFrameSize - frameSize);
frameSize = newFrameSize;
}
- return StackSlot.get(new TestValueKind(kind), -curStackSlot, true);
}
protected void setDeoptRescueSlot(StackSlot deoptRescue) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestHotSpotVMConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,50 @@
+/*
+ * 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.code.test;
+
+import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
+import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
+
+public class TestHotSpotVMConfig extends HotSpotVMConfigAccess {
+
+ public TestHotSpotVMConfig(HotSpotVMConfigStore config) {
+ super(config);
+ }
+
+ public final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
+ public final boolean useCompressedClassPointers = getFlag("UseCompressedClassPointers", Boolean.class);
+
+ public final long narrowOopBase = getFieldValue("CompilerToVM::Data::Universe_narrow_oop_base", Long.class, "address");
+ public final int narrowOopShift = getFieldValue("CompilerToVM::Data::Universe_narrow_oop_shift", Integer.class, "int");
+
+ public final long narrowKlassBase = getFieldValue("CompilerToVM::Data::Universe_narrow_klass_base", Long.class, "address");
+ public final int narrowKlassShift = getFieldValue("CompilerToVM::Data::Universe_narrow_klass_shift", Integer.class, "int");
+
+ public final int classMirrorOffset = getFieldOffset("Klass::_java_mirror", Integer.class, "oop");
+
+ public final int MARKID_DEOPT_HANDLER_ENTRY = getConstant("CodeInstaller::DEOPT_HANDLER_ENTRY", Integer.class);
+ public final long handleDeoptStub = getFieldValue("CompilerToVM::Data::SharedRuntime_deopt_blob_unpack", Long.class, "address");
+
+ public final int maxOopMapStackOffset = getFieldValue("CompilerToVM::Data::_max_oop_map_stack_offset", Integer.class, "int");
+ public final int heapWordSize = getConstant("HeapWordSize", Integer.class);
+}
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,7 +32,7 @@
* jdk.vm.ci/jdk.vm.ci.runtime
* jdk.vm.ci/jdk.vm.ci.amd64
* jdk.vm.ci/jdk.vm.ci.sparc
- * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
+ * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.VirtualObjectDebugInfoTest
*/
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java Fri Jul 01 16:50:34 2016 -0700
@@ -32,17 +32,17 @@
import jdk.vm.ci.code.site.ConstantReference;
import jdk.vm.ci.code.site.DataSectionReference;
import jdk.vm.ci.code.test.TestAssembler;
+import jdk.vm.ci.code.test.TestHotSpotVMConfig;
import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
import jdk.vm.ci.hotspot.HotSpotConstant;
import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.VMConstant;
public class AMD64TestAssembler extends TestAssembler {
- public AMD64TestAssembler(CodeCacheProvider codeCache) {
- super(codeCache, 16, 16, AMD64Kind.DWORD, AMD64.rax, AMD64.rcx, AMD64.rdi, AMD64.r8, AMD64.r9, AMD64.r10);
+ public AMD64TestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config) {
+ super(codeCache, config, 16, 16, AMD64Kind.DWORD, AMD64.rax, AMD64.rcx, AMD64.rdi, AMD64.r8, AMD64.r9, AMD64.r10);
}
private void emitFatNop() {
@@ -68,7 +68,6 @@
@Override
public void emitEpilogue() {
- HotSpotVMConfig config = HotSpotVMConfig.config();
recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
recordCall(new HotSpotForeignCallTarget(config.handleDeoptStub), 5, true, null);
code.emitByte(0xE8); // CALL rel32
@@ -86,12 +85,12 @@
@Override
public Register emitIntArg0() {
- return codeCache.getRegisterConfig().getCallingConventionRegisters(HotSpotCallingConventionType.JavaCall, JavaKind.Int)[0];
+ return codeCache.getRegisterConfig().getCallingConventionRegisters(HotSpotCallingConventionType.JavaCall, JavaKind.Int).get(0);
}
@Override
public Register emitIntArg1() {
- return codeCache.getRegisterConfig().getCallingConventionRegisters(HotSpotCallingConventionType.JavaCall, JavaKind.Int)[1];
+ return codeCache.getRegisterConfig().getCallingConventionRegisters(HotSpotCallingConventionType.JavaCall, JavaKind.Int).get(1);
}
private void emitREX(boolean w, int r, int x, int b) {
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java Fri Jul 01 16:50:34 2016 -0700
@@ -30,12 +30,12 @@
import jdk.vm.ci.code.site.ConstantReference;
import jdk.vm.ci.code.site.DataSectionReference;
import jdk.vm.ci.code.test.TestAssembler;
+import jdk.vm.ci.code.test.TestHotSpotVMConfig;
import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
import jdk.vm.ci.hotspot.HotSpotCompiledCode;
import jdk.vm.ci.hotspot.HotSpotConstant;
import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
-import jdk.vm.ci.hotspot.HotSpotVMConfig;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.VMConstant;
import jdk.vm.ci.sparc.SPARC;
@@ -45,11 +45,12 @@
private static final int MASK13 = (1 << 13) - 1;
- public SPARCTestAssembler(CodeCacheProvider codeCache) {
- super(codeCache, 0, 16, SPARCKind.WORD, SPARC.l0, SPARC.l1, SPARC.l2, SPARC.l3, SPARC.l4, SPARC.l5, SPARC.l6, SPARC.l7);
+ public SPARCTestAssembler(CodeCacheProvider codeCache, TestHotSpotVMConfig config) {
+ super(codeCache, config, 0, 16, SPARCKind.WORD, SPARC.l0, SPARC.l1, SPARC.l2, SPARC.l3, SPARC.l4, SPARC.l5, SPARC.l6, SPARC.l7);
}
private void emitOp2(Register rd, int op2, int imm22) {
+ assert isSimm(imm22, 22);
code.emitInt((0b00 << 30) | (rd.encoding << 25) | (op2 << 22) | imm22);
}
@@ -58,6 +59,7 @@
}
private void emitOp3(int op, Register rd, int op3, Register rs1, int simm13) {
+ assert isSimm(simm13, 13);
code.emitInt((op << 30) | (rd.encoding << 25) | (op3 << 19) | (rs1.encoding << 14) | (1 << 13) | (simm13 & MASK13));
}
@@ -65,6 +67,27 @@
code.emitInt(1 << 24);
}
+ /**
+ * Minimum value for signed immediate ranges.
+ */
+ public static long minSimm(long nbits) {
+ return -(1L << (nbits - 1));
+ }
+
+ /**
+ * Maximum value for signed immediate ranges.
+ */
+ public static long maxSimm(long nbits) {
+ return (1L << (nbits - 1)) - 1;
+ }
+
+ /**
+ * Test if imm is within signed immediate range for nbits.
+ */
+ public static boolean isSimm(long imm, int nbits) {
+ return minSimm(nbits) <= imm && imm <= maxSimm(nbits);
+ }
+
@Override
public void emitPrologue() {
// SAVE sp, -128, sp
@@ -74,7 +97,6 @@
@Override
public void emitEpilogue() {
- HotSpotVMConfig config = HotSpotVMConfig.config();
recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
recordCall(new HotSpotForeignCallTarget(config.handleDeoptStub), 4, true, null);
code.emitInt(1 << 30); // CALL
@@ -88,22 +110,33 @@
@Override
public void emitGrowStack(int size) {
- emitOp3(0b10, SPARC.sp, 0b000100, SPARC.sp, size); // SUB sp, size, sp
+ frameSize += size;
+ if (isSimm(size, 13)) {
+ emitOp3(0b10, SPARC.sp, 0b000100, SPARC.sp, size); // SUB sp, size, sp
+ } else {
+ Register r = emitLoadInt(size);
+ emitOp3(0b10, SPARC.sp, 0b000100, SPARC.sp, r); // SUB sp, size, sp
+ }
}
@Override
public Register emitIntArg0() {
- return codeCache.getRegisterConfig().getCallingConventionRegisters(HotSpotCallingConventionType.JavaCallee, JavaKind.Int)[0];
+ return codeCache.getRegisterConfig().getCallingConventionRegisters(HotSpotCallingConventionType.JavaCallee, JavaKind.Int).get(0);
}
@Override
public Register emitIntArg1() {
- return codeCache.getRegisterConfig().getCallingConventionRegisters(HotSpotCallingConventionType.JavaCallee, JavaKind.Int)[1];
+ return codeCache.getRegisterConfig().getCallingConventionRegisters(HotSpotCallingConventionType.JavaCallee, JavaKind.Int).get(1);
}
@Override
public Register emitLoadInt(int c) {
Register ret = newRegister();
+ loadIntToRegister(c, ret);
+ return ret;
+ }
+
+ private void loadIntToRegister(int c, Register ret) {
int hi = c >>> 10;
int lo = c & ((1 << 10) - 1);
if (hi == 0) {
@@ -114,19 +147,28 @@
emitOp3(0b10, ret, 0b000010, ret, lo); // OR ret, lo, ret
}
}
- return ret;
}
@Override
public Register emitLoadLong(long c) {
+ Register ret = newRegister();
+ emitLoadLongToRegister(c, ret);
+ return ret;
+ }
+
+ private void loadLongToRegister(long c, Register ret) {
+ DataSectionReference ref = new DataSectionReference();
+ data.align(8);
+ ref.setOffset(data.position());
+ data.emitLong(c);
+ emitLoadPointerToRegister(ref, ret);
+ }
+
+ public void emitLoadLongToRegister(long c, Register r) {
if ((c & 0xFFFF_FFFFL) == c) {
- return emitLoadInt((int) c);
+ loadIntToRegister((int) c, r);
} else {
- DataSectionReference ref = new DataSectionReference();
- data.align(8);
- ref.setOffset(data.position());
- data.emitLong(c);
- return emitLoadPointer(ref);
+ loadLongToRegister(c, r);
}
}
@@ -169,10 +211,14 @@
@Override
public Register emitLoadPointer(DataSectionReference ref) {
Register ret = newRegister();
+ emitLoadPointerToRegister(ref, ret);
+ return ret;
+ }
+
+ private void emitLoadPointerToRegister(DataSectionReference ref, Register ret) {
recordDataPatchInCode(ref);
emitPatchableSethi(ret, true);
emitOp3(0b11, ret, 0b001011, ret, 0); // LDX [ret+0], ret
- return ret;
}
@Override
@@ -195,15 +241,15 @@
public StackSlot emitIntToStack(Register a) {
StackSlot ret = newStackSlot(SPARCKind.WORD);
// STW a, [fp+offset]
- emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
+ emitStore(0b000100, a, ret);
return ret;
}
@Override
public StackSlot emitLongToStack(Register a) {
StackSlot ret = newStackSlot(SPARCKind.XWORD);
- // STX a, [fp+offset]
- emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
+ // STX a, [sp+offset]
+ emitStore(0b001110, a, ret);
return ret;
}
@@ -211,7 +257,7 @@
public StackSlot emitFloatToStack(Register a) {
StackSlot ret = newStackSlot(SPARCKind.SINGLE);
// STF a, [fp+offset]
- emitOp3(0b11, a, 0b100100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
+ emitStore(0b100100, a, ret);
return ret;
}
@@ -219,7 +265,7 @@
public StackSlot emitPointerToStack(Register a) {
StackSlot ret = newStackSlot(SPARCKind.XWORD);
// STX a, [fp+offset]
- emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
+ emitStore(0b001110, a, ret);
return ret;
}
@@ -227,10 +273,24 @@
public StackSlot emitNarrowPointerToStack(Register a) {
StackSlot ret = newStackSlot(SPARCKind.WORD);
// STW a, [fp+offset]
- emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS);
+ emitStore(0b000100, a, ret);
return ret;
}
+ private void emitStore(int op3, Register a, StackSlot ret) {
+ int offset = ret.getRawOffset() + SPARC.STACK_BIAS;
+ if (isSimm(offset, 13)) {
+ // op3 a, [sp+offset]
+ emitOp3(0b11, a, op3, SPARC.fp, offset);
+ } else {
+ assert a != SPARC.g3;
+ Register r = SPARC.g3;
+ loadLongToRegister(offset, r);
+ // op3 a, [sp+g3]
+ emitOp3(0b11, a, op3, SPARC.fp, r);
+ }
+ }
+
@Override
public Register emitUncompressPointer(Register compressed, long base, int shift) {
Register ret;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,15 +24,18 @@
package jdk.vm.ci.hotspot.test;
import java.lang.reflect.Field;
+
+import org.testng.annotations.DataProvider;
+
+import jdk.internal.misc.Unsafe;
+import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
+import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
+import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.runtime.JVMCI;
-import org.testng.annotations.DataProvider;
-import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
-import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.vm.ci.meta.Constant;
-import jdk.internal.misc.Unsafe;
public class MemoryAccessProviderData {
private static final Unsafe UNSAFE = getUnsafe();
@@ -54,7 +57,7 @@
@DataProvider(name = "positiveObject")
public static Object[][] getPositiveObjectJavaKind() {
HotSpotJVMCIRuntimeProvider runtime = (HotSpotJVMCIRuntimeProvider) JVMCI.getRuntime();
- int offset = runtime.getConfig().classMirrorOffset;
+ int offset = new HotSpotVMConfigAccess(runtime.getConfigStore()).getFieldOffset("Klass::_java_mirror", Integer.class, "oop");
Constant wrappedKlassPointer = ((HotSpotResolvedObjectType) runtime.fromClass(TestClass.class)).klass();
return new Object[][]{new Object[]{JavaKind.Object, wrappedKlassPointer, (long) offset, TEST_CLASS_CONSTANT, 0}};
}
--- a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,10 +26,10 @@
* @bug 8073480
* @summary explicit range checks should be recognized by C2
* @modules java.base/jdk.internal.misc
- * @library /testlibrary /test/lib /compiler/whitebox /
+ * @library /testlibrary /test/lib /
* @build TestExplicitRangeChecks
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main ClassFileInstaller jdk.test.lib.Platform
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * jdk.test.lib.Platform
* @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=compileonly,TestExplicitRangeChecks.test* TestExplicitRangeChecks
*
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,12 +25,12 @@
* @test
* @bug 8066103
* @summary C2's range check smearing allows out of bound array accesses
- * @library /testlibrary /test/lib /compiler/whitebox /
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRangeCheckSmearing
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main ClassFileInstaller jdk.test.lib.Platform
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * jdk.test.lib.Platform
* @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckSmearing
*
--- a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, 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
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8027751
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill
* @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp
*
--- a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,8 +28,8 @@
import jdk.test.lib.ExitCode;
import jdk.test.lib.cli.*;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Base for all RTM-related CLI tests on options whose processing depends
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify PrintPreciseRTMLockingStatistics on CPUs with
* rtm support and on VM with rtm locking support,
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
@@ -40,8 +40,8 @@
import jdk.test.lib.cli.*;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
extends TestPrintPreciseRTMLockingStatisticsBase {
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify PrintPreciseRTMLockingStatistics on CPUs without
* rtm support and/or unsupported VM.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
@@ -40,8 +40,8 @@
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
extends TestPrintPreciseRTMLockingStatisticsBase {
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify RTMAbortRatio option processing on CPU with rtm
* support and on VM with rtm locking support.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMAbortRatioOptionOnSupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMAbortRatioOptionOnSupportedConfig
*/
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,20 +27,20 @@
* @bug 8031320
* @summary Verify RTMAbortRatio option processing on CPU without rtm
* support or on VM that does not support rtm locking.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMAbortRatioOptionOnUnsupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMAbortRatioOptionOnUnsupportedConfig
*/
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestRTMAbortRatioOptionOnUnsupportedConfig
extends RTMGenericCommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify RTMTotalCountIncrRate option processing on CPU with
* rtm support and on VM with rtm locking support.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMTotalCountIncrRateOptionOnSupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestRTMTotalCountIncrRateOptionOnSupportedConfig
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,20 +24,20 @@
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* @test
* @bug 8031320
* @summary Verify RTMTotalCountIncrRate option processing on CPU without
* rtm support and/or on VM without rtm locking support.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify UseRTMDeopt option processing on CPUs with rtm support
* when rtm locking is supported by VM.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMDeoptOptionOnSupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnSupportedConfig
*/
@@ -40,8 +40,8 @@
import jdk.test.lib.ExitCode;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestUseRTMDeoptOptionOnSupportedConfig
extends CommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify UseRTMDeopt option processing on CPUs without rtm support
* or on VMs without rtm locking support.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMDeoptOptionOnUnsupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnUnsupportedConfig
*/
@@ -41,8 +41,8 @@
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestUseRTMDeoptOptionOnUnsupportedConfig
extends RTMGenericCommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify UseRTMForStackLocks option processing on CPU with
* rtm support when VM supports rtm locking.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMForStackLocksOptionOnSupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseRTMForStackLocksOptionOnSupportedConfig
@@ -41,8 +41,8 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.*;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestUseRTMForStackLocksOptionOnSupportedConfig
extends CommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify UseRTMForStackLocks option processing on CPUs without
* rtm support and/or on VMs without rtm locking support.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMForStackLocksOptionOnUnsupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseRTMForStackLocksOptionOnUnsupportedConfig
@@ -42,8 +42,8 @@
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestUseRTMForStackLocksOptionOnUnsupportedConfig
extends RTMGenericCommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify UseRTMLocking option processing on CPU with rtm support and
* on VM with rtm-locking support.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMLockingOptionOnSupportedConfig
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnSupportedConfig
*/
@@ -40,8 +40,8 @@
import jdk.test.lib.ExitCode;
import jdk.test.lib.cli.*;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestUseRTMLockingOptionOnSupportedConfig
extends CommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify UseRTMLocking option processing on CPU without
* rtm support.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMLockingOptionOnUnsupportedCPU
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedCPU
*/
@@ -41,8 +41,8 @@
import jdk.test.lib.cli.*;
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestUseRTMLockingOptionOnUnsupportedCPU
extends CommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify UseRTMLocking option processing on CPU with rtm support
* in case when VM should not support this option.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMLockingOptionOnUnsupportedVM
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedVM
*/
@@ -41,8 +41,8 @@
import jdk.test.lib.cli.*;
import jdk.test.lib.cli.predicate.AndPredicate;
import jdk.test.lib.cli.predicate.NotPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestUseRTMLockingOptionOnUnsupportedVM
extends CommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify processing of UseRTMLocking and UseBiasedLocking
* options combination on CPU and VM with rtm support.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMLockingOptionWithBiasedLocking
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockingOptionWithBiasedLocking
*/
@@ -40,8 +40,8 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.*;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
public class TestUseRTMLockingOptionWithBiasedLocking
extends CommandLineOptionTest {
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,11 +27,11 @@
* @bug 8031320
* @summary Verify that RTMAbortRatio affects amount of aborts before
* deoptimization.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMAbortRatio
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMAbortRatio
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
/**
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,11 +27,11 @@
* @bug 8031320
* @summary Verify that RTMAbortThreshold option affects
* amount of aborts after which abort ratio is calculated.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMAbortThreshold
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMAbortThreshold
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that on RTMAbortThreshold option actually affects how soon
--- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java Fri Jul 01 16:50:34 2016 -0700
@@ -29,12 +29,12 @@
* caused by reason other then rtm_state_change will reset
* method's RTM state. And if we don't use RTMDeopt, then
* RTM state remain the same after such deoptimization.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMAfterNonRTMDeopt
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMAfterNonRTMDeopt
*/
@@ -43,9 +43,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
/**
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that on high abort ratio method will be recompiled
* without rtm locking.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMDeoptOnHighAbortRatio
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMDeoptOnHighAbortRatio
*/
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that on high abort ratio method wil be deoptimized with
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @test
* @bug 8031320
* @summary Verify that on low abort ratio method will be recompiled.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMDeoptOnLowAbortRatio
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMDeoptOnLowAbortRatio
*/
@@ -40,9 +40,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
/**
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that RTMLockingCalculationDelay affect when
* abort ratio calculation is started.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMLockingCalculationDelay
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMLockingCalculationDelay
*/
@@ -40,9 +40,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that abort ratio calculation could be delayed using
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that RTMLockingThreshold affects rtm state transition
* ProfileRTM => UseRTM.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMLockingThreshold
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMLockingThreshold
*/
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
/**
--- a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @test
* @bug 8031320
* @summary Verify that RTMRetryCount affects actual amount of retries.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMRetryCount
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMRetryCount
*/
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that RTMRetryCount option actually affects amount of
--- a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that RTMSpinLoopCount affects time spent
* between locking attempts.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMSpinLoopCount
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMSpinLoopCount
*/
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that RTMSpinLoopCount increase time spent between retries
--- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that RTMTotalCountIncrRate option affects
* RTM locking statistics.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestRTMTotalCountIncrRate
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMTotalCountIncrRate
*/
@@ -43,9 +43,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that with RTMTotalCountIncrRate=1 RTM locking statistics
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that rtm locking is used for stack locks before
* inflation and after it used for inflated locks.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMAfterLockInflation
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMAfterLockInflation
*/
@@ -42,9 +42,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that RTM is used after lock inflation by executing compiled
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that UseRTMDeopt affects uncommon trap installation in
* copmpiled methods with synchronized block.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMDeopt
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMDeopt
*/
@@ -40,9 +40,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that usage of UseRTMDeopt option affects uncommon traps usage
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @test
* @bug 8031320
* @summary Verify that rtm locking is used for inflated locks.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMForInflatedLocks
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMForInflatedLocks
*/
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that RTM-based lock elision could be used for inflated locks
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,12 +26,12 @@
* @test
* @bug 8031320
* @summary Verify that rtm locking is used for stack locks.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMForStackLocks
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMForStackLocks
*/
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that RTM-based lock elision could be used for stack locks
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that UseRTMXendForLockBusy option affects
* method behaviour if lock is busy.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMXendForLockBusy
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMXendForLockBusy
*/
@@ -42,9 +42,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that with +UseRTMXendForLockBusy there will be no aborts
--- a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java Fri Jul 01 16:50:34 2016 -0700
@@ -27,12 +27,12 @@
* @bug 8031320
* @summary Verify that NoRTMLockEliding option could be applied to
* specified method and that such method will not use rtm.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestNoRTMLockElidingOption
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestNoRTMLockElidingOption
*/
@@ -41,9 +41,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that method tagged with option <i>NoRTMLockElidingOption</i>
--- a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,12 +28,12 @@
* @summary Verify that UseRTMLockEliding option could be applied to
* specified method and that such method will not be deoptimized
* on high abort ratio.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestUseRTMLockElidingOption
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockElidingOption
*/
@@ -42,9 +42,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that method tagged with option <i>UseRTMLockElidingOption</i>
--- a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java Fri Jul 01 16:50:34 2016 -0700
@@ -29,12 +29,12 @@
* on overall aborts and locks count and count of aborts of
* different types. Test also verify that VM output does not
* contain rtm locking statistics when it should not.
- * @library /testlibrary /test/lib /compiler/testlibrary
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TestPrintPreciseRTMLockingStatistics
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestPrintPreciseRTMLockingStatistics
*/
@@ -44,9 +44,9 @@
import jdk.test.lib.*;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
-import rtm.*;
-import rtm.predicate.SupportedCPU;
-import rtm.predicate.SupportedVM;
+import compiler.testlibrary.rtm.*;
+import compiler.testlibrary.rtm.predicate.SupportedCPU;
+import compiler.testlibrary.rtm.predicate.SupportedVM;
/**
* Test verifies that VM output does not contain RTM locking statistics when it
--- a/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,7 +28,7 @@
* @summary JVM crashes with "missing exception handler" error
* @author volker.simonis@sap.com
*
- * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss392k StackOverflowBug
+ * @run main/othervm -XX:CompileThreshold=100 -Xbatch -Xss512k StackOverflowBug
*/
--- a/hotspot/test/compiler/stable/TestStableBoolean.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableBoolean.java Fri Jul 01 16:50:34 2016 -0700
@@ -95,13 +95,12 @@
/* ==================================================== */
static class DefaultValue {
- public @Stable
- boolean v;
+ public @Stable boolean v;
public static final DefaultValue c = new DefaultValue();
public static boolean get() { return c.v; }
public static void test() throws Exception {
- boolean val1 = get();
+ boolean val1 = get();
c.v = true; boolean val2 = get();
assertEquals(val1, false);
assertEquals(val2, true);
@@ -131,7 +130,7 @@
public static final DefaultStaticValue c = new DefaultStaticValue();
public static boolean get() { return c.v; }
public static void test() throws Exception {
- boolean val1 = get();
+ boolean val1 = get();
c.v = true; boolean val2 = get();
assertEquals(val1, false);
assertEquals(val2, true);
@@ -181,14 +180,14 @@
public static void test() throws Exception {
{
c.v = new boolean[1]; c.v[0] = true; boolean val1 = get();
- c.v[0] = false; boolean val2 = get();
+ c.v[0] = false; boolean val2 = get();
assertEquals(val1, true);
assertEquals(val2, (isStableEnabled ? true : false));
}
{
c.v = new boolean[20]; c.v[10] = true; boolean val1 = get1();
- c.v[10] = false; boolean val2 = get1();
+ c.v[10] = false; boolean val2 = get1();
assertEquals(val1, true);
assertEquals(val2, (isStableEnabled ? true : false));
}
@@ -213,7 +212,7 @@
public static void test() throws Exception {
{
c.v = new boolean[1][1]; c.v[0][0] = true; boolean val1 = get();
- c.v[0][0] = false; boolean val2 = get();
+ c.v[0][0] = false; boolean val2 = get();
assertEquals(val1, true);
assertEquals(val2, (isStableEnabled ? true : false));
@@ -251,7 +250,7 @@
public static void test() throws Exception {
{
c.v = new boolean[1][1][1]; c.v[0][0][0] = true; boolean val1 = get();
- c.v[0][0][0] = false; boolean val2 = get();
+ c.v[0][0][0] = false; boolean val2 = get();
assertEquals(val1, true);
assertEquals(val2, (isStableEnabled ? true : false));
@@ -299,7 +298,7 @@
public static void test() throws Exception {
{
c.v = new boolean[1][1][1][1]; c.v[0][0][0][0] = true; boolean val1 = get();
- c.v[0][0][0][0] = false; boolean val2 = get();
+ c.v[0][0][0][0] = false; boolean val2 = get();
assertEquals(val1, true);
assertEquals(val2, (isStableEnabled ? true : false));
@@ -357,7 +356,7 @@
public static void test() throws Exception {
{
c.v = new boolean[1]; ((boolean[])c.v)[0] = true; boolean val1 = get();
- ((boolean[])c.v)[0] = false; boolean val2 = get();
+ ((boolean[])c.v)[0] = false; boolean val2 = get();
assertEquals(val1, true);
assertEquals(val2, false);
@@ -384,7 +383,7 @@
public static void test() throws Exception {
{
c.v = new boolean[1][1]; ((boolean[][])c.v)[0][0] = true; boolean val1 = get();
- ((boolean[][])c.v)[0][0] = false; boolean val2 = get();
+ ((boolean[][])c.v)[0][0] = false; boolean val2 = get();
assertEquals(val1, true);
assertEquals(val2, false);
@@ -392,7 +391,7 @@
{
c.v = new boolean[1][1]; c.v[0] = new boolean[0]; boolean[] val1 = get1();
- c.v[0] = new boolean[0]; boolean[] val2 = get1();
+ c.v[0] = new boolean[0]; boolean[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -420,7 +419,7 @@
public static void test() throws Exception {
{
c.v = new boolean[1][1][1]; ((boolean[][][])c.v)[0][0][0] = true; boolean val1 = get();
- ((boolean[][][])c.v)[0][0][0] = false; boolean val2 = get();
+ ((boolean[][][])c.v)[0][0][0] = false; boolean val2 = get();
assertEquals(val1, true);
assertEquals(val2, false);
@@ -428,14 +427,14 @@
{
c.v = new boolean[1][1][1]; c.v[0][0] = new boolean[0]; boolean[] val1 = get1();
- c.v[0][0] = new boolean[0]; boolean[] val2 = get1();
+ c.v[0][0] = new boolean[0]; boolean[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new boolean[1][1][1]; c.v[0] = new boolean[0][0]; boolean[][] val1 = get2();
- c.v[0] = new boolean[0][0]; boolean[][] val2 = get2();
+ c.v[0] = new boolean[0][0]; boolean[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -465,7 +464,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = true; A val1 = get();
- c.v.a = false; A val2 = get();
+ c.v.a = false; A val2 = get();
assertEquals(val1.a, false);
assertEquals(val2.a, false);
@@ -473,7 +472,7 @@
{
c.v = new A(); c.v.a = true; boolean val1 = get1();
- c.v.a = false; boolean val2 = get1();
+ c.v.a = false; boolean val2 = get1();
c.v = new A(); c.v.a = false; boolean val3 = get1();
assertEquals(val1, true);
@@ -499,8 +498,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = true; c.v.next.a = true; A val1 = get();
- c.v.a = false; c.v.next.a = false; A val2 = get();
+ c.v.a = true; c.v.next.a = true; A val1 = get();
+ c.v.a = false; c.v.next.a = false; A val2 = get();
assertEquals(val1.a, false);
assertEquals(val2.a, false);
@@ -508,10 +507,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = true; boolean val1 = get1();
- c.v.a = false; boolean val2 = get1();
+ c.v.a = true; boolean val1 = get1();
+ c.v.a = false; boolean val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = false; boolean val3 = get1();
+ c.v.a = false; boolean val3 = get1();
assertEquals(val1, true);
assertEquals(val2, (isStableEnabled ? true : false));
@@ -537,8 +536,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = true; boolean val1 = get(); boolean val2 = get1();
- c.v.a = false; boolean val3 = get(); boolean val4 = get1();
+ c.v.a = true; boolean val1 = get(); boolean val2 = get1();
+ c.v.a = false; boolean val3 = get(); boolean val4 = get1();
assertEquals(val1, true);
assertEquals(val3, (isStableEnabled ? true : false));
@@ -568,8 +567,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = true; boolean val1 = get(); boolean val2 = get1();
- elem.a = false; boolean val3 = get(); boolean val4 = get1();
+ elem.a = true; boolean val1 = get(); boolean val2 = get1();
+ elem.a = false; boolean val3 = get(); boolean val4 = get1();
assertEquals(val1, true);
assertEquals(val3, (isStableEnabled ? true : false));
@@ -606,5 +605,4 @@
}
}
}
-
}
--- a/hotspot/test/compiler/stable/TestStableByte.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableByte.java Fri Jul 01 16:50:34 2016 -0700
@@ -100,7 +100,7 @@
public static final DefaultValue c = new DefaultValue();
public static byte get() { return c.v; }
public static void test() throws Exception {
- byte val1 = get();
+ byte val1 = get();
c.v = 1; byte val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1);
@@ -130,7 +130,7 @@
public static final DefaultStaticValue c = new DefaultStaticValue();
public static byte get() { return c.v; }
public static void test() throws Exception {
- byte val1 = get();
+ byte val1 = get();
c.v = 1; byte val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1);
@@ -180,24 +180,24 @@
public static void test() throws Exception {
{
c.v = new byte[1]; c.v[0] = 1; byte val1 = get();
- c.v[0] = 2; byte val2 = get();
+ c.v[0] = 2; byte val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new byte[1]; c.v[0] = 3; byte val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
}
{
c.v = new byte[20]; c.v[10] = 1; byte val1 = get1();
- c.v[10] = 2; byte val2 = get1();
+ c.v[10] = 2; byte val2 = get1();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new byte[20]; c.v[10] = 3; byte val3 = get1();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
}
{
@@ -220,17 +220,17 @@
public static void test() throws Exception {
{
c.v = new byte[1][1]; c.v[0][0] = 1; byte val1 = get();
- c.v[0][0] = 2; byte val2 = get();
+ c.v[0][0] = 2; byte val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new byte[1][1]; c.v[0][0] = 3; byte val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new byte[1]; c.v[0][0] = 4; byte val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
}
{
@@ -260,21 +260,21 @@
public static void test() throws Exception {
{
c.v = new byte[1][1][1]; c.v[0][0][0] = 1; byte val1 = get();
- c.v[0][0][0] = 2; byte val2 = get();
+ c.v[0][0][0] = 2; byte val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new byte[1][1][1]; c.v[0][0][0] = 3; byte val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new byte[1][1]; c.v[0][0][0] = 4; byte val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
c.v[0][0] = new byte[1]; c.v[0][0][0] = 5; byte val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 5));
+ : 5));
}
{
@@ -311,25 +311,25 @@
public static void test() throws Exception {
{
c.v = new byte[1][1][1][1]; c.v[0][0][0][0] = 1; byte val1 = get();
- c.v[0][0][0][0] = 2; byte val2 = get();
+ c.v[0][0][0][0] = 2; byte val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new byte[1][1][1][1]; c.v[0][0][0][0] = 3; byte val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new byte[1][1][1]; c.v[0][0][0][0] = 4; byte val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
c.v[0][0] = new byte[1][1]; c.v[0][0][0][0] = 5; byte val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 5));
+ : 5));
c.v[0][0][0] = new byte[1]; c.v[0][0][0][0] = 6; byte val6 = get();
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 6));
+ : 6));
}
{
@@ -372,7 +372,7 @@
public static void test() throws Exception {
{
c.v = new byte[1]; ((byte[])c.v)[0] = 1; byte val1 = get();
- ((byte[])c.v)[0] = 2; byte val2 = get();
+ ((byte[])c.v)[0] = 2; byte val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -399,7 +399,7 @@
public static void test() throws Exception {
{
c.v = new byte[1][1]; ((byte[][])c.v)[0][0] = 1; byte val1 = get();
- ((byte[][])c.v)[0][0] = 2; byte val2 = get();
+ ((byte[][])c.v)[0][0] = 2; byte val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -407,7 +407,7 @@
{
c.v = new byte[1][1]; c.v[0] = new byte[0]; byte[] val1 = get1();
- c.v[0] = new byte[0]; byte[] val2 = get1();
+ c.v[0] = new byte[0]; byte[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -434,8 +434,8 @@
public static void test() throws Exception {
{
- c.v = new byte[1][1][1]; ((byte[][][])c.v)[0][0][0] = 1; byte val1 = get();
- ((byte[][][])c.v)[0][0][0] = 2; byte val2 = get();
+ c.v = new byte[1][1][1]; ((byte[][][])c.v)[0][0][0] = 1; byte val1 = get();
+ ((byte[][][])c.v)[0][0][0] = 2; byte val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -443,14 +443,14 @@
{
c.v = new byte[1][1][1]; c.v[0][0] = new byte[0]; byte[] val1 = get1();
- c.v[0][0] = new byte[0]; byte[] val2 = get1();
+ c.v[0][0] = new byte[0]; byte[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new byte[1][1][1]; c.v[0] = new byte[0][0]; byte[][] val1 = get2();
- c.v[0] = new byte[0][0]; byte[][] val2 = get2();
+ c.v[0] = new byte[0][0]; byte[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -480,7 +480,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = 1; A val1 = get();
- c.v.a = 2; A val2 = get();
+ c.v.a = 2; A val2 = get();
assertEquals(val1.a, 2);
assertEquals(val2.a, 2);
@@ -488,7 +488,7 @@
{
c.v = new A(); c.v.a = 1; byte val1 = get1();
- c.v.a = 2; byte val2 = get1();
+ c.v.a = 2; byte val2 = get1();
c.v = new A(); c.v.a = 3; byte val3 = get1();
assertEquals(val1, 1);
@@ -514,8 +514,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = 1; c.v.next.a = 1; A val1 = get();
- c.v.a = 2; c.v.next.a = 2; A val2 = get();
+ c.v.a = 1; c.v.next.a = 1; A val1 = get();
+ c.v.a = 2; c.v.next.a = 2; A val2 = get();
assertEquals(val1.a, 2);
assertEquals(val2.a, 2);
@@ -523,10 +523,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = 1; byte val1 = get1();
- c.v.a = 2; byte val2 = get1();
+ c.v.a = 1; byte val1 = get1();
+ c.v.a = 2; byte val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = 3; byte val3 = get1();
+ c.v.a = 3; byte val3 = get1();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
@@ -552,8 +552,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = 1; byte val1 = get(); byte val2 = get1();
- c.v.a = 2; byte val3 = get(); byte val4 = get1();
+ c.v.a = 1; byte val1 = get(); byte val2 = get1();
+ c.v.a = 2; byte val3 = get(); byte val4 = get1();
assertEquals(val1, 1);
assertEquals(val3, (isStableEnabled ? 1 : 2));
@@ -583,8 +583,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = 1; byte val1 = get(); byte val2 = get1();
- elem.a = 2; byte val3 = get(); byte val4 = get1();
+ elem.a = 1; byte val1 = get(); byte val2 = get1();
+ elem.a = 2; byte val3 = get(); byte val4 = get1();
assertEquals(val1, 1);
assertEquals(val3, (isStableEnabled ? 1 : 2));
--- a/hotspot/test/compiler/stable/TestStableChar.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableChar.java Fri Jul 01 16:50:34 2016 -0700
@@ -100,7 +100,7 @@
public static final DefaultValue c = new DefaultValue();
public static char get() { return c.v; }
public static void test() throws Exception {
- char val1 = get();
+ char val1 = get();
c.v = 'a'; char val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 'a');
@@ -130,7 +130,7 @@
public static final DefaultStaticValue c = new DefaultStaticValue();
public static char get() { return c.v; }
public static void test() throws Exception {
- char val1 = get();
+ char val1 = get();
c.v = 'a'; char val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 'a');
@@ -180,24 +180,24 @@
public static void test() throws Exception {
{
c.v = new char[1]; c.v[0] = 'a'; char val1 = get();
- c.v[0] = 'b'; char val2 = get();
+ c.v[0] = 'b'; char val2 = get();
assertEquals(val1, 'a');
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
c.v = new char[1]; c.v[0] = 'c'; char val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'c'));
+ : 'c'));
}
{
c.v = new char[20]; c.v[10] = 'a'; char val1 = get1();
- c.v[10] = 'b'; char val2 = get1();
+ c.v[10] = 'b'; char val2 = get1();
assertEquals(val1, 'a');
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
c.v = new char[20]; c.v[10] = 'c'; char val3 = get1();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'c'));
+ : 'c'));
}
{
@@ -220,17 +220,17 @@
public static void test() throws Exception {
{
c.v = new char[1][1]; c.v[0][0] = 'a'; char val1 = get();
- c.v[0][0] = 'b'; char val2 = get();
+ c.v[0][0] = 'b'; char val2 = get();
assertEquals(val1, 'a');
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
c.v = new char[1][1]; c.v[0][0] = 'c'; char val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'c'));
+ : 'c'));
c.v[0] = new char[1]; c.v[0][0] = 'd'; char val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'd'));
+ : 'd'));
}
{
@@ -260,21 +260,21 @@
public static void test() throws Exception {
{
c.v = new char[1][1][1]; c.v[0][0][0] = 'a'; char val1 = get();
- c.v[0][0][0] = 'b'; char val2 = get();
+ c.v[0][0][0] = 'b'; char val2 = get();
assertEquals(val1, 'a');
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
c.v = new char[1][1][1]; c.v[0][0][0] = 'c'; char val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'c'));
+ : 'c'));
c.v[0] = new char[1][1]; c.v[0][0][0] = 'd'; char val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'd'));
+ : 'd'));
c.v[0][0] = new char[1]; c.v[0][0][0] = 'e'; char val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'e'));
+ : 'e'));
}
{
@@ -311,25 +311,25 @@
public static void test() throws Exception {
{
c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'a'; char val1 = get();
- c.v[0][0][0][0] = 'b'; char val2 = get();
+ c.v[0][0][0][0] = 'b'; char val2 = get();
assertEquals(val1, 'a');
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'c'; char val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'c'));
+ : 'c'));
c.v[0] = new char[1][1][1]; c.v[0][0][0][0] = 'd'; char val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'd'));
+ : 'd'));
c.v[0][0] = new char[1][1]; c.v[0][0][0][0] = 'e'; char val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'e'));
+ : 'e'));
c.v[0][0][0] = new char[1]; c.v[0][0][0][0] = 'f'; char val6 = get();
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
- : 'f'));
+ : 'f'));
}
{
@@ -370,7 +370,7 @@
public static void test() throws Exception {
{
c.v = new char[1]; ((char[])c.v)[0] = 'a'; char val1 = get();
- ((char[])c.v)[0] = 'b'; char val2 = get();
+ ((char[])c.v)[0] = 'b'; char val2 = get();
assertEquals(val1, 'a');
assertEquals(val2, 'b');
@@ -397,7 +397,7 @@
public static void test() throws Exception {
{
c.v = new char[1][1]; ((char[][])c.v)[0][0] = 'a'; char val1 = get();
- ((char[][])c.v)[0][0] = 'b'; char val2 = get();
+ ((char[][])c.v)[0][0] = 'b'; char val2 = get();
assertEquals(val1, 'a');
assertEquals(val2, 'b');
@@ -405,7 +405,7 @@
{
c.v = new char[1][1]; c.v[0] = new char[0]; char[] val1 = get1();
- c.v[0] = new char[0]; char[] val2 = get1();
+ c.v[0] = new char[0]; char[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -432,8 +432,8 @@
public static void test() throws Exception {
{
- c.v = new char[1][1][1]; ((char[][][])c.v)[0][0][0] = 'a'; char val1 = get();
- ((char[][][])c.v)[0][0][0] = 'b'; char val2 = get();
+ c.v = new char[1][1][1]; ((char[][][])c.v)[0][0][0] = 'a'; char val1 = get();
+ ((char[][][])c.v)[0][0][0] = 'b'; char val2 = get();
assertEquals(val1, 'a');
assertEquals(val2, 'b');
@@ -441,14 +441,14 @@
{
c.v = new char[1][1][1]; c.v[0][0] = new char[0]; char[] val1 = get1();
- c.v[0][0] = new char[0]; char[] val2 = get1();
+ c.v[0][0] = new char[0]; char[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new char[1][1][1]; c.v[0] = new char[0][0]; char[][] val1 = get2();
- c.v[0] = new char[0][0]; char[][] val2 = get2();
+ c.v[0] = new char[0][0]; char[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -478,7 +478,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = 'a'; A val1 = get();
- c.v.a = 'b'; A val2 = get();
+ c.v.a = 'b'; A val2 = get();
assertEquals(val1.a, 'b');
assertEquals(val2.a, 'b');
@@ -486,7 +486,7 @@
{
c.v = new A(); c.v.a = 'a'; char val1 = get1();
- c.v.a = 'b'; char val2 = get1();
+ c.v.a = 'b'; char val2 = get1();
c.v = new A(); c.v.a = 'c'; char val3 = get1();
assertEquals(val1, 'a');
@@ -512,8 +512,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = 'a'; c.v.next.a = 'a'; A val1 = get();
- c.v.a = 'b'; c.v.next.a = 'b'; A val2 = get();
+ c.v.a = 'a'; c.v.next.a = 'a'; A val1 = get();
+ c.v.a = 'b'; c.v.next.a = 'b'; A val2 = get();
assertEquals(val1.a, 'b');
assertEquals(val2.a, 'b');
@@ -521,10 +521,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = 'a'; char val1 = get1();
- c.v.a = 'b'; char val2 = get1();
+ c.v.a = 'a'; char val1 = get1();
+ c.v.a = 'b'; char val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = 'c'; char val3 = get1();
+ c.v.a = 'c'; char val3 = get1();
assertEquals(val1, 'a');
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
@@ -550,8 +550,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = 'a'; char val1 = get(); char val2 = get1();
- c.v.a = 'b'; char val3 = get(); char val4 = get1();
+ c.v.a = 'a'; char val1 = get(); char val2 = get1();
+ c.v.a = 'b'; char val3 = get(); char val4 = get1();
assertEquals(val1, 'a');
assertEquals(val3, (isStableEnabled ? 'a' : 'b'));
@@ -581,8 +581,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = 'a'; char val1 = get(); char val2 = get1();
- elem.a = 'b'; char val3 = get(); char val4 = get1();
+ elem.a = 'a'; char val1 = get(); char val2 = get1();
+ elem.a = 'b'; char val3 = get(); char val4 = get1();
assertEquals(val1, 'a');
assertEquals(val3, (isStableEnabled ? 'a' : 'b'));
--- a/hotspot/test/compiler/stable/TestStableDouble.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableDouble.java Fri Jul 01 16:50:34 2016 -0700
@@ -100,7 +100,7 @@
public static final DefaultValue c = new DefaultValue();
public static double get() { return c.v; }
public static void test() throws Exception {
- double val1 = get();
+ double val1 = get();
c.v = 1.0; double val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1.0);
@@ -130,7 +130,7 @@
public static final DefaultStaticValue c = new DefaultStaticValue();
public static double get() { return c.v; }
public static void test() throws Exception {
- double val1 = get();
+ double val1 = get();
c.v = 1.0; double val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1.0);
@@ -180,24 +180,24 @@
public static void test() throws Exception {
{
c.v = new double[1]; c.v[0] = 1.0; double val1 = get();
- c.v[0] = 2.0; double val2 = get();
+ c.v[0] = 2.0; double val2 = get();
assertEquals(val1, 1.0);
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
c.v = new double[1]; c.v[0] = 3.0; double val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 3.0));
+ : 3.0));
}
{
c.v = new double[20]; c.v[10] = 1.0; double val1 = get1();
- c.v[10] = 2.0; double val2 = get1();
+ c.v[10] = 2.0; double val2 = get1();
assertEquals(val1, 1.0);
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
c.v = new double[20]; c.v[10] = 3.0; double val3 = get1();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 3.0));
+ : 3.0));
}
{
@@ -220,17 +220,17 @@
public static void test() throws Exception {
{
c.v = new double[1][1]; c.v[0][0] = 1.0; double val1 = get();
- c.v[0][0] = 2.0; double val2 = get();
+ c.v[0][0] = 2.0; double val2 = get();
assertEquals(val1, 1.0);
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
c.v = new double[1][1]; c.v[0][0] = 3.0; double val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 3.0));
+ : 3.0));
c.v[0] = new double[1]; c.v[0][0] = 4.0; double val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 4.0));
+ : 4.0));
}
{
@@ -260,21 +260,21 @@
public static void test() throws Exception {
{
c.v = new double[1][1][1]; c.v[0][0][0] = 1.0; double val1 = get();
- c.v[0][0][0] = 2.0; double val2 = get();
+ c.v[0][0][0] = 2.0; double val2 = get();
assertEquals(val1, 1.0);
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
c.v = new double[1][1][1]; c.v[0][0][0] = 3.0; double val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 3.0));
+ : 3.0));
c.v[0] = new double[1][1]; c.v[0][0][0] = 4.0; double val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 4.0));
+ : 4.0));
c.v[0][0] = new double[1]; c.v[0][0][0] = 5.0; double val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 5.0));
+ : 5.0));
}
{
@@ -311,25 +311,25 @@
public static void test() throws Exception {
{
c.v = new double[1][1][1][1]; c.v[0][0][0][0] = 1.0; double val1 = get();
- c.v[0][0][0][0] = 2.0; double val2 = get();
+ c.v[0][0][0][0] = 2.0; double val2 = get();
assertEquals(val1, 1.0);
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
c.v = new double[1][1][1][1]; c.v[0][0][0][0] = 3.0; double val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 3.0));
+ : 3.0));
c.v[0] = new double[1][1][1]; c.v[0][0][0][0] = 4.0; double val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 4.0));
+ : 4.0));
c.v[0][0] = new double[1][1]; c.v[0][0][0][0] = 5.0; double val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 5.0));
+ : 5.0));
c.v[0][0][0] = new double[1]; c.v[0][0][0][0] = 6.0; double val6 = get();
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
- : 6.0));
+ : 6.0));
}
{
@@ -370,7 +370,7 @@
public static void test() throws Exception {
{
c.v = new double[1]; ((double[])c.v)[0] = 1.0; double val1 = get();
- ((double[])c.v)[0] = 2.0; double val2 = get();
+ ((double[])c.v)[0] = 2.0; double val2 = get();
assertEquals(val1, 1.0);
assertEquals(val2, 2.0);
@@ -397,7 +397,7 @@
public static void test() throws Exception {
{
c.v = new double[1][1]; ((double[][])c.v)[0][0] = 1.0; double val1 = get();
- ((double[][])c.v)[0][0] = 2.0; double val2 = get();
+ ((double[][])c.v)[0][0] = 2.0; double val2 = get();
assertEquals(val1, 1.0);
assertEquals(val2, 2.0);
@@ -405,7 +405,7 @@
{
c.v = new double[1][1]; c.v[0] = new double[0]; double[] val1 = get1();
- c.v[0] = new double[0]; double[] val2 = get1();
+ c.v[0] = new double[0]; double[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -433,7 +433,7 @@
public static void test() throws Exception {
{
c.v = new double[1][1][1]; ((double[][][])c.v)[0][0][0] = 1.0; double val1 = get();
- ((double[][][])c.v)[0][0][0] = 2.0; double val2 = get();
+ ((double[][][])c.v)[0][0][0] = 2.0; double val2 = get();
assertEquals(val1, 1.0);
assertEquals(val2, 2.0);
@@ -441,14 +441,14 @@
{
c.v = new double[1][1][1]; c.v[0][0] = new double[0]; double[] val1 = get1();
- c.v[0][0] = new double[0]; double[] val2 = get1();
+ c.v[0][0] = new double[0]; double[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new double[1][1][1]; c.v[0] = new double[0][0]; double[][] val1 = get2();
- c.v[0] = new double[0][0]; double[][] val2 = get2();
+ c.v[0] = new double[0][0]; double[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -478,7 +478,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = 1.0; A val1 = get();
- c.v.a = 2.0; A val2 = get();
+ c.v.a = 2.0; A val2 = get();
assertEquals(val1.a, 2.0);
assertEquals(val2.a, 2.0);
@@ -486,7 +486,7 @@
{
c.v = new A(); c.v.a = 1.0; double val1 = get1();
- c.v.a = 2.0; double val2 = get1();
+ c.v.a = 2.0; double val2 = get1();
c.v = new A(); c.v.a = 3.0; double val3 = get1();
assertEquals(val1, 1.0);
@@ -512,8 +512,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = 1.0; c.v.next.a = 1.0; A val1 = get();
- c.v.a = 2.0; c.v.next.a = 2.0; A val2 = get();
+ c.v.a = 1.0; c.v.next.a = 1.0; A val1 = get();
+ c.v.a = 2.0; c.v.next.a = 2.0; A val2 = get();
assertEquals(val1.a, 2.0);
assertEquals(val2.a, 2.0);
@@ -521,10 +521,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = 1.0; double val1 = get1();
- c.v.a = 2.0; double val2 = get1();
+ c.v.a = 1.0; double val1 = get1();
+ c.v.a = 2.0; double val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = 3.0; double val3 = get1();
+ c.v.a = 3.0; double val3 = get1();
assertEquals(val1, 1.0);
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
@@ -550,8 +550,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = 1.0; double val1 = get(); double val2 = get1();
- c.v.a = 2.0; double val3 = get(); double val4 = get1();
+ c.v.a = 1.0; double val1 = get(); double val2 = get1();
+ c.v.a = 2.0; double val3 = get(); double val4 = get1();
assertEquals(val1, 1.0);
assertEquals(val3, (isStableEnabled ? 1.0 : 2.0));
@@ -581,8 +581,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = 1.0; double val1 = get(); double val2 = get1();
- elem.a = 2.0; double val3 = get(); double val4 = get1();
+ elem.a = 1.0; double val1 = get(); double val2 = get1();
+ elem.a = 2.0; double val3 = get(); double val4 = get1();
assertEquals(val1, 1.0);
assertEquals(val3, (isStableEnabled ? 1.0 : 2.0));
--- a/hotspot/test/compiler/stable/TestStableFloat.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableFloat.java Fri Jul 01 16:50:34 2016 -0700
@@ -100,7 +100,7 @@
public static final DefaultValue c = new DefaultValue();
public static float get() { return c.v; }
public static void test() throws Exception {
- float val1 = get();
+ float val1 = get();
c.v = 1.0F; float val2 = get();
assertEquals(val1, 0F);
assertEquals(val2, 1.0F);
@@ -180,24 +180,24 @@
public static void test() throws Exception {
{
c.v = new float[1]; c.v[0] = 1.0F; float val1 = get();
- c.v[0] = 2.0F; float val2 = get();
+ c.v[0] = 2.0F; float val2 = get();
assertEquals(val1, 1.0F);
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
c.v = new float[1]; c.v[0] = 3.0F; float val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 3.0F));
+ : 3.0F));
}
{
c.v = new float[20]; c.v[10] = 1.0F; float val1 = get1();
- c.v[10] = 2.0F; float val2 = get1();
+ c.v[10] = 2.0F; float val2 = get1();
assertEquals(val1, 1.0F);
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
c.v = new float[20]; c.v[10] = 3.0F; float val3 = get1();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 3.0F));
+ : 3.0F));
}
{
@@ -220,17 +220,17 @@
public static void test() throws Exception {
{
c.v = new float[1][1]; c.v[0][0] = 1.0F; float val1 = get();
- c.v[0][0] = 2.0F; float val2 = get();
+ c.v[0][0] = 2.0F; float val2 = get();
assertEquals(val1, 1.0F);
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
c.v = new float[1][1]; c.v[0][0] = 3.0F; float val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 3.0F));
+ : 3.0F));
c.v[0] = new float[1]; c.v[0][0] = 4.0F; float val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 4.0F));
+ : 4.0F));
}
{
@@ -260,21 +260,21 @@
public static void test() throws Exception {
{
c.v = new float[1][1][1]; c.v[0][0][0] = 1.0F; float val1 = get();
- c.v[0][0][0] = 2.0F; float val2 = get();
+ c.v[0][0][0] = 2.0F; float val2 = get();
assertEquals(val1, 1.0F);
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
c.v = new float[1][1][1]; c.v[0][0][0] = 3.0F; float val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 3.0F));
+ : 3.0F));
c.v[0] = new float[1][1]; c.v[0][0][0] = 4.0F; float val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 4.0F));
+ : 4.0F));
c.v[0][0] = new float[1]; c.v[0][0][0] = 5.0F; float val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 5.0F));
+ : 5.0F));
}
{
@@ -311,25 +311,25 @@
public static void test() throws Exception {
{
c.v = new float[1][1][1][1]; c.v[0][0][0][0] = 1.0F; float val1 = get();
- c.v[0][0][0][0] = 2.0F; float val2 = get();
+ c.v[0][0][0][0] = 2.0F; float val2 = get();
assertEquals(val1, 1.0F);
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
c.v = new float[1][1][1][1]; c.v[0][0][0][0] = 3.0F; float val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 3.0F));
+ : 3.0F));
c.v[0] = new float[1][1][1]; c.v[0][0][0][0] = 4.0F; float val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 4.0F));
+ : 4.0F));
c.v[0][0] = new float[1][1]; c.v[0][0][0][0] = 5.0F; float val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 5.0F));
+ : 5.0F));
c.v[0][0][0] = new float[1]; c.v[0][0][0][0] = 6.0F; float val6 = get();
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
- : 6.0F));
+ : 6.0F));
}
{
@@ -370,7 +370,7 @@
public static void test() throws Exception {
{
c.v = new float[1]; ((float[])c.v)[0] = 1.0F; float val1 = get();
- ((float[])c.v)[0] = 2.0F; float val2 = get();
+ ((float[])c.v)[0] = 2.0F; float val2 = get();
assertEquals(val1, 1.0F);
assertEquals(val2, 2.0F);
@@ -397,7 +397,7 @@
public static void test() throws Exception {
{
c.v = new float[1][1]; ((float[][])c.v)[0][0] = 1.0F; float val1 = get();
- ((float[][])c.v)[0][0] = 2.0F; float val2 = get();
+ ((float[][])c.v)[0][0] = 2.0F; float val2 = get();
assertEquals(val1, 1.0F);
assertEquals(val2, 2.0F);
@@ -405,7 +405,7 @@
{
c.v = new float[1][1]; c.v[0] = new float[0]; float[] val1 = get1();
- c.v[0] = new float[0]; float[] val2 = get1();
+ c.v[0] = new float[0]; float[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -433,7 +433,7 @@
public static void test() throws Exception {
{
c.v = new float[1][1][1]; ((float[][][])c.v)[0][0][0] = 1.0F; float val1 = get();
- ((float[][][])c.v)[0][0][0] = 2.0F; float val2 = get();
+ ((float[][][])c.v)[0][0][0] = 2.0F; float val2 = get();
assertEquals(val1, 1.0F);
assertEquals(val2, 2.0F);
@@ -441,14 +441,14 @@
{
c.v = new float[1][1][1]; c.v[0][0] = new float[0]; float[] val1 = get1();
- c.v[0][0] = new float[0]; float[] val2 = get1();
+ c.v[0][0] = new float[0]; float[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new float[1][1][1]; c.v[0] = new float[0][0]; float[][] val1 = get2();
- c.v[0] = new float[0][0]; float[][] val2 = get2();
+ c.v[0] = new float[0][0]; float[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -478,7 +478,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = 1.0F; A val1 = get();
- c.v.a = 2.0F; A val2 = get();
+ c.v.a = 2.0F; A val2 = get();
assertEquals(val1.a, 2.0F);
assertEquals(val2.a, 2.0F);
@@ -486,7 +486,7 @@
{
c.v = new A(); c.v.a = 1.0F; float val1 = get1();
- c.v.a = 2.0F; float val2 = get1();
+ c.v.a = 2.0F; float val2 = get1();
c.v = new A(); c.v.a = 3.0F; float val3 = get1();
assertEquals(val1, 1.0F);
@@ -512,8 +512,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = 1.0F; c.v.next.a = 1.0F; A val1 = get();
- c.v.a = 2.0F; c.v.next.a = 2.0F; A val2 = get();
+ c.v.a = 1.0F; c.v.next.a = 1.0F; A val1 = get();
+ c.v.a = 2.0F; c.v.next.a = 2.0F; A val2 = get();
assertEquals(val1.a, 2.0F);
assertEquals(val2.a, 2.0F);
@@ -521,10 +521,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = 1.0F; float val1 = get1();
- c.v.a = 2.0F; float val2 = get1();
+ c.v.a = 1.0F; float val1 = get1();
+ c.v.a = 2.0F; float val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = 3.0F; float val3 = get1();
+ c.v.a = 3.0F; float val3 = get1();
assertEquals(val1, 1.0F);
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
@@ -550,8 +550,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = 1.0F; float val1 = get(); float val2 = get1();
- c.v.a = 2.0F; float val3 = get(); float val4 = get1();
+ c.v.a = 1.0F; float val1 = get(); float val2 = get1();
+ c.v.a = 2.0F; float val3 = get(); float val4 = get1();
assertEquals(val1, 1.0F);
assertEquals(val3, (isStableEnabled ? 1.0F : 2.0F));
@@ -581,8 +581,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = 1.0F; float val1 = get(); float val2 = get1();
- elem.a = 2.0F; float val3 = get(); float val4 = get1();
+ elem.a = 1.0F; float val1 = get(); float val2 = get1();
+ elem.a = 2.0F; float val3 = get(); float val4 = get1();
assertEquals(val1, 1.0F);
assertEquals(val3, (isStableEnabled ? 1.0F : 2.0F));
--- a/hotspot/test/compiler/stable/TestStableInt.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableInt.java Fri Jul 01 16:50:34 2016 -0700
@@ -100,7 +100,7 @@
public static final DefaultValue c = new DefaultValue();
public static int get() { return c.v; }
public static void test() throws Exception {
- int val1 = get();
+ int val1 = get();
c.v = 1; int val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1);
@@ -130,7 +130,7 @@
public static final DefaultStaticValue c = new DefaultStaticValue();
public static int get() { return c.v; }
public static void test() throws Exception {
- int val1 = get();
+ int val1 = get();
c.v = 1; int val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1);
@@ -180,24 +180,24 @@
public static void test() throws Exception {
{
c.v = new int[1]; c.v[0] = 1; int val1 = get();
- c.v[0] = 2; int val2 = get();
+ c.v[0] = 2; int val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new int[1]; c.v[0] = 3; int val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
}
{
c.v = new int[20]; c.v[10] = 1; int val1 = get1();
- c.v[10] = 2; int val2 = get1();
+ c.v[10] = 2; int val2 = get1();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new int[20]; c.v[10] = 3; int val3 = get1();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
}
{
@@ -220,17 +220,17 @@
public static void test() throws Exception {
{
c.v = new int[1][1]; c.v[0][0] = 1; int val1 = get();
- c.v[0][0] = 2; int val2 = get();
+ c.v[0][0] = 2; int val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new int[1][1]; c.v[0][0] = 3; int val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new int[1]; c.v[0][0] = 4; int val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
}
{
@@ -260,21 +260,21 @@
public static void test() throws Exception {
{
c.v = new int[1][1][1]; c.v[0][0][0] = 1; int val1 = get();
- c.v[0][0][0] = 2; int val2 = get();
+ c.v[0][0][0] = 2; int val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new int[1][1][1]; c.v[0][0][0] = 3; int val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new int[1][1]; c.v[0][0][0] = 4; int val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
c.v[0][0] = new int[1]; c.v[0][0][0] = 5; int val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 5));
+ : 5));
}
{
@@ -311,25 +311,25 @@
public static void test() throws Exception {
{
c.v = new int[1][1][1][1]; c.v[0][0][0][0] = 1; int val1 = get();
- c.v[0][0][0][0] = 2; int val2 = get();
+ c.v[0][0][0][0] = 2; int val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new int[1][1][1][1]; c.v[0][0][0][0] = 3; int val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new int[1][1][1]; c.v[0][0][0][0] = 4; int val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
c.v[0][0] = new int[1][1]; c.v[0][0][0][0] = 5; int val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 5));
+ : 5));
c.v[0][0][0] = new int[1]; c.v[0][0][0][0] = 6; int val6 = get();
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 6));
+ : 6));
}
{
@@ -370,7 +370,7 @@
public static void test() throws Exception {
{
c.v = new int[1]; ((int[])c.v)[0] = 1; int val1 = get();
- ((int[])c.v)[0] = 2; int val2 = get();
+ ((int[])c.v)[0] = 2; int val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -397,7 +397,7 @@
public static void test() throws Exception {
{
c.v = new int[1][1]; ((int[][])c.v)[0][0] = 1; int val1 = get();
- ((int[][])c.v)[0][0] = 2; int val2 = get();
+ ((int[][])c.v)[0][0] = 2; int val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -405,7 +405,7 @@
{
c.v = new int[1][1]; c.v[0] = new int[0]; int[] val1 = get1();
- c.v[0] = new int[0]; int[] val2 = get1();
+ c.v[0] = new int[0]; int[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -433,7 +433,7 @@
public static void test() throws Exception {
{
c.v = new int[1][1][1]; ((int[][][])c.v)[0][0][0] = 1; int val1 = get();
- ((int[][][])c.v)[0][0][0] = 2; int val2 = get();
+ ((int[][][])c.v)[0][0][0] = 2; int val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -441,14 +441,14 @@
{
c.v = new int[1][1][1]; c.v[0][0] = new int[0]; int[] val1 = get1();
- c.v[0][0] = new int[0]; int[] val2 = get1();
+ c.v[0][0] = new int[0]; int[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new int[1][1][1]; c.v[0] = new int[0][0]; int[][] val1 = get2();
- c.v[0] = new int[0][0]; int[][] val2 = get2();
+ c.v[0] = new int[0][0]; int[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -478,7 +478,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = 1; A val1 = get();
- c.v.a = 2; A val2 = get();
+ c.v.a = 2; A val2 = get();
assertEquals(val1.a, 2);
assertEquals(val2.a, 2);
@@ -486,7 +486,7 @@
{
c.v = new A(); c.v.a = 1; int val1 = get1();
- c.v.a = 2; int val2 = get1();
+ c.v.a = 2; int val2 = get1();
c.v = new A(); c.v.a = 3; int val3 = get1();
assertEquals(val1, 1);
@@ -512,8 +512,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = 1; c.v.next.a = 1; A val1 = get();
- c.v.a = 2; c.v.next.a = 2; A val2 = get();
+ c.v.a = 1; c.v.next.a = 1; A val1 = get();
+ c.v.a = 2; c.v.next.a = 2; A val2 = get();
assertEquals(val1.a, 2);
assertEquals(val2.a, 2);
@@ -521,10 +521,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = 1; int val1 = get1();
- c.v.a = 2; int val2 = get1();
+ c.v.a = 1; int val1 = get1();
+ c.v.a = 2; int val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = 3; int val3 = get1();
+ c.v.a = 3; int val3 = get1();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
@@ -550,8 +550,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = 1; int val1 = get(); int val2 = get1();
- c.v.a = 2; int val3 = get(); int val4 = get1();
+ c.v.a = 1; int val1 = get(); int val2 = get1();
+ c.v.a = 2; int val3 = get(); int val4 = get1();
assertEquals(val1, 1);
assertEquals(val3, (isStableEnabled ? 1 : 2));
@@ -581,8 +581,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = 1; int val1 = get(); int val2 = get1();
- elem.a = 2; int val3 = get(); int val4 = get1();
+ elem.a = 1; int val1 = get(); int val2 = get1();
+ elem.a = 2; int val3 = get(); int val4 = get1();
assertEquals(val1, 1);
assertEquals(val3, (isStableEnabled ? 1 : 2));
--- a/hotspot/test/compiler/stable/TestStableLong.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableLong.java Fri Jul 01 16:50:34 2016 -0700
@@ -100,7 +100,7 @@
public static final DefaultValue c = new DefaultValue();
public static long get() { return c.v; }
public static void test() throws Exception {
- long val1 = get();
+ long val1 = get();
c.v = 1L; long val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1L);
@@ -130,7 +130,7 @@
public static final DefaultStaticValue c = new DefaultStaticValue();
public static long get() { return c.v; }
public static void test() throws Exception {
- long val1 = get();
+ long val1 = get();
c.v = 1L; long val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1L);
@@ -180,24 +180,24 @@
public static void test() throws Exception {
{
c.v = new long[1]; c.v[0] = 1; long val1 = get();
- c.v[0] = 2; long val2 = get();
+ c.v[0] = 2; long val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new long[1]; c.v[0] = 3; long val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
}
{
c.v = new long[20]; c.v[10] = 1; long val1 = get1();
- c.v[10] = 2; long val2 = get1();
+ c.v[10] = 2; long val2 = get1();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new long[20]; c.v[10] = 3; long val3 = get1();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
}
{
@@ -220,17 +220,17 @@
public static void test() throws Exception {
{
c.v = new long[1][1]; c.v[0][0] = 1; long val1 = get();
- c.v[0][0] = 2; long val2 = get();
+ c.v[0][0] = 2; long val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new long[1][1]; c.v[0][0] = 3; long val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new long[1]; c.v[0][0] = 4; long val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
}
{
@@ -260,21 +260,21 @@
public static void test() throws Exception {
{
c.v = new long[1][1][1]; c.v[0][0][0] = 1; long val1 = get();
- c.v[0][0][0] = 2; long val2 = get();
+ c.v[0][0][0] = 2; long val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new long[1][1][1]; c.v[0][0][0] = 3; long val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new long[1][1]; c.v[0][0][0] = 4; long val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
c.v[0][0] = new long[1]; c.v[0][0][0] = 5; long val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 5));
+ : 5));
}
{
@@ -311,25 +311,25 @@
public static void test() throws Exception {
{
c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 1; long val1 = get();
- c.v[0][0][0][0] = 2; long val2 = get();
+ c.v[0][0][0][0] = 2; long val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 3; long val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new long[1][1][1]; c.v[0][0][0][0] = 4; long val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
c.v[0][0] = new long[1][1]; c.v[0][0][0][0] = 5; long val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 5));
+ : 5));
c.v[0][0][0] = new long[1]; c.v[0][0][0][0] = 6; long val6 = get();
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 6));
+ : 6));
}
{
@@ -370,7 +370,7 @@
public static void test() throws Exception {
{
c.v = new long[1]; ((long[])c.v)[0] = 1; long val1 = get();
- ((long[])c.v)[0] = 2; long val2 = get();
+ ((long[])c.v)[0] = 2; long val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -397,7 +397,7 @@
public static void test() throws Exception {
{
c.v = new long[1][1]; ((long[][])c.v)[0][0] = 1; long val1 = get();
- ((long[][])c.v)[0][0] = 2; long val2 = get();
+ ((long[][])c.v)[0][0] = 2; long val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -405,7 +405,7 @@
{
c.v = new long[1][1]; c.v[0] = new long[0]; long[] val1 = get1();
- c.v[0] = new long[0]; long[] val2 = get1();
+ c.v[0] = new long[0]; long[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -433,7 +433,7 @@
public static void test() throws Exception {
{
c.v = new long[1][1][1]; ((long[][][])c.v)[0][0][0] = 1L; long val1 = get();
- ((long[][][])c.v)[0][0][0] = 2L; long val2 = get();
+ ((long[][][])c.v)[0][0][0] = 2L; long val2 = get();
assertEquals(val1, 1L);
assertEquals(val2, 2L);
@@ -441,14 +441,14 @@
{
c.v = new long[1][1][1]; c.v[0][0] = new long[0]; long[] val1 = get1();
- c.v[0][0] = new long[0]; long[] val2 = get1();
+ c.v[0][0] = new long[0]; long[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new long[1][1][1]; c.v[0] = new long[0][0]; long[][] val1 = get2();
- c.v[0] = new long[0][0]; long[][] val2 = get2();
+ c.v[0] = new long[0][0]; long[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -478,7 +478,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = 1; A val1 = get();
- c.v.a = 2; A val2 = get();
+ c.v.a = 2; A val2 = get();
assertEquals(val1.a, 2);
assertEquals(val2.a, 2);
@@ -486,7 +486,7 @@
{
c.v = new A(); c.v.a = 1; long val1 = get1();
- c.v.a = 2; long val2 = get1();
+ c.v.a = 2; long val2 = get1();
c.v = new A(); c.v.a = 3; long val3 = get1();
assertEquals(val1, 1);
@@ -512,8 +512,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = 1; c.v.next.a = 1; A val1 = get();
- c.v.a = 2; c.v.next.a = 2; A val2 = get();
+ c.v.a = 1; c.v.next.a = 1; A val1 = get();
+ c.v.a = 2; c.v.next.a = 2; A val2 = get();
assertEquals(val1.a, 2);
assertEquals(val2.a, 2);
@@ -521,10 +521,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = 1; long val1 = get1();
- c.v.a = 2; long val2 = get1();
+ c.v.a = 1; long val1 = get1();
+ c.v.a = 2; long val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = 3; long val3 = get1();
+ c.v.a = 3; long val3 = get1();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
@@ -550,8 +550,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = 1; long val1 = get(); long val2 = get1();
- c.v.a = 2; long val3 = get(); long val4 = get1();
+ c.v.a = 1; long val1 = get(); long val2 = get1();
+ c.v.a = 2; long val3 = get(); long val4 = get1();
assertEquals(val1, 1);
assertEquals(val3, (isStableEnabled ? 1 : 2));
@@ -581,8 +581,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = 1; long val1 = get(); long val2 = get1();
- elem.a = 2; long val3 = get(); long val4 = get1();
+ elem.a = 1; long val1 = get(); long val2 = get1();
+ elem.a = 2; long val3 = get(); long val4 = get1();
assertEquals(val1, 1);
assertEquals(val3, (isStableEnabled ? 1 : 2));
--- a/hotspot/test/compiler/stable/TestStableObject.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableObject.java Fri Jul 01 16:50:34 2016 -0700
@@ -102,7 +102,7 @@
public static final DefaultValue c = new DefaultValue();
public static Object get() { return c.v; }
public static void test() throws Exception {
- Object val1 = get();
+ Object val1 = get();
c.v = Values.A; Object val2 = get();
assertEquals(val1, null);
assertEquals(val2, Values.A);
@@ -132,7 +132,7 @@
public static final DefaultStaticValue c = new DefaultStaticValue();
public static Object get() { return c.v; }
public static void test() throws Exception {
- Object val1 = get();
+ Object val1 = get();
c.v = Values.A; Object val2 = get();
assertEquals(val1, null);
assertEquals(val2, Values.A);
@@ -182,24 +182,24 @@
public static void test() throws Exception {
{
c.v = new Object[1]; c.v[0] = Values.A; Object val1 = get();
- c.v[0] = Values.B; Object val2 = get();
+ c.v[0] = Values.B; Object val2 = get();
assertEquals(val1, Values.A);
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
c.v = new Object[1]; c.v[0] = Values.C; Object val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.C));
+ : Values.C));
}
{
c.v = new Object[20]; c.v[10] = Values.A; Object val1 = get1();
- c.v[10] = Values.B; Object val2 = get1();
+ c.v[10] = Values.B; Object val2 = get1();
assertEquals(val1, Values.A);
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
c.v = new Object[20]; c.v[10] = Values.C; Object val3 = get1();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.C));
+ : Values.C));
}
{
@@ -222,17 +222,17 @@
public static void test() throws Exception {
{
c.v = new Object[1][1]; c.v[0][0] = Values.A; Object val1 = get();
- c.v[0][0] = Values.B; Object val2 = get();
+ c.v[0][0] = Values.B; Object val2 = get();
assertEquals(val1, Values.A);
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
c.v = new Object[1][1]; c.v[0][0] = Values.C; Object val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.C));
+ : Values.C));
c.v[0] = new Object[1]; c.v[0][0] = Values.D; Object val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.D));
+ : Values.D));
}
{
@@ -262,21 +262,21 @@
public static void test() throws Exception {
{
c.v = new Object[1][1][1]; c.v[0][0][0] = Values.A; Object val1 = get();
- c.v[0][0][0] = Values.B; Object val2 = get();
+ c.v[0][0][0] = Values.B; Object val2 = get();
assertEquals(val1, Values.A);
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
c.v = new Object[1][1][1]; c.v[0][0][0] = Values.C; Object val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.C));
+ : Values.C));
c.v[0] = new Object[1][1]; c.v[0][0][0] = Values.D; Object val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.D));
+ : Values.D));
c.v[0][0] = new Object[1]; c.v[0][0][0] = Values.E; Object val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.E));
+ : Values.E));
}
{
@@ -313,25 +313,25 @@
public static void test() throws Exception {
{
c.v = new Object[1][1][1][1]; c.v[0][0][0][0] = Values.A; Object val1 = get();
- c.v[0][0][0][0] = Values.B; Object val2 = get();
+ c.v[0][0][0][0] = Values.B; Object val2 = get();
assertEquals(val1, Values.A);
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
c.v = new Object[1][1][1][1]; c.v[0][0][0][0] = Values.C; Object val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.C));
+ : Values.C));
c.v[0] = new Object[1][1][1]; c.v[0][0][0][0] = Values.D; Object val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.D));
+ : Values.D));
c.v[0][0] = new Object[1][1]; c.v[0][0][0][0] = Values.E; Object val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.E));
+ : Values.E));
c.v[0][0][0] = new Object[1]; c.v[0][0][0][0] = Values.F; Object val6 = get();
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
- : Values.F));
+ : Values.F));
}
{
@@ -372,7 +372,7 @@
public static void test() throws Exception {
{
c.v = new Object[1]; ((Object[])c.v)[0] = Values.A; Object val1 = get();
- ((Object[])c.v)[0] = Values.B; Object val2 = get();
+ ((Object[])c.v)[0] = Values.B; Object val2 = get();
assertEquals(val1, Values.A);
assertEquals(val2, Values.B);
@@ -399,7 +399,7 @@
public static void test() throws Exception {
{
c.v = new Object[1][1]; ((Object[][])c.v)[0][0] = Values.A; Object val1 = get();
- ((Object[][])c.v)[0][0] = Values.B; Object val2 = get();
+ ((Object[][])c.v)[0][0] = Values.B; Object val2 = get();
assertEquals(val1, Values.A);
assertEquals(val2, Values.B);
@@ -407,7 +407,7 @@
{
c.v = new Object[1][1]; c.v[0] = new Object[0]; Object[] val1 = get1();
- c.v[0] = new Object[0]; Object[] val2 = get1();
+ c.v[0] = new Object[0]; Object[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -435,7 +435,7 @@
public static void test() throws Exception {
{
c.v = new Object[1][1][1]; ((Object[][][])c.v)[0][0][0] = Values.A; Object val1 = get();
- ((Object[][][])c.v)[0][0][0] = Values.B; Object val2 = get();
+ ((Object[][][])c.v)[0][0][0] = Values.B; Object val2 = get();
assertEquals(val1, Values.A);
assertEquals(val2, Values.B);
@@ -443,14 +443,14 @@
{
c.v = new Object[1][1][1]; c.v[0][0] = new Object[0]; Object[] val1 = get1();
- c.v[0][0] = new Object[0]; Object[] val2 = get1();
+ c.v[0][0] = new Object[0]; Object[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new Object[1][1][1]; c.v[0] = new Object[0][0]; Object[][] val1 = get2();
- c.v[0] = new Object[0][0]; Object[][] val2 = get2();
+ c.v[0] = new Object[0][0]; Object[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -480,7 +480,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = Values.A; A val1 = get();
- c.v.a = Values.B; A val2 = get();
+ c.v.a = Values.B; A val2 = get();
assertEquals(val1.a, Values.B);
assertEquals(val2.a, Values.B);
@@ -488,7 +488,7 @@
{
c.v = new A(); c.v.a = Values.A; Object val1 = get1();
- c.v.a = Values.B; Object val2 = get1();
+ c.v.a = Values.B; Object val2 = get1();
c.v = new A(); c.v.a = Values.C; Object val3 = get1();
assertEquals(val1, Values.A);
@@ -514,8 +514,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = Values.A; c.v.next.a = Values.A; A val1 = get();
- c.v.a = Values.B; c.v.next.a = Values.B; A val2 = get();
+ c.v.a = Values.A; c.v.next.a = Values.A; A val1 = get();
+ c.v.a = Values.B; c.v.next.a = Values.B; A val2 = get();
assertEquals(val1.a, Values.B);
assertEquals(val2.a, Values.B);
@@ -523,10 +523,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = Values.A; Object val1 = get1();
- c.v.a = Values.B; Object val2 = get1();
+ c.v.a = Values.A; Object val1 = get1();
+ c.v.a = Values.B; Object val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = Values.C; Object val3 = get1();
+ c.v.a = Values.C; Object val3 = get1();
assertEquals(val1, Values.A);
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
@@ -552,8 +552,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = Values.A; Object val1 = get(); Object val2 = get1();
- c.v.a = Values.B; Object val3 = get(); Object val4 = get1();
+ c.v.a = Values.A; Object val1 = get(); Object val2 = get1();
+ c.v.a = Values.B; Object val3 = get(); Object val4 = get1();
assertEquals(val1, Values.A);
assertEquals(val3, (isStableEnabled ? Values.A : Values.B));
@@ -583,8 +583,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = Values.A; Object val1 = get(); Object val2 = get1();
- elem.a = Values.B; Object val3 = get(); Object val4 = get1();
+ elem.a = Values.A; Object val1 = get(); Object val2 = get1();
+ elem.a = Values.B; Object val3 = get(); Object val4 = get1();
assertEquals(val1, Values.A);
assertEquals(val3, (isStableEnabled ? Values.A : Values.B));
--- a/hotspot/test/compiler/stable/TestStableShort.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/stable/TestStableShort.java Fri Jul 01 16:50:34 2016 -0700
@@ -100,7 +100,7 @@
public static final DefaultValue c = new DefaultValue();
public static short get() { return c.v; }
public static void test() throws Exception {
- short val1 = get();
+ short val1 = get();
c.v = 1; short val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1);
@@ -130,7 +130,7 @@
public static final DefaultStaticValue c = new DefaultStaticValue();
public static short get() { return c.v; }
public static void test() throws Exception {
- short val1 = get();
+ short val1 = get();
c.v = 1; short val2 = get();
assertEquals(val1, 0);
assertEquals(val2, 1);
@@ -180,24 +180,24 @@
public static void test() throws Exception {
{
c.v = new short[1]; c.v[0] = 1; short val1 = get();
- c.v[0] = 2; short val2 = get();
+ c.v[0] = 2; short val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new short[1]; c.v[0] = 3; short val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
}
{
c.v = new short[20]; c.v[10] = 1; short val1 = get1();
- c.v[10] = 2; short val2 = get1();
+ c.v[10] = 2; short val2 = get1();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new short[20]; c.v[10] = 3; short val3 = get1();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
}
{
@@ -220,17 +220,17 @@
public static void test() throws Exception {
{
c.v = new short[1][1]; c.v[0][0] = 1; short val1 = get();
- c.v[0][0] = 2; short val2 = get();
+ c.v[0][0] = 2; short val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new short[1][1]; c.v[0][0] = 3; short val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new short[1]; c.v[0][0] = 4; short val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
}
{
@@ -260,21 +260,21 @@
public static void test() throws Exception {
{
c.v = new short[1][1][1]; c.v[0][0][0] = 1; short val1 = get();
- c.v[0][0][0] = 2; short val2 = get();
+ c.v[0][0][0] = 2; short val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new short[1][1][1]; c.v[0][0][0] = 3; short val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new short[1][1]; c.v[0][0][0] = 4; short val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
c.v[0][0] = new short[1]; c.v[0][0][0] = 5; short val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 5));
+ : 5));
}
{
@@ -311,25 +311,25 @@
public static void test() throws Exception {
{
c.v = new short[1][1][1][1]; c.v[0][0][0][0] = 1; short val1 = get();
- c.v[0][0][0][0] = 2; short val2 = get();
+ c.v[0][0][0][0] = 2; short val2 = get();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
c.v = new short[1][1][1][1]; c.v[0][0][0][0] = 3; short val3 = get();
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 3));
+ : 3));
c.v[0] = new short[1][1][1]; c.v[0][0][0][0] = 4; short val4 = get();
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 4));
+ : 4));
c.v[0][0] = new short[1][1]; c.v[0][0][0][0] = 5; short val5 = get();
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 5));
+ : 5));
c.v[0][0][0] = new short[1]; c.v[0][0][0][0] = 6; short val6 = get();
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1 : 2)
- : 6));
+ : 6));
}
{
@@ -370,7 +370,7 @@
public static void test() throws Exception {
{
c.v = new short[1]; ((short[])c.v)[0] = 1; short val1 = get();
- ((short[])c.v)[0] = 2; short val2 = get();
+ ((short[])c.v)[0] = 2; short val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -397,7 +397,7 @@
public static void test() throws Exception {
{
c.v = new short[1][1]; ((short[][])c.v)[0][0] = 1; short val1 = get();
- ((short[][])c.v)[0][0] = 2; short val2 = get();
+ ((short[][])c.v)[0][0] = 2; short val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -405,7 +405,7 @@
{
c.v = new short[1][1]; c.v[0] = new short[0]; short[] val1 = get1();
- c.v[0] = new short[0]; short[] val2 = get1();
+ c.v[0] = new short[0]; short[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -433,7 +433,7 @@
public static void test() throws Exception {
{
c.v = new short[1][1][1]; ((short[][][])c.v)[0][0][0] = 1; short val1 = get();
- ((short[][][])c.v)[0][0][0] = 2; short val2 = get();
+ ((short[][][])c.v)[0][0][0] = 2; short val2 = get();
assertEquals(val1, 1);
assertEquals(val2, 2);
@@ -441,14 +441,14 @@
{
c.v = new short[1][1][1]; c.v[0][0] = new short[0]; short[] val1 = get1();
- c.v[0][0] = new short[0]; short[] val2 = get1();
+ c.v[0][0] = new short[0]; short[] val2 = get1();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
{
c.v = new short[1][1][1]; c.v[0] = new short[0][0]; short[][] val1 = get2();
- c.v[0] = new short[0][0]; short[][] val2 = get2();
+ c.v[0] = new short[0][0]; short[][] val2 = get2();
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
}
@@ -478,7 +478,7 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.a = 1; A val1 = get();
- c.v.a = 2; A val2 = get();
+ c.v.a = 2; A val2 = get();
assertEquals(val1.a, 2);
assertEquals(val2.a, 2);
@@ -486,7 +486,7 @@
{
c.v = new A(); c.v.a = 1; short val1 = get1();
- c.v.a = 2; short val2 = get1();
+ c.v.a = 2; short val2 = get1();
c.v = new A(); c.v.a = 3; short val3 = get1();
assertEquals(val1, 1);
@@ -512,8 +512,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.next = new A(); c.v.next.next = c.v;
- c.v.a = 1; c.v.next.a = 1; A val1 = get();
- c.v.a = 2; c.v.next.a = 2; A val2 = get();
+ c.v.a = 1; c.v.next.a = 1; A val1 = get();
+ c.v.a = 2; c.v.next.a = 2; A val2 = get();
assertEquals(val1.a, 2);
assertEquals(val2.a, 2);
@@ -521,10 +521,10 @@
{
c.v = new A(); c.v.next = c.v;
- c.v.a = 1; short val1 = get1();
- c.v.a = 2; short val2 = get1();
+ c.v.a = 1; short val1 = get1();
+ c.v.a = 2; short val2 = get1();
c.v = new A(); c.v.next = c.v;
- c.v.a = 3; short val3 = get1();
+ c.v.a = 3; short val3 = get1();
assertEquals(val1, 1);
assertEquals(val2, (isStableEnabled ? 1 : 2));
@@ -550,8 +550,8 @@
public static void test() throws Exception {
{
c.v = new A(); c.v.left = c.v.right = c.v;
- c.v.a = 1; short val1 = get(); short val2 = get1();
- c.v.a = 2; short val3 = get(); short val4 = get1();
+ c.v.a = 1; short val1 = get(); short val2 = get1();
+ c.v.a = 2; short val3 = get(); short val4 = get1();
assertEquals(val1, 1);
assertEquals(val3, (isStableEnabled ? 1 : 2));
@@ -581,8 +581,8 @@
{
A elem = new A();
c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
- elem.a = 1; short val1 = get(); short val2 = get1();
- elem.a = 2; short val3 = get(); short val4 = get1();
+ elem.a = 1; short val1 = get(); short val2 = get1();
+ elem.a = 2; short val3 = get(); short val4 = get1();
assertEquals(val1, 1);
assertEquals(val3, (isStableEnabled ? 1 : 2));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/stringopts/TestStringObjectInitialization.java Fri Jul 01 16:50:34 2016 -0700
@@ -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.
+ */
+
+
+import java.util.Arrays;
+
+/*
+ * @test
+ * @bug 8159244
+ * @requires vm.gc == "Parallel" | vm.gc == "null"
+ * @summary Verifies that no partially initialized String object escapes from
+ * C2's String concat optimization in a highly concurrent setting.
+ * This test triggers the bug in about 1 out of 10 runs.
+ * @compile -XDstringConcat=inline TestStringObjectInitialization.java
+ * @run main/othervm/timeout=300 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-CompactStrings
+ * -XX:-UseG1GC -XX:+UseParallelGC TestStringObjectInitialization
+ */
+public class TestStringObjectInitialization {
+
+ String myString;
+
+ public static void main(String[] args) throws Exception {
+ TestStringObjectInitialization t = new TestStringObjectInitialization();
+ // Create some threads that concurrently update 'myString'
+ for (int i = 0; i < 100; ++i) {
+ (new Thread(new Runner(t))).start();
+ }
+ Thread last = new Thread(new Runner(t));
+ last.start();
+ last.join();
+ }
+
+ private void add(String message) {
+ // String escapes to other threads here
+ myString += message;
+ }
+
+ public void run(String s, String[] sArray) {
+ // Trigger C2's string concatenation optimization
+ add(s + Arrays.toString(sArray) + " const ");
+ }
+}
+
+class Runner implements Runnable {
+ private TestStringObjectInitialization test;
+
+ public Runner(TestStringObjectInitialization t) {
+ test = t;
+ }
+
+ public void run(){
+ String[] array = {"a", "b", "c"};
+ for (int i = 0; i < 10000; ++i) {
+ test.run("a", array);
+ }
+ }
+}
+
--- a/hotspot/test/compiler/testlibrary/intrinsics/Verifier.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/intrinsics/Verifier.java Fri Jul 01 16:50:34 2016 -0700
@@ -20,7 +20,8 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package intrinsics;
+
+package compiler.testlibrary.intrinsics;
import java.io.BufferedReader;
import java.io.FileReader;
--- a/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/AbortProvoker.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
import java.util.Objects;
import java.util.concurrent.BrokenBarrierException;
--- a/hotspot/test/compiler/testlibrary/rtm/AbortType.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/AbortType.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
import jdk.test.lib.Asserts;
--- a/hotspot/test/compiler/testlibrary/rtm/BufferOverflowProvoker.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/BufferOverflowProvoker.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
/**
* In order to provoke transactional execution abort due to
--- a/hotspot/test/compiler/testlibrary/rtm/BusyLock.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/BusyLock.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
--- a/hotspot/test/compiler/testlibrary/rtm/CompilableTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/CompilableTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
/**
* Interface for test scenarios that contain methods
--- a/hotspot/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/MemoryConflictProvoker.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
--- a/hotspot/test/compiler/testlibrary/rtm/NestedAbortProvoker.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/NestedAbortProvoker.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
import java.util.Arrays;
--- a/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/RTMLockingStatistics.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
import java.util.EnumMap;
import java.util.LinkedList;
--- a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
import java.io.IOException;
import java.nio.file.Files;
--- a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm;
+package compiler.testlibrary.rtm;
import jdk.test.lib.Utils;
import jdk.internal.misc.Unsafe;
--- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm.predicate;
+package compiler.testlibrary.rtm.predicate;
import sun.hotspot.cpuinfo.CPUInfo;
--- a/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/rtm/predicate/SupportedVM.java Fri Jul 01 16:50:34 2016 -0700
@@ -22,7 +22,7 @@
*
*/
-package rtm.predicate;
+package compiler.testlibrary.rtm.predicate;
import jdk.test.lib.Platform;
--- a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,7 +21,7 @@
* questions.
*/
-package sha.predicate;
+package compiler.testlibrary.sha.predicate;
import jdk.test.lib.Platform;
import jdk.test.lib.cli.predicate.AndPredicate;
--- a/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/testlibrary/uncommontrap/Verifier.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,7 +21,7 @@
* questions.
*/
-package uncommontrap;
+package compiler.testlibrary.uncommontrap;
import java.io.FileReader;
import java.io.IOException;
@@ -34,6 +34,7 @@
import java.util.regex.Pattern;
import jdk.test.lib.Asserts;
+
/**
* Utility tool aimed to verify presence or absence of specified uncommon trap
* in compilation log.
@@ -78,7 +79,9 @@
PROPERTIES_FILE_SUFFIX);
Properties properties = new Properties();
- properties.load(new FileReader(propertiesFile.toFile()));
+ try (FileReader reader = new FileReader(propertiesFile.toFile())) {
+ properties.load(reader);
+ }
if (Boolean.valueOf(properties.getProperty(
VERIFICATION_SHOULD_BE_SKIPPED, "false"))) {
--- a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,13 +21,9 @@
* questions.
*/
-import java.lang.reflect.Executable;
-import java.util.concurrent.Callable;
-import compiler.whitebox.CompilerWhiteBoxTest;
-
/**
* @test ConstantGettersTransitionsTest
- * @library /testlibrary /test/lib /compiler/whitebox /
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
* @build TransitionsTestExecutor ConstantGettersTransitionsTest
@@ -38,6 +34,11 @@
* TransitionsTestExecutor ConstantGettersTransitionsTest
* @summary Test the correctness of compilation level transitions for constant getters methods
*/
+
+import java.lang.reflect.Executable;
+import java.util.concurrent.Callable;
+import compiler.whitebox.CompilerWhiteBoxTest;
+
public class ConstantGettersTransitionsTest extends LevelTransitionTest {
public static void main(String[] args) {
assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
--- a/hotspot/test/compiler/tiered/LevelTransitionTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,6 +21,22 @@
* questions.
*/
+/**
+ * @test LevelTransitionTest
+ * @library /testlibrary /test/lib /
+ * @modules java.base/jdk.internal.misc
+ * java.management
+ * @ignore 8067651
+ * @build TransitionsTestExecutor LevelTransitionTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI -XX:+TieredCompilation
+ * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
+ * -XX:CompileCommand=compileonly,ExtendedTestCase$CompileMethodHolder::*
+ * TransitionsTestExecutor LevelTransitionTest
+ * @summary Test the correctness of compilation level transitions for different methods
+ */
+
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.util.Objects;
@@ -28,21 +44,6 @@
import compiler.whitebox.CompilerWhiteBoxTest;
import compiler.whitebox.SimpleTestCase;
-/**
- * @test LevelTransitionTest
- * @library /testlibrary /test/lib /compiler/whitebox /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @ignore 8067651
- * @build TransitionsTestExecutor LevelTransitionTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI -XX:+TieredCompilation
- * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
- * -XX:CompileCommand=compileonly,ExtendedTestCase$CompileMethodHolder::*
- * TransitionsTestExecutor LevelTransitionTest
- * @summary Test the correctness of compilation level transitions for different methods
- */
public class LevelTransitionTest extends TieredLevelsTest {
/** Shows if method was profiled by being executed on levels 2 or 3 */
protected boolean isMethodProfiled;
--- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,12 +21,9 @@
* questions.
*/
-import java.util.function.IntPredicate;
-import compiler.whitebox.CompilerWhiteBoxTest;
-
/**
* @test NonTieredLevelsTest
- * @library /testlibrary /test/lib /compiler/whitebox /
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* @modules java.management
* @build NonTieredLevelsTest
@@ -39,6 +36,10 @@
* @summary Verify that only one level can be used
* @author igor.ignatyev@oracle.com
*/
+
+import java.util.function.IntPredicate;
+import compiler.whitebox.CompilerWhiteBoxTest;
+
public class NonTieredLevelsTest extends CompLevelsTest {
private static final int AVAILABLE_COMP_LEVEL;
private static final IntPredicate IS_AVAILABLE_COMPLEVEL;
--- a/hotspot/test/compiler/tiered/TieredLevelsTest.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java Fri Jul 01 16:50:34 2016 -0700
@@ -21,16 +21,14 @@
* questions.
*/
-import compiler.whitebox.CompilerWhiteBoxTest;
-
/**
* @test TieredLevelsTest
- * @library /testlibrary /test/lib /compiler/whitebox /
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* @modules java.management
* @build TieredLevelsTest
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay
* -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::*
@@ -38,6 +36,9 @@
* @summary Verify that all levels < 'TieredStopAtLevel' can be used
* @author igor.ignatyev@oracle.com
*/
+
+import compiler.whitebox.CompilerWhiteBoxTest;
+
public class TieredLevelsTest extends CompLevelsTest {
public static void main(String[] args) throws Exception, Throwable {
if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
--- a/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java Fri Jul 01 16:50:34 2016 -0700
@@ -33,7 +33,7 @@
* @build Test8009761
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss392K Test8009761
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss512K Test8009761
*/
public class Test8009761 {
--- a/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/uncommontrap/StackOverflowGuardPagesOff.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8029383
* @summary stack overflow if callee is marked for deoptimization causes crash
- * @run main/othervm -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,StackOverflowGuardPagesOff::m1 -XX:CompileCommand=exclude,StackOverflowGuardPagesOff::m2 -Xss392K -XX:-UseOnStackReplacement StackOverflowGuardPagesOff
+ * @run main/othervm -XX:TieredStopAtLevel=1 -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,StackOverflowGuardPagesOff::m1 -XX:CompileCommand=exclude,StackOverflowGuardPagesOff::m2 -Xss512K -XX:-UseOnStackReplacement StackOverflowGuardPagesOff
*
*/
--- a/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/uncommontrap/TestStackBangMonitorOwned.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8032410
* @summary Stack overflow at deoptimization doesn't release owned monitors
- * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangMonitorOwned::m1 -XX:CompileCommand=exclude,TestStackBangMonitorOwned::m2 -Xss392K -XX:-UseOnStackReplacement TestStackBangMonitorOwned
+ * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangMonitorOwned::m1 -XX:CompileCommand=exclude,TestStackBangMonitorOwned::m2 -Xss512K -XX:-UseOnStackReplacement TestStackBangMonitorOwned
*
*/
public class TestStackBangMonitorOwned {
--- a/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/uncommontrap/TestStackBangRbp.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test
* @bug 8028308
* @summary rbp not restored when stack overflow is thrown from deopt/uncommon trap blobs
- * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangRbp::m1 -XX:CompileCommand=exclude,TestStackBangRbp::m2 -Xss392K -XX:-UseOnStackReplacement TestStackBangRbp
+ * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangRbp::m1 -XX:CompileCommand=exclude,TestStackBangRbp::m2 -Xss512K -XX:-UseOnStackReplacement TestStackBangRbp
*
*/
public class TestStackBangRbp {
--- a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java Fri Jul 01 16:50:34 2016 -0700
@@ -20,35 +20,19 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Properties;
-
-import jdk.test.lib.ByteCodeLoader;
-import jdk.test.lib.Platform;
-import jdk.internal.org.objectweb.asm.ClassVisitor;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.Label;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-
-import sun.hotspot.WhiteBox;
-import uncommontrap.Verifier;
/*
* @test
* @bug 8030976 8059226
- * @library /testlibrary /compiler/testlibrary /test/lib
+ * @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.org.objectweb.asm
* java.base/jdk.internal.misc
* java.compiler
* java.management
* jdk.jvmstat/sun.jvmstat.monitor
- * @build TestUnstableIfTrap jdk.test.lib.* uncommontrap.Verifier
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build TestUnstableIfTrap jdk.test.lib.* compiler.testlibrary.uncommontrap.Verifier
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -XX:+LogCompilation
* -XX:CompileCommand=compileonly,UnstableIfExecutable.test
@@ -69,11 +53,29 @@
* -XX:CompileCommand=compileonly,UnstableIfExecutable.test
* -XX:LogFile=never_taken_fired.xml
* TestUnstableIfTrap NEVER_TAKEN true
- * @run main/othervm uncommontrap.Verifier always_taken_not_fired.xml
- * always_taken_fired.xml
- * never_taken_not_fired.xml
- * never_taken_fired.xml
+ * @run driver compiler.testlibrary.uncommontrap.Verifier always_taken_not_fired.xml
+ * always_taken_fired.xml
+ * never_taken_not_fired.xml
+ * never_taken_fired.xml
*/
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Properties;
+
+import jdk.test.lib.ByteCodeLoader;
+import jdk.test.lib.Platform;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Label;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
+
+import sun.hotspot.WhiteBox;
+import compiler.testlibrary.uncommontrap.Verifier;
+
public class TestUnstableIfTrap {
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final String CLASS_NAME = "UnstableIfExecutable";
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java Fri Jul 01 16:50:34 2016 -0700
@@ -144,6 +144,115 @@
}
+ UNSAFE.putBoolean(base, offset, true);
+
+ // Compare
+ {
+ boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false);
+ assertEquals(r, true, "success compareAndSwap boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, false, "success compareAndSwap boolean value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false);
+ assertEquals(r, false, "failing compareAndSwap boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, false, "failing compareAndSwap boolean value");
+ }
+
+ // Advanced compare
+ {
+ boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, true);
+ assertEquals(r, false, "success compareAndExchangeVolatile boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, true, "success compareAndExchangeVolatile boolean value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, false);
+ assertEquals(r, true, "failing compareAndExchangeVolatile boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, true, "failing compareAndExchangeVolatile boolean value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndExchangeBooleanAcquire(base, offset, true, false);
+ assertEquals(r, true, "success compareAndExchangeAcquire boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, false, "success compareAndExchangeAcquire boolean value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndExchangeBooleanAcquire(base, offset, true, false);
+ assertEquals(r, false, "failing compareAndExchangeAcquire boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, false, "failing compareAndExchangeAcquire boolean value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndExchangeBooleanRelease(base, offset, false, true);
+ assertEquals(r, false, "success compareAndExchangeRelease boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, true, "success compareAndExchangeRelease boolean value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndExchangeBooleanRelease(base, offset, false, false);
+ assertEquals(r, true, "failing compareAndExchangeRelease boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, true, "failing compareAndExchangeRelease boolean value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapBoolean(base, offset, true, false);
+ }
+ assertEquals(success, true, "weakCompareAndSwap boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, false, "weakCompareAndSwap boolean value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapBooleanAcquire(base, offset, false, true);
+ }
+ assertEquals(success, true, "weakCompareAndSwapAcquire boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, true, "weakCompareAndSwapAcquire boolean");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapBooleanRelease(base, offset, true, false);
+ }
+ assertEquals(success, true, "weakCompareAndSwapRelease boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, false, "weakCompareAndSwapRelease boolean");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapBooleanVolatile(base, offset, false, true);
+ }
+ assertEquals(success, true, "weakCompareAndSwapVolatile boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, true, "weakCompareAndSwapVolatile boolean");
+ }
+
+ UNSAFE.putBoolean(base, offset, false);
+
+ // Compare set and get
+ {
+ boolean o = UNSAFE.getAndSetBoolean(base, offset, true);
+ assertEquals(o, false, "getAndSet boolean");
+ boolean x = UNSAFE.getBoolean(base, offset);
+ assertEquals(x, true, "getAndSet boolean value");
+ }
}
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,43 +145,161 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putByte(base, offset, (byte)1);
+ UNSAFE.putByte(base, offset, (byte)0x01);
byte x = UNSAFE.getByte(base, offset);
- assertEquals(x, (byte)1, "set byte value");
+ assertEquals(x, (byte)0x01, "set byte value");
}
// Volatile
{
- UNSAFE.putByteVolatile(base, offset, (byte)2);
+ UNSAFE.putByteVolatile(base, offset, (byte)0x23);
byte x = UNSAFE.getByteVolatile(base, offset);
- assertEquals(x, (byte)2, "putVolatile byte value");
+ assertEquals(x, (byte)0x23, "putVolatile byte value");
}
// Lazy
{
- UNSAFE.putByteRelease(base, offset, (byte)1);
+ UNSAFE.putByteRelease(base, offset, (byte)0x01);
byte x = UNSAFE.getByteAcquire(base, offset);
- assertEquals(x, (byte)1, "putRelease byte value");
+ assertEquals(x, (byte)0x01, "putRelease byte value");
}
// Opaque
{
- UNSAFE.putByteOpaque(base, offset, (byte)2);
+ UNSAFE.putByteOpaque(base, offset, (byte)0x23);
byte x = UNSAFE.getByteOpaque(base, offset);
- assertEquals(x, (byte)2, "putOpaque byte value");
+ assertEquals(x, (byte)0x23, "putOpaque byte value");
}
+ UNSAFE.putByte(base, offset, (byte)0x01);
+ // Compare
+ {
+ boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x23);
+ assertEquals(r, true, "success compareAndSwap byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x23, "success compareAndSwap byte value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x45);
+ assertEquals(r, false, "failing compareAndSwap byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x23, "failing compareAndSwap byte value");
+ }
+
+ // Advanced compare
+ {
+ byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x01);
+ assertEquals(r, (byte)0x23, "success compareAndExchangeVolatile byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x01, "success compareAndExchangeVolatile byte value");
+ }
+
+ {
+ byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x45);
+ assertEquals(r, (byte)0x01, "failing compareAndExchangeVolatile byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x01, "failing compareAndExchangeVolatile byte value");
+ }
+
+ {
+ byte r = UNSAFE.compareAndExchangeByteAcquire(base, offset, (byte)0x01, (byte)0x23);
+ assertEquals(r, (byte)0x01, "success compareAndExchangeAcquire byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x23, "success compareAndExchangeAcquire byte value");
+ }
+
+ {
+ byte r = UNSAFE.compareAndExchangeByteAcquire(base, offset, (byte)0x01, (byte)0x45);
+ assertEquals(r, (byte)0x23, "failing compareAndExchangeAcquire byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x23, "failing compareAndExchangeAcquire byte value");
+ }
+
+ {
+ byte r = UNSAFE.compareAndExchangeByteRelease(base, offset, (byte)0x23, (byte)0x01);
+ assertEquals(r, (byte)0x23, "success compareAndExchangeRelease byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x01, "success compareAndExchangeRelease byte value");
+ }
+
+ {
+ byte r = UNSAFE.compareAndExchangeByteRelease(base, offset, (byte)0x23, (byte)0x45);
+ assertEquals(r, (byte)0x01, "failing compareAndExchangeRelease byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x01, "failing compareAndExchangeRelease byte value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapByte(base, offset, (byte)0x01, (byte)0x23);
+ }
+ assertEquals(success, true, "weakCompareAndSwap byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x23, "weakCompareAndSwap byte value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapByteAcquire(base, offset, (byte)0x23, (byte)0x01);
+ }
+ assertEquals(success, true, "weakCompareAndSwapAcquire byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x01, "weakCompareAndSwapAcquire byte");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapByteRelease(base, offset, (byte)0x01, (byte)0x23);
+ }
+ assertEquals(success, true, "weakCompareAndSwapRelease byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x23, "weakCompareAndSwapRelease byte");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapByteVolatile(base, offset, (byte)0x23, (byte)0x01);
+ }
+ assertEquals(success, true, "weakCompareAndSwapVolatile byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x01, "weakCompareAndSwapVolatile byte");
+ }
+
+ UNSAFE.putByte(base, offset, (byte)0x23);
+
+ // Compare set and get
+ {
+ byte o = UNSAFE.getAndSetByte(base, offset, (byte)0x01);
+ assertEquals(o, (byte)0x23, "getAndSet byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)0x01, "getAndSet byte value");
+ }
+
+ UNSAFE.putByte(base, offset, (byte)0x01);
+
+ // get and add, add and get
+ {
+ byte o = UNSAFE.getAndAddByte(base, offset, (byte)0x23);
+ assertEquals(o, (byte)0x01, "getAndAdd byte");
+ byte x = UNSAFE.getByte(base, offset);
+ assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte");
+ }
}
static void testAccess(long address) {
// Plain
{
- UNSAFE.putByte(address, (byte)1);
+ UNSAFE.putByte(address, (byte)0x01);
byte x = UNSAFE.getByte(address);
- assertEquals(x, (byte)1, "set byte value");
+ assertEquals(x, (byte)0x01, "set byte value");
}
}
}
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,61 +145,179 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putChar(base, offset, 'a');
+ UNSAFE.putChar(base, offset, '\u0123');
char x = UNSAFE.getChar(base, offset);
- assertEquals(x, 'a', "set char value");
+ assertEquals(x, '\u0123', "set char value");
}
// Volatile
{
- UNSAFE.putCharVolatile(base, offset, 'b');
+ UNSAFE.putCharVolatile(base, offset, '\u4567');
char x = UNSAFE.getCharVolatile(base, offset);
- assertEquals(x, 'b', "putVolatile char value");
+ assertEquals(x, '\u4567', "putVolatile char value");
}
// Lazy
{
- UNSAFE.putCharRelease(base, offset, 'a');
+ UNSAFE.putCharRelease(base, offset, '\u0123');
char x = UNSAFE.getCharAcquire(base, offset);
- assertEquals(x, 'a', "putRelease char value");
+ assertEquals(x, '\u0123', "putRelease char value");
}
// Opaque
{
- UNSAFE.putCharOpaque(base, offset, 'b');
+ UNSAFE.putCharOpaque(base, offset, '\u4567');
char x = UNSAFE.getCharOpaque(base, offset);
- assertEquals(x, 'b', "putOpaque char value");
+ assertEquals(x, '\u4567', "putOpaque char value");
}
// Unaligned
{
- UNSAFE.putCharUnaligned(base, offset, 'b');
+ UNSAFE.putCharUnaligned(base, offset, '\u4567');
char x = UNSAFE.getCharUnaligned(base, offset);
- assertEquals(x, 'b', "putUnaligned char value");
+ assertEquals(x, '\u4567', "putUnaligned char value");
+ }
+
+ {
+ UNSAFE.putCharUnaligned(base, offset, '\u0123', true);
+ char x = UNSAFE.getCharUnaligned(base, offset, true);
+ assertEquals(x, '\u0123', "putUnaligned big endian char value");
+ }
+
+ {
+ UNSAFE.putCharUnaligned(base, offset, '\u4567', false);
+ char x = UNSAFE.getCharUnaligned(base, offset, false);
+ assertEquals(x, '\u4567', "putUnaligned little endian char value");
+ }
+
+ UNSAFE.putChar(base, offset, '\u0123');
+
+ // Compare
+ {
+ boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u4567');
+ assertEquals(r, true, "success compareAndSwap char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u4567', "success compareAndSwap char value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u89AB');
+ assertEquals(r, false, "failing compareAndSwap char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u4567', "failing compareAndSwap char value");
+ }
+
+ // Advanced compare
+ {
+ char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u0123');
+ assertEquals(r, '\u4567', "success compareAndExchangeVolatile char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u0123', "success compareAndExchangeVolatile char value");
+ }
+
+ {
+ char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u89AB');
+ assertEquals(r, '\u0123', "failing compareAndExchangeVolatile char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u0123', "failing compareAndExchangeVolatile char value");
+ }
+
+ {
+ char r = UNSAFE.compareAndExchangeCharAcquire(base, offset, '\u0123', '\u4567');
+ assertEquals(r, '\u0123', "success compareAndExchangeAcquire char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u4567', "success compareAndExchangeAcquire char value");
+ }
+
+ {
+ char r = UNSAFE.compareAndExchangeCharAcquire(base, offset, '\u0123', '\u89AB');
+ assertEquals(r, '\u4567', "failing compareAndExchangeAcquire char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u4567', "failing compareAndExchangeAcquire char value");
}
{
- UNSAFE.putCharUnaligned(base, offset, 'a', true);
- char x = UNSAFE.getCharUnaligned(base, offset, true);
- assertEquals(x, 'a', "putUnaligned big endian char value");
+ char r = UNSAFE.compareAndExchangeCharRelease(base, offset, '\u4567', '\u0123');
+ assertEquals(r, '\u4567', "success compareAndExchangeRelease char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u0123', "success compareAndExchangeRelease char value");
+ }
+
+ {
+ char r = UNSAFE.compareAndExchangeCharRelease(base, offset, '\u4567', '\u89AB');
+ assertEquals(r, '\u0123', "failing compareAndExchangeRelease char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u0123', "failing compareAndExchangeRelease char value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapChar(base, offset, '\u0123', '\u4567');
+ }
+ assertEquals(success, true, "weakCompareAndSwap char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u4567', "weakCompareAndSwap char value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapCharAcquire(base, offset, '\u4567', '\u0123');
+ }
+ assertEquals(success, true, "weakCompareAndSwapAcquire char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u0123', "weakCompareAndSwapAcquire char");
}
{
- UNSAFE.putCharUnaligned(base, offset, 'b', false);
- char x = UNSAFE.getCharUnaligned(base, offset, false);
- assertEquals(x, 'b', "putUnaligned little endian char value");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapCharRelease(base, offset, '\u0123', '\u4567');
+ }
+ assertEquals(success, true, "weakCompareAndSwapRelease char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u4567', "weakCompareAndSwapRelease char");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapCharVolatile(base, offset, '\u4567', '\u0123');
+ }
+ assertEquals(success, true, "weakCompareAndSwapVolatile char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u0123', "weakCompareAndSwapVolatile char");
}
+ UNSAFE.putChar(base, offset, '\u4567');
+ // Compare set and get
+ {
+ char o = UNSAFE.getAndSetChar(base, offset, '\u0123');
+ assertEquals(o, '\u4567', "getAndSet char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, '\u0123', "getAndSet char value");
+ }
+
+ UNSAFE.putChar(base, offset, '\u0123');
+
+ // get and add, add and get
+ {
+ char o = UNSAFE.getAndAddChar(base, offset, '\u4567');
+ assertEquals(o, '\u0123', "getAndAdd char");
+ char x = UNSAFE.getChar(base, offset);
+ assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char");
+ }
}
static void testAccess(long address) {
// Plain
{
- UNSAFE.putChar(address, 'a');
+ UNSAFE.putChar(address, '\u0123');
char x = UNSAFE.getChar(address);
- assertEquals(x, 'a', "set char value");
+ assertEquals(x, '\u0123', "set char value");
}
}
}
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java Fri Jul 01 16:50:34 2016 -0700
@@ -173,7 +173,125 @@
}
+ UNSAFE.putDouble(base, offset, 1.0d);
+ // Compare
+ {
+ boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 2.0d);
+ assertEquals(r, true, "success compareAndSwap double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 2.0d, "success compareAndSwap double value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 3.0d);
+ assertEquals(r, false, "failing compareAndSwap double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 2.0d, "failing compareAndSwap double value");
+ }
+
+ // Advanced compare
+ {
+ double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 1.0d);
+ assertEquals(r, 2.0d, "success compareAndExchangeVolatile double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 1.0d, "success compareAndExchangeVolatile double value");
+ }
+
+ {
+ double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 3.0d);
+ assertEquals(r, 1.0d, "failing compareAndExchangeVolatile double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 1.0d, "failing compareAndExchangeVolatile double value");
+ }
+
+ {
+ double r = UNSAFE.compareAndExchangeDoubleAcquire(base, offset, 1.0d, 2.0d);
+ assertEquals(r, 1.0d, "success compareAndExchangeAcquire double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 2.0d, "success compareAndExchangeAcquire double value");
+ }
+
+ {
+ double r = UNSAFE.compareAndExchangeDoubleAcquire(base, offset, 1.0d, 3.0d);
+ assertEquals(r, 2.0d, "failing compareAndExchangeAcquire double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 2.0d, "failing compareAndExchangeAcquire double value");
+ }
+
+ {
+ double r = UNSAFE.compareAndExchangeDoubleRelease(base, offset, 2.0d, 1.0d);
+ assertEquals(r, 2.0d, "success compareAndExchangeRelease double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 1.0d, "success compareAndExchangeRelease double value");
+ }
+
+ {
+ double r = UNSAFE.compareAndExchangeDoubleRelease(base, offset, 2.0d, 3.0d);
+ assertEquals(r, 1.0d, "failing compareAndExchangeRelease double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 1.0d, "failing compareAndExchangeRelease double value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapDouble(base, offset, 1.0d, 2.0d);
+ }
+ assertEquals(success, true, "weakCompareAndSwap double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 2.0d, "weakCompareAndSwap double value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapDoubleAcquire(base, offset, 2.0d, 1.0d);
+ }
+ assertEquals(success, true, "weakCompareAndSwapAcquire double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 1.0d, "weakCompareAndSwapAcquire double");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapDoubleRelease(base, offset, 1.0d, 2.0d);
+ }
+ assertEquals(success, true, "weakCompareAndSwapRelease double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 2.0d, "weakCompareAndSwapRelease double");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapDoubleVolatile(base, offset, 2.0d, 1.0d);
+ }
+ assertEquals(success, true, "weakCompareAndSwapVolatile double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 1.0d, "weakCompareAndSwapVolatile double");
+ }
+
+ UNSAFE.putDouble(base, offset, 2.0d);
+
+ // Compare set and get
+ {
+ double o = UNSAFE.getAndSetDouble(base, offset, 1.0d);
+ assertEquals(o, 2.0d, "getAndSet double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, 1.0d, "getAndSet double value");
+ }
+
+ UNSAFE.putDouble(base, offset, 1.0d);
+
+ // get and add, add and get
+ {
+ double o = UNSAFE.getAndAddDouble(base, offset, 2.0d);
+ assertEquals(o, 1.0d, "getAndAdd double");
+ double x = UNSAFE.getDouble(base, offset);
+ assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double");
+ }
}
static void testAccess(long address) {
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java Fri Jul 01 16:50:34 2016 -0700
@@ -173,7 +173,125 @@
}
+ UNSAFE.putFloat(base, offset, 1.0f);
+ // Compare
+ {
+ boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 2.0f);
+ assertEquals(r, true, "success compareAndSwap float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 2.0f, "success compareAndSwap float value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 3.0f);
+ assertEquals(r, false, "failing compareAndSwap float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 2.0f, "failing compareAndSwap float value");
+ }
+
+ // Advanced compare
+ {
+ float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 1.0f);
+ assertEquals(r, 2.0f, "success compareAndExchangeVolatile float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 1.0f, "success compareAndExchangeVolatile float value");
+ }
+
+ {
+ float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 3.0f);
+ assertEquals(r, 1.0f, "failing compareAndExchangeVolatile float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 1.0f, "failing compareAndExchangeVolatile float value");
+ }
+
+ {
+ float r = UNSAFE.compareAndExchangeFloatAcquire(base, offset, 1.0f, 2.0f);
+ assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
+ }
+
+ {
+ float r = UNSAFE.compareAndExchangeFloatAcquire(base, offset, 1.0f, 3.0f);
+ assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
+ }
+
+ {
+ float r = UNSAFE.compareAndExchangeFloatRelease(base, offset, 2.0f, 1.0f);
+ assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
+ }
+
+ {
+ float r = UNSAFE.compareAndExchangeFloatRelease(base, offset, 2.0f, 3.0f);
+ assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapFloat(base, offset, 1.0f, 2.0f);
+ }
+ assertEquals(success, true, "weakCompareAndSwap float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 2.0f, "weakCompareAndSwap float value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapFloatAcquire(base, offset, 2.0f, 1.0f);
+ }
+ assertEquals(success, true, "weakCompareAndSwapAcquire float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 1.0f, "weakCompareAndSwapAcquire float");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapFloatRelease(base, offset, 1.0f, 2.0f);
+ }
+ assertEquals(success, true, "weakCompareAndSwapRelease float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 2.0f, "weakCompareAndSwapRelease float");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapFloatVolatile(base, offset, 2.0f, 1.0f);
+ }
+ assertEquals(success, true, "weakCompareAndSwapVolatile float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 1.0f, "weakCompareAndSwapVolatile float");
+ }
+
+ UNSAFE.putFloat(base, offset, 2.0f);
+
+ // Compare set and get
+ {
+ float o = UNSAFE.getAndSetFloat(base, offset, 1.0f);
+ assertEquals(o, 2.0f, "getAndSet float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, 1.0f, "getAndSet float value");
+ }
+
+ UNSAFE.putFloat(base, offset, 1.0f);
+
+ // get and add, add and get
+ {
+ float o = UNSAFE.getAndAddFloat(base, offset, 2.0f);
+ assertEquals(o, 1.0f, "getAndAdd float");
+ float x = UNSAFE.getFloat(base, offset);
+ assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float");
+ }
}
static void testAccess(long address) {
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,179 +145,179 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putInt(base, offset, 1);
+ UNSAFE.putInt(base, offset, 0x01234567);
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "set int value");
+ assertEquals(x, 0x01234567, "set int value");
}
// Volatile
{
- UNSAFE.putIntVolatile(base, offset, 2);
+ UNSAFE.putIntVolatile(base, offset, 0x89ABCDEF);
int x = UNSAFE.getIntVolatile(base, offset);
- assertEquals(x, 2, "putVolatile int value");
+ assertEquals(x, 0x89ABCDEF, "putVolatile int value");
}
// Lazy
{
- UNSAFE.putIntRelease(base, offset, 1);
+ UNSAFE.putIntRelease(base, offset, 0x01234567);
int x = UNSAFE.getIntAcquire(base, offset);
- assertEquals(x, 1, "putRelease int value");
+ assertEquals(x, 0x01234567, "putRelease int value");
}
// Opaque
{
- UNSAFE.putIntOpaque(base, offset, 2);
+ UNSAFE.putIntOpaque(base, offset, 0x89ABCDEF);
int x = UNSAFE.getIntOpaque(base, offset);
- assertEquals(x, 2, "putOpaque int value");
+ assertEquals(x, 0x89ABCDEF, "putOpaque int value");
}
// Unaligned
{
- UNSAFE.putIntUnaligned(base, offset, 2);
+ UNSAFE.putIntUnaligned(base, offset, 0x89ABCDEF);
int x = UNSAFE.getIntUnaligned(base, offset);
- assertEquals(x, 2, "putUnaligned int value");
+ assertEquals(x, 0x89ABCDEF, "putUnaligned int value");
}
{
- UNSAFE.putIntUnaligned(base, offset, 1, true);
+ UNSAFE.putIntUnaligned(base, offset, 0x01234567, true);
int x = UNSAFE.getIntUnaligned(base, offset, true);
- assertEquals(x, 1, "putUnaligned big endian int value");
+ assertEquals(x, 0x01234567, "putUnaligned big endian int value");
}
{
- UNSAFE.putIntUnaligned(base, offset, 2, false);
+ UNSAFE.putIntUnaligned(base, offset, 0x89ABCDEF, false);
int x = UNSAFE.getIntUnaligned(base, offset, false);
- assertEquals(x, 2, "putUnaligned little endian int value");
+ assertEquals(x, 0x89ABCDEF, "putUnaligned little endian int value");
}
- UNSAFE.putInt(base, offset, 1);
+ UNSAFE.putInt(base, offset, 0x01234567);
// Compare
{
- boolean r = UNSAFE.compareAndSwapInt(base, offset, 1, 2);
+ boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
assertEquals(r, true, "success compareAndSwap int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 2, "success compareAndSwap int value");
+ assertEquals(x, 0x89ABCDEF, "success compareAndSwap int value");
}
{
- boolean r = UNSAFE.compareAndSwapInt(base, offset, 1, 3);
+ boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0xCAFEBABE);
assertEquals(r, false, "failing compareAndSwap int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 2, "failing compareAndSwap int value");
+ assertEquals(x, 0x89ABCDEF, "failing compareAndSwap int value");
}
// Advanced compare
{
- int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 2, 1);
- assertEquals(r, 2, "success compareAndExchangeVolatile int");
+ int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0x01234567);
+ assertEquals(r, 0x89ABCDEF, "success compareAndExchangeVolatile int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "success compareAndExchangeVolatile int value");
+ assertEquals(x, 0x01234567, "success compareAndExchangeVolatile int value");
}
{
- int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 2, 3);
- assertEquals(r, 1, "failing compareAndExchangeVolatile int");
+ int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0xCAFEBABE);
+ assertEquals(r, 0x01234567, "failing compareAndExchangeVolatile int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "failing compareAndExchangeVolatile int value");
+ assertEquals(x, 0x01234567, "failing compareAndExchangeVolatile int value");
}
{
- int r = UNSAFE.compareAndExchangeIntAcquire(base, offset, 1, 2);
- assertEquals(r, 1, "success compareAndExchangeAcquire int");
+ int r = UNSAFE.compareAndExchangeIntAcquire(base, offset, 0x01234567, 0x89ABCDEF);
+ assertEquals(r, 0x01234567, "success compareAndExchangeAcquire int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 2, "success compareAndExchangeAcquire int value");
+ assertEquals(x, 0x89ABCDEF, "success compareAndExchangeAcquire int value");
}
{
- int r = UNSAFE.compareAndExchangeIntAcquire(base, offset, 1, 3);
- assertEquals(r, 2, "failing compareAndExchangeAcquire int");
+ int r = UNSAFE.compareAndExchangeIntAcquire(base, offset, 0x01234567, 0xCAFEBABE);
+ assertEquals(r, 0x89ABCDEF, "failing compareAndExchangeAcquire int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 2, "failing compareAndExchangeAcquire int value");
+ assertEquals(x, 0x89ABCDEF, "failing compareAndExchangeAcquire int value");
}
{
- int r = UNSAFE.compareAndExchangeIntRelease(base, offset, 2, 1);
- assertEquals(r, 2, "success compareAndExchangeRelease int");
+ int r = UNSAFE.compareAndExchangeIntRelease(base, offset, 0x89ABCDEF, 0x01234567);
+ assertEquals(r, 0x89ABCDEF, "success compareAndExchangeRelease int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "success compareAndExchangeRelease int value");
+ assertEquals(x, 0x01234567, "success compareAndExchangeRelease int value");
}
{
- int r = UNSAFE.compareAndExchangeIntRelease(base, offset, 2, 3);
- assertEquals(r, 1, "failing compareAndExchangeRelease int");
+ int r = UNSAFE.compareAndExchangeIntRelease(base, offset, 0x89ABCDEF, 0xCAFEBABE);
+ assertEquals(r, 0x01234567, "failing compareAndExchangeRelease int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "failing compareAndExchangeRelease int value");
+ assertEquals(x, 0x01234567, "failing compareAndExchangeRelease int value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
- success = UNSAFE.weakCompareAndSwapInt(base, offset, 1, 2);
+ success = UNSAFE.weakCompareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
}
assertEquals(success, true, "weakCompareAndSwap int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 2, "weakCompareAndSwap int value");
+ assertEquals(x, 0x89ABCDEF, "weakCompareAndSwap int value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
- success = UNSAFE.weakCompareAndSwapIntAcquire(base, offset, 2, 1);
+ success = UNSAFE.weakCompareAndSwapIntAcquire(base, offset, 0x89ABCDEF, 0x01234567);
}
assertEquals(success, true, "weakCompareAndSwapAcquire int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "weakCompareAndSwapAcquire int");
+ assertEquals(x, 0x01234567, "weakCompareAndSwapAcquire int");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
- success = UNSAFE.weakCompareAndSwapIntRelease(base, offset, 1, 2);
+ success = UNSAFE.weakCompareAndSwapIntRelease(base, offset, 0x01234567, 0x89ABCDEF);
}
assertEquals(success, true, "weakCompareAndSwapRelease int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 2, "weakCompareAndSwapRelease int");
+ assertEquals(x, 0x89ABCDEF, "weakCompareAndSwapRelease int");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
- success = UNSAFE.weakCompareAndSwapIntVolatile(base, offset, 2, 1);
+ success = UNSAFE.weakCompareAndSwapIntVolatile(base, offset, 0x89ABCDEF, 0x01234567);
}
assertEquals(success, true, "weakCompareAndSwapVolatile int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "weakCompareAndSwapVolatile int");
+ assertEquals(x, 0x01234567, "weakCompareAndSwapVolatile int");
}
- UNSAFE.putInt(base, offset, 2);
+ UNSAFE.putInt(base, offset, 0x89ABCDEF);
// Compare set and get
{
- int o = UNSAFE.getAndSetInt(base, offset, 1);
- assertEquals(o, 2, "getAndSet int");
+ int o = UNSAFE.getAndSetInt(base, offset, 0x01234567);
+ assertEquals(o, 0x89ABCDEF, "getAndSet int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "getAndSet int value");
+ assertEquals(x, 0x01234567, "getAndSet int value");
}
- UNSAFE.putInt(base, offset, 1);
+ UNSAFE.putInt(base, offset, 0x01234567);
// get and add, add and get
{
- int o = UNSAFE.getAndAddInt(base, offset, 2);
- assertEquals(o, 1, "getAndAdd int");
+ int o = UNSAFE.getAndAddInt(base, offset, 0x89ABCDEF);
+ assertEquals(o, 0x01234567, "getAndAdd int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1 + 2, "getAndAdd int");
+ assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int");
}
}
static void testAccess(long address) {
// Plain
{
- UNSAFE.putInt(address, 1);
+ UNSAFE.putInt(address, 0x01234567);
int x = UNSAFE.getInt(address);
- assertEquals(x, 1, "set int value");
+ assertEquals(x, 0x01234567, "set int value");
}
}
}
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,179 +145,179 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putLong(base, offset, 1L);
+ UNSAFE.putLong(base, offset, 0x0123456789ABCDEFL);
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "set long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "set long value");
}
// Volatile
{
- UNSAFE.putLongVolatile(base, offset, 2L);
+ UNSAFE.putLongVolatile(base, offset, 0xCAFEBABECAFEBABEL);
long x = UNSAFE.getLongVolatile(base, offset);
- assertEquals(x, 2L, "putVolatile long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "putVolatile long value");
}
// Lazy
{
- UNSAFE.putLongRelease(base, offset, 1L);
+ UNSAFE.putLongRelease(base, offset, 0x0123456789ABCDEFL);
long x = UNSAFE.getLongAcquire(base, offset);
- assertEquals(x, 1L, "putRelease long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "putRelease long value");
}
// Opaque
{
- UNSAFE.putLongOpaque(base, offset, 2L);
+ UNSAFE.putLongOpaque(base, offset, 0xCAFEBABECAFEBABEL);
long x = UNSAFE.getLongOpaque(base, offset);
- assertEquals(x, 2L, "putOpaque long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "putOpaque long value");
}
// Unaligned
{
- UNSAFE.putLongUnaligned(base, offset, 2L);
+ UNSAFE.putLongUnaligned(base, offset, 0xCAFEBABECAFEBABEL);
long x = UNSAFE.getLongUnaligned(base, offset);
- assertEquals(x, 2L, "putUnaligned long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "putUnaligned long value");
}
{
- UNSAFE.putLongUnaligned(base, offset, 1L, true);
+ UNSAFE.putLongUnaligned(base, offset, 0x0123456789ABCDEFL, true);
long x = UNSAFE.getLongUnaligned(base, offset, true);
- assertEquals(x, 1L, "putUnaligned big endian long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "putUnaligned big endian long value");
}
{
- UNSAFE.putLongUnaligned(base, offset, 2L, false);
+ UNSAFE.putLongUnaligned(base, offset, 0xCAFEBABECAFEBABEL, false);
long x = UNSAFE.getLongUnaligned(base, offset, false);
- assertEquals(x, 2L, "putUnaligned little endian long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "putUnaligned little endian long value");
}
- UNSAFE.putLong(base, offset, 1L);
+ UNSAFE.putLong(base, offset, 0x0123456789ABCDEFL);
// Compare
{
- boolean r = UNSAFE.compareAndSwapLong(base, offset, 1L, 2L);
+ boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
assertEquals(r, true, "success compareAndSwap long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 2L, "success compareAndSwap long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSwap long value");
}
{
- boolean r = UNSAFE.compareAndSwapLong(base, offset, 1L, 3L);
+ boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
assertEquals(r, false, "failing compareAndSwap long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 2L, "failing compareAndSwap long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSwap long value");
}
// Advanced compare
{
- long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 2L, 1L);
- assertEquals(r, 2L, "success compareAndExchangeVolatile long");
+ long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
+ assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeVolatile long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "success compareAndExchangeVolatile long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeVolatile long value");
}
{
- long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 2L, 3L);
- assertEquals(r, 1L, "failing compareAndExchangeVolatile long");
+ long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
+ assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "failing compareAndExchangeVolatile long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long value");
}
{
- long r = UNSAFE.compareAndExchangeLongAcquire(base, offset, 1L, 2L);
- assertEquals(r, 1L, "success compareAndExchangeAcquire long");
+ long r = UNSAFE.compareAndExchangeLongAcquire(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
+ assertEquals(r, 0x0123456789ABCDEFL, "success compareAndExchangeAcquire long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 2L, "success compareAndExchangeAcquire long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndExchangeAcquire long value");
}
{
- long r = UNSAFE.compareAndExchangeLongAcquire(base, offset, 1L, 3L);
- assertEquals(r, 2L, "failing compareAndExchangeAcquire long");
+ long r = UNSAFE.compareAndExchangeLongAcquire(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
+ assertEquals(r, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 2L, "failing compareAndExchangeAcquire long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long value");
}
{
- long r = UNSAFE.compareAndExchangeLongRelease(base, offset, 2L, 1L);
- assertEquals(r, 2L, "success compareAndExchangeRelease long");
+ long r = UNSAFE.compareAndExchangeLongRelease(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
+ assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeRelease long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "success compareAndExchangeRelease long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeRelease long value");
}
{
- long r = UNSAFE.compareAndExchangeLongRelease(base, offset, 2L, 3L);
- assertEquals(r, 1L, "failing compareAndExchangeRelease long");
+ long r = UNSAFE.compareAndExchangeLongRelease(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
+ assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "failing compareAndExchangeRelease long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
- success = UNSAFE.weakCompareAndSwapLong(base, offset, 1L, 2L);
+ success = UNSAFE.weakCompareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
}
assertEquals(success, true, "weakCompareAndSwap long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 2L, "weakCompareAndSwap long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwap long value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
- success = UNSAFE.weakCompareAndSwapLongAcquire(base, offset, 2L, 1L);
+ success = UNSAFE.weakCompareAndSwapLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
}
assertEquals(success, true, "weakCompareAndSwapAcquire long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "weakCompareAndSwapAcquire long");
+ assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapAcquire long");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
- success = UNSAFE.weakCompareAndSwapLongRelease(base, offset, 1L, 2L);
+ success = UNSAFE.weakCompareAndSwapLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
}
assertEquals(success, true, "weakCompareAndSwapRelease long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 2L, "weakCompareAndSwapRelease long");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwapRelease long");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
- success = UNSAFE.weakCompareAndSwapLongVolatile(base, offset, 2L, 1L);
+ success = UNSAFE.weakCompareAndSwapLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
}
assertEquals(success, true, "weakCompareAndSwapVolatile long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "weakCompareAndSwapVolatile long");
+ assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapVolatile long");
}
- UNSAFE.putLong(base, offset, 2L);
+ UNSAFE.putLong(base, offset, 0xCAFEBABECAFEBABEL);
// Compare set and get
{
- long o = UNSAFE.getAndSetLong(base, offset, 1L);
- assertEquals(o, 2L, "getAndSet long");
+ long o = UNSAFE.getAndSetLong(base, offset, 0x0123456789ABCDEFL);
+ assertEquals(o, 0xCAFEBABECAFEBABEL, "getAndSet long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "getAndSet long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "getAndSet long value");
}
- UNSAFE.putLong(base, offset, 1L);
+ UNSAFE.putLong(base, offset, 0x0123456789ABCDEFL);
// get and add, add and get
{
- long o = UNSAFE.getAndAddLong(base, offset, 2L);
- assertEquals(o, 1L, "getAndAdd long");
+ long o = UNSAFE.getAndAddLong(base, offset, 0xCAFEBABECAFEBABEL);
+ assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L + 2L, "getAndAdd long");
+ assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long");
}
}
static void testAccess(long address) {
// Plain
{
- UNSAFE.putLong(address, 1L);
+ UNSAFE.putLong(address, 0x0123456789ABCDEFL);
long x = UNSAFE.getLong(address);
- assertEquals(x, 1L, "set long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "set long value");
}
}
}
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,61 +145,179 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putShort(base, offset, (short)1);
+ UNSAFE.putShort(base, offset, (short)0x0123);
short x = UNSAFE.getShort(base, offset);
- assertEquals(x, (short)1, "set short value");
+ assertEquals(x, (short)0x0123, "set short value");
}
// Volatile
{
- UNSAFE.putShortVolatile(base, offset, (short)2);
+ UNSAFE.putShortVolatile(base, offset, (short)0x4567);
short x = UNSAFE.getShortVolatile(base, offset);
- assertEquals(x, (short)2, "putVolatile short value");
+ assertEquals(x, (short)0x4567, "putVolatile short value");
}
// Lazy
{
- UNSAFE.putShortRelease(base, offset, (short)1);
+ UNSAFE.putShortRelease(base, offset, (short)0x0123);
short x = UNSAFE.getShortAcquire(base, offset);
- assertEquals(x, (short)1, "putRelease short value");
+ assertEquals(x, (short)0x0123, "putRelease short value");
}
// Opaque
{
- UNSAFE.putShortOpaque(base, offset, (short)2);
+ UNSAFE.putShortOpaque(base, offset, (short)0x4567);
short x = UNSAFE.getShortOpaque(base, offset);
- assertEquals(x, (short)2, "putOpaque short value");
+ assertEquals(x, (short)0x4567, "putOpaque short value");
}
// Unaligned
{
- UNSAFE.putShortUnaligned(base, offset, (short)2);
+ UNSAFE.putShortUnaligned(base, offset, (short)0x4567);
short x = UNSAFE.getShortUnaligned(base, offset);
- assertEquals(x, (short)2, "putUnaligned short value");
+ assertEquals(x, (short)0x4567, "putUnaligned short value");
+ }
+
+ {
+ UNSAFE.putShortUnaligned(base, offset, (short)0x0123, true);
+ short x = UNSAFE.getShortUnaligned(base, offset, true);
+ assertEquals(x, (short)0x0123, "putUnaligned big endian short value");
+ }
+
+ {
+ UNSAFE.putShortUnaligned(base, offset, (short)0x4567, false);
+ short x = UNSAFE.getShortUnaligned(base, offset, false);
+ assertEquals(x, (short)0x4567, "putUnaligned little endian short value");
+ }
+
+ UNSAFE.putShort(base, offset, (short)0x0123);
+
+ // Compare
+ {
+ boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x4567);
+ assertEquals(r, true, "success compareAndSwap short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x4567, "success compareAndSwap short value");
+ }
+
+ {
+ boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x89AB);
+ assertEquals(r, false, "failing compareAndSwap short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x4567, "failing compareAndSwap short value");
+ }
+
+ // Advanced compare
+ {
+ short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x0123);
+ assertEquals(r, (short)0x4567, "success compareAndExchangeVolatile short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x0123, "success compareAndExchangeVolatile short value");
+ }
+
+ {
+ short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x89AB);
+ assertEquals(r, (short)0x0123, "failing compareAndExchangeVolatile short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x0123, "failing compareAndExchangeVolatile short value");
+ }
+
+ {
+ short r = UNSAFE.compareAndExchangeShortAcquire(base, offset, (short)0x0123, (short)0x4567);
+ assertEquals(r, (short)0x0123, "success compareAndExchangeAcquire short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x4567, "success compareAndExchangeAcquire short value");
+ }
+
+ {
+ short r = UNSAFE.compareAndExchangeShortAcquire(base, offset, (short)0x0123, (short)0x89AB);
+ assertEquals(r, (short)0x4567, "failing compareAndExchangeAcquire short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x4567, "failing compareAndExchangeAcquire short value");
}
{
- UNSAFE.putShortUnaligned(base, offset, (short)1, true);
- short x = UNSAFE.getShortUnaligned(base, offset, true);
- assertEquals(x, (short)1, "putUnaligned big endian short value");
+ short r = UNSAFE.compareAndExchangeShortRelease(base, offset, (short)0x4567, (short)0x0123);
+ assertEquals(r, (short)0x4567, "success compareAndExchangeRelease short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x0123, "success compareAndExchangeRelease short value");
+ }
+
+ {
+ short r = UNSAFE.compareAndExchangeShortRelease(base, offset, (short)0x4567, (short)0x89AB);
+ assertEquals(r, (short)0x0123, "failing compareAndExchangeRelease short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x0123, "failing compareAndExchangeRelease short value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapShort(base, offset, (short)0x0123, (short)0x4567);
+ }
+ assertEquals(success, true, "weakCompareAndSwap short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x4567, "weakCompareAndSwap short value");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapShortAcquire(base, offset, (short)0x4567, (short)0x0123);
+ }
+ assertEquals(success, true, "weakCompareAndSwapAcquire short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x0123, "weakCompareAndSwapAcquire short");
}
{
- UNSAFE.putShortUnaligned(base, offset, (short)2, false);
- short x = UNSAFE.getShortUnaligned(base, offset, false);
- assertEquals(x, (short)2, "putUnaligned little endian short value");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapShortRelease(base, offset, (short)0x0123, (short)0x4567);
+ }
+ assertEquals(success, true, "weakCompareAndSwapRelease short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x4567, "weakCompareAndSwapRelease short");
+ }
+
+ {
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = UNSAFE.weakCompareAndSwapShortVolatile(base, offset, (short)0x4567, (short)0x0123);
+ }
+ assertEquals(success, true, "weakCompareAndSwapVolatile short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x0123, "weakCompareAndSwapVolatile short");
}
+ UNSAFE.putShort(base, offset, (short)0x4567);
+ // Compare set and get
+ {
+ short o = UNSAFE.getAndSetShort(base, offset, (short)0x0123);
+ assertEquals(o, (short)0x4567, "getAndSet short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)0x0123, "getAndSet short value");
+ }
+
+ UNSAFE.putShort(base, offset, (short)0x0123);
+
+ // get and add, add and get
+ {
+ short o = UNSAFE.getAndAddShort(base, offset, (short)0x4567);
+ assertEquals(o, (short)0x0123, "getAndAdd short");
+ short x = UNSAFE.getShort(base, offset);
+ assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short");
+ }
}
static void testAccess(long address) {
// Plain
{
- UNSAFE.putShort(address, (short)1);
+ UNSAFE.putShort(address, (short)0x0123);
short x = UNSAFE.getShort(address);
- assertEquals(x, (short)1, "set short value");
+ assertEquals(x, (short)0x0123, "set short value");
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeUnalignedAccess.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 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 8158260
+ * @summary Test unaligned Unsafe accesses
+ * @modules java.base/jdk.internal.misc
+ * @run main/othervm -Diters=20000 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation JdkInternalMiscUnsafeUnalignedAccess
+ * @author volker.simonis@gmail.com
+ */
+
+import java.lang.reflect.Field;
+import java.nio.ByteOrder;
+import jdk.internal.misc.Unsafe;
+
+public class JdkInternalMiscUnsafeUnalignedAccess {
+ static final int ITERS = Integer.getInteger("iters", 20_000);
+ private static final boolean BIG_ENDIAN = ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN);
+ private static final Unsafe UNSAFE;
+ private static final int SIZE = 1024;
+ private static long memory;
+
+ static {
+ try {
+ Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
+ unsafeField.setAccessible(true);
+ UNSAFE = (Unsafe) unsafeField.get(null);
+ }
+ catch (Exception e) {
+ throw new RuntimeException("Unable to get Unsafe instance.", e);
+ }
+ }
+
+ static int getInt_0() {
+ return UNSAFE.getInt(memory + 0);
+ }
+ static int getInt_1() {
+ return UNSAFE.getInt(memory + 1);
+ }
+ static int getInt_4() {
+ return UNSAFE.getInt(memory + 4);
+ }
+ static int getInt_17() {
+ return UNSAFE.getInt(memory + 17);
+ }
+
+ static long getIntAsLong_0() {
+ return UNSAFE.getInt(memory + 0);
+ }
+ static long getIntAsLong_1() {
+ return UNSAFE.getInt(memory + 1);
+ }
+ static long getIntAsLong_4() {
+ return UNSAFE.getInt(memory + 4);
+ }
+ static long getIntAsLong_17() {
+ return UNSAFE.getInt(memory + 17);
+ }
+
+ static long getLong_0() {
+ return UNSAFE.getLong(memory + 0);
+ }
+ static long getLong_1() {
+ return UNSAFE.getLong(memory + 1);
+ }
+ static long getLong_4() {
+ return UNSAFE.getLong(memory + 4);
+ }
+ static long getLong_8() {
+ return UNSAFE.getLong(memory + 8);
+ }
+ static long getLong_17() {
+ return UNSAFE.getLong(memory + 17);
+ }
+
+ static void putInt_0(int i) {
+ UNSAFE.putInt(memory + 0, i);
+ }
+ static void putInt_1(int i) {
+ UNSAFE.putInt(memory + 1, i);
+ }
+ static void putInt_4(int i) {
+ UNSAFE.putInt(memory + 4, i);
+ }
+ static void putInt_17(int i) {
+ UNSAFE.putInt(memory + 17, i);
+ }
+
+ static void putLong_0(long l) {
+ UNSAFE.putLong(memory + 0, l);
+ }
+ static void putLong_1(long l) {
+ UNSAFE.putLong(memory + 1, l);
+ }
+ static void putLong_4(long l) {
+ UNSAFE.putLong(memory + 4, l);
+ }
+ static void putLong_8(long l) {
+ UNSAFE.putLong(memory + 8, l);
+ }
+ static void putLong_17(long l) {
+ UNSAFE.putLong(memory + 17, l);
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ if (!UNSAFE.unalignedAccess()) {
+ System.out.println("Platform is not supporting unaligned access - nothing to test.");
+ return;
+ }
+
+ memory = UNSAFE.allocateMemory(SIZE);
+
+ UNSAFE.putInt(memory + 0, 0x00112233);
+ UNSAFE.putInt(memory + 4, 0x44556677);
+ UNSAFE.putInt(memory + 8, 0x8899aabb);
+ UNSAFE.putInt(memory + 12, 0xccddeeff);
+ UNSAFE.putInt(memory + 16, 0x01234567);
+ UNSAFE.putInt(memory + 20, 0x89abcdef);
+ UNSAFE.putInt(memory + 24, 0x01234567);
+
+ // Unsafe.getInt()
+ int res;
+ for (int i = 0; i < ITERS; i++) {
+ res = getInt_0();
+ if (res != 0x00112233) {
+ throw new Exception(res + " != 0x00112233");
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ res = getInt_1();
+ if (res != (BIG_ENDIAN ? 0x11223344 : 0x77001122)) {
+ throw new Exception(res + " != " + (BIG_ENDIAN ? 0x11223344 : 0x77001122));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ res = getInt_4();
+ if (res != 0x44556677) {
+ throw new Exception(res + " != 0x44556677");
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ res = getInt_17();
+ if (res != (BIG_ENDIAN ? 0x23456789 : 0xef012345)) {
+ throw new Exception(res + " != " + (BIG_ENDIAN ? 0x23456789 : 0xef012345));
+ }
+ }
+
+ // (long)Unsafe.getInt()
+ long lres;
+ for (int i = 0; i < ITERS; i++) {
+ lres = getIntAsLong_0();
+ if (lres != (long)0x00112233) {
+ throw new Exception(lres + " != 0x00112233");
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ lres = getIntAsLong_1();
+ if (lres != (BIG_ENDIAN ? (long)0x11223344 : (long)0x77001122)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? (long)0x11223344 : (long)0x77001122));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ lres = getIntAsLong_4();
+ if (lres != (long)0x44556677) {
+ throw new Exception(lres + " != 0x44556677");
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ lres = getIntAsLong_17();
+ if (lres != (BIG_ENDIAN ? (long)0x23456789 : (long)0xef012345)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? (long)0x23456789 : (long)0xef012345));
+ }
+ }
+
+ // Unsafe.getLong()
+ for (int i = 0; i < ITERS; i++) {
+ lres = getLong_0();
+ if (lres != (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ lres = getLong_1();
+ if (lres != (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ lres = getLong_4();
+ if (lres != (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ lres = getLong_8();
+ if (lres != (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ lres = getLong_17();
+ if (lres != (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L));
+ }
+ }
+
+ // Unsafe.putInt()
+ for (int i = 0; i < ITERS; i++) {
+ putInt_0(0x00112233);
+ res = getInt_0();
+ if (res != 0x00112233) {
+ throw new Exception(res + " != 0x00112233");
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ putInt_1(BIG_ENDIAN ? 0x11223344 : 0x77001122);
+ res = getInt_1();
+ if (res != (BIG_ENDIAN ? 0x11223344 : 0x77001122)) {
+ throw new Exception(res + " != " + (BIG_ENDIAN ? 0x11223344 : 0x77001122));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ putInt_4(0x44556677);
+ res = getInt_4();
+ if (res != 0x44556677) {
+ throw new Exception(res + " != 0x44556677");
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ putInt_17(BIG_ENDIAN ? 0x23456789 : 0xef012345);
+ res = getInt_17();
+ if (res != (BIG_ENDIAN ? 0x23456789 : 0xef012345)) {
+ throw new Exception(res + " != " + (BIG_ENDIAN ? 0x23456789 : 0xef012345));
+ }
+ }
+
+
+ // Unsafe.putLong()
+ for (int i = 0; i < ITERS; i++) {
+ putLong_0(BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L);
+ lres = getLong_0();
+ if (lres != (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x0011223344556677L : 0x4455667700112233L));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ putLong_1(BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L);
+ lres = getLong_1();
+ if (lres != (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x1122334455667788L : 0xbb44556677001122L));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ putLong_4(BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L);
+ lres = getLong_4();
+ if (lres != (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x445566778899aabbL : 0x8899aabb44556677L));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ putLong_8(BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL);
+ lres = getLong_8();
+ if (lres != (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x8899aabbccddeeffL : 0xccddeeff8899aabbL));
+ }
+ }
+
+ for (int i = 0; i < ITERS; i++) {
+ putLong_17(BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L);
+ lres = getLong_17();
+ if (lres != (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L)) {
+ throw new Exception(lres + " != " + (BIG_ENDIAN ? 0x23456789abcdef01L : 0x6789abcdef012345L));
+ }
+ }
+ }
+
+}
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,16 +145,16 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putByte(base, offset, (byte)1);
+ UNSAFE.putByte(base, offset, (byte)0x01);
byte x = UNSAFE.getByte(base, offset);
- assertEquals(x, (byte)1, "set byte value");
+ assertEquals(x, (byte)0x01, "set byte value");
}
// Volatile
{
- UNSAFE.putByteVolatile(base, offset, (byte)2);
+ UNSAFE.putByteVolatile(base, offset, (byte)0x23);
byte x = UNSAFE.getByteVolatile(base, offset);
- assertEquals(x, (byte)2, "putVolatile byte value");
+ assertEquals(x, (byte)0x23, "putVolatile byte value");
}
@@ -166,9 +166,9 @@
static void testAccess(long address) {
// Plain
{
- UNSAFE.putByte(address, (byte)1);
+ UNSAFE.putByte(address, (byte)0x01);
byte x = UNSAFE.getByte(address);
- assertEquals(x, (byte)1, "set byte value");
+ assertEquals(x, (byte)0x01, "set byte value");
}
}
}
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,16 +145,16 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putChar(base, offset, 'a');
+ UNSAFE.putChar(base, offset, '\u0123');
char x = UNSAFE.getChar(base, offset);
- assertEquals(x, 'a', "set char value");
+ assertEquals(x, '\u0123', "set char value");
}
// Volatile
{
- UNSAFE.putCharVolatile(base, offset, 'b');
+ UNSAFE.putCharVolatile(base, offset, '\u4567');
char x = UNSAFE.getCharVolatile(base, offset);
- assertEquals(x, 'b', "putVolatile char value");
+ assertEquals(x, '\u4567', "putVolatile char value");
}
@@ -166,9 +166,9 @@
static void testAccess(long address) {
// Plain
{
- UNSAFE.putChar(address, 'a');
+ UNSAFE.putChar(address, '\u0123');
char x = UNSAFE.getChar(address);
- assertEquals(x, 'a', "set char value");
+ assertEquals(x, '\u0123', "set char value");
}
}
}
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,71 +145,71 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putInt(base, offset, 1);
+ UNSAFE.putInt(base, offset, 0x01234567);
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "set int value");
+ assertEquals(x, 0x01234567, "set int value");
}
// Volatile
{
- UNSAFE.putIntVolatile(base, offset, 2);
+ UNSAFE.putIntVolatile(base, offset, 0x89ABCDEF);
int x = UNSAFE.getIntVolatile(base, offset);
- assertEquals(x, 2, "putVolatile int value");
+ assertEquals(x, 0x89ABCDEF, "putVolatile int value");
}
// Lazy
{
- UNSAFE.putOrderedInt(base, offset, 1);
+ UNSAFE.putOrderedInt(base, offset, 0x01234567);
int x = UNSAFE.getIntVolatile(base, offset);
- assertEquals(x, 1, "putRelease int value");
+ assertEquals(x, 0x01234567, "putRelease int value");
}
- UNSAFE.putInt(base, offset, 1);
+ UNSAFE.putInt(base, offset, 0x01234567);
// Compare
{
- boolean r = UNSAFE.compareAndSwapInt(base, offset, 1, 2);
+ boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
assertEquals(r, true, "success compareAndSwap int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 2, "success compareAndSwap int value");
+ assertEquals(x, 0x89ABCDEF, "success compareAndSwap int value");
}
{
- boolean r = UNSAFE.compareAndSwapInt(base, offset, 1, 3);
+ boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0xCAFEBABE);
assertEquals(r, false, "failing compareAndSwap int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 2, "failing compareAndSwap int value");
+ assertEquals(x, 0x89ABCDEF, "failing compareAndSwap int value");
}
- UNSAFE.putInt(base, offset, 2);
+ UNSAFE.putInt(base, offset, 0x89ABCDEF);
// Compare set and get
{
- int o = UNSAFE.getAndSetInt(base, offset, 1);
- assertEquals(o, 2, "getAndSet int");
+ int o = UNSAFE.getAndSetInt(base, offset, 0x01234567);
+ assertEquals(o, 0x89ABCDEF, "getAndSet int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1, "getAndSet int value");
+ assertEquals(x, 0x01234567, "getAndSet int value");
}
- UNSAFE.putInt(base, offset, 1);
+ UNSAFE.putInt(base, offset, 0x01234567);
// get and add, add and get
{
- int o = UNSAFE.getAndAddInt(base, offset, 2);
- assertEquals(o, 1, "getAndAdd int");
+ int o = UNSAFE.getAndAddInt(base, offset, 0x89ABCDEF);
+ assertEquals(o, 0x01234567, "getAndAdd int");
int x = UNSAFE.getInt(base, offset);
- assertEquals(x, 1 + 2, "getAndAdd int");
+ assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int");
}
}
static void testAccess(long address) {
// Plain
{
- UNSAFE.putInt(address, 1);
+ UNSAFE.putInt(address, 0x01234567);
int x = UNSAFE.getInt(address);
- assertEquals(x, 1, "set int value");
+ assertEquals(x, 0x01234567, "set int value");
}
}
}
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,71 +145,71 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putLong(base, offset, 1L);
+ UNSAFE.putLong(base, offset, 0x0123456789ABCDEFL);
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "set long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "set long value");
}
// Volatile
{
- UNSAFE.putLongVolatile(base, offset, 2L);
+ UNSAFE.putLongVolatile(base, offset, 0xCAFEBABECAFEBABEL);
long x = UNSAFE.getLongVolatile(base, offset);
- assertEquals(x, 2L, "putVolatile long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "putVolatile long value");
}
// Lazy
{
- UNSAFE.putOrderedLong(base, offset, 1L);
+ UNSAFE.putOrderedLong(base, offset, 0x0123456789ABCDEFL);
long x = UNSAFE.getLongVolatile(base, offset);
- assertEquals(x, 1L, "putRelease long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "putRelease long value");
}
- UNSAFE.putLong(base, offset, 1L);
+ UNSAFE.putLong(base, offset, 0x0123456789ABCDEFL);
// Compare
{
- boolean r = UNSAFE.compareAndSwapLong(base, offset, 1L, 2L);
+ boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
assertEquals(r, true, "success compareAndSwap long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 2L, "success compareAndSwap long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSwap long value");
}
{
- boolean r = UNSAFE.compareAndSwapLong(base, offset, 1L, 3L);
+ boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
assertEquals(r, false, "failing compareAndSwap long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 2L, "failing compareAndSwap long value");
+ assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSwap long value");
}
- UNSAFE.putLong(base, offset, 2L);
+ UNSAFE.putLong(base, offset, 0xCAFEBABECAFEBABEL);
// Compare set and get
{
- long o = UNSAFE.getAndSetLong(base, offset, 1L);
- assertEquals(o, 2L, "getAndSet long");
+ long o = UNSAFE.getAndSetLong(base, offset, 0x0123456789ABCDEFL);
+ assertEquals(o, 0xCAFEBABECAFEBABEL, "getAndSet long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L, "getAndSet long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "getAndSet long value");
}
- UNSAFE.putLong(base, offset, 1L);
+ UNSAFE.putLong(base, offset, 0x0123456789ABCDEFL);
// get and add, add and get
{
- long o = UNSAFE.getAndAddLong(base, offset, 2L);
- assertEquals(o, 1L, "getAndAdd long");
+ long o = UNSAFE.getAndAddLong(base, offset, 0xCAFEBABECAFEBABEL);
+ assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
long x = UNSAFE.getLong(base, offset);
- assertEquals(x, 1L + 2L, "getAndAdd long");
+ assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long");
}
}
static void testAccess(long address) {
// Plain
{
- UNSAFE.putLong(address, 1L);
+ UNSAFE.putLong(address, 0x0123456789ABCDEFL);
long x = UNSAFE.getLong(address);
- assertEquals(x, 1L, "set long value");
+ assertEquals(x, 0x0123456789ABCDEFL, "set long value");
}
}
}
--- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java Fri Jul 01 16:50:34 2016 -0700
@@ -145,16 +145,16 @@
static void testAccess(Object base, long offset) {
// Plain
{
- UNSAFE.putShort(base, offset, (short)1);
+ UNSAFE.putShort(base, offset, (short)0x0123);
short x = UNSAFE.getShort(base, offset);
- assertEquals(x, (short)1, "set short value");
+ assertEquals(x, (short)0x0123, "set short value");
}
// Volatile
{
- UNSAFE.putShortVolatile(base, offset, (short)2);
+ UNSAFE.putShortVolatile(base, offset, (short)0x4567);
short x = UNSAFE.getShortVolatile(base, offset);
- assertEquals(x, (short)2, "putVolatile short value");
+ assertEquals(x, (short)0x4567, "putVolatile short value");
}
@@ -166,9 +166,9 @@
static void testAccess(long address) {
// Plain
{
- UNSAFE.putShort(address, (short)1);
+ UNSAFE.putShort(address, (short)0x0123);
short x = UNSAFE.getShort(address);
- assertEquals(x, (short)1, "set short value");
+ assertEquals(x, (short)0x0123, "set short value");
}
}
}
--- a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template Fri Jul 01 16:50:34 2016 -0700
@@ -333,7 +333,7 @@
$type$ o = UNSAFE.getAndAdd$Type$(base, offset, $value2$);
assertEquals(o, $value1$, "getAndAdd $type$");
$type$ x = UNSAFE.get$Type$(base, offset);
- assertEquals(x, $value1$ + $value2$, "getAndAdd $type$");
+ assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$");
}
#end[AtomicAdd]
}
--- a/hotspot/test/compiler/unsafe/generate-unsafe-access-tests.sh Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/compiler/unsafe/generate-unsafe-access-tests.sh Fri Jul 01 16:50:34 2016 -0700
@@ -53,6 +53,19 @@
;;
esac
+ if [ "$package" == "jdk.internal.misc" ]; then
+ case $type in
+ boolean|byte|char|short|float|double)
+ args="$args -KCAS"
+ ;;
+ esac
+ case $type in
+ byte|char|short|float|double)
+ args="$args -KAtomicAdd"
+ ;;
+ esac
+ fi
+
case $type in
short|char|int|long)
args="$args -KUnaligned"
@@ -66,29 +79,29 @@
value3=false
;;
byte)
- value1=(byte)1
- value2=(byte)2
- value3=(byte)3
+ value1=(byte)0x01
+ value2=(byte)0x23
+ value3=(byte)0x45
;;
short)
- value1=(short)1
- value2=(short)2
- value3=(short)3
+ value1=(short)0x0123
+ value2=(short)0x4567
+ value3=(short)0x89AB
;;
char)
- value1=\'a\'
- value2=\'b\'
- value3=\'c\'
+ value1=\'\\\\u0123\'
+ value2=\'\\\\u4567\'
+ value3=\'\\\\u89AB\'
;;
int)
- value1=1
- value2=2
- value3=3
+ value1=0x01234567
+ value2=0x89ABCDEF
+ value3=0xCAFEBABE
;;
long)
- value1=1L
- value2=2L
- value3=3L
+ value1=0x0123456789ABCDEFL
+ value2=0xCAFEBABECAFEBABEL
+ value3=0xDEADBEEFDEADBEEFL
;;
float)
value1=1.0f
--- a/hotspot/test/gc/TestCardTablePageCommits.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/TestCardTablePageCommits.java Fri Jul 01 16:50:34 2016 -0700
@@ -31,7 +31,7 @@
* @key gc
* @bug 8059066
* @summary Tests that the card table does not commit the same page twice
- * @requires vm.gc=="Parallel" | vm.gc=="null"
+ * @requires vm.gc.Parallel
* @library /testlibrary
* @modules java.base/jdk.internal.misc
* java.management
--- a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestCMSHeapSizeFlags
* @key gc
* @bug 8006088
- * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
+ * @requires vm.gc.ConcMarkSweep
* @summary Tests argument processing for initial and maximum heap size for the CMS collector
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -24,7 +24,7 @@
/*
* @test TestG1ConcMarkStepDurationMillis
* @key gc
- * @requires vm.gc=="null" | vm.gc=="G1"
+ * @requires vm.gc.G1
* @summary Tests argument processing for double type flag, G1ConcMarkStepDurationMillis
* @library /testlibrary
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestG1ConcRefinementThreads
* @key gc
* @bug 8047976
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary Tests argument processing for G1ConcRefinementThreads
* @library /testlibrary
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -25,7 +25,7 @@
* @test TestG1HeapRegionSize
* @key gc
* @bug 8021879
- * @requires vm.gc=="null" | vm.gc=="G1"
+ * @requires vm.gc.G1
* @summary Verify that the flag G1HeapRegionSize is updated properly
* @modules java.base/jdk.internal.misc
* @modules java.management/sun.management
--- a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestG1HeapSizeFlags
* @key gc
* @bug 8006088
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary Tests argument processing for initial and maximum heap size for the G1 collector
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/arguments/TestG1PercentageOptions.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestG1PercentageOptions.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestG1PercentageOptions
* @key gc
* @bug 8068942
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary Test argument processing of various percentage options
* @library /testlibrary
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestInitialTenuringThreshold
* @key gc
* @bug 8014765
- * @requires vm.gc=="Parallel" | vm.gc=="null"
+ * @requires vm.gc.Parallel
* @summary Tests argument processing for initial tenuring threshold
* @library /testlibrary
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -27,7 +27,7 @@
* @bug 8144527
* @summary Tests argument processing for NewSizeThreadIncrease
* @library /testlibrary
- * @requires vm.gc=="Serial" | vm.gc=="null"
+ * @requires vm.gc.Serial
* @modules java.base/jdk.internal.misc
* java.management
*/
--- a/hotspot/test/gc/arguments/TestObjectTenuringFlags.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestObjectTenuringFlags
* @key gc
* @bug 6521376
- * @requires vm.gc=="Parallel" | vm.gc=="null"
+ * @requires vm.gc.Parallel
* @summary Tests argument processing for NeverTenure, AlwaysTenure,
* and MaxTenuringThreshold
* @library /testlibrary
--- a/hotspot/test/gc/cms/DisableResizePLAB.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/cms/DisableResizePLAB.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+* 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
@@ -26,7 +26,7 @@
* @key gc
* @bug 8060467
* @author filipp.zhinkin@oracle.com, john.coomes@oracle.com
- * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
+ * @requires vm.gc.ConcMarkSweep
* @summary Run CMS with PLAB resizing disabled and a small OldPLABSize
* @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -Xlog:gc=debug DisableResizePLAB
*/
--- a/hotspot/test/gc/cms/TestBubbleUpRef.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/cms/TestBubbleUpRef.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,7 +28,7 @@
/*
* @test
- * @requires vm.gc=="ConcMarkSweep" | vm.gc == "null"
+ * @requires vm.gc.ConcMarkSweep
* @key cte_test
* @bug 4950157
* @summary Stress the behavior of ergonomics when the heap is nearly full and
--- a/hotspot/test/gc/cms/TestCMSScavengeBeforeRemark.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/cms/TestCMSScavengeBeforeRemark.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -25,7 +25,7 @@
* @test TestCMSScavengeBeforeRemark
* @key gc
* @bug 8139868
- * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
+ * @requires vm.gc.ConcMarkSweep
* @summary Run CMS with CMSScavengeBeforeRemark
* @run main/othervm -XX:+UseConcMarkSweepGC -XX:+CMSScavengeBeforeRemark -XX:+ExplicitGCInvokesConcurrent -Xmx256m -Xlog:gc=debug TestCMSScavengeBeforeRemark
*/
--- a/hotspot/test/gc/cms/TestMBeanCMS.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/cms/TestMBeanCMS.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,7 +24,7 @@
/*
* @test TestMBeanCMS.java
* @bug 6581734
- * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
+ * @requires vm.gc.ConcMarkSweep
* @summary CMS Old Gen's collection usage is zero after GC which is incorrect
* @modules java.management
* @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC TestMBeanCMS
--- a/hotspot/test/gc/g1/Test2GbHeap.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/Test2GbHeap.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8031686
* @summary Regression test to ensure we can start G1 with 2gb heap.
* Skip test on 32 bit system: it typically does not support the many and large virtual memory reservations needed.
- * @requires (vm.gc == "G1" | vm.gc == "null")
+ * @requires vm.gc.G1
* @requires vm.bits != "32"
* @key gc
* @key regression
--- a/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,7 +24,7 @@
/*
* @test TestGreyReclaimedHumongousObjects.java
* @bug 8069367
- * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires vm.gc.G1
* @summary Test handling of marked but unscanned reclaimed humongous objects.
* @key gc
* @modules jdk.management
--- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,7 +24,7 @@
/**
* @test TestHumongousShrinkHeap
* @bug 8036025 8056043
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary Verify that heap shrinks after GC in the presence of fragmentation
* due to humongous objects
* @library /testlibrary
--- a/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -28,7 +28,7 @@
* @key gc
* @modules java.base/jdk.internal.misc
* @library /testlibrary /test/lib
- * @requires (vm.gc=="G1" | vm.gc=="null")
+ * @requires vm.gc.G1
* @build jdk.test.lib.* sun.hotspot.WhiteBox
* @build TestLargePageUseForAuxMemory
* @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/gc/g1/TestNoEagerReclaimOfHumongousRegions.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestNoEagerReclaimOfHumongousRegions.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -27,7 +27,7 @@
* @summary Test to check that a live humongous object is not eagerly reclaimed. This is a regression test for
* 8139424 and the test will crash if an eager reclaim occur. The test is not 100% deterministic and
* might pass even if there are problems in the code, but it will never crash unless there is a problem.
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @key gc
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestPLABOutput.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestPLABOutput.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestPLABOutput
* @bug 8140585
* @summary Check that G1 does not report empty PLAB statistics in the first evacuation.
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @key gc
* @modules java.base/jdk.internal.misc
* @library /testlibrary /test/lib
--- a/hotspot/test/gc/g1/TestPLABSizeBounds.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestPLABSizeBounds.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -25,7 +25,7 @@
* @test TestPLABSizeBounds
* @bug 8134857
* @summary Regression test to ensure that G1 supports PLAB sizes of half a region size.
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @key gc
* @library /testlibrary
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestRegionAlignment.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestRegionAlignment.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, 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
@@ -24,7 +24,7 @@
/*
* @test TestRegionAlignment.java
* @bug 8013791
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary Make sure that G1 ergonomics pick a heap size that is aligned with the region size
* @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -XX:MaxRAM=555m TestRegionAlignment
*
--- a/hotspot/test/gc/g1/TestRegionLivenessPrint.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestRegionLivenessPrint.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,7 +24,7 @@
/*
* @test TestRegionLivenessPrint.java
* @bug 8151920
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary Make sure that G1 does not assert when printing region liveness data on a humongous continues region.
* @key gc
* @library /testlibrary /test/lib
--- a/hotspot/test/gc/g1/TestRemsetLogging.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestRemsetLogging.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -23,7 +23,7 @@
/*
* @test TestRemsetLogging.java
- * @requires vm.gc=="G1" | vm.gc =="null"
+ * @requires vm.gc.G1
* @bug 8013895 8129977 8145534
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestRemsetLoggingPerRegion.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestRemsetLoggingPerRegion.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -23,7 +23,7 @@
/*
* @test TestRemsetLoggingPerRegion.java
- * @requires vm.gc=="G1" | vm.gc =="null"
+ * @requires vm.gc.G1
* @bug 8014078 8129977 8145534
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestRemsetLoggingThreads.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestRemsetLoggingThreads.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -23,7 +23,7 @@
/*
* @test TestRemsetLoggingThreads
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @bug 8025441 8145534
* @key gc
* @library /testlibrary
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8038423 8061715
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8038423 8061715 8078405
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8038423 8061715 8078405
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8038423 8061715 8078405
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8038423 8061715 8078405
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8038423 8061715 8078405
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8038423 8061715 8078405
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/TestShrinkToOneRegion.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/TestShrinkToOneRegion.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, 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
@@ -24,7 +24,7 @@
/*
* @test TestShrinkToOneRegion.java
* @bug 8013872
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary Shrinking the heap down to one region used to hit an assert
* @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -Xmx256m TestShrinkToOneRegion
*
--- a/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java Fri Jul 01 16:50:34 2016 -0700
@@ -37,7 +37,7 @@
/**
* @test TestHeapCounters
* @summary Checks that heap counters work as expected after humongous allocations/deallocations
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* @modules java.management
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java Fri Jul 01 16:50:34 2016 -0700
@@ -38,7 +38,7 @@
/**
* @test gc.g1.humongousObjects.TestHumongousClassLoader
* @summary Checks that unreachable classes and unreachable humongous class loader are unloaded after GC
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M"
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @library /testlibrary /test/lib /
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -39,7 +39,7 @@
/**
* @test TestHumongousMovement
* @summary Checks that Humongous objects are not moved during GC
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* @modules java.management
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -37,7 +37,7 @@
/**
* @test gc.g1.humongousObjects.TestHumongousNonArrayAllocation
* @summary Checks that huge class' instances (ie with huge amount of fields) are allocated successfully
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M"
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java Fri Jul 01 16:50:34 2016 -0700
@@ -31,7 +31,7 @@
/**
* @test TestHumongousThreshold
* @summary Checks that objects larger than half a region are allocated as humongous
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* @modules java.management
--- a/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -37,7 +37,7 @@
* @test TestObjectCollected
* @summary checks that after different type of GCs weak/soft references to humongous object behave correspondingly to
* actual object behavior
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* @modules java.management
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java Fri Jul 01 16:50:34 2016 -0700
@@ -48,7 +48,7 @@
/**
* @test TestObjectGraphAfterGC
* @summary Checks that objects' graph behave as expected after gc
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @library /testlibrary /test/lib /
* @modules java.management java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/ihop/TestIHOPErgo.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/ihop/TestIHOPErgo.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestIHOPErgo
* @bug 8148397
* @summary Test checks that behavior of Adaptive and Static IHOP at concurrent cycle initiation
- * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires vm.gc.G1
* @requires !vm.flightRecorder
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @requires vm.opt.MaxGCPauseMillis == "null"
--- a/hotspot/test/gc/g1/ihop/TestIHOPStatic.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/ihop/TestIHOPStatic.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestIHOPStatic
* @bug 8148397
* @summary Test checks concurrent cycle initiation which depends on IHOP value.
- * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires vm.gc.G1
* @requires !vm.flightRecorder
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @library /testlibrary /
--- a/hotspot/test/gc/g1/mixedgc/TestLogging.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/mixedgc/TestLogging.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,7 +24,7 @@
/*
* @test TestLogging
* @summary Check that a mixed GC is reflected in the gc logs
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires vm.opt.MaxGCPauseMillis == "null"
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestPLABEvacuationFailure
* @bug 8148376
* @summary Checks PLAB statistics on evacuation failure
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @library /testlibrary /
* @modules java.base/jdk.internal.misc
* @modules java.management
--- a/hotspot/test/gc/g1/plab/TestPLABPromotion.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/plab/TestPLABPromotion.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestPLABPromotion
* @bug 8141278 8141141
* @summary Test PLAB promotion
- * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires vm.gc.G1
* @requires !vm.flightRecorder
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/plab/TestPLABResize.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/g1/plab/TestPLABResize.java Fri Jul 01 16:50:34 2016 -0700
@@ -25,7 +25,7 @@
* @test TestPLABResize
* @bug 8141278 8141141
* @summary Test for PLAB resizing
- * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires vm.gc.G1
* @requires !vm.flightRecorder
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, 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
@@ -24,7 +24,7 @@
/*
* @test G1AddMetaspaceDependency
* @bug 8010196
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @summary Checks that we don't get locking problems when adding metaspace dependencies with the G1 update buffer monitor
* @run main/othervm -XX:+UseG1GC -XX:G1UpdateBufferSize=1 G1AddMetaspaceDependency
*/
--- a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -30,7 +30,7 @@
/* @test TestPerfCountersAndMemoryPools
* @bug 8023476
* @library /testlibrary
- * @requires vm.gc=="Serial" | vm.gc=="null"
+ * @requires vm.gc.Serial
* @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
* report the same data.
* @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/parallel/TestDynShrinkHeap.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/parallel/TestDynShrinkHeap.java Fri Jul 01 16:50:34 2016 -0700
@@ -24,7 +24,7 @@
/**
* @test TestDynShrinkHeap
* @bug 8016479
- * @requires vm.gc=="Parallel" | vm.gc=="null"
+ * @requires vm.gc.Parallel
* @summary Verify that the heap shrinks after full GC according to the current values of the Min/MaxHeapFreeRatio flags
* @modules java.base/jdk.internal.misc
* @modules jdk.management
--- a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8016740
* @summary Tests that jvm with maximally verbose GC logging does not crash when ParOldGC has no memory
* @key gc
- * @requires vm.gc=="Parallel" | vm.gc=="null"
+ * @requires vm.gc.Parallel
* @modules java.base/jdk.internal.misc
* @library /testlibrary
* @run main/othervm -Xmx50m -XX:+UseParallelGC -Xlog:gc*=trace TestPrintGCDetailsVerbose
--- a/hotspot/test/gc/stress/TestMultiThreadStressRSet.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/stress/TestMultiThreadStressRSet.java Fri Jul 01 16:50:34 2016 -0700
@@ -31,7 +31,7 @@
/*
* @test TestMultiThreadStressRSet.java
* @key stress
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires os.maxMemory > 2G
* @requires vm.opt.MaxGCPauseMillis == "null"
*
--- a/hotspot/test/gc/stress/TestStressG1Humongous.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/stress/TestStressG1Humongous.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @key gc
* @key stress
* @summary Stress G1 by humongous allocations in situation near OOM
- * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires vm.gc.G1
* @requires !vm.flightRecorder
* @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=4m
* -Dtimeout=120 -Dthreads=3 -Dhumongoussize=1.1 -Dregionsize=4 TestStressG1Humongous
--- a/hotspot/test/gc/stress/TestStressIHOPMultiThread.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/stress/TestStressIHOPMultiThread.java Fri Jul 01 16:50:34 2016 -0700
@@ -26,7 +26,7 @@
* @bug 8148397
* @key stress
* @summary Stress test for IHOP
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @run main/othervm/timeout=200 -Xmx128m -XX:G1HeapWastePercent=0 -XX:G1MixedGCCountTarget=1
* -XX:+UseG1GC -XX:G1HeapRegionSize=1m -XX:+G1UseAdaptiveIHOP
* -Xlog:gc+ihop=debug,gc+ihop+ergo=debug,gc+ergo=debug:TestStressIHOPMultiThread1.log
--- a/hotspot/test/gc/stress/TestStressRSetCoarsening.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/stress/TestStressRSetCoarsening.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,7 +28,7 @@
* @test TestStressRSetCoarsening.java
* @key stress
* @bug 8146984 8147087
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc.G1
* @requires os.maxMemory > 3G
* @requires vm.opt.MaxGCPauseMillis == "null"
*
--- a/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java Fri Jul 01 16:50:34 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,7 +24,7 @@
/*
* @test TestConMarkCycleWB
* @bug 8065579
- * @requires vm.gc=="null" | vm.gc=="G1"
+ * @requires vm.gc.G1
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
* java.compiler
--- a/hotspot/test/native/runtime/test_classLoader.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/native/runtime/test_classLoader.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -22,6 +22,7 @@
*
*/
+#include "precompiled.hpp"
#include "classfile/classLoader.hpp"
#include "memory/resourceArea.hpp"
#include "unittest.hpp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/runtime/test_globals.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,74 @@
+/*
+ * 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 "runtime/globals.hpp"
+#include "unittest.hpp"
+
+#define TEST_FLAG(f, type, value) \
+ do { \
+ ASSERT_TRUE(Flag::find_flag(#f)->is_ ## type()); \
+ type original_value = f; \
+ { \
+ FLAG_GUARD(f); \
+ f = value; \
+ } \
+ ASSERT_EQ(original_value, f); \
+ } while (0)
+
+TEST_VM(FlagGuard, bool_flag) {
+ TEST_FLAG(AlwaysActAsServerClassMachine, bool, true);
+}
+
+TEST_VM(FlagGuard, int_flag) {
+ TEST_FLAG(ParGCArrayScanChunk, int, 1337);
+}
+
+TEST_VM(FlagGuard, intx_flag) {
+ TEST_FLAG(RefDiscoveryPolicy, intx, 1337);
+}
+
+TEST_VM(FlagGuard, uint_flag) {
+ TEST_FLAG(ConcGCThreads, uint, 1337);
+}
+
+TEST_VM(FlagGuard, uintx_flag) {
+ TEST_FLAG(GCTaskTimeStampEntries, uintx, 1337);
+}
+
+TEST_VM(FlagGuard, size_t_flag) {
+ TEST_FLAG(HeapSizePerGCThread, size_t, 1337);
+}
+
+TEST_VM(FlagGuard, uint64_t_flag) {
+ TEST_FLAG(MaxRAM, uint64_t, 1337);
+}
+
+TEST_VM(FlagGuard, double_flag) {
+ TEST_FLAG(CompileThresholdScaling, double, 3.141569);
+}
+
+TEST_VM(FlagGuard, ccstr_flag) {
+ TEST_FLAG(PerfDataSaveFile, ccstr, "/a/random/path");
+}
--- a/hotspot/test/native/runtime/test_instanceKlass.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/native/runtime/test_instanceKlass.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -22,6 +22,7 @@
*
*/
+#include "precompiled.hpp"
#include "classfile/symbolTable.hpp"
#include "memory/resourceArea.hpp"
#include "oops/instanceKlass.hpp"
--- a/hotspot/test/native/runtime/test_os.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/native/runtime/test_os.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -22,6 +22,7 @@
*
*/
+#include "precompiled.hpp"
#include "runtime/os.hpp"
#include "unittest.hpp"
--- a/hotspot/test/native/unittest.hpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/native/unittest.hpp Fri Jul 01 16:50:34 2016 -0700
@@ -22,13 +22,25 @@
*
*/
+#ifndef UNITTEST_HPP
+#define UNITTEST_HPP
+
#include <stdlib.h>
#include <stdio.h>
#define GTEST_DONT_DEFINE_TEST 1
#include "gtest/gtest.h"
+
+// gtest/gtest.h includes assert.h which will define the assert macro, but hotspot has its
+// own standards incompatible assert macro that takes two parameters.
+// The workaround is to undef assert and then re-define it. The re-definition
+// must unfortunately be copied since debug.hpp might already have been
+// included and a second include wouldn't work due to the header guards in debug.hpp.
#ifdef assert
#undef assert
+ #ifdef vmassert
+ #define assert(p, ...) vmassert(p, __VA_ARGS__)
+ #endif
#endif
#define CONCAT(a, b) a ## b
@@ -102,3 +114,5 @@
#define TEST_VM_ASSERT_MSG(...) \
TEST_VM_ASSERT_MSG is only available in debug builds
#endif
+
+#endif // UNITTEST_HPP
--- a/hotspot/test/native/utilities/test_quicksort.cpp Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/native/utilities/test_quicksort.cpp Fri Jul 01 16:50:34 2016 -0700
@@ -22,6 +22,7 @@
*
*/
+#include "precompiled.hpp"
#include "prims/jvm.h"
#include "utilities/quickSort.hpp"
#include "unittest.hpp"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ConstantPool/TestMethodHandleConstant.java Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,45 @@
+/*
+ * 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 8159470
+ * @summary Test that MethodHandle constants are checked
+ * @modules java.base/jdk.internal.misc
+ * @compile WithConfiguration.jcod
+ * @run main/othervm TestMethodHandleConstant
+ */
+public class TestMethodHandleConstant {
+
+ public static void main(String[] args) {
+ try {
+ // This interface has bad constant pool entry for MethodHandle -> Method
+ String URI_DEFAULT
+ = WithConfiguration.autoDetect().getLocation();
+ throw new RuntimeException("FAILED, ICCE not thrown");
+ } catch (BootstrapMethodError icce) {
+ System.out.println("PASSED, expecting ICCE" + icce.getMessage());
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/ConstantPool/WithConfiguration.jcod Fri Jul 01 16:50:34 2016 -0700
@@ -0,0 +1,170 @@
+/*
+ * 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.
+ */
+
+// This class has a MethodHandle constant that points to an incompatible Methodref constant
+// (should be InterfaceMethodref)
+// Throws ICCE/BootstrapMethodError
+
+// public interface WithConfiguration {
+// String getLocation();
+// static WithConfiguration autoDetect() {
+// return () -> "$Default$";
+// }
+// }
+
+class WithConfiguration {
+ 0xCAFEBABE;
+ 0; // minor version
+ 53; // version
+ [] { // Constant Pool
+ ; // first element is empty
+ InvokeDynamic 0s #18; // #1
+ String #19; // #2
+ class #20; // #3
+ class #21; // #4
+ Utf8 "getLocation"; // #5
+ Utf8 "()Ljava/lang/String;"; // #6
+ Utf8 "autoDetect"; // #7
+ Utf8 "()LWithConfiguration;"; // #8
+ Utf8 "Code"; // #9
+ Utf8 "LineNumberTable"; // #10
+ Utf8 "lambda$autoDetect$0"; // #11
+ Utf8 "SourceFile"; // #12
+ Utf8 "WithConfiguration.java"; // #13
+ Utf8 "BootstrapMethods"; // #14
+ MethodHandle 6b #22; // #15
+ MethodType #6; // #16
+ MethodHandle 6b #23; // #17
+ NameAndType #5 #8; // #18
+ Utf8 "$Default$"; // #19
+ Utf8 "WithConfiguration"; // #20
+ Utf8 "java/lang/Object"; // #21
+ Method #24 #25; // #22
+ Method #3 #26; // #23 THIS IS WRONG!!
+ class #27; // #24
+ NameAndType #28 #32; // #25
+ NameAndType #11 #6; // #26
+ Utf8 "java/lang/invoke/LambdaMetafactory"; // #27
+ Utf8 "metafactory"; // #28
+ class #34; // #29
+ Utf8 "Lookup"; // #30
+ Utf8 "InnerClasses"; // #31
+ Utf8 "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"; // #32
+ class #35; // #33
+ Utf8 "java/lang/invoke/MethodHandles$Lookup"; // #34
+ Utf8 "java/lang/invoke/MethodHandles"; // #35
+ } // Constant Pool
+
+ 0x0601; // access
+ #3;// this_cpx
+ #4;// super_cpx
+
+ [] { // Interfaces
+ } // Interfaces
+
+ [] { // fields
+ } // fields
+
+ [] { // methods
+ { // Member
+ 0x0401; // access
+ #5; // name_cpx
+ #6; // sig_cpx
+ [] { // Attributes
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x0009; // access
+ #7; // name_cpx
+ #8; // sig_cpx
+ [] { // Attributes
+ Attr(#9) { // Code
+ 1; // max_stack
+ 0; // max_locals
+ Bytes[]{
+ 0xBA00010000B0;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#10) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 26;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ ;
+ { // Member
+ 0x100A; // access
+ #11; // name_cpx
+ #6; // sig_cpx
+ [] { // Attributes
+ Attr(#9) { // Code
+ 1; // max_stack
+ 0; // max_locals
+ Bytes[]{
+ 0x1202B0;
+ };
+ [] { // Traps
+ } // end Traps
+ [] { // Attributes
+ Attr(#10) { // LineNumberTable
+ [] { // LineNumberTable
+ 0 26;
+ }
+ } // end LineNumberTable
+ } // Attributes
+ } // end Code
+ } // Attributes
+ } // Member
+ } // methods
+
+ [] { // Attributes
+ Attr(#12) { // SourceFile
+ #13;
+ } // end SourceFile
+ ;
+ Attr(#31) { // InnerClasses
+ [] { // InnerClasses
+ #29 #33 #30 25;
+ }
+ } // end InnerClasses
+ ;
+ Attr(#14) { // BootstrapMethods
+ [] { // bootstrap_methods
+ { // bootstrap_method
+ #15; // bootstrap_method_ref
+ [] { // bootstrap_arguments
+ #16;
+ #17;
+ #16;
+ } // bootstrap_arguments
+ } // bootstrap_method
+ }
+ } // end BootstrapMethods
+ } // Attributes
+} // end class WithConfiguration
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java Fri Jul 01 16:50:34 2016 -0700
@@ -28,7 +28,7 @@
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
- * @requires (vm.gc=="G1" | vm.gc=="null")
+ * @requires vm.gc.G1
* @library /testlibrary /test/lib
* @modules java.base/jdk.internal.misc
* java.management
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java Fri Jul 01 16:50:34 2016 -0700
@@ -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
@@ -27,7 +27,7 @@
* Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows
* @requires (sun.arch.data.model != "32") & (os.family != "windows")
* @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
- * @requires (vm.gc=="G1" | vm.gc=="null")
+ * @requires vm.gc.G1
* @library /testlibrary
* @modules java.base/jdk.internal.misc
* java.management
--- a/hotspot/test/runtime/StackGuardPages/invoke.c Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/runtime/StackGuardPages/invoke.c Fri Jul 01 16:50:34 2016 -0700
@@ -221,7 +221,7 @@
printf("Test started with pid: %ld\n", (long) getpid());
options[0].optionString = "-Xint";
- options[1].optionString = "-Xss328k";
+ options[1].optionString = "-Xss512k";
vm_args.version = JNI_VERSION_1_2;
vm_args.ignoreUnrecognized = JNI_TRUE;
--- a/hotspot/test/runtime/Throwable/StackTraceLogging.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/runtime/Throwable/StackTraceLogging.java Fri Jul 01 16:50:34 2016 -0700
@@ -39,15 +39,10 @@
import jdk.test.lib.ProcessTools;
public class StackTraceLogging {
- static void updateEnvironment(ProcessBuilder pb, String environmentVariable, String value) {
- Map<String, String> env = pb.environment();
- env.put(environmentVariable, value);
- }
-
static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- // These depths match the ones in TestThrowable.java
- int[] depths = {10, 34, 100, 1024};
+ // These depths match the ones in TestThrowable.java, except the one greater than 1024
+ int[] depths = {10, 34, 100, 1023, 1024};
for (int d : depths) {
output.shouldContain("java.lang.RuntimeException, " + d);
}
--- a/hotspot/test/runtime/Throwable/TestThrowable.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/runtime/Throwable/TestThrowable.java Fri Jul 01 16:50:34 2016 -0700
@@ -38,7 +38,7 @@
// Inner class that throws a lot of exceptions
static class Thrower {
static int MaxJavaStackTraceDepth = 1024; // as above
- int[] depths = {10, 34, 100, 1024, 2042};
+ int[] depths = {10, 34, 100, 1023, 1024, 1025};
int count = 0;
int getDepth(Throwable t) throws Exception {
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ByteCodeGenerator.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ByteCodeGenerator.java Fri Jul 01 16:50:34 2016 -0700
@@ -78,7 +78,7 @@
} catch (Throwable t) {
Path errFile = generatorDir.resolve(mainClassName + ".err");
try (PrintWriter pw = new PrintWriter(Files.newOutputStream(errFile,
- StandardOpenOption.CREATE_NEW))) {
+ StandardOpenOption.CREATE, StandardOpenOption.WRITE))) {
t.printStackTrace(pw);
} catch (IOException e) {
t.printStackTrace();
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/IRNode.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/IRNode.java Fri Jul 01 16:50:34 2016 -0700
@@ -198,6 +198,31 @@
return result;
}
+ public static long getModifiableNodesCount(List<IRNode> nodes) {
+ return nodes.stream()
+ .map(IRNode::getStackableLeaves)
+ .mapToInt(List::size)
+ .filter(i -> i > 0)
+ .count();
+ }
+
+ public static boolean tryToReduceNodesDepth(List<IRNode> nodes, int maxDepth) {
+ boolean allSucceed = true;
+ for (IRNode child : nodes) {
+ for (IRNode leaf : child.getDeviantBlocks(Math.max(child.countDepth(), maxDepth + 1))) {
+ if (child.countDepth() > maxDepth) {
+ // doesn't remove control deviation block. Just some parts.
+ leaf.removeSelf();
+ boolean successfull = child.countDepth() > maxDepth;
+ allSucceed &= successfull;
+ } else {
+ break;
+ }
+ }
+ }
+ return allSucceed;
+ }
+
// TODO: add field instead this function
public boolean isCFDeviation() {
return this instanceof If || this instanceof Switch
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/ClassDefinitionBlockFactory.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/ClassDefinitionBlockFactory.java Fri Jul 01 16:50:34 2016 -0700
@@ -102,11 +102,16 @@
addMoreChildren(childs, content, minDepth);
}
- private void addMoreChildren(List<IRNode> childs, Collection<IRNode> content, int minDepth)
- throws ProductionFailedException {
- while (!childs.isEmpty() && IRNode.countDepth(content) < minDepth) {
- PseudoRandom.shuffle(childs);
- IRNode randomChild = childs.get(0);
+ private void addMoreChildren(List<IRNode> children, Collection<IRNode> content, int minDepth)
+ throws ProductionFailedException {
+ /* check situation when no stackable leaves available in all children */
+ if (IRNode.getModifiableNodesCount(children) == 0L) {
+ return;
+ }
+ /* now let's try to add children */
+ while (!children.isEmpty() && IRNode.countDepth(content) < minDepth) {
+ PseudoRandom.shuffle(children);
+ IRNode randomChild = children.get(0);
List<IRNode> leaves = randomChild.getStackableLeaves();
if (!leaves.isEmpty()) {
Block randomLeaf = (Block) leaves.get(PseudoRandom.randomNotNegative(leaves.size()));
@@ -131,18 +136,11 @@
private void ensureMaxDepth(Collection<IRNode> content) {
int maxDepth = ProductionParams.maxCfgDepth.value();
- List<IRNode> childs = content.stream()
+ List<IRNode> childrenClasses = content.stream()
.filter(c -> c instanceof Klass && c.countDepth() > maxDepth)
.collect(Collectors.toList());
- for (IRNode ch : childs) {
- List<IRNode> leaves;
- do {
- long depth = Math.max(ch.countDepth(), maxDepth + 1);
- leaves = ch.getDeviantBlocks(depth);
- if(leaves.size() > 0) {
- leaves.get(0).removeSelf();
- }
- } while (!leaves.isEmpty() && ch.countDepth() > maxDepth);
- }
+ /* now attempt to reduce depth by removing optional parts of control deviation
+ blocks in case IRTree has oversized depth */
+ IRNode.tryToReduceNodesDepth(childrenClasses, maxDepth);
}
}
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/MainKlassFactory.java Wed Jul 05 21:55:11 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/MainKlassFactory.java Fri Jul 01 16:50:34 2016 -0700
@@ -112,19 +112,14 @@
functionDefinitions, testFunction, printVariables);
}
- private void ensureMaxDepth(List<IRNode> childs) {
+ private void ensureMaxDepth(List<IRNode> children) {
int maxDepth = ProductionParams.maxCfgDepth.value();
- List<IRNode> filtered = childs.stream()
- .filter(c -> c.isCFDeviation() && c.countDepth() > maxDepth)
- .collect(Collectors.toList());
- for (IRNode child : filtered) {
- List<IRNode> leaves;
- do {
- long depth = Math.max(child.countDepth(), maxDepth + 1);
- leaves = child.getDeviantBlocks(depth);
- leaves.get(0).removeSelf();
- } while (!leaves.isEmpty() && child.countDepth() > maxDepth);
- }
+ List<IRNode> filtered = children.stream()
+ .filter(c -> c.isCFDeviation() && c.countDepth() > maxDepth)
+ .collect(Collectors.toList());
+ /* Now attempt to reduce depth by removing optional parts of control deviation
+ blocks in case IRTree has oversized depth */
+ IRNode.tryToReduceNodesDepth(filtered, maxDepth);
}
private void ensureMinDepth(List<IRNode> childs, IRNodeBuilder builder)
@@ -134,10 +129,15 @@
addMoreChildren(filtered, minDepth, builder);
}
- private void addMoreChildren(List<IRNode> childs, int minDepth, IRNodeBuilder builder)
+ private void addMoreChildren(List<IRNode> children, int minDepth, IRNodeBuilder builder)
throws ProductionFailedException {
- while (!childs.isEmpty() && IRNode.countDepth(childs) < minDepth) {
- IRNode randomChild = childs.get(PseudoRandom.randomNotNegative(childs.size()));
+ /* check situation when no stackable leaves available in all children */
+ if (IRNode.getModifiableNodesCount(children) == 0L) {
+ return;
+ }
+ /* now let's try to add children */
+ while (!children.isEmpty() && IRNode.countDepth(children) < minDepth) {
+ IRNode randomChild = children.get(PseudoRandom.randomNotNegative(children.size()));
List<IRNode> leaves = randomChild.getStackableLeaves();
if (!leaves.isEmpty()) {
Block randomLeaf = (Block) leaves.get(PseudoRandom.randomNotNegative(leaves.size()));