diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 9b00c6661fd..0c614608939 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -376,3 +376,4 @@ d94d54a3192fea79234c3ac55cd0b4052d45e954 jdk-9+130 8728756c2f70a79a90188f4019cfd6b9a275765c jdk-9+131 a24702d4d5ab0015a5c553ed57f66fce7d85155e jdk-9+132 be1218f792a450dfb5d4b1f82616b9d95a6a732e jdk-9+133 +065724348690eda41fc69112278d8da6dcde548c jdk-9+134 diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 92e055d9a12..b233cdcd433 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -5095,7 +5095,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1470863189 +DATE_WHEN_GENERATED=1472718471 ############################################################################### # @@ -15944,6 +15944,8 @@ $as_echo "$COMPILE_TYPE" >&6; } HOTSPOT_TARGET_CPU_DEFINE=S390 elif test "x$OPENJDK_TARGET_CPU" = xs390x; then HOTSPOT_TARGET_CPU_DEFINE=S390 + elif test "x$OPENJDK_TARGET_CPU" != x; then + HOTSPOT_TARGET_CPU_DEFINE=$(echo $OPENJDK_TARGET_CPU | tr a-z A-Z) fi @@ -16117,6 +16119,8 @@ $as_echo "$COMPILE_TYPE" >&6; } HOTSPOT_BUILD_CPU_DEFINE=S390 elif test "x$OPENJDK_BUILD_CPU" = xs390x; then HOTSPOT_BUILD_CPU_DEFINE=S390 + elif test "x$OPENJDK_BUILD_CPU" != x; then + HOTSPOT_BUILD_CPU_DEFINE=$(echo $OPENJDK_BUILD_CPU | tr a-z A-Z) fi diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 index 2fbac1d0dd3..e7ffe4a2fa5 100644 --- a/common/autoconf/platform.m4 +++ b/common/autoconf/platform.m4 @@ -454,6 +454,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER], HOTSPOT_$1_CPU_DEFINE=S390 elif test "x$OPENJDK_$1_CPU" = xs390x; then HOTSPOT_$1_CPU_DEFINE=S390 + elif test "x$OPENJDK_$1_CPU" != x; then + HOTSPOT_$1_CPU_DEFINE=$(echo $OPENJDK_$1_CPU | tr a-z A-Z) fi AC_SUBST(HOTSPOT_$1_CPU_DEFINE) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 8d8a2e6cf99..4cc7243b9ce 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -536,3 +536,4 @@ e96b34b76d863ed1fa04e0eeb3f297ac17b490fd jdk-9+129 943bf73b49c33c2d7cbd796f6a4ae3c7a00ae932 jdk-9+131 713951c08aa26813375175c2ab6cc99ff2a56903 jdk-9+132 a25e0fb6033245ab075136e744d362ce765464cd jdk-9+133 +b8b694c6b4d2ab0939aed7adaf0eec1ac321a085 jdk-9+134 diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk index ce4a0319909..9ed952f36c0 100644 --- a/hotspot/make/test/JtregNative.gmk +++ b/hotspot/make/test/JtregNative.gmk @@ -71,15 +71,15 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC += \ endif ifeq ($(TOOLCHAIN_TYPE), solstudio) - BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_liboverflow := -lc - BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libSimpleClassFileLoadHook := -lc - BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libGetNamedModuleTest := -lc + BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_liboverflow := -lc + BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libSimpleClassFileLoadHook := -lc + BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libGetNamedModuleTest := -lc endif ifeq ($(OPENJDK_TARGET_OS), linux) BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z noexecstack BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack - BUILD_HOTSPOT_JTREG_EXECUTABLES_LDFLAGS_exeinvoke := -ljvm -lpthread + BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exeinvoke := -ljvm -lpthread BUILD_TEST_invoke_exeinvoke.c_OPTIMIZATION := NONE endif diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad index 50c6d33f39d..f338390dbbb 100644 --- a/hotspot/src/cpu/aarch64/vm/aarch64.ad +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad @@ -4680,7 +4680,7 @@ encode %{ Label retaddr; __ adr(rscratch2, retaddr); __ lea(rscratch1, RuntimeAddress(entry)); - // Leave a breadcrumb for JavaThread::pd_last_frame(). + // Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc() __ stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize))); __ blrt(rscratch1, gpcnt, fpcnt, rtype); __ bind(retaddr); diff --git a/hotspot/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp index 7752e7bfee3..f6339d7976c 100644 --- a/hotspot/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp @@ -78,7 +78,7 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result, addre } pop(r0, sp); #endif - reset_last_Java_frame(true, true); + reset_last_Java_frame(true); maybe_isb(); // check for pending exceptions @@ -547,7 +547,7 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) { __ bind(L); } #endif - __ reset_last_Java_frame(true, false); + __ reset_last_Java_frame(true); __ maybe_isb(); // check for pending exceptions diff --git a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp index 473c4bc67eb..8963353ede3 100644 --- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp @@ -336,13 +336,16 @@ frame frame::sender_for_entry_frame(RegisterMap* map) const { JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor(); assert(!entry_frame_is_first(), "next Java fp must be non zero"); assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack"); + // Since we are walking the stack now this nested anchor is obviously walkable + // even if it wasn't when it was stacked. + if (!jfa->walkable()) { + // Capture _last_Java_pc (if needed) and mark anchor walkable. + jfa->capture_last_Java_pc(); + } map->clear(); assert(map->include_argument_oops(), "should be set by clear"); - if (jfa->last_Java_pc() != NULL ) { - frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); - return fr; - } - frame fr(jfa->last_Java_sp(), jfa->last_Java_fp()); + vmassert(jfa->last_Java_pc() != NULL, "not walkable"); + frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); return fr; } @@ -769,3 +772,21 @@ frame::frame(void* sp, void* fp, void* pc) { init((intptr_t*)sp, (intptr_t*)fp, (address)pc); } #endif + +void JavaFrameAnchor::make_walkable(JavaThread* thread) { + // last frame set? + if (last_Java_sp() == NULL) return; + // already walkable? + if (walkable()) return; + vmassert(Thread::current() == (Thread*)thread, "not current thread"); + vmassert(last_Java_sp() != NULL, "not called from Java code?"); + vmassert(last_Java_pc() == NULL, "already walkable"); + capture_last_Java_pc(); + vmassert(walkable(), "something went wrong"); +} + +void JavaFrameAnchor::capture_last_Java_pc() { + vmassert(_last_Java_sp != NULL, "no last frame set"); + vmassert(_last_Java_pc == NULL, "already walkable"); + _last_Java_pc = (address)_last_Java_sp[-1]; +} diff --git a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp index dd73bf5283d..925690b0d80 100644 --- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp @@ -201,7 +201,7 @@ class InterpreterMacroAssembler: public MacroAssembler { // #endif MacroAssembler::null_check(reg, offset); // #ifdef ASSERT -// reset_last_Java_frame(true, false); +// reset_last_Java_frame(true); // #endif } diff --git a/hotspot/src/cpu/aarch64/vm/javaFrameAnchor_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/javaFrameAnchor_aarch64.hpp index e6375d77bdc..afdab23b9b5 100644 --- a/hotspot/src/cpu/aarch64/vm/javaFrameAnchor_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/javaFrameAnchor_aarch64.hpp @@ -64,10 +64,9 @@ public: _last_Java_sp = src->_last_Java_sp; } - // Always walkable - bool walkable(void) { return true; } - // Never any thing to do since we are always walkable and can find address of return addresses - void make_walkable(JavaThread* thread) { } + bool walkable(void) { return _last_Java_sp != NULL && _last_Java_pc != NULL; } + void make_walkable(JavaThread* thread); + void capture_last_Java_pc(void); intptr_t* last_Java_sp(void) const { return _last_Java_sp; } diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp index 6e686f51b1b..bd350716788 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -274,19 +274,18 @@ void MacroAssembler::serialize_memory(Register thread, Register tmp) { } -void MacroAssembler::reset_last_Java_frame(bool clear_fp, - bool clear_pc) { +void MacroAssembler::reset_last_Java_frame(bool clear_fp) { // we must set sp to zero to clear frame str(zr, Address(rthread, JavaThread::last_Java_sp_offset())); + // must clear fp, so that compiled frames are not confused; it is // possible that we need it only for debugging if (clear_fp) { str(zr, Address(rthread, JavaThread::last_Java_fp_offset())); } - if (clear_pc) { - str(zr, Address(rthread, JavaThread::last_Java_pc_offset())); - } + // Always clear the pc because it could have been set by make_walkable() + str(zr, Address(rthread, JavaThread::last_Java_pc_offset())); } // Calls to C land @@ -632,7 +631,7 @@ void MacroAssembler::call_VM_base(Register oop_result, // reset last Java frame // Only interpreter should have to clear fp - reset_last_Java_frame(true, true); + reset_last_Java_frame(true); // C++ interp handles this in the interpreter check_and_handle_popframe(java_thread); @@ -875,7 +874,7 @@ void MacroAssembler:: notify(int type) { if (type == bytecode_start) { // set_last_Java_frame(esp, rfp, (address)NULL); Assembler:: notify(type); - // reset_last_Java_frame(true, false); + // reset_last_Java_frame(true); } else Assembler:: notify(type); diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp index 51a47b7a83e..84fe75e305e 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp @@ -757,10 +757,10 @@ public: Register last_java_pc, Register scratch); - void reset_last_Java_frame(Register thread, bool clearfp, bool clear_pc); + void reset_last_Java_frame(Register thread); - // thread in the default location (r15_thread on 64bit) - void reset_last_Java_frame(bool clear_fp, bool clear_pc); + // thread in the default location (rthread) + void reset_last_Java_frame(bool clear_fp); // Stores void store_check(Register obj); // store check for obj - register is destroyed afterwards diff --git a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp index 6a5bb7a66b7..771dc099b9f 100644 --- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp @@ -2030,7 +2030,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ bind(dtrace_method_exit_done); } - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); // Unpack oop result if (ret_type == T_OBJECT || ret_type == T_ARRAY) { @@ -2370,7 +2370,7 @@ void SharedRuntime::generate_deopt_blob() { __ bind(retaddr); oop_maps->add_gc_map( __ pc()-start, map->deep_copy()); - __ reset_last_Java_frame(false, false); + __ reset_last_Java_frame(false); __ b(after_fetch_unroll_info_call); } // EnableJVMCI @@ -2465,7 +2465,7 @@ void SharedRuntime::generate_deopt_blob() { // find any register it might need. oop_maps->add_gc_map(__ pc() - start, map); - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); #if INCLUDE_JVMCI if (EnableJVMCI) { @@ -2606,7 +2606,7 @@ void SharedRuntime::generate_deopt_blob() { new OopMap( frame_size_in_words, 0 )); // Clear fp AND pc - __ reset_last_Java_frame(true, true); + __ reset_last_Java_frame(true); // Collect return values __ ldrd(v0, Address(sp, RegisterSaver::v0_offset_in_bytes())); @@ -2709,7 +2709,7 @@ void SharedRuntime::generate_uncommon_trap_blob() { oop_maps->add_gc_map(__ pc() - start, map); - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); // move UnrollBlock* into r4 __ mov(r4, r0); @@ -2828,7 +2828,7 @@ void SharedRuntime::generate_uncommon_trap_blob() { oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); // Clear fp AND pc - __ reset_last_Java_frame(true, true); + __ reset_last_Java_frame(true); // Pop self-frame. __ leave(); // Epilog @@ -2906,7 +2906,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t Label noException; - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); __ maybe_isb(); __ membar(Assembler::LoadLoad | Assembler::LoadStore); @@ -2985,7 +2985,7 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha // r0 contains the address we are going to jump to assuming no exception got installed // clear last_Java_sp - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); // check for pending exceptions Label pending; __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset())); @@ -3116,7 +3116,7 @@ void OptoRuntime::generate_exception_blob() { oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); // Restore callee-saved registers diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp index 13071f52aba..4df4aad6228 100644 --- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp @@ -3801,7 +3801,7 @@ class StubGenerator: public StubCodeGenerator { oop_maps->add_gc_map(the_pc - start, map); - __ reset_last_Java_frame(true, true); + __ reset_last_Java_frame(true); __ maybe_isb(); __ leave(); diff --git a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp index 293024c9826..5ac01c904fc 100644 --- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp @@ -1353,7 +1353,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { __ stlrw(rscratch1, rscratch2); // reset_last_Java_frame - __ reset_last_Java_frame(true, true); + __ reset_last_Java_frame(true); // reset handle block __ ldr(t, Address(rthread, JavaThread::active_handles_offset())); diff --git a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp index 3fd9dbef98e..b2f6e2329d3 100644 --- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp @@ -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) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -852,26 +852,23 @@ void TemplateTable::aload_0_internal(RewriteControl rc) { // get next bytecode __ load_unsigned_byte(r1, at_bcp(Bytecodes::length_for(Bytecodes::_aload_0))); - // do actual aload_0 - aload(0); - // if _getfield then wait with rewrite __ cmpw(r1, Bytecodes::Bytecodes::_getfield); __ br(Assembler::EQ, done); - // if _igetfield then reqrite to _fast_iaccess_0 + // if _igetfield then rewrite to _fast_iaccess_0 assert(Bytecodes::java_code(Bytecodes::_fast_iaccess_0) == Bytecodes::_aload_0, "fix bytecode definition"); __ cmpw(r1, Bytecodes::_fast_igetfield); __ movw(bc, Bytecodes::_fast_iaccess_0); __ br(Assembler::EQ, rewrite); - // if _agetfield then reqrite to _fast_aaccess_0 + // if _agetfield then rewrite to _fast_aaccess_0 assert(Bytecodes::java_code(Bytecodes::_fast_aaccess_0) == Bytecodes::_aload_0, "fix bytecode definition"); __ cmpw(r1, Bytecodes::_fast_agetfield); __ movw(bc, Bytecodes::_fast_aaccess_0); __ br(Assembler::EQ, rewrite); - // if _fgetfield then reqrite to _fast_faccess_0 + // if _fgetfield then rewrite to _fast_faccess_0 assert(Bytecodes::java_code(Bytecodes::_fast_faccess_0) == Bytecodes::_aload_0, "fix bytecode definition"); __ cmpw(r1, Bytecodes::_fast_fgetfield); __ movw(bc, Bytecodes::_fast_faccess_0); @@ -887,9 +884,10 @@ void TemplateTable::aload_0_internal(RewriteControl rc) { patch_bytecode(Bytecodes::_aload_0, bc, r1, false); __ bind(done); - } else { - aload(0); } + + // Do actual aload_0 (must do this after patch_bytecode which might call VM and GC might change oop). + aload(0); } void TemplateTable::istore() diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp index bab62cd4f86..22097092a7a 100644 --- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -28,6 +28,7 @@ #include "runtime/globals_extension.hpp" #include "runtime/vm_version.hpp" +#include "utilities/sizes.hpp" class VM_Version : public Abstract_VM_Version { friend class JVMCIVMStructs; diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index 44bee0c703c..f828aa0e370 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -705,9 +705,6 @@ void TemplateTable::aload_0_internal(RewriteControl rc) { // get next byte __ ldub(at_bcp(Bytecodes::length_for(Bytecodes::_aload_0)), G3_scratch); - // do actual aload_0 - aload(0); - // if _getfield then wait with rewrite __ cmp_and_br_short(G3_scratch, (int)Bytecodes::_getfield, Assembler::equal, Assembler::pn, done); @@ -738,9 +735,10 @@ void TemplateTable::aload_0_internal(RewriteControl rc) { __ bind(rewrite); patch_bytecode(Bytecodes::_aload_0, G4_scratch, G3_scratch, false); __ bind(done); - } else { - aload(0); } + + // Do actual aload_0 (must do this after patch_bytecode which might call VM and GC might change oop). + aload(0); } void TemplateTable::istore() { diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp index 0b607df2606..5fe455600d1 100644 --- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp @@ -98,7 +98,7 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result, addre } pop(rax); #endif - reset_last_Java_frame(thread, true, align_stack); + reset_last_Java_frame(thread, true); // discard thread and arguments NOT_LP64(addptr(rsp, num_rt_args()*BytesPerWord)); @@ -872,7 +872,7 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) { } __ pop(rax); #endif - __ reset_last_Java_frame(thread, true, false); + __ reset_last_Java_frame(thread, true); #ifndef _LP64 __ pop(rcx); // discard thread arg __ pop(rcx); // discard dummy diff --git a/hotspot/src/cpu/x86/vm/frame_x86.cpp b/hotspot/src/cpu/x86/vm/frame_x86.cpp index 1db4b424cf5..0a636f44ec0 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.cpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp @@ -337,13 +337,16 @@ frame frame::sender_for_entry_frame(RegisterMap* map) const { JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor(); assert(!entry_frame_is_first(), "next Java fp must be non zero"); assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack"); + // Since we are walking the stack now this nested anchor is obviously walkable + // even if it wasn't when it was stacked. + if (!jfa->walkable()) { + // Capture _last_Java_pc (if needed) and mark anchor walkable. + jfa->capture_last_Java_pc(); + } map->clear(); assert(map->include_argument_oops(), "should be set by clear"); - if (jfa->last_Java_pc() != NULL ) { - frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); - return fr; - } - frame fr(jfa->last_Java_sp(), jfa->last_Java_fp()); + vmassert(jfa->last_Java_pc() != NULL, "not walkable"); + frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); return fr; } @@ -666,3 +669,21 @@ frame::frame(void* sp, void* fp, void* pc) { init((intptr_t*)sp, (intptr_t*)fp, (address)pc); } #endif + +void JavaFrameAnchor::make_walkable(JavaThread* thread) { + // last frame set? + if (last_Java_sp() == NULL) return; + // already walkable? + if (walkable()) return; + vmassert(Thread::current() == (Thread*)thread, "not current thread"); + vmassert(last_Java_sp() != NULL, "not called from Java code?"); + vmassert(last_Java_pc() == NULL, "already walkable"); + capture_last_Java_pc(); + vmassert(walkable(), "something went wrong"); +} + +void JavaFrameAnchor::capture_last_Java_pc() { + vmassert(_last_Java_sp != NULL, "no last frame set"); + vmassert(_last_Java_pc == NULL, "already walkable"); + _last_Java_pc = (address)_last_Java_sp[-1]; +} diff --git a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp index 0c968ce80cf..d7d8e47ea89 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp @@ -101,6 +101,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) { // call a specialized frame constructor instead of this one. // Then we could use the assert below. However this assert is of somewhat dubious // value. + // UPDATE: this constructor is only used by trace_method_handle_stub() now. // assert(_pc != NULL, "no pc?"); _cb = CodeCache::find_blob(_pc); diff --git a/hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp b/hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp index 77298e53770..40eedf019ae 100644 --- a/hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp +++ b/hotspot/src/cpu/x86/vm/javaFrameAnchor_x86.hpp @@ -62,10 +62,9 @@ public: _last_Java_sp = src->_last_Java_sp; } - // Always walkable - bool walkable(void) { return true; } - // Never any thing to do since we are always walkable and can find address of return addresses - void make_walkable(JavaThread* thread) { } + bool walkable(void) { return _last_Java_sp != NULL && _last_Java_pc != NULL; } + void make_walkable(JavaThread* thread); + void capture_last_Java_pc(void); intptr_t* last_Java_sp(void) const { return _last_Java_sp; } diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp index 9b52535459a..9957425c95c 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -752,8 +752,7 @@ void MacroAssembler::pushptr(AddressLiteral src) { } } -void MacroAssembler::reset_last_Java_frame(bool clear_fp, - bool clear_pc) { +void MacroAssembler::reset_last_Java_frame(bool clear_fp) { // we must set sp to zero to clear frame movptr(Address(r15_thread, JavaThread::last_Java_sp_offset()), NULL_WORD); // must clear fp, so that compiled frames are not confused; it is @@ -762,9 +761,8 @@ void MacroAssembler::reset_last_Java_frame(bool clear_fp, movptr(Address(r15_thread, JavaThread::last_Java_fp_offset()), NULL_WORD); } - if (clear_pc) { - movptr(Address(r15_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); - } + // Always clear the pc because it could have been set by make_walkable() + movptr(Address(r15_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); } void MacroAssembler::set_last_Java_frame(Register last_java_sp, @@ -2531,7 +2529,7 @@ void MacroAssembler::call_VM_base(Register oop_result, } // reset last Java frame // Only interpreter should have to clear fp - reset_last_Java_frame(java_thread, true, false); + reset_last_Java_frame(java_thread, true); // C++ interp handles this in the interpreter check_and_handle_popframe(java_thread); @@ -3642,8 +3640,7 @@ void MacroAssembler::push_IU_state() { pusha(); } -void MacroAssembler::reset_last_Java_frame(Register java_thread, bool clear_fp, bool clear_pc) { - // determine java_thread register +void MacroAssembler::reset_last_Java_frame(Register java_thread, bool clear_fp) { // determine java_thread register if (!java_thread->is_valid()) { java_thread = rdi; get_thread(java_thread); @@ -3654,8 +3651,8 @@ void MacroAssembler::reset_last_Java_frame(Register java_thread, bool clear_fp, movptr(Address(java_thread, JavaThread::last_Java_fp_offset()), NULL_WORD); } - if (clear_pc) - movptr(Address(java_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); + // Always clear the pc because it could have been set by make_walkable() + movptr(Address(java_thread, JavaThread::last_Java_pc_offset()), NULL_WORD); } diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp index 2098c05891e..cd3c67c4ab2 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp @@ -288,10 +288,10 @@ class MacroAssembler: public Assembler { Register last_java_fp, address last_java_pc); - void reset_last_Java_frame(Register thread, bool clear_fp, bool clear_pc); + void reset_last_Java_frame(Register thread, bool clear_fp); // thread in the default location (r15_thread on 64bit) - void reset_last_Java_frame(bool clear_fp, bool clear_pc); + void reset_last_Java_frame(bool clear_fp); // Stores void store_check(Register obj); // store check for obj - register is destroyed afterwards diff --git a/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp b/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp index 5ff630145a7..a40edbd1297 100644 --- a/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/runtime_x86_32.cpp @@ -117,7 +117,7 @@ void OptoRuntime::generate_exception_blob() { // No registers to map, rbp is known implicitly oop_maps->add_gc_map( __ pc() - start, new OopMap( framesize, 0 )); __ get_thread(rcx); - __ reset_last_Java_frame(rcx, false, false); + __ reset_last_Java_frame(rcx, false); // Restore callee-saved registers __ movptr(rbp, Address(rsp, rbp_off * wordSize)); diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp index a24397f4c8f..96961a8b9b0 100644 --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp @@ -1330,7 +1330,7 @@ static void check_needs_gc_for_critical_native(MacroAssembler* masm, __ increment(rsp, wordSize); __ get_thread(thread); - __ reset_last_Java_frame(thread, false, true); + __ reset_last_Java_frame(thread, false); save_or_restore_arguments(masm, stack_slots, total_in_args, arg_save_area, NULL, in_regs, in_sig_bt); @@ -2224,7 +2224,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // We can finally stop using that last_Java_frame we setup ages ago - __ reset_last_Java_frame(thread, false, true); + __ reset_last_Java_frame(thread, false); // Unpack oop result if (ret_type == T_OBJECT || ret_type == T_ARRAY) { @@ -2553,7 +2553,7 @@ void SharedRuntime::generate_deopt_blob() { __ pop(rcx); __ get_thread(rcx); - __ reset_last_Java_frame(rcx, false, false); + __ reset_last_Java_frame(rcx, false); // Load UnrollBlock into EDI __ mov(rdi, rax); @@ -2702,7 +2702,7 @@ void SharedRuntime::generate_deopt_blob() { __ push(rax); __ get_thread(rcx); - __ reset_last_Java_frame(rcx, false, false); + __ reset_last_Java_frame(rcx, false); // Collect return values __ movptr(rax,Address(rsp, (RegisterSaver::raxOffset() + additional_words + 1)*wordSize)); @@ -2806,7 +2806,7 @@ void SharedRuntime::generate_uncommon_trap_blob() { __ get_thread(rcx); - __ reset_last_Java_frame(rcx, false, false); + __ reset_last_Java_frame(rcx, false); // Load UnrollBlock into EDI __ movptr(rdi, rax); @@ -2912,7 +2912,7 @@ void SharedRuntime::generate_uncommon_trap_blob() { oop_maps->add_gc_map( __ pc()-start, new OopMap( framesize, 0 ) ); __ get_thread(rdi); - __ reset_last_Java_frame(rdi, true, false); + __ reset_last_Java_frame(rdi, true); // Pop self-frame. __ leave(); // Epilog! @@ -3007,7 +3007,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t // Clear last_Java_sp again __ get_thread(java_thread); - __ reset_last_Java_frame(java_thread, false, false); + __ reset_last_Java_frame(java_thread, false); __ cmpptr(Address(java_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); __ jcc(Assembler::equal, noException); @@ -3082,7 +3082,7 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha __ addptr(rsp, wordSize); // clear last_Java_sp - __ reset_last_Java_frame(thread, true, false); + __ reset_last_Java_frame(thread, true); // check for pending exceptions Label pending; __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp index 81ed472f462..76b7bb46e34 100644 --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp @@ -1461,7 +1461,7 @@ static void check_needs_gc_for_critical_native(MacroAssembler* masm, __ mov(rsp, r12); // restore sp __ reinit_heapbase(); - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); save_or_restore_arguments(masm, stack_slots, total_in_args, arg_save_area, NULL, in_regs, in_sig_bt); @@ -2577,7 +2577,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, restore_native_result(masm, ret_type, stack_slots); } - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); // Unpack oop result if (ret_type == T_OBJECT || ret_type == T_ARRAY) { @@ -2849,7 +2849,7 @@ void SharedRuntime::generate_deopt_blob() { __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap))); oop_maps->add_gc_map( __ pc()-start, map->deep_copy()); - __ reset_last_Java_frame(false, false); + __ reset_last_Java_frame(false); __ jmp(after_fetch_unroll_info_call); } // EnableJVMCI @@ -2939,7 +2939,7 @@ void SharedRuntime::generate_deopt_blob() { // find any register it might need. oop_maps->add_gc_map(__ pc() - start, map); - __ reset_last_Java_frame(false, false); + __ reset_last_Java_frame(false); #if INCLUDE_JVMCI if (EnableJVMCI) { @@ -3087,7 +3087,7 @@ void SharedRuntime::generate_deopt_blob() { new OopMap( frame_size_in_words, 0 )); // Clear fp AND pc - __ reset_last_Java_frame(true, true); + __ reset_last_Java_frame(true); // Collect return values __ movdbl(xmm0, Address(rsp, RegisterSaver::xmm0_offset_in_bytes())); @@ -3164,7 +3164,7 @@ void SharedRuntime::generate_uncommon_trap_blob() { oop_maps->add_gc_map(__ pc() - start, map); - __ reset_last_Java_frame(false, false); + __ reset_last_Java_frame(false); // Load UnrollBlock* into rdi __ mov(rdi, rax); @@ -3281,7 +3281,7 @@ void SharedRuntime::generate_uncommon_trap_blob() { oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); // Clear fp AND pc - __ reset_last_Java_frame(true, true); + __ reset_last_Java_frame(true); // Pop self-frame. __ leave(); // Epilog @@ -3364,7 +3364,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t Label noException; - __ reset_last_Java_frame(false, false); + __ reset_last_Java_frame(false); __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); __ jcc(Assembler::equal, noException); @@ -3434,7 +3434,7 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha // rax contains the address we are going to jump to assuming no exception got installed // clear last_Java_sp - __ reset_last_Java_frame(false, false); + __ reset_last_Java_frame(false); // check for pending exceptions Label pending; __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); @@ -3809,7 +3809,7 @@ void OptoRuntime::generate_exception_blob() { oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); - __ reset_last_Java_frame(false, true); + __ reset_last_Java_frame(false); // Restore callee-saved registers diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp index 60485a6a1d8..c52be1e17cb 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp @@ -3766,7 +3766,7 @@ class StubGenerator: public StubCodeGenerator { // however can use the register value directly if it is callee saved. __ get_thread(java_thread); - __ reset_last_Java_frame(java_thread, true, false); + __ reset_last_Java_frame(java_thread, true); __ leave(); // required for proper stackwalking of RuntimeStub frame diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 02e46bd02aa..668b3e1e128 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -5018,7 +5018,7 @@ class StubGenerator: public StubCodeGenerator { oop_maps->add_gc_map(the_pc - start, map); - __ reset_last_Java_frame(true, true); + __ reset_last_Java_frame(true); __ leave(); // required for proper stackwalking of RuntimeStub frame diff --git a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp index 225850e8f40..845959fe4e4 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp @@ -1167,7 +1167,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_Java); // reset_last_Java_frame - __ reset_last_Java_frame(thread, true, true); + __ reset_last_Java_frame(thread, true); // reset handle block __ movptr(t, Address(thread, JavaThread::active_handles_offset())); @@ -1659,7 +1659,7 @@ void TemplateInterpreterGenerator::generate_throw_exception() { __ set_last_Java_frame(noreg, rbp, __ pc()); __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), r15_thread, c_rarg1, c_rarg2); #endif - __ reset_last_Java_frame(thread, true, true); + __ reset_last_Java_frame(thread, true); // Restore the last_sp and null it out __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp index 9f99613b1e6..5f1c935f944 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -858,26 +858,23 @@ void TemplateTable::aload_0_internal(RewriteControl rc) { // get next byte __ load_unsigned_byte(rbx, at_bcp(Bytecodes::length_for(Bytecodes::_aload_0))); - // do actual aload_0 - aload(0); - // if _getfield then wait with rewrite __ cmpl(rbx, Bytecodes::_getfield); __ jcc(Assembler::equal, done); - // if _igetfield then reqrite to _fast_iaccess_0 + // if _igetfield then rewrite to _fast_iaccess_0 assert(Bytecodes::java_code(Bytecodes::_fast_iaccess_0) == Bytecodes::_aload_0, "fix bytecode definition"); __ cmpl(rbx, Bytecodes::_fast_igetfield); __ movl(bc, Bytecodes::_fast_iaccess_0); __ jccb(Assembler::equal, rewrite); - // if _agetfield then reqrite to _fast_aaccess_0 + // if _agetfield then rewrite to _fast_aaccess_0 assert(Bytecodes::java_code(Bytecodes::_fast_aaccess_0) == Bytecodes::_aload_0, "fix bytecode definition"); __ cmpl(rbx, Bytecodes::_fast_agetfield); __ movl(bc, Bytecodes::_fast_aaccess_0); __ jccb(Assembler::equal, rewrite); - // if _fgetfield then reqrite to _fast_faccess_0 + // if _fgetfield then rewrite to _fast_faccess_0 assert(Bytecodes::java_code(Bytecodes::_fast_faccess_0) == Bytecodes::_aload_0, "fix bytecode definition"); __ cmpl(rbx, Bytecodes::_fast_fgetfield); __ movl(bc, Bytecodes::_fast_faccess_0); @@ -893,9 +890,10 @@ void TemplateTable::aload_0_internal(RewriteControl rc) { patch_bytecode(Bytecodes::_aload_0, bc, rbx, false); __ bind(done); - } else { - aload(0); } + + // Do actual aload_0 (must do this after patch_bytecode which might call VM and GC might change oop). + aload(0); } void TemplateTable::istore() { diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index 52b58ec0281..6be113df68e 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -986,7 +986,7 @@ void MachEpilogNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const emit_opcode(cbuf, 0x58 | RBP_enc); if (StackReservedPages > 0 && C->has_reserved_stack_access()) { - __ reserved_stack_check(); + __ reserved_stack_check(); } if (do_polling() && C->is_method_compilation()) { @@ -7355,7 +7355,7 @@ instruct compareAndSwapB(rRegI res, "movzbl $res, $res" %} opcode(0x0F, 0xB0); ins_encode(lock_prefix, - REX_reg_mem(newval, mem_ptr), + REX_breg_mem(newval, mem_ptr), OpcP, OpcS, reg_mem(newval, mem_ptr), REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete @@ -7380,7 +7380,7 @@ instruct compareAndSwapS(rRegI res, opcode(0x0F, 0xB1); ins_encode(lock_prefix, SizePrefix, - REX_reg_mem(newval, mem_ptr), + REX_reg_mem(newval, mem_ptr), OpcP, OpcS, reg_mem(newval, mem_ptr), REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete @@ -7424,7 +7424,7 @@ instruct compareAndExchangeB( "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), + REX_breg_mem(newval, mem_ptr), OpcP, OpcS, reg_mem(newval, mem_ptr) // lock cmpxchg ); diff --git a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp index 9e91f22f266..1fcf7d9984b 100644 --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp @@ -37,7 +37,7 @@ #include "prims/jvmtiExport.hpp" #include "prims/jvmtiThreadState.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/interfaceSupport.hpp" diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java index 89bc1fcfce2..787060e9761 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java @@ -32,6 +32,7 @@ import sun.jvm.hotspot.types.CIntegerField; import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.TypeDataBase; import sun.jvm.hotspot.utilities.Assert; +import sun.jvm.hotspot.utilities.CStringUtilities; import java.io.PrintStream; import java.util.Observable; @@ -115,7 +116,7 @@ public class CodeBlob extends VMObject { } public String getName() { - return getName(); + return CStringUtilities.getString(nameField.getValue(addr)); } /** OopMap for frame; can return null if none available */ diff --git a/hotspot/src/os/aix/vm/attachListener_aix.cpp b/hotspot/src/os/aix/vm/attachListener_aix.cpp index 06225616bb6..a199c711820 100644 --- a/hotspot/src/os/aix/vm/attachListener_aix.cpp +++ b/hotspot/src/os/aix/vm/attachListener_aix.cpp @@ -494,7 +494,7 @@ void AttachListener::vm_start() { if (ret == 0) { ret = ::unlink(fn); if (ret == -1) { - debug_only(warning("failed to remove stale attach pid file at %s", fn)); + log_debug(attach)("Failed to remove stale attach pid file at %s", fn); } } } @@ -537,16 +537,23 @@ bool AttachListener::is_init_trigger() { struct stat64 st; RESTARTABLE(::stat64(fn, &st), ret); if (ret == -1) { + log_trace(attach)("Failed to find attach file: %s, trying alternate", fn); snprintf(fn, sizeof(fn), "%s/.attach_pid%d", os::get_temp_directory(), os::current_process_id()); RESTARTABLE(::stat64(fn, &st), ret); + if (ret == -1) { + log_debug(attach)("Failed to find attach file: %s", fn); + } } if (ret == 0) { // simple check to avoid starting the attach mechanism when // a bogus user creates the file if (st.st_uid == geteuid()) { init(); + log_trace(attach)("Attach trigerred by %s", fn); return true; + } else { + log_debug(attach)("File %s has wrong user id %d (vs %d). Attach is not triggered", fn, st.st_uid, geteuid()); } } return false; diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index dffad2b7f3f..6c668c16870 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -52,7 +52,7 @@ #include "prims/jvm.h" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/extendedPC.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.hpp" @@ -3800,10 +3800,6 @@ int os::stat(const char *path, struct stat *sbuf) { return ::stat(pathbuf, sbuf); } -bool os::check_heap(bool force) { - return true; -} - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL; diff --git a/hotspot/src/os/bsd/vm/attachListener_bsd.cpp b/hotspot/src/os/bsd/vm/attachListener_bsd.cpp index 57db0673fd2..f9246117812 100644 --- a/hotspot/src/os/bsd/vm/attachListener_bsd.cpp +++ b/hotspot/src/os/bsd/vm/attachListener_bsd.cpp @@ -456,7 +456,7 @@ void AttachListener::vm_start() { if (ret == 0) { ret = ::unlink(fn); if (ret == -1) { - debug_only(warning("failed to remove stale attach pid file at %s", fn)); + log_debug(attach)("Failed to remove stale attach pid file at %s", fn); } } } @@ -493,19 +493,25 @@ bool AttachListener::is_init_trigger() { if (init_at_startup() || is_initialized()) { return false; // initialized at startup or already initialized } - char path[PATH_MAX + 1]; + char fn[PATH_MAX + 1]; int ret; struct stat st; - snprintf(path, PATH_MAX + 1, "%s/.attach_pid%d", + snprintf(fn, PATH_MAX + 1, "%s/.attach_pid%d", os::get_temp_directory(), os::current_process_id()); - RESTARTABLE(::stat(path, &st), ret); + RESTARTABLE(::stat(fn, &st), ret); + if (ret == -1) { + log_debug(attach)("Failed to find attach file: %s", fn); + } if (ret == 0) { // simple check to avoid starting the attach mechanism when // a bogus user creates the file if (st.st_uid == geteuid()) { init(); + log_trace(attach)("Attach trigerred by %s", fn); return true; + } else { + log_debug(attach)("File %s has wrong user id %d (vs %d). Attach is not triggered", fn, st.st_uid, geteuid()); } } return false; diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index a40175df89c..39cfd207cc6 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -42,7 +42,7 @@ #include "prims/jvm.h" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/extendedPC.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.hpp" @@ -3780,11 +3780,6 @@ int os::compare_file_modified_times(const char* file1, const char* file2) { return diff; } - -bool os::check_heap(bool force) { - return true; -} - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL; diff --git a/hotspot/src/os/linux/vm/attachListener_linux.cpp b/hotspot/src/os/linux/vm/attachListener_linux.cpp index 4e54d898fb2..652d0de1201 100644 --- a/hotspot/src/os/linux/vm/attachListener_linux.cpp +++ b/hotspot/src/os/linux/vm/attachListener_linux.cpp @@ -453,7 +453,7 @@ void AttachListener::vm_start() { if (ret == 0) { ret = ::unlink(fn); if (ret == -1) { - debug_only(warning("failed to remove stale attach pid file at %s", fn)); + log_debug(attach)("Failed to remove stale attach pid file at %s", fn); } } } @@ -496,16 +496,23 @@ bool AttachListener::is_init_trigger() { struct stat64 st; RESTARTABLE(::stat64(fn, &st), ret); if (ret == -1) { + log_trace(attach)("Failed to find attach file: %s, trying alternate", fn); snprintf(fn, sizeof(fn), "%s/.attach_pid%d", os::get_temp_directory(), os::current_process_id()); RESTARTABLE(::stat64(fn, &st), ret); + if (ret == -1) { + log_debug(attach)("Failed to find attach file: %s", fn); + } } if (ret == 0) { // simple check to avoid starting the attach mechanism when // a bogus user creates the file if (st.st_uid == geteuid()) { init(); + log_trace(attach)("Attach trigerred by %s", fn); return true; + } else { + log_debug(attach)("File %s has wrong user id %d (vs %d). Attach is not trigerred", fn, st.st_uid, geteuid()); } } return false; diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 5f4f1174c9d..9248eb72e35 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -42,7 +42,7 @@ #include "prims/jvm.h" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/extendedPC.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.hpp" @@ -5174,10 +5174,6 @@ int os::stat(const char *path, struct stat *sbuf) { return ::stat(pathbuf, sbuf); } -bool os::check_heap(bool force) { - return true; -} - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL; diff --git a/hotspot/src/os/solaris/vm/attachListener_solaris.cpp b/hotspot/src/os/solaris/vm/attachListener_solaris.cpp index b6a4b434940..a1c078490ce 100644 --- a/hotspot/src/os/solaris/vm/attachListener_solaris.cpp +++ b/hotspot/src/os/solaris/vm/attachListener_solaris.cpp @@ -394,7 +394,7 @@ int SolarisAttachListener::create_door() { snprintf(initial_path, sizeof(initial_path), "%s.tmp", door_path); RESTARTABLE(::creat(initial_path, S_IRUSR | S_IWUSR), fd); if (fd == -1) { - debug_only(warning("attempt to create %s failed", initial_path)); + log_debug(attach)("attempt to create door file %s failed (%d)", initial_path, errno); ::door_revoke(dd); return -1; } @@ -409,6 +409,7 @@ int SolarisAttachListener::create_door() { res = ::fattach(dd, initial_path); } if (res == -1) { + log_debug(attach)("unable to create door - fattach failed (%d)", errno); ::door_revoke(dd); dd = -1; } @@ -419,12 +420,14 @@ int SolarisAttachListener::create_door() { if (::rename(initial_path, door_path) == -1) { ::close(dd); ::fdetach(initial_path); + log_debug(attach)("unable to create door - rename %s to %s failed (%d)", errno); dd = -1; } } if (dd >= 0) { set_door_descriptor(dd); set_door_path(door_path); + log_trace(attach)("door file %s created succesfully", door_path); } else { // unable to create door, attach it to file, or rename file into place ::unlink(initial_path); @@ -602,7 +605,7 @@ void AttachListener::vm_start() { if (ret == 0) { ret = ::unlink(fn); if (ret == -1) { - debug_only(warning("failed to remove stale attach pid file at %s", fn)); + log_debug(attach)("Failed to remove stale attach pid file at %s", fn); } } } @@ -645,9 +648,13 @@ bool AttachListener::is_init_trigger() { struct stat64 st; RESTARTABLE(::stat64(fn, &st), ret); if (ret == -1) { + log_trace(attach)("Failed to find attach file: %s, trying alternate", fn); snprintf(fn, sizeof(fn), "%s/.attach_pid%d", os::get_temp_directory(), os::current_process_id()); RESTARTABLE(::stat64(fn, &st), ret); + if (ret == -1) { + log_debug(attach)("Failed to find attach file: %s", fn); + } } if (ret == 0) { // simple check to avoid starting the attach mechanism when diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 3b9a3793a61..825a679dc19 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -42,7 +42,7 @@ #include "prims/jvm.h" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/extendedPC.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.hpp" @@ -4589,10 +4589,6 @@ void os::make_polling_page_readable(void) { } } -// OS interface. - -bool os::check_heap(bool force) { return true; } - // Is a (classpath) directory empty? bool os::dir_is_empty(const char* path) { DIR *dir = NULL; diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 5dfdab012d6..24b39189e76 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -45,7 +45,7 @@ #include "prims/jvm.h" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/extendedPC.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.hpp" @@ -5258,75 +5258,6 @@ int os::fork_and_exec(char* cmd) { } } -//-------------------------------------------------------------------------------------------------- -// Non-product code - -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) { - // Note: HeapValidate executes two hardware breakpoints when it finds something - // wrong; at these points, eax contains the address of the offending block (I think). - // To get to the exlicit error message(s) below, just continue twice. - // - // Note: we want to check the CRT heap, which is not necessarily located in the - // process default heap. - HANDLE heap = (HANDLE) _get_heap_handle(); - if (!heap) { - return true; - } - - // If we fail to lock the heap, then gflags.exe has been used - // or some other special heap flag has been set that prevents - // locking. We don't try to walk a heap we can't lock. - 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, 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(); - if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED && - (err == ERROR_INVALID_FUNCTION && phe.lpData != NULL)) { - HeapUnlock(heap); - fatal("heap walk aborted with error %d", err); - } - HeapUnlock(heap); - } - mallocDebugIntervalCounter = 0; - } - return true; -} - - bool os::find(address addr, outputStream* st) { int offset = -1; bool result = false; diff --git a/hotspot/src/os/windows/vm/threadCritical_windows.cpp b/hotspot/src/os/windows/vm/threadCritical_windows.cpp index 3ea83c1acb6..b432f7bb078 100644 --- a/hotspot/src/os/windows/vm/threadCritical_windows.cpp +++ b/hotspot/src/os/windows/vm/threadCritical_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, 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 @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/thread.inline.hpp" #include "runtime/threadCritical.hpp" diff --git a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp similarity index 98% rename from hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp rename to hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp index a7462ad395e..efa550bffea 100644 --- a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp +++ b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,11 +23,8 @@ * */ -#ifndef OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP -#define OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP - -#include "runtime/atomic.hpp" -#include "runtime/os.hpp" +#ifndef OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_HPP +#define OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_HPP #ifndef _LP64 #error "Atomic currently only impleneted for PPC64" @@ -479,4 +476,4 @@ inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void #undef strasm_nobarrier #undef strasm_nobarrier_clobber_memory -#endif // OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP +#endif // OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_HPP diff --git a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.hpp similarity index 97% rename from hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp rename to hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.hpp index 8310003a8f1..92b5b9311ae 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,10 +22,9 @@ * */ -#ifndef OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP -#define OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP +#ifndef OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_HPP +#define OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_HPP -#include "runtime/atomic.hpp" #include "runtime/os.hpp" // Implementation of class atomic @@ -225,4 +224,4 @@ inline void Atomic::store(jlong store_value, volatile jlong* dest) { #endif // AMD64 -#endif // OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP +#endif // OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_HPP diff --git a/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp b/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp index bc28eb2b2d4..038d6f985d5 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #ifndef OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP #define OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" diff --git a/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp index df36e6edbe1..9747e0aab65 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp @@ -45,7 +45,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) // If we have a last_Java_frame, then we should use it even if // isInJava == true. It should be more reliable than ucontext info. - if (jt->has_last_Java_frame()) { + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { *fr_addr = jt->pd_last_frame(); return true; } diff --git a/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp b/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp index 1d7921c7114..b1717c5c22a 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/thread_bsd_x86.hpp @@ -32,12 +32,8 @@ frame pd_last_frame() { assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); - if (_anchor.last_Java_pc() != NULL) { - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); - } else { - // This will pick up pc from sp - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); - } + vmassert(_anchor.last_Java_pc() != NULL, "not walkable"); + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); } public: diff --git a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp similarity index 97% rename from hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp rename to hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp index 4490e49020c..e8083400ec1 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011, 2015, Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,10 +23,9 @@ * */ -#ifndef OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP -#define OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP +#ifndef OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP +#define OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP -#include "runtime/atomic.hpp" #include "runtime/os.hpp" // Implementation of class atomic @@ -331,4 +330,4 @@ inline void Atomic::store(jlong store_value, volatile jlong* dest) { os::atomic_copy64((volatile jlong*)&store_value, dest); } -#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP +#endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.inline.hpp b/hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.hpp similarity index 94% rename from hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.inline.hpp rename to hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.hpp index 95d007fc21b..77dd34a663e 100644 --- a/hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.inline.hpp +++ b/hotspot/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,11 +23,9 @@ * */ -#ifndef OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_INLINE_HPP -#define OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_INLINE_HPP +#ifndef OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP +#define OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP -#include "runtime/atomic.hpp" -#include "runtime/os.hpp" #include "vm_version_aarch64.hpp" // Implementation of class atomic @@ -161,4 +159,4 @@ inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void inline jlong Atomic::load(volatile jlong* src) { return *src; } -#endif // OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_INLINE_HPP +#endif // OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/orderAccess_linux_aarch64.inline.hpp b/hotspot/src/os_cpu/linux_aarch64/vm/orderAccess_linux_aarch64.inline.hpp index adeaa0ad1fd..03c6b314d56 100644 --- a/hotspot/src/os_cpu/linux_aarch64/vm/orderAccess_linux_aarch64.inline.hpp +++ b/hotspot/src/os_cpu/linux_aarch64/vm/orderAccess_linux_aarch64.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -26,7 +26,7 @@ #ifndef OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP #define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" #include "vm_version_aarch64.hpp" diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp index 07206d873d7..f0f2e05ccf1 100644 --- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp +++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp @@ -47,7 +47,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) // If we have a last_Java_frame, then we should use it even if // isInJava == true. It should be more reliable than ucontext info. - if (jt->has_last_Java_frame()) { + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { *fr_addr = jt->pd_last_frame(); return true; } diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp index 70e37cecaeb..95127e67421 100644 --- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp +++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp @@ -43,12 +43,7 @@ frame pd_last_frame() { assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); - if (_anchor.last_Java_pc() != NULL) { - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); - } else { - // This will pick up pc from sp - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); - } + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); } public: diff --git a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp similarity index 98% rename from hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp rename to hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp index 6c8498c4508..0f4a5a8447d 100644 --- a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp +++ b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,11 +23,8 @@ * */ -#ifndef OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP -#define OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP - -#include "runtime/atomic.hpp" -#include "runtime/os.hpp" +#ifndef OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_HPP +#define OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_HPP #ifndef PPC64 #error "Atomic currently only implemented for PPC64" @@ -479,4 +476,4 @@ inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* dest, void #undef strasm_nobarrier #undef strasm_nobarrier_clobber_memory -#endif // OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP +#endif // OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_HPP diff --git a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp index b0df28daea3..5830beba77d 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,6 @@ #ifndef OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP #define OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP -#include "runtime/atomic.hpp" -#include "runtime/os.hpp" - // Implementation of class atomic inline void Atomic::store (jbyte store_value, jbyte* dest) { *dest = store_value; } diff --git a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.hpp similarity index 97% rename from hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp rename to hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.hpp index faf0a8043f7..7b51da41ce0 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,10 +22,9 @@ * */ -#ifndef OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP -#define OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP +#ifndef OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_HPP +#define OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_HPP -#include "runtime/atomic.hpp" #include "runtime/os.hpp" // Implementation of class atomic @@ -225,4 +224,4 @@ inline void Atomic::store(jlong store_value, volatile jlong* dest) { #endif // AMD64 -#endif // OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP +#endif // OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_HPP diff --git a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp index b4aceaf5a91..0f564216e13 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #ifndef OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP #define OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" diff --git a/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp index 3075dd19dd3..59991b7765f 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp @@ -46,7 +46,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) // If we have a last_Java_frame, then we should use it even if // isInJava == true. It should be more reliable than ucontext info. - if (jt->has_last_Java_frame()) { + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { *fr_addr = jt->pd_last_frame(); return true; } diff --git a/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.hpp b/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.hpp index 75fb7df5787..ab8bd4c3cb9 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/thread_linux_x86.hpp @@ -32,12 +32,8 @@ frame pd_last_frame() { assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); - if (_anchor.last_Java_pc() != NULL) { - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); - } else { - // This will pick up pc from sp - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); - } + vmassert(_anchor.last_Java_pc() != NULL, "not walkable"); + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); } public: diff --git a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp similarity index 97% rename from hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp rename to hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp index 4a9b2c05da9..7c3235ffd06 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp +++ b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011, 2015, Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,10 +23,9 @@ * */ -#ifndef OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP -#define OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP +#ifndef OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP +#define OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP -#include "runtime/atomic.hpp" #include "runtime/os.hpp" // Implementation of class atomic @@ -325,4 +324,4 @@ inline void Atomic::store(jlong store_value, volatile jlong* dest) { os::atomic_copy64((volatile jlong*)&store_value, dest); } -#endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP +#endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp b/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.hpp similarity index 97% rename from hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp rename to hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.hpp index 03c4326073a..3c292a4dea0 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,10 +22,9 @@ * */ -#ifndef OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP -#define OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP +#ifndef OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_HPP +#define OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_HPP -#include "runtime/atomic.hpp" #include "runtime/os.hpp" // Implementation of class atomic @@ -374,4 +373,4 @@ inline void* Atomic::cmpxchg_ptr(void* exchange_value, volatile void* #endif // _GNU_SOURCE -#endif // OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP +#endif // OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_HPP diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp b/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp index 4bf5833a458..7a74147d6a0 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #ifndef OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP #define OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" // Compiler version last used for testing: solaris studio 12u3 diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index be5134db66f..a4a4e3da963 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -274,8 +274,14 @@ bool os::Solaris::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_ // stack overflow handling return false; } else { - *fr = os::fetch_frame_from_ucontext(thread, uc); - *fr = frame(fr->sender_sp(), fr->sp()); + // Returned frame will be the caller of the method that faults on the stack bang. + // Register window not yet rotated (happens at SAVE after stack bang), so there is no new + // frame to go with the faulting PC. Using caller SP that is still in SP, and caller PC + // that was written to O7 at call. + intptr_t* sp = os::Solaris::ucontext_get_sp(uc); + address pc = (address)uc->uc_mcontext.gregs[REG_O7]; + *fr = frame(sp, frame::unpatchable, pc); + if (!fr->is_java_frame()) { assert(fr->safe_for_sender(thread), "Safety check"); *fr = fr->java_sender(); diff --git a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.hpp similarity index 97% rename from hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp rename to hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.hpp index e856b755cf2..44f269912f5 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,10 +22,9 @@ * */ -#ifndef OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP -#define OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP +#ifndef OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP +#define OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP -#include "runtime/atomic.hpp" #include "runtime/os.hpp" inline void Atomic::store (jbyte store_value, jbyte* dest) { *dest = store_value; } @@ -276,4 +275,4 @@ extern "C" { #endif // _GNU_SOURCE -#endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP +#endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP diff --git a/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp b/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp index af4e2e29337..b88e715e4d4 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #ifndef OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP #define OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index 7713550f374..ef64ff751d0 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -38,7 +38,7 @@ #include "prims/jvm.h" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/extendedPC.hpp" #include "runtime/frame.inline.hpp" #include "runtime/interfaceSupport.hpp" diff --git a/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp index 48af49f7497..4f413baaca3 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp @@ -45,9 +45,8 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, assert(this->is_Java_thread(), "must be JavaThread"); JavaThread* jt = (JavaThread *)this; - // last_Java_frame is always walkable and safe use it if we have it - - if (jt->has_last_Java_frame()) { + // There is small window where last_Java_frame is not walkable or safe + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { *fr_addr = jt->pd_last_frame(); return true; } diff --git a/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.hpp b/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.hpp index 7589a81a83b..934f80a04fe 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/thread_solaris_x86.hpp @@ -30,12 +30,8 @@ frame pd_last_frame() { assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); - if (_anchor.last_Java_pc() != NULL) { - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); - } else { - // This will pick up pc from sp - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); - } + vmassert(_anchor.last_Java_pc() != NULL, "not walkable"); + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); } public: diff --git a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.hpp similarity index 97% rename from hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp rename to hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.hpp index 3d7662e5cd7..953e13d8ddf 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,10 +22,9 @@ * */ -#ifndef OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP -#define OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP +#ifndef OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_HPP +#define OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_HPP -#include "runtime/atomic.hpp" #include "runtime/os.hpp" // The following alternative implementations are needed because @@ -301,4 +300,4 @@ inline void Atomic::store(jlong store_value, jlong* dest) { #pragma warning(default: 4035) // Enables warnings reporting missing return statement -#endif // OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP +#endif // OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_HPP diff --git a/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp b/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp index 8481bd93f30..36c1c4a42c0 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #define OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP #include -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" diff --git a/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp index ba5be5736cf..c093c146842 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp +++ b/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp @@ -48,7 +48,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) // If we have a last_Java_frame, then we should use it even if // isInJava == true. It should be more reliable than CONTEXT info. - if (jt->has_last_Java_frame()) { + if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { *fr_addr = jt->pd_last_frame(); return true; } diff --git a/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.hpp index 65aac35109a..8d6e5f820f8 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/thread_windows_x86.hpp @@ -32,12 +32,8 @@ frame pd_last_frame() { assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); - if (_anchor.last_Java_pc() != NULL) { - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); - } else { - // This will pick up pc from sp - return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp()); - } + vmassert(_anchor.last_Java_pc() != NULL, "not walkable"); + return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); } public: diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp index fe8dbb1b401..120b68e39a7 100644 --- a/hotspot/src/share/vm/asm/assembler.cpp +++ b/hotspot/src/share/vm/asm/assembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #include "asm/codeBuffer.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/icache.hpp" #include "runtime/os.hpp" #include "runtime/thread.hpp" diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index 7120e76c874..d78cdc81cf2 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -4255,7 +4255,7 @@ void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool succes #if INCLUDE_TRACE EventCompilerInlining event; if (event.should_commit()) { - event.set_compileID(compilation()->env()->task()->compile_id()); + event.set_compileId(compilation()->env()->task()->compile_id()); event.set_message(msg); event.set_succeeded(success); event.set_bci(bci()); diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp index 3ee774ec00f..bbb5ef87c67 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -49,7 +49,7 @@ #include "memory/resourceArea.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/interfaceSupport.hpp" diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index 323b75a5016..024909b1cbc 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -1149,10 +1149,10 @@ void ciEnv::record_failure(const char* reason) { void ciEnv::report_failure(const char* reason) { // Create and fire JFR event - EventCompilerFailure event; + EventCompilationFailure event; if (event.should_commit()) { - event.set_compileID(compile_id()); - event.set_failure(reason); + event.set_compileId(compile_id()); + event.set_failureMessage(reason); event.commit(); } } diff --git a/hotspot/src/share/vm/ci/ciMethod.cpp b/hotspot/src/share/vm/ci/ciMethod.cpp index a54c0a724de..4860427786f 100644 --- a/hotspot/src/share/vm/ci/ciMethod.cpp +++ b/hotspot/src/share/vm/ci/ciMethod.cpp @@ -1410,11 +1410,11 @@ void ciMethod::print_impl(outputStream* st) { } #if INCLUDE_TRACE -TraceStructCiMethod ciMethod::to_trace_struct() const { - TraceStructCiMethod result; - result.set_class(holder()->name()->as_utf8()); +TraceStructCalleeMethod ciMethod::to_trace_struct() const { + TraceStructCalleeMethod result; + result.set_type(holder()->name()->as_utf8()); result.set_name(name()->as_utf8()); - result.set_signature(signature()->as_symbol()->as_utf8()); + result.set_descriptor(signature()->as_symbol()->as_utf8()); return result; } #endif diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp index 7a56f1cf2a5..94e6ac523c7 100644 --- a/hotspot/src/share/vm/ci/ciMethod.hpp +++ b/hotspot/src/share/vm/ci/ciMethod.hpp @@ -342,7 +342,7 @@ class ciMethod : public ciMetadata { void print_short_name(outputStream* st = tty); #if INCLUDE_TRACE - TraceStructCiMethod to_trace_struct() const; + TraceStructCalleeMethod to_trace_struct() const; #endif }; diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index 0028f1ae37d..30262696a8c 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -5844,6 +5844,7 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st _super_klass, _methods, _access_flags, + _major_version, _loader_data->class_loader(), _class_name, _local_interfaces, diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp index 09ddbf40b92..ba1191614b1 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp @@ -63,7 +63,7 @@ #include "memory/resourceArea.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/javaCalls.hpp" #include "runtime/jniHandles.hpp" #include "runtime/mutex.hpp" diff --git a/hotspot/src/share/vm/classfile/klassFactory.cpp b/hotspot/src/share/vm/classfile/klassFactory.cpp index 6eb6ccc9405..4d08ea3329c 100644 --- a/hotspot/src/share/vm/classfile/klassFactory.cpp +++ b/hotspot/src/share/vm/classfile/klassFactory.cpp @@ -31,12 +31,12 @@ #include "prims/jvmtiEnvBase.hpp" #include "trace/traceMacros.hpp" -static ClassFileStream* prologue(ClassFileStream* stream, - Symbol* name, - ClassLoaderData* loader_data, - Handle protection_domain, - JvmtiCachedClassFileData** cached_class_file, - TRAPS) { +static ClassFileStream* check_class_file_load_hook(ClassFileStream* stream, + Symbol* name, + ClassLoaderData* loader_data, + Handle protection_domain, + JvmtiCachedClassFileData** cached_class_file, + TRAPS) { assert(stream != NULL, "invariant"); @@ -102,8 +102,6 @@ instanceKlassHandle KlassFactory::create_from_stream(ClassFileStream* stream, assert(loader_data != NULL, "invariant"); assert(THREAD->is_Java_thread(), "must be a JavaThread"); - bool changed_by_loadhook = false; - ResourceMark rm; HandleMark hm; @@ -111,12 +109,15 @@ instanceKlassHandle KlassFactory::create_from_stream(ClassFileStream* stream, ClassFileStream* old_stream = stream; - stream = prologue(stream, - name, - loader_data, - protection_domain, - &cached_class_file, - CHECK_NULL); + // Skip this processing for VM anonymous classes + if (host_klass == NULL) { + stream = check_class_file_load_hook(stream, + name, + loader_data, + protection_domain, + &cached_class_file, + CHECK_NULL); + } ClassFileParser parser(stream, name, diff --git a/hotspot/src/share/vm/classfile/stringTable.cpp b/hotspot/src/share/vm/classfile/stringTable.cpp index abf662cb403..7d3fe1636f2 100644 --- a/hotspot/src/share/vm/classfile/stringTable.cpp +++ b/hotspot/src/share/vm/classfile/stringTable.cpp @@ -34,7 +34,7 @@ #include "memory/filemap.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/hashtable.inline.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index f4997a7ca70..8f51f527508 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -34,7 +34,7 @@ #include "memory/filemap.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/hashtable.inline.hpp" diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 033980e3d78..70f9e6a169f 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -1641,7 +1641,6 @@ void SystemDictionary::define_instance_class(instanceKlassHandle k, TRAPS) { JvmtiExport::post_class_load((JavaThread *) THREAD, k()); } - TRACE_KLASS_DEFINITION(k, THREAD); class_define_event(k); } diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp index d09518c011f..db757f7faa0 100644 --- a/hotspot/src/share/vm/code/nmethod.cpp +++ b/hotspot/src/share/vm/code/nmethod.cpp @@ -41,7 +41,7 @@ #include "oops/methodData.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiImpl.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/os.hpp" #include "runtime/sharedRuntime.hpp" diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index f9768b50d99..b3bc80c6a51 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -42,7 +42,7 @@ #include "prims/nativeLookup.hpp" #include "prims/whitebox.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/init.hpp" #include "runtime/interfaceSupport.hpp" @@ -1755,7 +1755,7 @@ void CompileBroker::post_compile(CompilerThread* thread, CompileTask* task, Even assert(task->compile_id() != CICrashAt, "just as planned"); if (event.should_commit()) { event.set_method(task->method()); - event.set_compileID(task->compile_id()); + event.set_compileId(task->compile_id()); event.set_compileLevel(task->comp_level()); event.set_succeded(task->is_success()); event.set_isOsr(task->osr_bci() != CompileBroker::standard_entry_bci); @@ -2399,4 +2399,3 @@ void CompileBroker::print_last_compile() { } } } - diff --git a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp index cbbbfbded27..6d78865ac43 100644 --- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp @@ -61,7 +61,7 @@ #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" diff --git a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp index da6b6d623a3..e8f606eecc8 100644 --- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp @@ -50,7 +50,7 @@ #include "memory/resourceArea.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/handles.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" diff --git a/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp b/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp index cc9dbf46e67..1e757b8009d 100644 --- a/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp +++ b/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp @@ -26,7 +26,7 @@ #include "gc/g1/collectionSetChooser.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/shared/space.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" // Even though we don't use the GC efficiency in our heuristics as // much as we used to, we still order according to GC efficiency. This diff --git a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp index b16ccc6fed0..dcd88be5057 100644 --- a/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp +++ b/hotspot/src/share/vm/gc/g1/dirtyCardQueue.cpp @@ -27,7 +27,7 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "gc/shared/workgroup.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" #include "runtime/thread.inline.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp b/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp index 100b894ecc1..fc6fe469625 100644 --- a/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp @@ -30,7 +30,7 @@ #include "gc/shared/workgroup.hpp" #include "logging/log.hpp" #include "memory/universe.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/globals.hpp" #include "runtime/os.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp index d84e1000763..e1462e9343c 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp @@ -74,7 +74,7 @@ #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/init.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/vmThread.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp index 454c5989484..27f4071b7bf 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp @@ -52,7 +52,7 @@ #include "memory/allocation.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" #include "runtime/prefetch.inline.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1EvacStats.inline.hpp b/hotspot/src/share/vm/gc/g1/g1EvacStats.inline.hpp index 337d4625707..007f62d3af4 100644 --- a/hotspot/src/share/vm/gc/g1/g1EvacStats.inline.hpp +++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.inline.hpp @@ -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 @@ -26,7 +26,7 @@ #define SHARE_VM_GC_G1_G1EVACSTATS_INLINE_HPP #include "gc/g1/g1EvacStats.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" inline void G1EvacStats::add_direct_allocated(size_t value) { Atomic::add_ptr(value, &_direct_allocated); diff --git a/hotspot/src/share/vm/gc/g1/g1HotCardCache.cpp b/hotspot/src/share/vm/gc/g1/g1HotCardCache.cpp index aae9c94f0f6..c18fb36afaf 100644 --- a/hotspot/src/share/vm/gc/g1/g1HotCardCache.cpp +++ b/hotspot/src/share/vm/gc/g1/g1HotCardCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #include "gc/g1/dirtyCardQueue.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1HotCardCache.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" G1HotCardCache::G1HotCardCache(G1CollectedHeap *g1h): _g1h(g1h), _hot_cache(NULL), _use_cache(false), _card_counts(g1h) {} diff --git a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp index 3d8866de817..4eed0960dca 100644 --- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp @@ -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 @@ -45,7 +45,7 @@ #include "oops/instanceRefKlass.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/fprofiler.hpp" #include "runtime/synchronizer.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp index c701b700c6a..006a658f5d8 100644 --- a/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp +++ b/hotspot/src/share/vm/gc/g1/g1SATBCardTableModRefBS.cpp @@ -30,7 +30,7 @@ #include "gc/shared/memset_with_concurrent_readers.hpp" #include "logging/log.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/thread.inline.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1StringDedup.cpp b/hotspot/src/share/vm/gc/g1/g1StringDedup.cpp index 8b8ce067eaf..e9f91bd2c1b 100644 --- a/hotspot/src/share/vm/gc/g1/g1StringDedup.cpp +++ b/hotspot/src/share/vm/gc/g1/g1StringDedup.cpp @@ -31,7 +31,7 @@ #include "gc/g1/g1StringDedupStat.hpp" #include "gc/g1/g1StringDedupTable.hpp" #include "gc/g1/g1StringDedupThread.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" bool G1StringDedup::_enabled = false; diff --git a/hotspot/src/share/vm/gc/g1/g1StringDedup.hpp b/hotspot/src/share/vm/gc/g1/g1StringDedup.hpp index 9191613787b..6ed8f22b74a 100644 --- a/hotspot/src/share/vm/gc/g1/g1StringDedup.hpp +++ b/hotspot/src/share/vm/gc/g1/g1StringDedup.hpp @@ -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 @@ -84,7 +84,6 @@ #include "memory/allocation.hpp" #include "oops/oop.hpp" -#include "runtime/atomic.hpp" class OopClosure; class BoolObjectClosure; diff --git a/hotspot/src/share/vm/gc/g1/g1StringDedupQueue.cpp b/hotspot/src/share/vm/gc/g1/g1StringDedupQueue.cpp index 3bca86a80a5..b029c3f2b40 100644 --- a/hotspot/src/share/vm/gc/g1/g1StringDedupQueue.cpp +++ b/hotspot/src/share/vm/gc/g1/g1StringDedupQueue.cpp @@ -30,7 +30,7 @@ #include "gc/shared/gcLocker.hpp" #include "logging/log.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/stack.inline.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1StringDedupThread.cpp b/hotspot/src/share/vm/gc/g1/g1StringDedupThread.cpp index 0bdfc193064..f0b25d3c6a9 100644 --- a/hotspot/src/share/vm/gc/g1/g1StringDedupThread.cpp +++ b/hotspot/src/share/vm/gc/g1/g1StringDedupThread.cpp @@ -31,7 +31,7 @@ #include "gc/g1/suspendibleThreadSet.hpp" #include "logging/log.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" G1StringDedupThread* G1StringDedupThread::_thread = NULL; diff --git a/hotspot/src/share/vm/gc/g1/heapRegion.cpp b/hotspot/src/share/vm/gc/g1/heapRegion.cpp index 13143a32afe..33d8268855d 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp @@ -39,7 +39,7 @@ #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.inline.hpp" int HeapRegion::LogOfHRGrainBytes = 0; diff --git a/hotspot/src/share/vm/gc/g1/heapRegion.inline.hpp b/hotspot/src/share/vm/gc/g1/heapRegion.inline.hpp index 248e0befa1d..01c53283579 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegion.inline.hpp +++ b/hotspot/src/share/vm/gc/g1/heapRegion.inline.hpp @@ -30,7 +30,7 @@ #include "gc/g1/heapRegion.hpp" #include "gc/shared/space.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" inline HeapWord* G1ContiguousSpace::allocate_impl(size_t min_word_size, size_t desired_word_size, diff --git a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp index ad4821ae4fd..9aa4da68968 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp +++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp @@ -33,7 +33,7 @@ #include "memory/allocation.hpp" #include "memory/padded.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/growableArray.hpp" diff --git a/hotspot/src/share/vm/gc/g1/heapRegionTracer.cpp b/hotspot/src/share/vm/gc/g1/heapRegionTracer.cpp index ec3febd2f64..35baa9d5d66 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegionTracer.cpp +++ b/hotspot/src/share/vm/gc/g1/heapRegionTracer.cpp @@ -39,7 +39,7 @@ void HeapRegionTracer::send_region_type_change(uint index, e.set_to(to); e.set_start(start); e.set_used(used); - e.set_allocContext(allocationContext); + e.set_allocationContext(allocationContext); e.commit(); } } diff --git a/hotspot/src/share/vm/gc/g1/sparsePRT.cpp b/hotspot/src/share/vm/gc/g1/sparsePRT.cpp index cab39b36e91..44e43465ce6 100644 --- a/hotspot/src/share/vm/gc/g1/sparsePRT.cpp +++ b/hotspot/src/share/vm/gc/g1/sparsePRT.cpp @@ -30,7 +30,7 @@ #include "gc/shared/cardTableModRefBS.hpp" #include "gc/shared/space.inline.hpp" #include "memory/allocation.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" // Check that the size of the SparsePRTEntry is evenly divisible by the maximum diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp index 42e67119e0a..48eb3c4163d 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp @@ -30,7 +30,7 @@ #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/handles.hpp" #include "runtime/handles.inline.hpp" #include "runtime/os.hpp" diff --git a/hotspot/src/share/vm/gc/parallel/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc/parallel/mutableNUMASpace.cpp index e53d195d639..c4cb76d5c86 100644 --- a/hotspot/src/share/vm/gc/parallel/mutableNUMASpace.cpp +++ b/hotspot/src/share/vm/gc/parallel/mutableNUMASpace.cpp @@ -1,6 +1,5 @@ - /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 +27,7 @@ #include "gc/shared/collectedHeap.hpp" #include "gc/shared/spaceDecorator.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/thread.inline.hpp" MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) { diff --git a/hotspot/src/share/vm/gc/parallel/mutableSpace.cpp b/hotspot/src/share/vm/gc/parallel/mutableSpace.cpp index 4db21472ec5..61dc795d484 100644 --- a/hotspot/src/share/vm/gc/parallel/mutableSpace.cpp +++ b/hotspot/src/share/vm/gc/parallel/mutableSpace.cpp @@ -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 @@ -26,7 +26,7 @@ #include "gc/parallel/mutableSpace.hpp" #include "gc/shared/spaceDecorator.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/safepoint.hpp" #include "runtime/thread.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp b/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp index 39b63acb016..df29bbdcde4 100644 --- a/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp +++ b/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp @@ -27,7 +27,7 @@ #include "gc/parallel/psCompactionManager.inline.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "services/memTracker.hpp" #include "utilities/bitMap.inline.hpp" diff --git a/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp b/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp index 2884b4c7df6..fc3e9088ea9 100644 --- a/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp +++ b/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp @@ -38,7 +38,7 @@ #include "oops/instanceMirrorKlass.inline.hpp" #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" PSOldGen* ParCompactionManager::_old_gen = NULL; ParCompactionManager** ParCompactionManager::_manager_array = NULL; diff --git a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp index d16e510a5f5..ccd464892e4 100644 --- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp @@ -57,7 +57,7 @@ #include "oops/methodData.hpp" #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/fprofiler.hpp" #include "runtime/safepoint.hpp" #include "runtime/vmThread.hpp" diff --git a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp index a10a9f18c62..147bc06d305 100644 --- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp +++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp @@ -46,7 +46,7 @@ #include "memory/resourceArea.hpp" #include "oops/instanceRefKlass.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/java.hpp" #include "runtime/prefetch.inline.hpp" #include "runtime/thread.inline.hpp" diff --git a/hotspot/src/share/vm/gc/shared/allocTracer.cpp b/hotspot/src/share/vm/gc/shared/allocTracer.cpp index af427a8289f..5f79a3310b3 100644 --- a/hotspot/src/share/vm/gc/shared/allocTracer.cpp +++ b/hotspot/src/share/vm/gc/shared/allocTracer.cpp @@ -29,18 +29,18 @@ #include "utilities/globalDefinitions.hpp" void AllocTracer::send_allocation_outside_tlab_event(KlassHandle klass, size_t alloc_size) { - EventAllocObjectOutsideTLAB event; + EventObjectAllocationOutsideTLAB event; if (event.should_commit()) { - event.set_class(klass()); + event.set_objectClass(klass()); event.set_allocationSize(alloc_size); event.commit(); } } void AllocTracer::send_allocation_in_new_tlab_event(KlassHandle klass, size_t tlab_size, size_t alloc_size) { - EventAllocObjectInNewTLAB event; + EventObjectAllocationInNewTLAB event; if (event.should_commit()) { - event.set_class(klass()); + event.set_objectClass(klass()); event.set_allocationSize(alloc_size); event.set_tlabSize(tlab_size); event.commit(); diff --git a/hotspot/src/share/vm/gc/shared/cardTableRS.cpp b/hotspot/src/share/vm/gc/shared/cardTableRS.cpp index 5e28170a2aa..eabc5156902 100644 --- a/hotspot/src/share/vm/gc/shared/cardTableRS.cpp +++ b/hotspot/src/share/vm/gc/shared/cardTableRS.cpp @@ -29,7 +29,7 @@ #include "gc/shared/space.inline.hpp" #include "memory/allocation.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/gc/shared/gcLocker.cpp b/hotspot/src/share/vm/gc/shared/gcLocker.cpp index cc847261efd..4b72cd80bfd 100644 --- a/hotspot/src/share/vm/gc/shared/gcLocker.cpp +++ b/hotspot/src/share/vm/gc/shared/gcLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ #include "gc/shared/gcLocker.inline.hpp" #include "memory/resourceArea.hpp" #include "logging/log.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/thread.inline.hpp" volatile jint GCLocker::_jni_lock_count = 0; diff --git a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp index e51e8fe8f54..046db77d4d5 100644 --- a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp +++ b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp @@ -43,7 +43,7 @@ typedef uintptr_t TraceAddress; void GCTracer::send_garbage_collection_event() const { - EventGCGarbageCollection event(UNTIMED); + EventGarbageCollection event(UNTIMED); if (event.should_commit()) { event.set_gcId(GCId::current()); event.set_name(_shared_gc_info.name()); @@ -91,7 +91,7 @@ void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspa } void ParallelOldTracer::send_parallel_old_event() const { - EventGCParallelOld e(UNTIMED); + EventParallelOldGarbageCollection e(UNTIMED); if (e.should_commit()) { e.set_gcId(GCId::current()); e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix()); @@ -102,7 +102,7 @@ void ParallelOldTracer::send_parallel_old_event() const { } void YoungGCTracer::send_young_gc_event() const { - EventGCYoungGarbageCollection e(UNTIMED); + EventYoungGarbageCollection e(UNTIMED); if (e.should_commit()) { e.set_gcId(GCId::current()); e.set_tenuringThreshold(_tenuring_threshold); @@ -127,7 +127,7 @@ void YoungGCTracer::send_promotion_in_new_plab_event(Klass* klass, size_t obj_si EventPromoteObjectInNewPLAB event; if (event.should_commit()) { event.set_gcId(GCId::current()); - event.set_class(klass); + event.set_objectClass(klass); event.set_objectSize(obj_size); event.set_tenured(tenured); event.set_tenuringAge(age); @@ -142,7 +142,7 @@ void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_s EventPromoteObjectOutsidePLAB event; if (event.should_commit()) { event.set_gcId(GCId::current()); - event.set_class(klass); + event.set_objectClass(klass); event.set_objectSize(obj_size); event.set_tenured(tenured); event.set_tenuringAge(age); @@ -151,7 +151,7 @@ void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_s } void OldGCTracer::send_old_gc_event() const { - EventGCOldGarbageCollection e(UNTIMED); + EventOldGarbageCollection e(UNTIMED); if (e.should_commit()) { e.set_gcId(GCId::current()); e.set_starttime(_shared_gc_info.start_timestamp()); @@ -173,7 +173,7 @@ void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_in EventPromotionFailed e; if (e.should_commit()) { e.set_gcId(GCId::current()); - e.set_data(to_trace_struct(pf_info)); + e.set_promotionFailed(to_trace_struct(pf_info)); e.set_thread(pf_info.thread_trace_id()); e.commit(); } @@ -190,7 +190,7 @@ void OldGCTracer::send_concurrent_mode_failure_event() { #if INCLUDE_ALL_GCS void G1NewTracer::send_g1_young_gc_event() { - EventGCG1GarbageCollection e(UNTIMED); + EventG1GarbageCollection e(UNTIMED); if (e.should_commit()) { e.set_gcId(GCId::current()); e.set_type(_g1_young_gc_info.type()); @@ -201,7 +201,7 @@ void G1NewTracer::send_g1_young_gc_event() { } void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxTime) { - EventGCG1MMU e; + EventG1MMU e; if (e.should_commit()) { e.set_gcId(GCId::current()); e.set_timeSlice(timeSlice); @@ -212,15 +212,15 @@ void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxT } void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) { - EventEvacuationInfo e; + EventEvacuationInformation e; if (e.should_commit()) { e.set_gcId(GCId::current()); e.set_cSetRegions(info->collectionset_regions()); e.set_cSetUsedBefore(info->collectionset_used_before()); e.set_cSetUsedAfter(info->collectionset_used_after()); e.set_allocationRegions(info->allocation_regions()); - e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); - e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied()); + e.set_allocationRegionsUsedBefore(info->alloc_regions_used_before()); + e.set_allocationRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied()); e.set_bytesCopied(info->bytes_copied()); e.set_regionsFreed(info->regions_freed()); e.commit(); @@ -231,13 +231,14 @@ void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_in EventEvacuationFailed e; if (e.should_commit()) { e.set_gcId(GCId::current()); - e.set_data(to_trace_struct(ef_info)); + e.set_evacuationFailed(to_trace_struct(ef_info)); e.commit(); } } -static TraceStructG1EvacStats create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) { - TraceStructG1EvacStats s; +static TraceStructG1EvacuationStatistics +create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) { + TraceStructG1EvacuationStatistics s; s.set_gcId(gcid); s.set_allocated(summary.allocated() * HeapWordSize); s.set_wasted(summary.wasted() * HeapWordSize); @@ -252,17 +253,17 @@ static TraceStructG1EvacStats create_g1_evacstats(unsigned gcid, const G1EvacSum } void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const { - EventGCG1EvacuationYoungStatistics surv_evt; + EventG1EvacuationYoungStatistics surv_evt; if (surv_evt.should_commit()) { - surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary)); + surv_evt.set_statistics(create_g1_evacstats(GCId::current(), summary)); surv_evt.commit(); } } void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const { - EventGCG1EvacuationOldStatistics old_evt; + EventG1EvacuationOldStatistics old_evt; if (old_evt.should_commit()) { - old_evt.set_stats(create_g1_evacstats(GCId::current(), summary)); + old_evt.set_statistics(create_g1_evacstats(GCId::current(), summary)); old_evt.commit(); } } @@ -273,7 +274,7 @@ void G1NewTracer::send_basic_ihop_statistics(size_t threshold, size_t last_allocation_size, double last_allocation_duration, double last_marking_length) { - EventGCG1BasicIHOP evt; + EventG1BasicIHOP evt; if (evt.should_commit()) { evt.set_gcId(GCId::current()); evt.set_threshold(threshold); @@ -295,7 +296,7 @@ void G1NewTracer::send_adaptive_ihop_statistics(size_t threshold, double predicted_allocation_rate, double predicted_marking_length, bool prediction_active) { - EventGCG1AdaptiveIHOP evt; + EventG1AdaptiveIHOP evt; if (evt.should_commit()) { evt.set_gcId(GCId::current()); evt.set_threshold(threshold); diff --git a/hotspot/src/share/vm/gc/shared/objectCountEventSender.cpp b/hotspot/src/share/vm/gc/shared/objectCountEventSender.cpp index 4146a809d3b..d9ca9294da6 100644 --- a/hotspot/src/share/vm/gc/shared/objectCountEventSender.cpp +++ b/hotspot/src/share/vm/gc/shared/objectCountEventSender.cpp @@ -40,7 +40,7 @@ void ObjectCountEventSender::send(const KlassInfoEntry* entry, const Ticks& time EventObjectCountAfterGC event(UNTIMED); event.set_gcId(GCId::current()); - event.set_class(entry->klass()); + event.set_objectClass(entry->klass()); event.set_count(entry->count()); event.set_totalSize(entry->words() * BytesPerWord); event.set_endtime(timestamp); diff --git a/hotspot/src/share/vm/gc/shared/plab.inline.hpp b/hotspot/src/share/vm/gc/shared/plab.inline.hpp index 33a9f58007c..6963a7fd913 100644 --- a/hotspot/src/share/vm/gc/shared/plab.inline.hpp +++ b/hotspot/src/share/vm/gc/shared/plab.inline.hpp @@ -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 @@ -28,7 +28,7 @@ #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/plab.hpp" #include "memory/allocation.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" inline HeapWord* PLAB::allocate_aligned(size_t word_sz, unsigned short alignment_in_bytes) { HeapWord* res = CollectedHeap::align_allocation_or_fail(_top, _end, alignment_in_bytes); diff --git a/hotspot/src/share/vm/gc/shared/space.cpp b/hotspot/src/share/vm/gc/shared/space.cpp index c207dcd74b5..db21862989c 100644 --- a/hotspot/src/share/vm/gc/shared/space.cpp +++ b/hotspot/src/share/vm/gc/shared/space.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ #include "gc/shared/spaceDecorator.hpp" #include "memory/universe.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/java.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/prefetch.inline.hpp" diff --git a/hotspot/src/share/vm/gc/shared/taskqueue.cpp b/hotspot/src/share/vm/gc/shared/taskqueue.cpp index 57b65fbcc73..2fc94c6304d 100644 --- a/hotspot/src/share/vm/gc/shared/taskqueue.cpp +++ b/hotspot/src/share/vm/gc/shared/taskqueue.cpp @@ -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 @@ -26,7 +26,7 @@ #include "gc/shared/taskqueue.hpp" #include "oops/oop.inline.hpp" #include "logging/log.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "runtime/thread.inline.hpp" #include "utilities/debug.hpp" diff --git a/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp b/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp index baa35059bed..8852557c5db 100644 --- a/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp +++ b/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp @@ -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 @@ #include "gc/shared/taskqueue.hpp" #include "memory/allocation.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.inline.hpp" #include "utilities/debug.hpp" #include "utilities/stack.inline.hpp" diff --git a/hotspot/src/share/vm/gc/shared/workgroup.cpp b/hotspot/src/share/vm/gc/shared/workgroup.cpp index 84016fe466d..6df874b2510 100644 --- a/hotspot/src/share/vm/gc/shared/workgroup.cpp +++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp @@ -28,7 +28,7 @@ #include "gc/shared/workerManager.hpp" #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "runtime/semaphore.hpp" #include "runtime/thread.inline.hpp" diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp index 179940d7e22..655b58af156 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp @@ -39,7 +39,7 @@ #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiThreadState.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/frame.inline.hpp" #include "runtime/handles.inline.hpp" diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp index 0770b397d79..18ac2392abe 100644 --- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp @@ -48,7 +48,7 @@ #include "oops/symbol.hpp" #include "prims/jvmtiExport.hpp" #include "prims/nativeLookup.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/deoptimization.hpp" diff --git a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp index 994220ff006..9c5d98361e0 100644 --- a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp @@ -342,7 +342,7 @@ methodHandle JVMCIEnv::get_method_by_index_impl(const constantPoolHandle& cpool, Symbol* sig_sym = cpool->signature_ref_at(index); if (cpool->has_preresolution() - || (holder() == SystemDictionary::MethodHandle_klass() && + || ((holder() == SystemDictionary::MethodHandle_klass() || holder() == SystemDictionary::VarHandle_klass()) && MethodHandles::is_signature_polymorphic_name(holder(), name_sym))) { // Short-circuit lookups for JSR 292-related call sites. // That is, do not rely only on name-based lookups, because they may fail diff --git a/hotspot/src/share/vm/logging/logDecorations.hpp b/hotspot/src/share/vm/logging/logDecorations.hpp index 3988bac83b3..38dcb40e99c 100644 --- a/hotspot/src/share/vm/logging/logDecorations.hpp +++ b/hotspot/src/share/vm/logging/logDecorations.hpp @@ -53,10 +53,6 @@ class LogDecorations VALUE_OBJ_CLASS_SPEC { LogDecorations(LogLevelType level, const LogTagSet& tagset, const LogDecorators& decorators); - LogLevelType level() const { - return _level; - } - void set_level(LogLevelType level) { _level = level; } diff --git a/hotspot/src/share/vm/logging/logOutputList.cpp b/hotspot/src/share/vm/logging/logOutputList.cpp index e2f8a6f1559..bc0565ae766 100644 --- a/hotspot/src/share/vm/logging/logOutputList.cpp +++ b/hotspot/src/share/vm/logging/logOutputList.cpp @@ -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 @@ #include "logging/logLevel.hpp" #include "logging/logOutputList.hpp" #include "memory/allocation.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.inline.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/hotspot/src/share/vm/logging/logOutputList.hpp b/hotspot/src/share/vm/logging/logOutputList.hpp index e983cb0d7c2..851f4192bb3 100644 --- a/hotspot/src/share/vm/logging/logOutputList.hpp +++ b/hotspot/src/share/vm/logging/logOutputList.hpp @@ -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 @@ -26,7 +26,6 @@ #include "logging/logLevel.hpp" #include "memory/allocation.hpp" -#include "runtime/atomic.hpp" #include "utilities/globalDefinitions.hpp" class LogOutput; @@ -61,6 +60,11 @@ class LogOutputList VALUE_OBJ_CLASS_SPEC { void add_output(LogOutput* output, LogLevelType level); void update_output_level(LogOutputNode* node, LogLevelType level); + // Bookkeeping functions to keep track of number of active readers/iterators for the list. + jint increase_readers(); + jint decrease_readers(); + void wait_until_no_readers() const; + public: LogOutputList() : _active_readers(0) { for (size_t i = 0; i < LogLevel::Count; i++) { @@ -84,11 +88,6 @@ class LogOutputList VALUE_OBJ_CLASS_SPEC { // Set (add/update/remove) the output to the specified level. void set_output_level(LogOutput* output, LogLevelType level); - // Bookkeeping functions to keep track of number of active readers/iterators for the list. - jint increase_readers(); - jint decrease_readers(); - void wait_until_no_readers() const; - class Iterator VALUE_OBJ_CLASS_SPEC { friend class LogOutputList; private: diff --git a/hotspot/src/share/vm/logging/logTag.hpp b/hotspot/src/share/vm/logging/logTag.hpp index f5dc582c6b5..9cbb568b414 100644 --- a/hotspot/src/share/vm/logging/logTag.hpp +++ b/hotspot/src/share/vm/logging/logTag.hpp @@ -35,8 +35,9 @@ LOG_TAG(add) \ LOG_TAG(age) \ LOG_TAG(alloc) \ - LOG_TAG(arguments) \ LOG_TAG(annotation) \ + LOG_TAG(arguments) \ + LOG_TAG(attach) \ LOG_TAG(barrier) \ LOG_TAG(biasedlocking) \ LOG_TAG(bot) \ diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp index f7dea3d6c91..2e32964bf7e 100644 --- a/hotspot/src/share/vm/memory/allocation.cpp +++ b/hotspot/src/share/vm/memory/allocation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ #include "memory/metaspaceShared.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "runtime/task.hpp" #include "runtime/threadCritical.hpp" diff --git a/hotspot/src/share/vm/memory/allocation.inline.hpp b/hotspot/src/share/vm/memory/allocation.inline.hpp index 5fe55f4a292..db09c0cfb0e 100644 --- a/hotspot/src/share/vm/memory/allocation.inline.hpp +++ b/hotspot/src/share/vm/memory/allocation.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #ifndef SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP #define SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "services/memTracker.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index ac7d0f838a3..1801a7c21cf 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -37,7 +37,7 @@ #include "memory/metaspaceTracer.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/globals.hpp" #include "runtime/init.hpp" #include "runtime/java.hpp" diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index a3dff52548f..1e434d1b79a 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -56,7 +56,7 @@ #include "oops/oop.inline.hpp" #include "oops/typeArrayKlass.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/commandLineFlagConstraintList.hpp" #include "runtime/deoptimization.hpp" #include "runtime/fprofiler.hpp" @@ -1129,8 +1129,6 @@ void Universe::initialize_verify_flags() { verify_flags |= Verify_MetaspaceAux; } else if (strcmp(token, "jni_handles") == 0) { verify_flags |= Verify_JNIHandles; - } else if (strcmp(token, "c-heap") == 0) { - verify_flags |= Verify_CHeap; } else if (strcmp(token, "codecache_oops") == 0) { verify_flags |= Verify_CodeCacheOops; } else { @@ -1208,10 +1206,6 @@ void Universe::verify(VerifyOption option, const char* prefix) { log_debug(gc, verify)("JNIHandles"); JNIHandles::verify(); } - if (should_verify_subset(Verify_CHeap)) { - log_debug(gc, verify)("C-heap"); - os::check_heap(); - } if (should_verify_subset(Verify_CodeCacheOops)) { log_debug(gc, verify)("CodeCache Oops"); CodeCache::verify_oops(); diff --git a/hotspot/src/share/vm/memory/universe.hpp b/hotspot/src/share/vm/memory/universe.hpp index 924809b5704..054b11aa873 100644 --- a/hotspot/src/share/vm/memory/universe.hpp +++ b/hotspot/src/share/vm/memory/universe.hpp @@ -480,8 +480,7 @@ class Universe: AllStatic { Verify_ClassLoaderDataGraph = 64, Verify_MetaspaceAux = 128, Verify_JNIHandles = 256, - Verify_CHeap = 512, - Verify_CodeCacheOops = 1024, + Verify_CodeCacheOops = 512, Verify_All = -1 }; static void initialize_verify_flags(); diff --git a/hotspot/src/share/vm/oops/compiledICHolder.cpp b/hotspot/src/share/vm/oops/compiledICHolder.cpp index 9e01e4ea705..55397d06c10 100644 --- a/hotspot/src/share/vm/oops/compiledICHolder.cpp +++ b/hotspot/src/share/vm/oops/compiledICHolder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #include "oops/compiledICHolder.hpp" #include "oops/klass.hpp" #include "oops/method.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" volatile int CompiledICHolder::_live_count; volatile int CompiledICHolder::_live_not_claimed_count; diff --git a/hotspot/src/share/vm/oops/cpCache.cpp b/hotspot/src/share/vm/oops/cpCache.cpp index ee2425fc615..a30d19dd685 100644 --- a/hotspot/src/share/vm/oops/cpCache.cpp +++ b/hotspot/src/share/vm/oops/cpCache.cpp @@ -32,7 +32,7 @@ #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "prims/methodHandles.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 1e7b1b1bb3d..d6b2323af28 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -56,7 +56,7 @@ #include "prims/jvmtiRedefineClasses.hpp" #include "prims/jvmtiThreadState.hpp" #include "prims/methodComparator.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaCalls.hpp" diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index d7fb8924e71..38a613d93b7 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -36,7 +36,7 @@ #include "oops/instanceKlass.hpp" #include "oops/klass.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.inline.hpp" #include "trace/traceMacros.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/oops/klassVtable.cpp b/hotspot/src/share/vm/oops/klassVtable.cpp index 73db3001d34..c3118cc24e6 100644 --- a/hotspot/src/share/vm/oops/klassVtable.cpp +++ b/hotspot/src/share/vm/oops/klassVtable.cpp @@ -60,7 +60,7 @@ bool klassVtable::is_preinitialized_vtable() { void klassVtable::compute_vtable_size_and_num_mirandas( int* vtable_length_ret, int* num_new_mirandas, GrowableArray* all_mirandas, const Klass* super, - Array* methods, AccessFlags class_flags, + Array* methods, AccessFlags class_flags, u2 major_version, Handle classloader, Symbol* classname, Array* local_interfaces, TRAPS) { NoSafepointVerifier nsv; @@ -77,7 +77,7 @@ void klassVtable::compute_vtable_size_and_num_mirandas( assert(methods->at(i)->is_method(), "must be a Method*"); methodHandle mh(THREAD, methods->at(i)); - if (needs_new_vtable_entry(mh, super, classloader, classname, class_flags, THREAD)) { + if (needs_new_vtable_entry(mh, super, classloader, classname, class_flags, major_version, THREAD)) { vtable_length += vtableEntry::size(); // we need a new entry } } @@ -256,10 +256,15 @@ void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) { // In class hierarchies where the accessibility is not increasing (i.e., going from private -> // package_private -> public/protected), the vtable might actually be smaller than our initial - // calculation. - assert(initialized <= _length, "vtable initialization failed"); - for(;initialized < _length; initialized++) { - put_method_at(NULL, initialized); + // calculation, for classfile versions for which we do not do transitive override + // calculations. + if (ik()->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION) { + assert(initialized == _length, "vtable initialization failed"); + } else { + assert(initialized <= _length, "vtable initialization failed"); + for(;initialized < _length; initialized++) { + table()[initialized].clear(); + } } NOT_PRODUCT(verify(tty, true)); } @@ -298,9 +303,9 @@ InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper ResourceMark rm(THREAD); outputStream* logst = Log(vtables)::trace_stream(); char* sig = target_method()->name_and_sig_as_C_string(); - logst->print("transitive overriding superclass %s with %s::%s index %d, original flags: ", + logst->print("transitive overriding superclass %s with %s index %d, original flags: ", supersuperklass->internal_name(), - _klass->internal_name(), sig, vtable_index); + sig, vtable_index); super_method->print_linkage_flags(logst); logst->print("overriders flags: "); target_method->print_linkage_flags(logst); @@ -330,11 +335,11 @@ static void log_vtables(int i, bool overrides, methodHandle target_method, outputStream* logst = Log(vtables)::trace_stream(); char* sig = target_method()->name_and_sig_as_C_string(); if (overrides) { - logst->print("overriding with %s::%s index %d, original flags: ", - target_klass->internal_name(), sig, i); + logst->print("overriding with %s index %d, original flags: ", + sig, i); } else { - logst->print("NOT overriding with %s::%s index %d, original flags: ", - target_klass->internal_name(), sig, i); + logst->print("NOT overriding with %s index %d, original flags: ", + sig, i); } super_method->print_linkage_flags(logst); logst->print("overriders flags: "); @@ -566,6 +571,7 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method, Handle classloader, Symbol* classname, AccessFlags class_flags, + u2 major_version, TRAPS) { if (class_flags.is_interface()) { // Interfaces do not use vtables, except for java.lang.Object methods, @@ -646,8 +652,12 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method, } } - // Start with lookup result and continue to search up - k = superk->super(); // haven't found an override match yet; continue to look + // Start with lookup result and continue to search up, for versions supporting transitive override + if (major_version >= VTABLE_TRANSITIVE_OVERRIDE_VERSION) { + k = superk->super(); // haven't found an override match yet; continue to look + } else { + break; + } } // if the target method is public or protected it may have a matching @@ -1500,15 +1510,22 @@ void klassVtable::print() { void vtableEntry::verify(klassVtable* vt, outputStream* st) { NOT_PRODUCT(FlagSetting fs(IgnoreLockingAssertions, true)); - assert(method() != NULL, "must have set method"); - method()->verify(); - // we sub_type, because it could be a miranda method - if (!vt->klass()->is_subtype_of(method()->method_holder())) { -#ifndef PRODUCT - print(); -#endif - fatal("vtableEntry " PTR_FORMAT ": method is from subclass", p2i(this)); + KlassHandle vtklass_h = vt->klass(); + Klass* vtklass = vtklass_h(); + if (vtklass->is_instance_klass() && + (InstanceKlass::cast(vtklass)->major_version() >= klassVtable::VTABLE_TRANSITIVE_OVERRIDE_VERSION)) { + assert(method() != NULL, "must have set method"); } + if (method() != NULL) { + method()->verify(); + // we sub_type, because it could be a miranda method + if (!vtklass_h->is_subtype_of(method()->method_holder())) { +#ifndef PRODUCT + print(); +#endif + fatal("vtableEntry " PTR_FORMAT ": method is from subclass", p2i(this)); + } + } } #ifndef PRODUCT diff --git a/hotspot/src/share/vm/oops/klassVtable.hpp b/hotspot/src/share/vm/oops/klassVtable.hpp index 8d33f7960ee..06e84034214 100644 --- a/hotspot/src/share/vm/oops/klassVtable.hpp +++ b/hotspot/src/share/vm/oops/klassVtable.hpp @@ -90,6 +90,7 @@ class klassVtable : public ResourceObj { const Klass* super, Array* methods, AccessFlags class_flags, + u2 major_version, Handle classloader, Symbol* classname, Array* local_interfaces, @@ -115,8 +116,14 @@ class klassVtable : public ResourceObj { protected: friend class vtableEntry; - private: + + public: + // Transitive overridng rules for class files < JDK1_7 use the older JVMS rules. + // Overriding is determined as we create the vtable, so we use the class file version + // of the class whose vtable we are calculating. enum { VTABLE_TRANSITIVE_OVERRIDE_VERSION = 51 } ; + + private: void copy_vtable_to(vtableEntry* start); int initialize_from_super(KlassHandle super); int index_of(Method* m, int len) const; // same as index_of, but search only up to len @@ -126,6 +133,7 @@ class klassVtable : public ResourceObj { Handle classloader, Symbol* classname, AccessFlags access_flags, + u2 major_version, TRAPS); bool update_inherited_vtable(InstanceKlass* klass, methodHandle target_method, int super_vtable_len, int default_index, bool checkconstraints, TRAPS); diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp index 9bcf81fe0f7..f890d1d1e9b 100644 --- a/hotspot/src/share/vm/oops/method.cpp +++ b/hotspot/src/share/vm/oops/method.cpp @@ -54,6 +54,7 @@ #include "runtime/compilationPolicy.hpp" #include "runtime/frame.inline.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/init.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/relocator.hpp" #include "runtime/sharedRuntime.hpp" @@ -1015,7 +1016,14 @@ address Method::make_adapters(methodHandle mh, TRAPS) { // so making them eagerly shouldn't be too expensive. AdapterHandlerEntry* adapter = AdapterHandlerLibrary::get_adapter(mh); if (adapter == NULL ) { - THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters"); + if (!is_init_completed()) { + // Don't throw exceptions during VM initialization because java.lang.* classes + // might not have been initialized, causing problems when constructing the + // Java exception object. + vm_exit_during_initialization("Out of space in CodeCache for adapters"); + } else { + THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters"); + } } if (mh->is_shared()) { diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp index fe3cd508a9f..578bcc4e520 100644 --- a/hotspot/src/share/vm/oops/oop.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -36,7 +36,7 @@ #include "oops/klass.inline.hpp" #include "oops/markOop.inline.hpp" #include "oops/oop.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/os.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/oops/symbol.cpp b/hotspot/src/share/vm/oops/symbol.cpp index 74d56db1e7d..f515621efff 100644 --- a/hotspot/src/share/vm/oops/symbol.cpp +++ b/hotspot/src/share/vm/oops/symbol.cpp @@ -29,7 +29,7 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/symbol.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.hpp" Symbol::Symbol(const u1* name, int length, int refcount) { diff --git a/hotspot/src/share/vm/oops/symbol.hpp b/hotspot/src/share/vm/oops/symbol.hpp index b6801f03f9c..468640caa24 100644 --- a/hotspot/src/share/vm/oops/symbol.hpp +++ b/hotspot/src/share/vm/oops/symbol.hpp @@ -26,8 +26,8 @@ #define SHARE_VM_OOPS_SYMBOL_HPP #include "memory/allocation.hpp" -#include "runtime/atomic.hpp" #include "utilities/exceptions.hpp" +#include "utilities/macros.hpp" #include "utilities/utf8.hpp" // A Symbol is a canonicalized string. diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp index 9882317cf0b..4c5ee040585 100644 --- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp @@ -508,7 +508,7 @@ void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, #if INCLUDE_TRACE EventCompilerInlining event; if (event.should_commit()) { - event.set_compileID(C->compile_id()); + event.set_compileId(C->compile_id()); event.set_message(inline_msg); event.set_succeeded(success); event.set_bci(caller_bci); diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index f2f8c4630db..651166c50d8 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -729,7 +729,7 @@ class Compile : public Phase { if (event.should_commit()) { event.set_starttime(C->_latest_stage_start_counter); event.set_phase((u1) cpt); - event.set_compileID(C->_compile_id); + event.set_compileId(C->_compile_id); event.set_phaseLevel(level); event.commit(); } @@ -748,7 +748,7 @@ class Compile : public Phase { if (event.should_commit()) { event.set_starttime(C->_latest_stage_start_counter); event.set_phase((u1) PHASE_END); - event.set_compileID(C->_compile_id); + event.set_compileId(C->_compile_id); event.set_phaseLevel(level); event.commit(); } diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index 3626009a15c..d0a3c4b8fd3 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -60,7 +60,7 @@ #include "opto/runtime.hpp" #include "opto/subnode.hpp" #include "prims/jvmtiThreadState.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index 878bd6623a5..f083a74c7aa 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -59,7 +59,7 @@ #include "prims/jvm_misc.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiThreadState.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/fprofiler.hpp" diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 79c450b002d..b66c22bf74e 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -54,7 +54,7 @@ #include "prims/privilegedStack.hpp" #include "prims/stackwalk.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" #include "runtime/init.hpp" #include "runtime/interfaceSupport.hpp" diff --git a/hotspot/src/share/vm/prims/jvmti.xml b/hotspot/src/share/vm/prims/jvmti.xml index 3a06d2fc2b6..48b58c3f7c7 100644 --- a/hotspot/src/share/vm/prims/jvmti.xml +++ b/hotspot/src/share/vm/prims/jvmti.xml @@ -7152,15 +7152,19 @@ class C2 extends C1 implements I2 { returns JNI_FALSE) the class can be neither redefined nor retransformed.

- Primitive classes (for example, java.lang.Integer.TYPE) - and array classes are never modifiable. + Primitive classes (for example, java.lang.Integer.TYPE), + array classes, and some implementation defined classes are never modifiable.

new - If possessed then all classes (except primitive and array classes) - are modifiable. + If possessed then all classes (except primitive, array, and some implementation defined + classes) are modifiable (redefine or retransform). + + + If possessed then all classes (except primitive, array, and some implementation defined + classes) are modifiable with . No effect on the result of the function. @@ -9900,7 +9904,7 @@ myInit() { - Can modify (retransform or redefine) any non-primitive non-array class. + Can modify (retransform or redefine) any modifiable class. See . @@ -10024,7 +10028,8 @@ myInit() { - can be called on any class + can be called on any modifiable class. + See . ( must also be set) @@ -12494,8 +12499,8 @@ myInit() { Otherwise, this event may be sent before the VM is initialized (the start phase). Some classes might not be compatible - with the function (eg. ROMized classes) and this event will not be - generated for these classes. + with the function (eg. ROMized classes or implementation defined classes) and this event will + not be generated for these classes.

The agent must allocate the space for the modified class file data buffer @@ -14498,6 +14503,10 @@ typedef void (JNICALL *jvmtiEventVMInit) - Add new capability can_generate_early_class_hook_events - Add new function GetNamedModule + + Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to + disallow some implementation defined classes. + diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp index 5b44ee01085..f1c5f962b17 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp @@ -283,7 +283,7 @@ JvmtiEnv::RetransformClasses(jint class_count, const jclass* classes) { return JVMTI_ERROR_INVALID_CLASS; } - if (java_lang_Class::is_primitive(k_mirror)) { + if (!VM_RedefineClasses::is_modifiable_class(k_mirror)) { return JVMTI_ERROR_UNMODIFIABLE_CLASS; } @@ -294,9 +294,6 @@ JvmtiEnv::RetransformClasses(jint class_count, const jclass* classes) { if (status & (JVMTI_CLASS_STATUS_ERROR)) { return JVMTI_ERROR_INVALID_CLASS; } - if (status & (JVMTI_CLASS_STATUS_ARRAY)) { - return JVMTI_ERROR_UNMODIFIABLE_CLASS; - } instanceKlassHandle ikh(current_thread, k_oop); if (ikh->get_cached_class_file_bytes() == NULL) { diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.cpp b/hotspot/src/share/vm/prims/jvmtiImpl.cpp index 398f5720b13..20905222276 100644 --- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp +++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ #include "prims/jvmtiEventController.inline.hpp" #include "prims/jvmtiImpl.hpp" #include "prims/jvmtiRedefineClasses.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/deoptimization.hpp" #include "runtime/handles.hpp" #include "runtime/handles.inline.hpp" diff --git a/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp b/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp index 003f12f0c0a..3ce6cf760b4 100644 --- a/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp +++ b/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "prims/jvmtiRawMonitor.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/thread.inline.hpp" diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp index f173e570dce..8a84d0ecf23 100644 --- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp +++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp @@ -130,7 +130,7 @@ bool VM_RedefineClasses::doit_prologue() { } oop mirror = JNIHandles::resolve_non_null(_class_defs[i].klass); - // classes for primitives and arrays cannot be redefined + // classes for primitives and arrays and vm anonymous classes cannot be redefined // check here so following code can assume these classes are InstanceKlass if (!is_modifiable_class(mirror)) { _res = JVMTI_ERROR_UNMODIFIABLE_CLASS; @@ -250,9 +250,14 @@ bool VM_RedefineClasses::is_modifiable_class(oop klass_mirror) { if (java_lang_Class::is_primitive(klass_mirror)) { return false; } - Klass* the_class_oop = java_lang_Class::as_Klass(klass_mirror); + Klass* k = java_lang_Class::as_Klass(klass_mirror); // classes for arrays cannot be redefined - if (the_class_oop == NULL || !the_class_oop->is_instance_klass()) { + if (k == NULL || !k->is_instance_klass()) { + return false; + } + + // Cannot redefine or retransform an anonymous class. + if (InstanceKlass::cast(k)->is_anonymous()) { return false; } return true; diff --git a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp index fa9d5131e31..b2cf5660865 100644 --- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp +++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp @@ -3119,6 +3119,11 @@ inline bool VM_HeapWalkOperation::collect_stack_roots(JavaThread* java_thread, } } + // Follow oops from compiled nmethod + if (jvf->cb() != NULL && jvf->cb()->is_nmethod()) { + blk->set_context(thread_tag, tid, depth, method); + jvf->cb()->as_nmethod()->oops_do(blk); + } } else { blk->set_context(thread_tag, tid, depth, method); if (is_top_frame) { diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index d7721ec5f55..55a968170a5 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -32,7 +32,7 @@ #include "prims/jni.h" #include "prims/jvm.h" #include "prims/unsafe.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/orderAccess.inline.hpp" @@ -1047,7 +1047,7 @@ UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, if (event.should_commit()) { oop obj = thread->current_park_blocker(); - event.set_klass((obj != NULL) ? obj->klass() : NULL); + event.set_parkedClass((obj != NULL) ? obj->klass() : NULL); event.set_timeout(time); event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop(obj) : 0); event.commit(); diff --git a/hotspot/src/share/vm/runtime/atomic.hpp b/hotspot/src/share/vm/runtime/atomic.hpp index c71a2d3f3a5..a685b6070e8 100644 --- a/hotspot/src/share/vm/runtime/atomic.hpp +++ b/hotspot/src/share/vm/runtime/atomic.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #define SHARE_VM_RUNTIME_ATOMIC_HPP #include "memory/allocation.hpp" +#include "utilities/macros.hpp" enum cmpxchg_memory_order { memory_order_relaxed, @@ -119,24 +120,120 @@ class Atomic : AllStatic { 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 -// aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to -// achieve is to place your short value next to another short value, which doesn't need atomic ops. -// -// Example -// ATOMIC_SHORT_PAIR( -// volatile short _refcount, // needs atomic operation -// unsigned short _length // number of UTF8 characters in the symbol (does not need atomic op) -// ); +// platform specific in-line definitions - must come before shared definitions -#ifdef VM_LITTLE_ENDIAN - #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ - non_atomic_decl; \ - atomic_decl -#else - #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ - atomic_decl; \ - non_atomic_decl +#include OS_CPU_HEADER(atomic) + +// shared in-line definitions + +// size_t casts... +#if (SIZE_MAX != UINTPTR_MAX) +#error size_t is not WORD_SIZE, interesting platform, but missing implementation here #endif +inline size_t Atomic::add(size_t add_value, volatile size_t* dest) { + return (size_t) add_ptr((intptr_t) add_value, (volatile intptr_t*) dest); +} + +inline void Atomic::inc(volatile size_t* dest) { + inc_ptr((volatile intptr_t*) dest); +} + +inline void Atomic::dec(volatile size_t* dest) { + dec_ptr((volatile intptr_t*) dest); +} + +#ifndef VM_HAS_SPECIALIZED_CMPXCHG_BYTE +/* + * 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 compare_value, cmpxchg_memory_order order) { + STATIC_ASSERT(sizeof(jbyte) == 1); + volatile jint* dest_int = + static_cast(align_ptr_down(dest, sizeof(jint))); + size_t offset = pointer_delta(dest, dest_int, 1); + jint cur = *dest_int; + jbyte* cur_as_bytes = reinterpret_cast(&cur); + + // current value may not be what we are looking for, so force it + // to that value so the initial cmpxchg will fail if it is different + cur_as_bytes[offset] = compare_value; + + // always execute a real cmpxchg so that we get the required memory + // barriers even on initial failure + do { + // value to swap in matches current value ... + jint new_value = cur; + // ... except for the one jbyte we want to update + reinterpret_cast(&new_value)[offset] = exchange_value; + + jint res = cmpxchg(new_value, dest_int, cur, order); + if (res == cur) break; // success + + // at least one jbyte in the jint changed value, so update + // our view of the current jint + cur = res; + // if our jbyte is still as cur we loop and try again + } while (cur_as_bytes[offset] == compare_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 (see macros.hpp) 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_HPP diff --git a/hotspot/src/share/vm/runtime/atomic.inline.hpp b/hotspot/src/share/vm/runtime/atomic.inline.hpp deleted file mode 100644 index 690be7daaf1..00000000000 --- a/hotspot/src/share/vm/runtime/atomic.inline.hpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - * - */ - -#ifndef SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP -#define SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP - -#include "runtime/atomic.hpp" -#include "utilities/macros.hpp" - -#include OS_CPU_HEADER_INLINE(atomic) - -// size_t casts... -#if (SIZE_MAX != UINTPTR_MAX) -#error size_t is not WORD_SIZE, interesting platform, but missing implementation here -#endif - -inline size_t Atomic::add(size_t add_value, volatile size_t* dest) { - return (size_t) add_ptr((intptr_t) add_value, (volatile intptr_t*) dest); -} - -inline void Atomic::inc(volatile size_t* dest) { - inc_ptr((volatile intptr_t*) dest); -} - -inline void Atomic::dec(volatile size_t* dest) { - dec_ptr((volatile intptr_t*) dest); -} - -#ifndef VM_HAS_SPECIALIZED_CMPXCHG_BYTE -/* - * 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) -{ - 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 diff --git a/hotspot/src/share/vm/runtime/biasedLocking.cpp b/hotspot/src/share/vm/runtime/biasedLocking.cpp index 1d5fd538b8d..84349601766 100644 --- a/hotspot/src/share/vm/runtime/biasedLocking.cpp +++ b/hotspot/src/share/vm/runtime/biasedLocking.cpp @@ -28,7 +28,7 @@ #include "oops/klass.inline.hpp" #include "oops/markOop.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/task.hpp" diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index b0a0d798bd7..68ec6b058cc 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -975,8 +975,8 @@ template static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) { E e; e.set_name(name); - e.set_old_value(old_value); - e.set_new_value(new_value); + e.set_oldValue(old_value); + e.set_newValue(new_value); e.set_origin(origin); e.commit(); } diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 89314669efd..20b62a688ea 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -2242,7 +2242,7 @@ public: "in a comma separated string. Sub-systems are: " \ "threads, heap, symbol_table, string_table, codecache, " \ "dictionary, classloader_data_graph, metaspace, jni_handles, " \ - "c-heap, codecache_oops") \ + "codecache_oops") \ \ diagnostic(bool, GCParallelVerificationEnabled, true, \ "Enable parallel memory system verification") \ @@ -3008,16 +3008,6 @@ public: notproduct(intx, ZombieALotInterval, 5, \ "Number of exits until ZombieALot kicks in") \ \ - diagnostic(intx, MallocVerifyInterval, 0, \ - "If non-zero, verify C heap after every N calls to " \ - "malloc/realloc/free") \ - range(0, max_intx) \ - \ - diagnostic(intx, MallocVerifyStart, 0, \ - "If non-zero, start verifying C heap after Nth call to " \ - "malloc/realloc/free") \ - range(0, max_intx) \ - \ diagnostic(uintx, MallocMaxTestWords, 0, \ "If non-zero, maximum number of words that malloc/realloc can " \ "allocate (for testing only)") \ diff --git a/hotspot/src/share/vm/runtime/handles.cpp b/hotspot/src/share/vm/runtime/handles.cpp index baa4e2f508d..a8b6f8b9f01 100644 --- a/hotspot/src/share/vm/runtime/handles.cpp +++ b/hotspot/src/share/vm/runtime/handles.cpp @@ -26,7 +26,7 @@ #include "memory/allocation.inline.hpp" #include "oops/constantPool.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" #include "runtime/thread.inline.hpp" diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.cpp b/hotspot/src/share/vm/runtime/interfaceSupport.cpp index cd0d20a65e2..db7ad9ce905 100644 --- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp +++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "memory/resourceArea.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/init.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/orderAccess.inline.hpp" diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp index f24e2a034db..86e11841cda 100644 --- a/hotspot/src/share/vm/runtime/mutex.cpp +++ b/hotspot/src/share/vm/runtime/mutex.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/mutex.hpp" #include "runtime/orderAccess.inline.hpp" @@ -1148,7 +1148,16 @@ bool Monitor::wait(bool no_safepoint_check, long timeout, } Monitor::~Monitor() { - assert((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, ""); +#ifdef ASSERT + uintptr_t owner = UNS(_owner); + uintptr_t lockword = UNS(_LockWord.FullWord); + uintptr_t entrylist = UNS(_EntryList); + uintptr_t waitset = UNS(_WaitSet); + uintptr_t ondeck = UNS(_OnDeck); + assert((owner|lockword|entrylist|waitset|ondeck) == 0, + "_owner(" INTPTR_FORMAT ")|_LockWord(" INTPTR_FORMAT ")|_EntryList(" INTPTR_FORMAT ")|_WaitSet(" + INTPTR_FORMAT ")|_OnDeck(" INTPTR_FORMAT ") != 0", owner, lockword, entrylist, waitset, ondeck); +#endif } void Monitor::ClearMonitor(Monitor * m, const char *name) { diff --git a/hotspot/src/share/vm/runtime/objectMonitor.cpp b/hotspot/src/share/vm/runtime/objectMonitor.cpp index 7590d90c9e7..e765ee011eb 100644 --- a/hotspot/src/share/vm/runtime/objectMonitor.cpp +++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp @@ -27,7 +27,7 @@ #include "memory/resourceArea.hpp" #include "oops/markOop.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/mutexLocker.hpp" @@ -390,7 +390,7 @@ void ObjectMonitor::enter(TRAPS) { } if (event.should_commit()) { - event.set_klass(((oop)this->object())->klass()); + event.set_monitorClass(((oop)this->object())->klass()); event.set_previousOwner((TYPE_THREAD)_previous_owner_tid); event.set_address((TYPE_ADDRESS)(uintptr_t)(this->object_addr())); event.commit(); @@ -1381,7 +1381,7 @@ void ObjectMonitor::post_monitor_wait_event(EventJavaMonitorWait* event, jlong timeout, bool timedout) { assert(event != NULL, "invariant"); - event->set_klass(((oop)this->object())->klass()); + event->set_monitorClass(((oop)this->object())->klass()); event->set_timeout(timeout); event->set_address((TYPE_ADDRESS)this->object_addr()); event->set_notifier(notifier_tid); diff --git a/hotspot/src/share/vm/runtime/orderAccess.inline.hpp b/hotspot/src/share/vm/runtime/orderAccess.inline.hpp index 0907a43d71a..f7830c400af 100644 --- a/hotspot/src/share/vm/runtime/orderAccess.inline.hpp +++ b/hotspot/src/share/vm/runtime/orderAccess.inline.hpp @@ -26,7 +26,7 @@ #ifndef SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP #define SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/orderAccess.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index e9ff778760c..7089f6a6629 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -44,7 +44,7 @@ #include "prims/jvm_misc.hpp" #include "prims/privilegedStack.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/frame.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/java.hpp" @@ -596,8 +596,6 @@ void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { } #endif - NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap()); - // For the test flag -XX:MallocMaxTestWords if (has_reached_max_malloc_test_peak(size)) { return NULL; @@ -658,7 +656,6 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa // NMT support void* membase = MemTracker::malloc_base(memblock); verify_memory(membase); - NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap()); if (size == 0) { return NULL; } @@ -695,7 +692,6 @@ void os::free(void *memblock) { } void* membase = MemTracker::record_free(memblock); verify_memory(membase); - NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap()); GuardedMemory guarded(membase); size_t size = guarded.get_user_size(); diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index 0cf1bd6e068..431e7b2a985 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -709,7 +709,6 @@ class os: AllStatic { static void* realloc (void *memblock, size_t size, MEMFLAGS flag); static void free (void *memblock); - static bool check_heap(bool force = false); // verify C heap integrity static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup // Like strdup, but exit VM when strdup() returns NULL static char* strdup_check_oom(const char*, MEMFLAGS flags = mtInternal); diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp index 28f00fdbe03..50cae3cc396 100644 --- a/hotspot/src/share/vm/runtime/safepoint.cpp +++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -39,7 +39,7 @@ #include "memory/universe.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" @@ -173,7 +173,7 @@ void SafepointSynchronize::begin() { // block itself when it attempts transitions to a new state. // { - EventSafepointStateSync sync_event; + EventSafepointStateSynchronization sync_event; int initial_running = 0; _state = _synchronizing; diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index 11e7f834dba..c2bf3c00778 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -49,7 +49,7 @@ #include "prims/methodHandles.hpp" #include "prims/nativeLookup.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/handles.inline.hpp" diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp index 16cf5cde781..60fc91c43e6 100644 --- a/hotspot/src/share/vm/runtime/sweeper.cpp +++ b/hotspot/src/share/vm/runtime/sweeper.cpp @@ -30,7 +30,7 @@ #include "compiler/compileBroker.hpp" #include "memory/resourceArea.hpp" #include "oops/method.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/orderAccess.inline.hpp" @@ -485,7 +485,7 @@ void NMethodSweeper::sweep_code_cache() { if (event.should_commit()) { event.set_starttime(sweep_start_counter); event.set_endtime(sweep_end_counter); - event.set_sweepIndex(_traversals); + event.set_sweepId(_traversals); event.set_sweptCount(swept_count); event.set_flushedCount(flushed_count); event.set_zombifiedCount(zombified_count); diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp index ef8a271106a..b9004d62860 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.cpp +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp @@ -30,7 +30,7 @@ #include "memory/resourceArea.hpp" #include "oops/markOop.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" @@ -1819,7 +1819,7 @@ static void post_monitor_inflate_event(EventJavaMonitorInflate& event, const ObjectSynchronizer::InflateCause cause) { #if INCLUDE_TRACE assert(event.should_commit(), "check outside"); - event.set_klass(obj->klass()); + event.set_monitorClass(obj->klass()); event.set_address((TYPE_ADDRESS)(uintptr_t)(void*)obj); event.set_cause((u1)cause); event.commit(); diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index c87de622492..f3481dad820 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -57,7 +57,7 @@ #include "prims/jvmtiThreadState.hpp" #include "prims/privilegedStack.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/commandLineFlagConstraintList.hpp" #include "runtime/commandLineFlagWriteableList.hpp" diff --git a/hotspot/src/share/vm/runtime/thread.inline.hpp b/hotspot/src/share/vm/runtime/thread.inline.hpp index b8c7a142612..bb1fb9c80eb 100644 --- a/hotspot/src/share/vm/runtime/thread.inline.hpp +++ b/hotspot/src/share/vm/runtime/thread.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.inline.hpp" #include "runtime/thread.hpp" diff --git a/hotspot/src/share/vm/runtime/vmThread.cpp b/hotspot/src/share/vm/runtime/vmThread.cpp index d7c0137a1f4..5b3fda00fd9 100644 --- a/hotspot/src/share/vm/runtime/vmThread.cpp +++ b/hotspot/src/share/vm/runtime/vmThread.cpp @@ -279,7 +279,6 @@ void VMThread::run() { HandleMark hm(VMThread::vm_thread()); // Among other things, this ensures that Eden top is correct. Universe::heap()->prepare_for_verify(); - os::check_heap(); // Silent verification so as not to pollute normal output, // unless we really asked for it. Universe::verify(); diff --git a/hotspot/src/share/vm/services/mallocTracker.cpp b/hotspot/src/share/vm/services/mallocTracker.cpp index ea399401115..16a0cde04c4 100644 --- a/hotspot/src/share/vm/services/mallocTracker.cpp +++ b/hotspot/src/share/vm/services/mallocTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 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,6 @@ #include "precompiled.hpp" #include "runtime/atomic.hpp" -#include "runtime/atomic.inline.hpp" #include "services/mallocSiteTable.hpp" #include "services/mallocTracker.hpp" #include "services/mallocTracker.inline.hpp" diff --git a/hotspot/src/share/vm/services/memTracker.hpp b/hotspot/src/share/vm/services/memTracker.hpp index f05d39f3b4c..1682cb91f42 100644 --- a/hotspot/src/share/vm/services/memTracker.hpp +++ b/hotspot/src/share/vm/services/memTracker.hpp @@ -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 @@ -75,7 +75,6 @@ class MemTracker : AllStatic { #else -#include "runtime/atomic.hpp" #include "runtime/threadCritical.hpp" #include "services/mallocTracker.hpp" #include "services/virtualMemoryTracker.hpp" diff --git a/hotspot/src/share/vm/services/threadService.cpp b/hotspot/src/share/vm/services/threadService.cpp index f89ff8b87bc..3bd7a9f70ca 100644 --- a/hotspot/src/share/vm/services/threadService.cpp +++ b/hotspot/src/share/vm/services/threadService.cpp @@ -31,7 +31,7 @@ #include "oops/instanceKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" #include "runtime/init.hpp" #include "runtime/thread.hpp" diff --git a/hotspot/src/share/vm/services/virtualMemoryTracker.cpp b/hotspot/src/share/vm/services/virtualMemoryTracker.cpp index 964af28bf5b..c21aa542b2d 100644 --- a/hotspot/src/share/vm/services/virtualMemoryTracker.cpp +++ b/hotspot/src/share/vm/services/virtualMemoryTracker.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "runtime/threadCritical.hpp" #include "services/memTracker.hpp" diff --git a/hotspot/src/share/vm/shark/sharkRuntime.cpp b/hotspot/src/share/vm/shark/sharkRuntime.cpp index 454c87f657e..fff58022612 100644 --- a/hotspot/src/share/vm/shark/sharkRuntime.cpp +++ b/hotspot/src/share/vm/shark/sharkRuntime.cpp @@ -24,7 +24,7 @@ */ #include "precompiled.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/deoptimization.hpp" #include "runtime/thread.hpp" diff --git a/hotspot/src/share/vm/trace/traceDataTypes.hpp b/hotspot/src/share/vm/trace/traceDataTypes.hpp index 5df07eb1bbe..31be0589f3f 100644 --- a/hotspot/src/share/vm/trace/traceDataTypes.hpp +++ b/hotspot/src/share/vm/trace/traceDataTypes.hpp @@ -32,7 +32,6 @@ enum { CONTENT_TYPE_NONE = 0, CONTENT_TYPE_CLASS = 20, - CONTENT_TYPE_UTF8 = 21, CONTENT_TYPE_THREAD = 22, CONTENT_TYPE_STACKTRACE = 23, CONTENT_TYPE_BYTES = 24, diff --git a/hotspot/src/share/vm/trace/traceMacros.hpp b/hotspot/src/share/vm/trace/traceMacros.hpp index a69acef1f70..67f71f3493c 100644 --- a/hotspot/src/share/vm/trace/traceMacros.hpp +++ b/hotspot/src/share/vm/trace/traceMacros.hpp @@ -30,7 +30,6 @@ typedef u8 traceid; #define EVENT_THREAD_EXIT(thread) #define EVENT_THREAD_DESTRUCT(thread) #define TRACE_KLASS_CREATION(k, p, t) -#define TRACE_KLASS_DEFINITION(k, t) #define TRACE_INIT_KLASS_ID(k) #define TRACE_REMOVE_KLASS_ID(k) diff --git a/hotspot/src/share/vm/trace/traceevents.xml b/hotspot/src/share/vm/trace/traceevents.xml index 10671cfc136..f3b6447127a 100644 --- a/hotspot/src/share/vm/trace/traceevents.xml +++ b/hotspot/src/share/vm/trace/traceevents.xml @@ -76,111 +76,112 @@ Declares a structure type that can be used in other events. - + - + - + - + - + - + - - - + + + - + + has_thread="true" has_stacktrace="true" is_instant="false"> + has_thread="true" has_stacktrace="true" is_instant="true"> + has_thread="true" is_instant="true"> - - - + is_instant="true"> + + + - - - + is_instant="true"> + + + - - - + is_instant="true"> + + + - - - + is_instant="true"> + + + - - - + is_instant="true"> + + + - - - + is_instant="true"> + + + - - - + is_instant="true"> + + + @@ -200,7 +201,7 @@ Declares a structure type that can be used in other events. - + @@ -213,7 +214,7 @@ Declares a structure type that can be used in other events. - + @@ -244,7 +245,7 @@ Declares a structure type that can be used in other events. - + @@ -258,7 +259,7 @@ Declares a structure type that can be used in other events. - + @@ -271,7 +272,7 @@ Declares a structure type that can be used in other events. - + @@ -280,53 +281,53 @@ Declares a structure type that can be used in other events. - - + - - + - - + - - + - - + - - - - - + + + + + - - + + - - + + @@ -334,7 +335,7 @@ Declares a structure type that can be used in other events. - + @@ -347,14 +348,14 @@ Declares a structure type that can be used in other events. - - + + - - + + @@ -366,48 +367,48 @@ Declares a structure type that can be used in other events. - - + + - - + + - - + + - - - - - - + + + + + + - - - - - - - - - - + + + + + + + + + + - - + + @@ -415,10 +416,10 @@ Declares a structure type that can be used in other events. - - + + @@ -426,81 +427,76 @@ Declares a structure type that can be used in other events. - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - + + description="Information about a G1 heap region type change" is_instant="true"> - - + + - - - - - + + has_thread="true" is_requestable="false" is_constant="false"> - + @@ -509,39 +505,39 @@ Declares a structure type that can be used in other events. + has_thread="true" is_requestable="false" is_constant="false"> - + - - - + + + - - - - + + + + - + has_thread="true" is_instant="true"> + - + - + - + has_thread="true" is_requestable="false" is_constant="false"> + @@ -550,7 +546,7 @@ Declares a structure type that can be used in other events. + has_thread="true" is_requestable="false" is_constant="false" is_instant="true"> @@ -564,14 +560,14 @@ Declares a structure type that can be used in other events. - + - - + @@ -579,46 +575,46 @@ Declares a structure type that can be used in other events. - + - + - - + + - + + description="Execution of a VM Operation" has_thread="true"> - - - - + + + + - - + + - - + + diff --git a/hotspot/src/share/vm/trace/tracerelationdecls.xml b/hotspot/src/share/vm/trace/tracerelationdecls.xml index 06a83aab418..472c5c61c8a 100644 --- a/hotspot/src/share/vm/trace/tracerelationdecls.xml +++ b/hotspot/src/share/vm/trace/tracerelationdecls.xml @@ -27,9 +27,9 @@ - - - - - + + + + + diff --git a/hotspot/src/share/vm/trace/tracetypes.xml b/hotspot/src/share/vm/trace/tracetypes.xml index c4c3ddbf959..003b9016bac 100644 --- a/hotspot/src/share/vm/trace/tracetypes.xml +++ b/hotspot/src/share/vm/trace/tracetypes.xml @@ -43,7 +43,7 @@ jvm_type means defining a new one for our own use. Example: (GcMode) - + This creates a content type CONTENT_TYPE_GCMODE @@ -61,131 +61,131 @@ Now we can use the content + data type in declaring event fields. - - - - + + + + - + - + - + - + - - + + - - + - + - + - + - + - + - + - + - + - + - + - - + - + - + - + - + - + + type="U8" jvm_type="MODULE"> - + + type="U8" jvm_type="PACKAGE"> @@ -288,8 +288,9 @@ Now we can use the content + data type in declaring event fields. - - + @@ -325,8 +326,7 @@ Now we can use the content + data type in declaring event fields. + type="u8" sizeop="sizeof(u8)"/> - + - + - + - + - + - + - + - + diff --git a/hotspot/src/share/vm/utilities/accessFlags.cpp b/hotspot/src/share/vm/utilities/accessFlags.cpp index 9cc0f1bb95a..17c47b3e363 100644 --- a/hotspot/src/share/vm/utilities/accessFlags.cpp +++ b/hotspot/src/share/vm/utilities/accessFlags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "utilities/accessFlags.hpp" void AccessFlags::atomic_set_bits(jint bits) { diff --git a/hotspot/src/share/vm/utilities/bitMap.cpp b/hotspot/src/share/vm/utilities/bitMap.cpp index 12758ab02e4..b0b7d567f8e 100644 --- a/hotspot/src/share/vm/utilities/bitMap.cpp +++ b/hotspot/src/share/vm/utilities/bitMap.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/copy.hpp" #include "utilities/debug.hpp" @@ -376,77 +376,99 @@ void BitMap::par_at_put_large_range(idx_t beg, idx_t end, bool value) { par_put_range_within_word(bit_index(end_full_word), end, value); } +inline bm_word_t tail_mask(idx_t tail_bits) { + assert(tail_bits != 0, "precondition"); // Works, but shouldn't be called. + assert(tail_bits < (idx_t)BitsPerWord, "precondition"); + return (bm_word_t(1) << tail_bits) - 1; +} + +// Get the low tail_bits of value, which is the last partial word of a map. +inline bm_word_t tail_of_map(bm_word_t value, idx_t tail_bits) { + return value & tail_mask(tail_bits); +} + +// Compute the new last word of a map with a non-aligned length. +// new_value has the new trailing bits of the map in the low tail_bits. +// old_value is the last word of the map, including bits beyond the end. +// Returns old_value with the low tail_bits replaced by the corresponding +// bits in new_value. +inline bm_word_t merge_tail_of_map(bm_word_t new_value, + bm_word_t old_value, + idx_t tail_bits) { + bm_word_t mask = tail_mask(tail_bits); + return (new_value & mask) | (old_value & ~mask); +} + bool BitMap::contains(const BitMap& other) const { assert(size() == other.size(), "must have same size"); const bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size_in_words(); index++) { - bm_word_t word_union = dest_map[index] | other_map[index]; - // If this has more bits set than dest_map[index], then other is not a - // subset. - if (word_union != dest_map[index]) return false; + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { + // false if other bitmap has bits set which are clear in this bitmap. + if ((~dest_map[index] & other_map[index]) != 0) return false; } - return true; + idx_t rest = bit_in_word(size()); + // true unless there is a partial-word tail in which the other + // bitmap has bits set which are clear in this bitmap. + return (rest == 0) || tail_of_map(~dest_map[limit] & other_map[limit], rest) == 0; } bool BitMap::intersects(const BitMap& other) const { assert(size() == other.size(), "must have same size"); const bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size_in_words(); index++) { + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { if ((dest_map[index] & other_map[index]) != 0) return true; } - // Otherwise, no intersection. - return false; + idx_t rest = bit_in_word(size()); + // false unless there is a partial-word tail with non-empty intersection. + return (rest > 0) && tail_of_map(dest_map[limit] & other_map[limit], rest) != 0; } void BitMap::set_union(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size_in_words(); index++) { - dest_map[index] = dest_map[index] | other_map[index]; + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { + dest_map[index] |= other_map[index]; + } + idx_t rest = bit_in_word(size()); + if (rest > 0) { + bm_word_t orig = dest_map[limit]; + dest_map[limit] = merge_tail_of_map(orig | other_map[limit], orig, rest); } } - void BitMap::set_difference(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size_in_words(); index++) { - dest_map[index] = dest_map[index] & ~(other_map[index]); + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { + dest_map[index] &= ~other_map[index]; + } + idx_t rest = bit_in_word(size()); + if (rest > 0) { + bm_word_t orig = dest_map[limit]; + dest_map[limit] = merge_tail_of_map(orig & ~other_map[limit], orig, rest); } } - void BitMap::set_intersection(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size; index++) { - dest_map[index] = dest_map[index] & other_map[index]; + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { + dest_map[index] &= other_map[index]; } -} - - -void BitMap::set_intersection_at_offset(const BitMap& other, idx_t offset) { - assert(other.size() >= offset, "offset not in range"); - assert(other.size() - offset >= size(), "other not large enough"); - // XXX Ideally, we would remove this restriction. - guarantee((offset % (sizeof(bm_word_t) * BitsPerByte)) == 0, - "Only handle aligned cases so far."); - bm_word_t* dest_map = map(); - const bm_word_t* other_map = other.map(); - idx_t offset_word_ind = word_index(offset); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size; index++) { - dest_map[index] = dest_map[index] & other_map[offset_word_ind + index]; + idx_t rest = bit_in_word(size()); + if (rest > 0) { + bm_word_t orig = dest_map[limit]; + dest_map[limit] = merge_tail_of_map(orig & other_map[limit], orig, rest); } } @@ -455,88 +477,111 @@ bool BitMap::set_union_with_result(const BitMap& other) { bool changed = false; bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size; index++) { - idx_t temp = dest_map[index] | other_map[index]; - changed = changed || (temp != dest_map[index]); + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { + bm_word_t orig = dest_map[index]; + bm_word_t temp = orig | other_map[index]; + changed = changed || (temp != orig); dest_map[index] = temp; } + idx_t rest = bit_in_word(size()); + if (rest > 0) { + bm_word_t orig = dest_map[limit]; + bm_word_t temp = merge_tail_of_map(orig | other_map[limit], orig, rest); + changed = changed || (temp != orig); + dest_map[limit] = temp; + } return changed; } - bool BitMap::set_difference_with_result(const BitMap& other) { assert(size() == other.size(), "must have same size"); bool changed = false; bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size; index++) { - bm_word_t temp = dest_map[index] & ~(other_map[index]); - changed = changed || (temp != dest_map[index]); + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { + bm_word_t orig = dest_map[index]; + bm_word_t temp = orig & ~other_map[index]; + changed = changed || (temp != orig); dest_map[index] = temp; } + idx_t rest = bit_in_word(size()); + if (rest > 0) { + bm_word_t orig = dest_map[limit]; + bm_word_t temp = merge_tail_of_map(orig & ~other_map[limit], orig, rest); + changed = changed || (temp != orig); + dest_map[limit] = temp; + } return changed; } - bool BitMap::set_intersection_with_result(const BitMap& other) { assert(size() == other.size(), "must have same size"); bool changed = false; bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size; index++) { + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { bm_word_t orig = dest_map[index]; bm_word_t temp = orig & other_map[index]; changed = changed || (temp != orig); - dest_map[index] = temp; + dest_map[index] = temp; + } + idx_t rest = bit_in_word(size()); + if (rest > 0) { + bm_word_t orig = dest_map[limit]; + bm_word_t temp = merge_tail_of_map(orig & other_map[limit], orig, rest); + changed = changed || (temp != orig); + dest_map[limit] = temp; } return changed; } - void BitMap::set_from(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size; index++) { - dest_map[index] = other_map[index]; + idx_t copy_words = word_index(size()); + Copy::disjoint_words((HeapWord*)other_map, (HeapWord*)dest_map, copy_words); + idx_t rest = bit_in_word(size()); + if (rest > 0) { + dest_map[copy_words] = merge_tail_of_map(other_map[copy_words], + dest_map[copy_words], + rest); } } - -bool BitMap::is_same(const BitMap& other) { +bool BitMap::is_same(const BitMap& other) const { assert(size() == other.size(), "must have same size"); - bm_word_t* dest_map = map(); + const bm_word_t* dest_map = map(); const bm_word_t* other_map = other.map(); - idx_t size = size_in_words(); - for (idx_t index = 0; index < size; index++) { + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { if (dest_map[index] != other_map[index]) return false; } - return true; + idx_t rest = bit_in_word(size()); + return (rest == 0) || (tail_of_map(dest_map[limit] ^ other_map[limit], rest) == 0); } bool BitMap::is_full() const { - const bm_word_t* word = map(); - idx_t rest = size(); - for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) { - if (*word != ~(bm_word_t)0) return false; - word++; + const bm_word_t* words = map(); + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { + if (~words[index] != 0) return false; } - return rest == 0 || (*word | ~right_n_bits((int)rest)) == ~(bm_word_t)0; + idx_t rest = bit_in_word(size()); + return (rest == 0) || (tail_of_map(~words[limit], rest) == 0); } - bool BitMap::is_empty() const { - const bm_word_t* word = map(); - idx_t rest = size(); - for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) { - if (*word != 0) return false; - word++; + const bm_word_t* words = map(); + idx_t limit = word_index(size()); + for (idx_t index = 0; index < limit; ++index) { + if (words[index] != 0) return false; } - return rest == 0 || (*word & right_n_bits((int)rest)) == 0; + idx_t rest = bit_in_word(size()); + return (rest == 0) || (tail_of_map(words[limit], rest) == 0); } void BitMap::clear_large() { diff --git a/hotspot/src/share/vm/utilities/bitMap.hpp b/hotspot/src/share/vm/utilities/bitMap.hpp index 01c94dae19c..919a54cd483 100644 --- a/hotspot/src/share/vm/utilities/bitMap.hpp +++ b/hotspot/src/share/vm/utilities/bitMap.hpp @@ -284,18 +284,9 @@ class BitMap VALUE_OBJ_CLASS_SPEC { bool set_difference_with_result(const BitMap& bits); bool set_intersection_with_result(const BitMap& bits); - // Requires the submap of "bits" starting at offset to be at least as - // large as "this". Modifies "this" to be the intersection of its - // current contents and the submap of "bits" starting at "offset" of the - // same length as "this." - // (For expedience, currently requires the offset to be aligned to the - // bitsize of a uintptr_t. This should go away in the future though it - // will probably remain a good case to optimize.) - void set_intersection_at_offset(const BitMap& bits, idx_t offset); - void set_from(const BitMap& bits); - bool is_same(const BitMap& bits); + bool is_same(const BitMap& bits) const; // Test if all bits are set or cleared bool is_full() const; diff --git a/hotspot/src/share/vm/utilities/bitMap.inline.hpp b/hotspot/src/share/vm/utilities/bitMap.inline.hpp index 1b3a9bb11f0..ae890e90cde 100644 --- a/hotspot/src/share/vm/utilities/bitMap.inline.hpp +++ b/hotspot/src/share/vm/utilities/bitMap.inline.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_VM_UTILITIES_BITMAP_INLINE_HPP #define SHARE_VM_UTILITIES_BITMAP_INLINE_HPP -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "utilities/bitMap.hpp" inline void BitMap::set_bit(idx_t bit) { diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp index 95fd3b67e44..d48479c303d 100644 --- a/hotspot/src/share/vm/utilities/debug.cpp +++ b/hotspot/src/share/vm/utilities/debug.cpp @@ -38,7 +38,7 @@ #include "oops/oop.inline.hpp" #include "prims/privilegedStack.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/frame.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index aec8ab9d7bc..a7ebde3ed54 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -327,11 +327,12 @@ inline address_word castable_address(void* x) { return address_w // and then additions like // ... top() + size ... // are safe because we know that top() is at least size below end(). -inline size_t pointer_delta(const void* left, - const void* right, +inline size_t pointer_delta(const volatile void* left, + const volatile void* right, size_t element_size) { return (((uintptr_t) left) - ((uintptr_t) right)) / element_size; } + // A version specialized for HeapWord*'s. inline size_t pointer_delta(const HeapWord* left, const HeapWord* right) { return pointer_delta(left, right, sizeof(HeapWord)); @@ -516,6 +517,10 @@ inline void* align_ptr_down(void* ptr, size_t alignment) { return (void*)align_size_down((intptr_t)ptr, (intptr_t)alignment); } +inline volatile void* align_ptr_down(volatile void* ptr, size_t alignment) { + return (volatile void*)align_size_down((intptr_t)ptr, (intptr_t)alignment); +} + // Align metaspace objects by rounding up to natural word boundary inline intptr_t align_metadata_size(intptr_t size) { diff --git a/hotspot/src/share/vm/utilities/histogram.cpp b/hotspot/src/share/vm/utilities/histogram.cpp index f4d7091cd22..6787fce2f33 100644 --- a/hotspot/src/share/vm/utilities/histogram.cpp +++ b/hotspot/src/share/vm/utilities/histogram.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "utilities/histogram.hpp" #ifdef ASSERT diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp index ebcaaee043d..9904650b01d 100644 --- a/hotspot/src/share/vm/utilities/macros.hpp +++ b/hotspot/src/share/vm/utilities/macros.hpp @@ -486,4 +486,24 @@ #define OS_CPU_HEADER(basename) XSTR(OS_CPU_HEADER_STEM(basename).hpp) #define OS_CPU_HEADER_INLINE(basename) XSTR(OS_CPU_HEADER_STEM(basename).inline.hpp) +// To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially +// aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to +// achieve is to place your short value next to another short value, which doesn't need atomic ops. +// +// Example +// ATOMIC_SHORT_PAIR( +// volatile short _refcount, // needs atomic operation +// unsigned short _length // number of UTF8 characters in the symbol (does not need atomic op) +// ); + +#ifdef VM_LITTLE_ENDIAN + #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ + non_atomic_decl; \ + atomic_decl +#else + #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ + atomic_decl; \ + non_atomic_decl +#endif + #endif // SHARE_VM_UTILITIES_MACROS_HPP diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp index 4a2ac95995b..8ae3d5222e3 100644 --- a/hotspot/src/share/vm/utilities/vmError.cpp +++ b/hotspot/src/share/vm/utilities/vmError.cpp @@ -31,7 +31,7 @@ #include "logging/logConfiguration.hpp" #include "prims/whitebox.hpp" #include "runtime/arguments.hpp" -#include "runtime/atomic.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/frame.inline.hpp" #include "runtime/init.hpp" #include "runtime/os.hpp" diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index c87769b91e1..2fdda388eea 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -407,6 +407,11 @@ hotspot_runtime_tier2_platform_agnostic = \ runtime/SelectionResolution \ -:hotspot_fast_runtime +hotspot_runtime_minimalvm = \ + runtime/MinimalVM \ + runtime/ErrorHandling \ + runtime/logging + #All tests that depends on nashorn extension. # needs_nashorn = \ diff --git a/hotspot/test/compiler/arguments/BMISupportedCPUTest.java b/hotspot/test/compiler/arguments/BMISupportedCPUTest.java index 9582e8fe69f..4979de0ae5c 100644 --- a/hotspot/test/compiler/arguments/BMISupportedCPUTest.java +++ b/hotspot/test/compiler/arguments/BMISupportedCPUTest.java @@ -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 @@ -23,7 +23,7 @@ package compiler.arguments; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; /** diff --git a/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java b/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java index 103d2a91e7e..957bc7607a2 100644 --- a/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java +++ b/hotspot/test/compiler/arguments/BMIUnsupportedCPUTest.java @@ -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 @@ -23,7 +23,7 @@ package compiler.arguments; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/arguments/CheckCICompilerCount.java b/hotspot/test/compiler/arguments/CheckCICompilerCount.java index 14bbdaa3dc5..7a975785a16 100644 --- a/hotspot/test/compiler/arguments/CheckCICompilerCount.java +++ b/hotspot/test/compiler/arguments/CheckCICompilerCount.java @@ -25,7 +25,7 @@ * @test CheckCheckCICompilerCount * @bug 8130858 8132525 8162881 * @summary Check that correct range of values for CICompilerCount are allowed depending on whether tiered is enabled or not - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * @run driver compiler.arguments.CheckCICompilerCount @@ -33,8 +33,8 @@ package compiler.arguments; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class CheckCICompilerCount { private static final String[][] NON_TIERED_ARGUMENTS = { diff --git a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java index ecfe31d427f..1d2de0f7640 100644 --- a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java +++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java @@ -25,7 +25,7 @@ * @test CheckCompileThresholdScaling * @bug 8059604 * @summary Add CompileThresholdScaling flag to control when methods are first compiled (with +/-TieredCompilation) - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver compiler.arguments.CheckCompileThresholdScaling @@ -33,8 +33,8 @@ package compiler.arguments; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class CheckCompileThresholdScaling { diff --git a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java index 5d7f9fc3bc3..001ac21ac34 100644 --- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java @@ -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,11 +26,10 @@ * @bug 8031321 * @summary Verify processing of UseBMI1Instructions option on CPU with * BMI1 feature support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.arguments.TestUseBMI1InstructionsOnSupportedCPU - * compiler.arguments.BMISupportedCPUTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java index 4fd996f584a..fe4f4d8df57 100644 --- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java @@ -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,11 +26,10 @@ * @bug 8031321 * @summary Verify processing of UseBMI1Instructions option on CPU without * BMI1 feature support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.arguments.TestUseBMI1InstructionsOnUnsupportedCPU - * compiler.arguments.BMIUnsupportedCPUTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java index 3ebd44d5b13..2d71823fe10 100644 --- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java @@ -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,11 +26,11 @@ * @bug 8031321 * @summary Verify processing of UseCountLeadingZerosInstruction option * on CPU with LZCNT support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.arguments.TestUseCountLeadingZerosInstructionOnSupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java index 4285c27cb48..a79a04f3b7a 100644 --- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java @@ -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,11 +26,11 @@ * @bug 8031321 * @summary Verify processing of UseCountLeadingZerosInstruction option * on CPU without LZCNT support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.arguments.TestUseCountLeadingZerosInstructionOnUnsupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java index 3e988e6b7fe..a0262952134 100644 --- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java @@ -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,11 +26,11 @@ * @bug 8031321 * @summary Verify processing of UseCountTrailingZerosInstruction option * on CPU with TZCNT (BMI1 feature) support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.arguments.TestUseCountTrailingZerosInstructionOnSupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java index 96ccd674126..a6a9501322a 100644 --- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java @@ -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,11 +26,11 @@ * @bug 8031321 * @summary Verify processing of UseCountTrailingZerosInstruction option * on CPU without TZCNT instruction (BMI1 feature) support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.arguments.TestUseCountTrailingZerosInstructionOnUnsupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java index c3ee9a4d495..e121ab36b6b 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,13 +26,12 @@ * @bug 8072016 * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.arraycopy.TestArrayCopyNoInitDeopt + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission - * jdk.test.lib.Platform * @run main/othervm -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020 * compiler.arraycopy.TestArrayCopyNoInitDeopt diff --git a/hotspot/test/compiler/c2/PolynomialRoot.java b/hotspot/test/compiler/c2/PolynomialRoot.java index 86836d0b93b..fe34c845c94 100644 --- a/hotspot/test/compiler/c2/PolynomialRoot.java +++ b/hotspot/test/compiler/c2/PolynomialRoot.java @@ -13,7 +13,7 @@ * @test * @bug 8005956 * @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/c2/Test5057225.java b/hotspot/test/compiler/c2/Test5057225.java index 632f678d85f..99f7e5d6a44 100644 --- a/hotspot/test/compiler/c2/Test5057225.java +++ b/hotspot/test/compiler/c2/Test5057225.java @@ -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 @@ -26,7 +26,7 @@ * @bug 5057225 * @summary Remove useless I2L conversions * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main/othervm -Xcomp * -XX:CompileCommand=compileonly,compiler.c2.Test5057225::doload diff --git a/hotspot/test/compiler/c2/Test6603011.java b/hotspot/test/compiler/c2/Test6603011.java index 9495fe3a054..a4e7d03571e 100644 --- a/hotspot/test/compiler/c2/Test6603011.java +++ b/hotspot/test/compiler/c2/Test6603011.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @bug 6603011 * @summary long/int division by constant * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main/othervm -Xcomp -Xbatch -XX:-Inline compiler.c2.Test6603011 */ diff --git a/hotspot/test/compiler/c2/Test6800154.java b/hotspot/test/compiler/c2/Test6800154.java index 9de9b7648d2..d8407cfa9f0 100644 --- a/hotspot/test/compiler/c2/Test6800154.java +++ b/hotspot/test/compiler/c2/Test6800154.java @@ -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 @@ -26,7 +26,7 @@ * @bug 6800154 * @summary Add comments to long_by_long_mulhi() for better understandability * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main/othervm -Xcomp * -XX:CompileCommand=compileonly,compiler.c2.Test6800154::divcomp diff --git a/hotspot/test/compiler/c2/Test6805724.java b/hotspot/test/compiler/c2/Test6805724.java index 2433fce8377..d0565c6e67a 100644 --- a/hotspot/test/compiler/c2/Test6805724.java +++ b/hotspot/test/compiler/c2/Test6805724.java @@ -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 @@ -27,7 +27,7 @@ * @summary ModLNode::Ideal() generates functionally incorrect graph * when divisor is any (2^k-1) constant. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main/othervm -Xcomp * -XX:CompileCommand=compileonly,compiler.c2.Test6805724::fcomp diff --git a/hotspot/test/compiler/c2/Test6857159.java b/hotspot/test/compiler/c2/Test6857159.java index 894fc5f1cbe..efe9653ebe3 100644 --- a/hotspot/test/compiler/c2/Test6857159.java +++ b/hotspot/test/compiler/c2/Test6857159.java @@ -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 @@ -26,7 +26,7 @@ * @test * @bug 6857159 * @summary local schedule failed with checkcast of Thread.currentThread() - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -35,8 +35,8 @@ package compiler.c2; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class Test6857159 { public static void main(String[] args) throws Throwable { diff --git a/hotspot/test/compiler/c2/Test7068051.java b/hotspot/test/compiler/c2/Test7068051.java index 408fd6f0b37..d16629077d9 100644 --- a/hotspot/test/compiler/c2/Test7068051.java +++ b/hotspot/test/compiler/c2/Test7068051.java @@ -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 @@ -26,7 +26,7 @@ * @test * @bug 7068051 * @summary SIGSEGV in PhaseIdealLoop::build_loop_late_post on T5440 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -36,7 +36,7 @@ package compiler.c2; import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import java.io.IOException; import java.io.InputStream; diff --git a/hotspot/test/compiler/c2/Test7177917.java b/hotspot/test/compiler/c2/Test7177917.java index 6fe88a37bff..ae4529a52f9 100644 --- a/hotspot/test/compiler/c2/Test7177917.java +++ b/hotspot/test/compiler/c2/Test7177917.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @bug 7177917 * @summary Micro-benchmark for Math.pow() and Math.exp() * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main compiler.c2.Test7177917 */ diff --git a/hotspot/test/compiler/c2/cr6589834/Test_ia32.java b/hotspot/test/compiler/c2/cr6589834/Test_ia32.java index c6cf6510c57..58f56351323 100644 --- a/hotspot/test/compiler/c2/cr6589834/Test_ia32.java +++ b/hotspot/test/compiler/c2/cr6589834/Test_ia32.java @@ -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 @@ -26,15 +26,13 @@ * @bug 6589834 * @summary Safepoint placed between stack pointer increment and decrement leads * to interpreter's stack corruption after deoptimization. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor * - * @build ClassFileInstaller sun.hotspot.WhiteBox jdk.test.lib.* - * compiler.c2.cr6589834.Test_ia32 - * compiler.c2.cr6589834.InlinedArrayCloneTestCase + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/c2/stemmer/Stemmer.java b/hotspot/test/compiler/c2/stemmer/Stemmer.java index 0f8cb297010..893749d3a99 100644 --- a/hotspot/test/compiler/c2/stemmer/Stemmer.java +++ b/hotspot/test/compiler/c2/stemmer/Stemmer.java @@ -3,7 +3,7 @@ * @bug 7070134 * @summary Hotspot crashes with sigsegv from PorterStemmer * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run driver jdk.test.lib.FileInstaller words words * @run main/othervm -Xbatch compiler.c2.stemmer.Stemmer words diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java index 0ba2498b8a8..777189c307d 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java @@ -24,12 +24,11 @@ /* * @test * @summary check calls from compiled to compiled using InvokeDynamic - * @library /test/lib /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.base/jdk.internal.org.objectweb.asm * - * @build compiler.calls.common.InvokeDynamic - * compiler.calls.common.InvokeDynamicPatcher + * @build sun.hotspot.WhiteBox * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java index 98a86b15360..e0a25eb3897 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java @@ -24,12 +24,11 @@ /* * @test * @summary check calls from compiled to interpreted using InvokeDynamic - * @library /test/lib /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.base/jdk.internal.org.objectweb.asm * - * @build compiler.calls.common.InvokeDynamic - * @build compiler.calls.common.InvokeDynamicPatcher + * @build sun.hotspot.WhiteBox * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java index 397faf23229..4c81223b565 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java @@ -24,12 +24,11 @@ /* * @test * @summary check calls from compiled to native using InvokeDynamic - * @library /test/lib /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.base/jdk.internal.org.objectweb.asm * - * @build compiler.calls.common.InvokeDynamic - * compiler.calls.common.InvokeDynamicPatcher + * @build sun.hotspot.WhiteBox * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java index 46667c9e794..4332fda343b 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @modules java.base/jdk.internal.misc * @summary check calls from compiled to compiled using InvokeInterface - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeInterface + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java index 07fcff14d2c..c889b919d11 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to interpreted using InvokeInterface * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeInterface + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java index e3a68951d30..2544b4cc3d8 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to native using InvokeInterface * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeInterface + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java index 07e6fc906ec..882b75ccb4b 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to compiled using InvokeSpecial * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeSpecial + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java index e08784dc1df..79a8075f130 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to interpreted using InvokeSpecial * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeSpecial + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java index 600301b3e01..301811399c2 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to native using InvokeSpecial * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeSpecial + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java index ddd88ab72df..85412f2f762 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to compiled using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java index 7ca6263ca59..96c2d9655cb 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to interpreted using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java index 560c8079cd5..a40d9d41090 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to native using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java index ef408fdfc3b..1c6701dd858 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to compiled using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeVirtual + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java index 718aef28707..7ece0a4cd97 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to interpreted using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeVirtual + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java index e161834319e..c82f056bd24 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from compiled to native using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeVirtual + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java index f83beb4127e..4b9d84f47f4 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java @@ -24,12 +24,11 @@ /* * @test * @summary check calls from interpreted to compiled using InvokeDynamic - * @library /test/lib /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.base/jdk.internal.org.objectweb.asm * - * @build compiler.calls.common.InvokeDynamic - * compiler.calls.common.InvokeDynamicPatcher + * @build sun.hotspot.WhiteBox * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java index e4ff0998b66..028008805a4 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java @@ -24,12 +24,11 @@ /* * @test * @summary check calls from interpreted to interpreted using InvokeDynamic - * @library /test/lib /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.base/jdk.internal.org.objectweb.asm * - * @build compiler.calls.common.InvokeDynamic - * compiler.calls.common.InvokeDynamicPatcher + * @build sun.hotspot.WhiteBox * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java index 37850589fa6..1d5ac09b6c1 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java @@ -24,12 +24,11 @@ /* * @test * @summary check calls from interpreted to native using InvokeDynamic - * @library /test/lib /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.base/jdk.internal.org.objectweb.asm * - * @build compiler.calls.common.InvokeDynamic - * compiler.calls.common.InvokeDynamicPatcher + * @build sun.hotspot.WhiteBox * @run main compiler.calls.common.InvokeDynamicPatcher * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java index 83024bb25b4..4d3f556b6a7 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to compiled using InvokeInterface * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeInterface + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java index 2a811103ba3..8c1b18d7824 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to interpreted using InvokeInterface * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeInterface + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java index 72c927568cc..b03e5bd5ec2 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to native using InvokeInterface * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeInterface + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2CompiledTest.java index ad0b12f1d7f..2624a94386a 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / - * @build compiler.calls.common.InvokeSpecial + * @library /test/lib / + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java index a6a3ae46ba3..d0da40eaa32 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to interpreted using InvokeSpecial * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeSpecial + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java index f52dd626082..8593ebc2551 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @summary check calls from interpreted to native using InvokeSpecial * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java index 1db10145bce..a83b6d3a31e 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to compiled using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java index 7e3925491eb..88aca669169 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to interpreted using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java index 789fe9c77f3..a17e9c5c2a7 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to native using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java index 41e89d3babc..db644c14842 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to compiled using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeVirtual + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java index f299f4ae85a..e6d94ee077b 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to interpreted using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeVirtual + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java index 5a99727c863..9ebf7a359c8 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from interpreted to native using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeVirtual + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java index b25f7a12053..74007716168 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from native to compiled using InvokeSpecial * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeSpecial + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java index f7c66cf77e8..4efd098904d 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from native to interpreted using InvokeSpecial * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeSpecial + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java index 041af4fb832..1005783754c 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from native to native using InvokeSpecial * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeSpecial + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java index f7e8f52b112..f1f0634e9f0 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from native to compiled using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java index ab0e447e350..fc0a0592072 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from native to interpreted using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java index de0b8c158c8..f9da3d65c98 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from native to native using InvokeStatic * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeStatic + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java index 4361a8d5690..b6cce29b413 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from native to compiled using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeVirtual + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java index fde24657a05..270ecfa6f35 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @summary check calls from native to interpreted using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / - * @build compiler.calls.common.InvokeVirtual + * @library /test/lib / + * @build sun.hotspot.WhiteBox * * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java index a07510709f3..83564c143b2 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @summary check calls from native to native using InvokeVirtual * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary / + * @library /test/lib / * - * @build compiler.calls.common.InvokeVirtual + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java index 694b6e74bfc..ea2d1920d87 100644 --- a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java +++ b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java @@ -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 @@ -25,7 +25,7 @@ * @test TestAnonymousClassUnloading * @bug 8054402 * @summary "Tests unloading of anonymous classes." - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * * @run main/othervm/bootclasspath -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java b/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java index d0f022d7fbe..9b0598f3f60 100644 --- a/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java +++ b/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 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,9 +26,9 @@ * @bug 8029443 * @summary Tests the unloading of methods to to class unloading * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.classUnloading.methodUnloading.TestMethodUnloading + * @build sun.hotspot.WhiteBox * compiler.classUnloading.methodUnloading.WorkerClass * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java index 1c8d70f5adb..eb8fcc0c178 100644 --- a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java +++ b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java @@ -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 @@ -26,7 +26,7 @@ * @bug 8013496 * @summary Test checks that the order in which ReversedCodeCacheSize and * InitialCodeCacheSize are passed to the VM is irrelevant. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -35,8 +35,8 @@ package compiler.codecache; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class CheckReservedInitialCodeCacheSizeArgOrder { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java index 2e09a4a580c..12e1ca15ac7 100644 --- a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java +++ b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java @@ -25,11 +25,11 @@ * @test CheckSegmentedCodeCache * @bug 8015774 * @summary Checks VM options related to the segmented code cache - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.codecache.CheckSegmentedCodeCache + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -39,9 +39,9 @@ package compiler.codecache; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; import sun.hotspot.WhiteBox; public class CheckSegmentedCodeCache { diff --git a/hotspot/test/compiler/codecache/CheckUpperLimit.java b/hotspot/test/compiler/codecache/CheckUpperLimit.java index d4c34ca36e5..473ec3f147c 100644 --- a/hotspot/test/compiler/codecache/CheckUpperLimit.java +++ b/hotspot/test/compiler/codecache/CheckUpperLimit.java @@ -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 * @bug 8015635 * @summary Test ensures that the ReservedCodeCacheSize is at most MAXINT - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -34,8 +34,8 @@ package compiler.codecache; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class CheckUpperLimit { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java index 6b45694e988..64bbd2c1dae 100644 --- a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java +++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java @@ -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,11 +26,11 @@ * @test OverflowCodeCacheTest * @bug 8059550 * @summary testing of code cache segments overflow - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.codecache.OverflowCodeCacheTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java index c5db695125b..c6fc3af49d5 100644 --- a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java +++ b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java @@ -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 @@ -25,20 +25,19 @@ * @test * @bug 8015774 * @summary Verify SegmentedCodeCache option's processing - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor * - * @build jdk.test.lib.* * @run driver compiler.codecache.cli.TestSegmentedCodeCacheOption */ package compiler.codecache.cli; import compiler.codecache.cli.common.CodeCacheOptions; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import sun.hotspot.code.BlobType; diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java b/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java index ffc333c7d84..56816e8b81a 100644 --- a/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java +++ b/hotspot/test/compiler/codecache/cli/codeheapsize/CodeCacheFreeSpaceRunner.java @@ -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 @@ -25,7 +25,7 @@ package compiler.codecache.cli.codeheapsize; import compiler.codecache.cli.common.CodeCacheCLITestCase; import compiler.codecache.cli.common.CodeCacheOptions; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import sun.hotspot.code.BlobType; diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java b/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java index 8eb8d15af3e..bde7beb68bf 100644 --- a/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java +++ b/hotspot/test/compiler/codecache/cli/codeheapsize/JVMStartupRunner.java @@ -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 @@ -25,7 +25,7 @@ package compiler.codecache.cli.codeheapsize; import compiler.codecache.cli.common.CodeCacheCLITestCase; import compiler.codecache.cli.common.CodeCacheOptions; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; import sun.hotspot.code.BlobType; diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java index ce576107af8..ca28cdb29ff 100644 --- a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java +++ b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java @@ -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 @@ -25,13 +25,12 @@ * @test * @bug 8015774 * @summary Verify processing of options related to code heaps sizing. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor * - * @build compiler.codecache.cli.codeheapsize.TestCodeHeapSizeOptions jdk.test.lib.* * @run driver/timeout=240 compiler.codecache.cli.codeheapsize.TestCodeHeapSizeOptions */ diff --git a/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java b/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java index 4bd269aafb5..43d4e387852 100644 --- a/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java +++ b/hotspot/test/compiler/codecache/cli/printcodecache/PrintCodeCacheRunner.java @@ -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 @@ package compiler.codecache.cli.printcodecache; import compiler.codecache.cli.common.CodeCacheCLITestCase; import compiler.codecache.cli.common.CodeCacheInfoFormatter; import compiler.codecache.cli.common.CodeCacheOptions; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import sun.hotspot.code.BlobType; diff --git a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java index eb50d4a7e3e..74ed9071156 100644 --- a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java +++ b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java @@ -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 @@ -25,13 +25,12 @@ * @test * @bug 8015774 * @summary Verify that PrintCodeCache option print correct information. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor * - * @build jdk.test.lib.* compiler.codecache.cli.common.* * @run main/timeout=240 compiler.codecache.cli.printcodecache.TestPrintCodeCacheOption */ diff --git a/hotspot/test/testlibrary/jdk/test/lib/dtrace/DtraceResultsAnalyzer.java b/hotspot/test/compiler/codecache/dtrace/DtraceResultsAnalyzer.java similarity index 88% rename from hotspot/test/testlibrary/jdk/test/lib/dtrace/DtraceResultsAnalyzer.java rename to hotspot/test/compiler/codecache/dtrace/DtraceResultsAnalyzer.java index 1df4512105e..9cab7a422c4 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dtrace/DtraceResultsAnalyzer.java +++ b/hotspot/test/compiler/codecache/dtrace/DtraceResultsAnalyzer.java @@ -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 @@ -20,9 +20,9 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.test.lib.dtrace; +package compiler.codecache.dtrace; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; public interface DtraceResultsAnalyzer { public void analyze(OutputAnalyzer oa, String logFilePath); diff --git a/hotspot/test/testlibrary/jdk/test/lib/dtrace/DtraceRunner.java b/hotspot/test/compiler/codecache/dtrace/DtraceRunner.java similarity index 97% rename from hotspot/test/testlibrary/jdk/test/lib/dtrace/DtraceRunner.java rename to hotspot/test/compiler/codecache/dtrace/DtraceRunner.java index 014087c8814..dbdbfa15f09 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dtrace/DtraceRunner.java +++ b/hotspot/test/compiler/codecache/dtrace/DtraceRunner.java @@ -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 @@ -20,10 +20,10 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.test.lib.dtrace; +package compiler.codecache.dtrace; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import java.io.File; import java.io.IOException; import java.util.ArrayList; diff --git a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java index 535adc0a4fb..d4dbf663a19 100644 --- a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java +++ b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java @@ -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 @@ -27,9 +27,9 @@ * @summary testing of dtrace for segmented code cache * @requires os.family=="solaris" * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.codecache.dtrace.SegmentedCodeCacheDtraceTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -Xbootclasspath/a:. @@ -42,10 +42,8 @@ package compiler.codecache.dtrace; import compiler.testlibrary.CompilerUtils; import jdk.test.lib.Asserts; import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; -import jdk.test.lib.dtrace.DtraceResultsAnalyzer; -import jdk.test.lib.dtrace.DtraceRunner; import java.io.IOException; import java.lang.reflect.Executable; diff --git a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java index d620e9ee3f2..dca730a46ac 100644 --- a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java +++ b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java @@ -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,9 +26,9 @@ * @summary verify types of code cache memory pool bean * @modules java.base/jdk.internal.misc * java.management - * @library /testlibrary /test/lib + * @library /test/lib * - * @build compiler.codecache.jmx.BeanTypeTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java b/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java index 31646f96225..0cce0931188 100644 --- a/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java +++ b/hotspot/test/compiler/codecache/jmx/CodeCacheUtils.java @@ -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 @@ -119,6 +119,28 @@ public final class CodeCacheUtils { } } + /** + * Verifies that 'newValue' is equal to 'oldValue' if usage of the + * corresponding code heap is predictable. Checks the weaker condition + * 'newValue <= oldValue' if usage is not predictable because intermediate + * allocations may happen. + * + * @param btype BlobType of the code heap to be checked + * @param newValue New value to be verified + * @param oldValue Old value to be verified + * @param msg Error message if verification fails + */ + public static void assertEQorLTE(BlobType btype, long newValue, long oldValue, String msg) { + if (CodeCacheUtils.isCodeHeapPredictable(btype)) { + // Usage is predictable, check strong == condition + Asserts.assertEQ(newValue, oldValue, msg); + } else { + // Usage is not predictable, check weaker <= condition + Asserts.assertLTE(newValue, oldValue, msg); + } + } + + public static void disableCollectionUsageThresholds() { BlobType.getAvailable().stream() .map(BlobType::getMemoryPool) diff --git a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java index ccf6927a467..0bdd2f78676 100644 --- a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java @@ -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,9 +26,9 @@ * @summary verify CodeHeap bean presence * @modules java.base/jdk.internal.misc * java.management - * @library /testlibrary /test/lib + * @library /test/lib * - * @build compiler.codecache.jmx.CodeHeapBeanPresenceTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java index 01f247c43ed..cf838dd14da 100644 --- a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java @@ -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,9 +26,9 @@ * @summary testing of getUsage() for segmented code cache * @modules java.base/jdk.internal.misc * java.management - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.codecache.jmx.GetUsageTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java index e96dc4713d9..49b1fa53fe8 100644 --- a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java @@ -26,9 +26,9 @@ * @summary testing of initial and max usage * @modules java.base/jdk.internal.misc * java.management - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.codecache.jmx.InitialAndMaxUsageTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing diff --git a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java index f8e678727e1..a80298a2066 100644 --- a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java +++ b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java @@ -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,9 +26,9 @@ * @summary verify getMemoryManageNames calls in case of segmented code cache * @modules java.base/jdk.internal.misc * java.management - * @library /testlibrary /test/lib + * @library /test/lib * - * @build compiler.codecache.jmx.ManagerNamesTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java index b0796cd3213..6e5ea32f577 100644 --- a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java @@ -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,9 +26,9 @@ * @summary verify that MemoryManagerMXBean exists for every code cache segment * @modules java.base/jdk.internal.misc * java.management - * @library /testlibrary /test/lib + * @library /test/lib * - * @build compiler.codecache.jmx.MemoryPoolsPresenceTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java index e75a362142e..57518e61833 100644 --- a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java @@ -23,12 +23,11 @@ /* * @test PeakUsageTest - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @ignore 8151345 - * @build ompiler.codecache.jmx.PeakUsageTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -69,9 +68,17 @@ public class PeakUsageTest { bean.resetPeakUsage(); long addr = CodeCacheUtils.WB.allocateCodeBlob( CodeCacheUtils.ALLOCATION_SIZE, btype.id); - long newPeakUsage = bean.getPeakUsage().getUsed(); + try { - CodeCacheUtils.assertEQorGTE(btype, newPeakUsage, bean.getUsage().getUsed(), + /* + Always save peakUsage after saving currentUsage. Reversing the order + can lead to inconsistent results (currentUsage > peakUsage) because + of intermediate allocations. + */ + long currUsage = bean.getUsage().getUsed(); + long peakUsage = bean.getPeakUsage().getUsed(); + CodeCacheUtils.assertEQorLTE(btype, currUsage, + peakUsage, "Peak usage does not match usage after allocation for " + bean.getName()); } finally { @@ -79,19 +86,21 @@ public class PeakUsageTest { CodeCacheUtils.WB.freeCodeBlob(addr); } } - CodeCacheUtils.assertEQorGTE(btype, newPeakUsage, bean.getPeakUsage().getUsed(), - "Code cache peak usage has changed after usage decreased for " - + bean.getName()); bean.resetPeakUsage(); - CodeCacheUtils.assertEQorGTE(btype, bean.getPeakUsage().getUsed(), - bean.getUsage().getUsed(), + long currUsage = bean.getUsage().getUsed(); + long peakUsage = bean.getPeakUsage().getUsed(); + CodeCacheUtils.assertEQorLTE(btype, currUsage, + peakUsage, "Code cache peak usage is not equal to usage after reset for " + bean.getName()); long addr2 = CodeCacheUtils.WB.allocateCodeBlob( CodeCacheUtils.ALLOCATION_SIZE, btype.id); try { - CodeCacheUtils.assertEQorGTE(btype, bean.getPeakUsage().getUsed(), - bean.getUsage().getUsed(), + currUsage = bean.getUsage().getUsed(); + peakUsage = bean.getPeakUsage().getUsed(); + + CodeCacheUtils.assertEQorLTE(btype, currUsage, + peakUsage, "Code cache peak usage is not equal to usage after fresh " + "allocation for " + bean.getName()); } finally { diff --git a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java index cd61fea7ac6..50b56ef461f 100644 --- a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java @@ -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,9 +26,9 @@ * @summary testing of getUsageThreshold() * @modules java.base/jdk.internal.misc * java.management - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.codecache.jmx.PoolsIndependenceTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java index e173fc8a6c7..e3cc8734674 100644 --- a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java +++ b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java @@ -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,11 +24,11 @@ /* * @test ThresholdNotificationsTest * @summary testing of getUsageThreshold() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.codecache.jmx.ThresholdNotificationsTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -Xbootclasspath/a:. -XX:-UseCodeCacheFlushing diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java index e90222d8c1d..fd39beaaaf7 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java @@ -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 @@ -25,11 +25,11 @@ * @test UsageThresholdExceededSeveralTimesTest * @summary verifying that getUsageThresholdCount() returns correct value * after threshold has been hit several times - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.codecache.jmx.UsageThresholdExceededTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java index 154a096a277..bf78a1c910c 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java @@ -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 @@ -25,11 +25,11 @@ * @test UsageThresholdExceededTest * @summary verifying that getUsageThresholdCount() returns correct value * after threshold has been hit - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.codecache.jmx.UsageThresholdExceededTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java index f432f8a1e70..ee071d41843 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java @@ -25,11 +25,10 @@ * @test UsageThresholdIncreasedTest * @summary verifying that threshold hasn't been hit after allocation smaller * than threshold value and that threshold value can be changed - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * - * @build compiler.codecache.jmx.UsageThresholdIncreasedTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java index 46bd21b8b2d..60587960821 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java @@ -25,13 +25,13 @@ * @test UsageThresholdNotExceededTest * @summary verifying that usage threshold not exceeded while allocating less * than usage threshold - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @build compiler.codecache.jmx.UsageThresholdNotExceededTest * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -XX:-MethodFlushing * -XX:CompileCommand=compileonly,null::* diff --git a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java index e3d4a9af13f..e02eef8f7bb 100644 --- a/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java +++ b/hotspot/test/compiler/codecache/stress/CodeCacheStressRunner.java @@ -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 @@ package compiler.codecache.stress; -import jdk.test.lib.TimeLimitedRunner; +import jdk.test.lib.wrappers.TimeLimitedRunner; import jdk.test.lib.Utils; public class CodeCacheStressRunner { diff --git a/hotspot/test/compiler/codecache/stress/Helper.java b/hotspot/test/compiler/codecache/stress/Helper.java index 6399d30d5dc..1e2f04f617b 100644 --- a/hotspot/test/compiler/codecache/stress/Helper.java +++ b/hotspot/test/compiler/codecache/stress/Helper.java @@ -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 @@ package compiler.codecache.stress; import jdk.test.lib.Asserts; import jdk.test.lib.ByteCodeLoader; -import jdk.test.lib.InfiniteLoop; +import jdk.test.lib.wrappers.InfiniteLoop; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java index 4a93f2ef4dd..95899878e81 100644 --- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java +++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java @@ -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 @@ -25,12 +25,12 @@ /* * @test OverloadCompileQueueTest * @summary stressing code cache by overloading compile queues - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * * @ignore 8071905 - * @build compiler.codecache.stress.OverloadCompileQueueTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java index 761cbfd4842..21f602b39a7 100644 --- a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java +++ b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java @@ -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,11 +26,11 @@ * @test RandomAllocationTest * @key stress * @summary stressing code cache by allocating randomly sized "dummy" code blobs - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.codecache.stress.RandomAllocationTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java index 4cd43a154e7..a6b3a6cb9e4 100644 --- a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java +++ b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java @@ -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,11 +26,11 @@ * @test UnexpectedDeoptimizationTest * @key stress * @summary stressing code cache by forcing unexpected deoptimizations - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.codecache.stress.UnexpectedDeoptimizationTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/codegen/Test6823354.java b/hotspot/test/compiler/codegen/Test6823354.java index 7ff6f2ca94d..fb332420f14 100644 --- a/hotspot/test/compiler/codegen/Test6823354.java +++ b/hotspot/test/compiler/codegen/Test6823354.java @@ -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 @@ -26,7 +26,7 @@ * @bug 6823354 * @summary These methods can be instrinsified by using bit scan, bit test, and population count instructions. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main/othervm -Xcomp * -XX:CompileCommand=compileonly,compiler.codegen.Test6823354::lzcomp diff --git a/hotspot/test/compiler/codegen/Test6896617.java b/hotspot/test/compiler/codegen/Test6896617.java index 90e4854f321..bc3807bef8d 100644 --- a/hotspot/test/compiler/codegen/Test6896617.java +++ b/hotspot/test/compiler/codegen/Test6896617.java @@ -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 * @bug 6896617 * @summary Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() with SSE instructions on x86 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.base/sun.nio.cs * java.management diff --git a/hotspot/test/compiler/codegen/Test7100757.java b/hotspot/test/compiler/codegen/Test7100757.java index 3736d85c7fb..6dbae9c6cab 100644 --- a/hotspot/test/compiler/codegen/Test7100757.java +++ b/hotspot/test/compiler/codegen/Test7100757.java @@ -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 @@ -26,7 +26,7 @@ * @test * @bug 7100757 * @summary The BitSet.nextSetBit() produces incorrect result in 32bit VM on Sparc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/codegen/aes/TestAESMain.java b/hotspot/test/compiler/codegen/aes/TestAESMain.java index 36353ca45f3..4c9398de8da 100644 --- a/hotspot/test/compiler/codegen/aes/TestAESMain.java +++ b/hotspot/test/compiler/codegen/aes/TestAESMain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @bug 7184394 * @key stress * @summary add intrinsics to use AES instructions - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java b/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java index a406e2edbac..b2c6507c1d8 100644 --- a/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java +++ b/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,9 +26,9 @@ * @bug 8074095 * @summary Testing of compiler/InlineMatcher * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * - * @build compiler.compilercontrol.InlineMatcherTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java index 882e78367b8..11013a69da3 100644 --- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java +++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,16 +25,12 @@ * @test TestCompilerDirectivesCompatibilityBase * @bug 8137167 * @summary Test compiler control compatibility with compile command - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * - * @build jdk.test.lib.* - * jdk.test.lib.dcmd.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.TestCompilerDirectivesCompatibilityBase + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java index 903691954f6..d8e246c429a 100644 --- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java +++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,16 +25,12 @@ * @test TestCompilerDirectivesCompatibilityCommandOff * @bug 8137167 * @summary Test compiler control compatibility with compile command - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * - * @build jdk.test.lib.* - * jdk.test.lib.dcmd.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.TestCompilerDirectivesCompatibilityCommandOff + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java index 7336b0ec3cc..44bf2a7ecd8 100644 --- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java +++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,16 +25,12 @@ * @test TestCompilerDirectivesCompatibilityCommandOn * @bug 8137167 * @summary Test compiler control compatibility with compile command - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * - * @build jdk.test.lib.* - * jdk.test.lib.dcmd.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.TestCompilerDirectivesCompatibilityCommandOn + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java index a8276567b8b..81f1460313d 100644 --- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java +++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,16 +24,12 @@ /* * @test TestCompilerDirectivesCompatibilityFlag * @bug 8137167 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * - * @build jdk.test.lib.* - * jdk.test.lib.dcmd.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.TestCompilerDirectivesCompatibilityFlag + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java index ae03d3ff2c3..bb49aea3c4f 100644 --- a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java +++ b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests CompileCommand=compileonly * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.commandfile.CompileOnlyTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.commandfile.CompileOnlyTest diff --git a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java index 0caa287210f..8c48e9a0443 100644 --- a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java +++ b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests CompileCommand=exclude * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.commandfile.ExcludeTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.commandfile.ExcludeTest diff --git a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java index 1d5768b2cef..5c0551a0200 100644 --- a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java +++ b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests CompileCommand=log * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.commandfile.LogTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.commandfile.LogTest diff --git a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java index 30127ce7885..1187d75334c 100644 --- a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java +++ b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests CompileCommand=print * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.commandfile.PrintTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.commandfile.PrintTest diff --git a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java index 49b6c484759..7dcd1885f07 100644 --- a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java +++ b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests CompileCommand=compileonly * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.commands.CompileOnlyTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.commands.CompileOnlyTest diff --git a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java index d6b931eda15..3765d175dd6 100644 --- a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java +++ b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests CompileCommand=exclude * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.commands.ExcludeTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.commands.ExcludeTest diff --git a/hotspot/test/compiler/compilercontrol/commands/LogTest.java b/hotspot/test/compiler/compilercontrol/commands/LogTest.java index b079475555e..0d9b7af260e 100644 --- a/hotspot/test/compiler/compilercontrol/commands/LogTest.java +++ b/hotspot/test/compiler/compilercontrol/commands/LogTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests CompileCommand=log * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.commands.LogTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.commands.LogTest diff --git a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java index ca5eaa06049..26ce69351ec 100644 --- a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java +++ b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests CompileCommand=print * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.commands.PrintTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.commands.PrintTest diff --git a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java index fce58414830..f79e97f9683 100644 --- a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java +++ b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests directives to be able to compile only specified methods * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.directives.CompileOnlyTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.directives.CompileOnlyTest diff --git a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java index fda9b26a885..1d0dfe3c577 100644 --- a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java +++ b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests directives to be able to exclude methods from compilation * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.directives.ExcludeTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.directives.ExcludeTest diff --git a/hotspot/test/compiler/compilercontrol/directives/LogTest.java b/hotspot/test/compiler/compilercontrol/directives/LogTest.java index d5cef20565b..5e32238cd98 100644 --- a/hotspot/test/compiler/compilercontrol/directives/LogTest.java +++ b/hotspot/test/compiler/compilercontrol/directives/LogTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests directives to be able to turn on LogCompilation * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.directives.LogTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.directives.LogTest diff --git a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java index 41326546b8e..83c613680ef 100644 --- a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java +++ b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests directives to be able to turn on print_assembly * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.directives.PrintTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.directives.PrintTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java index 55674ebfcaa..96e8599d14e 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests directives to be able to add and remove directives * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.jcmd.AddAndRemoveTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.AddAndRemoveTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java index 598a2ea4a76..5cb7069838f 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @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 / + * @library /test/lib / * - * @build compiler.compilercontrol.jcmd.AddCompileOnlyTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.AddCompileOnlyTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java index c8be85dddaa..dc57aa2e82f 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @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 / + * @library /test/lib / * - * @build compiler.compilercontrol.jcmd.AddExcludeTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.AddExcludeTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java index c4ffd001dc9..91b8c934d88 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @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 / + * @library /test/lib / * - * @build compiler.compilercontrol.jcmd.AddLogTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.AddLogTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java index 5d817895dcc..d719df0eb9b 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,14 +27,9 @@ * @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 / + * @library /test/lib / * - * @build compiler.compilercontrol.jcmd.AddPrintAssemblyTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.AddPrintAssemblyTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java index bd01ba11857..ed76061b2cd 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,15 +26,10 @@ * @bug 8137167 * @summary Tests jcmd to be able to clear directives added via options * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * * @ignore 8140405 - * @build compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java index d8c8c81d49e..8514afd083d 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests clear JCMD command * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.jcmd.ClearDirectivesStackTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.ClearDirectivesStackTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java index 297ad1abb8a..335e89c6668 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,15 +26,10 @@ * @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 / + * @library /test/lib / * @requires vm.flavor != "minimal" * - * @build compiler.compilercontrol.jcmd.PrintDirectivesTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.PrintDirectivesTest diff --git a/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java b/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java index 4f8dd0fa14c..30baaed7684 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddJcmdBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,8 @@ import compiler.compilercontrol.share.AbstractTestBase; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.scenario.Executor; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.TimeLimitedRunner; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.wrappers.TimeLimitedRunner; import jdk.test.lib.Utils; import java.util.ArrayList; diff --git a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java index 2fbe53616c8..e5c277ae624 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,14 +27,9 @@ * @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 / + * @library /test/lib / * - * @build compiler.compilercontrol.jcmd.StressAddMultiThreadedTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.jcmd.StressAddMultiThreadedTest diff --git a/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java b/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java index 1535d3e3d55..b681029061a 100644 --- a/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java +++ b/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Tests LogCompilation executed standalone without log commands or directives * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.logcompilation.LogTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver compiler.compilercontrol.logcompilation.LogTest diff --git a/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java b/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java index 91c7fa73768..cff49828bd8 100644 --- a/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java +++ b/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,9 +26,9 @@ * @bug 8135068 * @summary Tests CompilerCommand's method matcher * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.matcher.MethodMatcherTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -40,7 +40,7 @@ package compiler.compilercontrol.matcher; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; import compiler.compilercontrol.share.pool.PoolHelper; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import sun.hotspot.WhiteBox; import java.lang.reflect.Executable; diff --git a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java index 85cb8c6a7fd..b7fd9030663 100644 --- a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java +++ b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Randomly generates commands with random types * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.mixed.RandomCommandsTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=600 compiler.compilercontrol.mixed.RandomCommandsTest diff --git a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java index 4b1b6f692cb..9a1e9ce50c3 100644 --- a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java +++ b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,9 @@ * @bug 8137167 * @summary Randomly generates valid commands with random types * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.compilercontrol.mixed.RandomValidCommandsTest - * compiler.compilercontrol.share.pool.sub.* - * compiler.compilercontrol.share.pool.subpack.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils - * compiler.compilercontrol.share.actions.* + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=600 compiler.compilercontrol.mixed.RandomValidCommandsTest diff --git a/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java b/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java index a362e02c1a8..b230b1d72ab 100644 --- a/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java +++ b/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @bug 8137167 * @summary Tests directive json parser * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * * @run driver compiler.compilercontrol.parser.DirectiveParserTest */ @@ -35,7 +35,7 @@ package compiler.compilercontrol.parser; import compiler.compilercontrol.share.JSONFile; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; public class DirectiveParserTest { diff --git a/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java b/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java index fa95072b725..2cf7dbe6e91 100644 --- a/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java +++ b/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @bug 8137167 * @summary Stress directive json parser * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * * @run driver compiler.compilercontrol.parser.DirectiveStressTest */ @@ -38,7 +38,7 @@ import compiler.compilercontrol.share.JSONFile; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.scenario.DirectiveWriter; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import java.util.List; import java.util.stream.Collectors; diff --git a/hotspot/test/compiler/compilercontrol/parser/HugeDirectiveUtil.java b/hotspot/test/compiler/compilercontrol/parser/HugeDirectiveUtil.java index 6bf59324810..9cd25bb420f 100644 --- a/hotspot/test/compiler/compilercontrol/parser/HugeDirectiveUtil.java +++ b/hotspot/test/compiler/compilercontrol/parser/HugeDirectiveUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ import compiler.compilercontrol.share.JSONFile; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.scenario.DirectiveWriter; import compiler.compilercontrol.share.scenario.Scenario; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import java.util.EnumSet; diff --git a/hotspot/test/compiler/compilercontrol/share/AbstractTestBase.java b/hotspot/test/compiler/compilercontrol/share/AbstractTestBase.java index 0baf937326a..2bec3f9290a 100644 --- a/hotspot/test/compiler/compilercontrol/share/AbstractTestBase.java +++ b/hotspot/test/compiler/compilercontrol/share/AbstractTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ package compiler.compilercontrol.share; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; import compiler.compilercontrol.share.pool.PoolHelper; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import java.lang.reflect.Executable; import java.util.List; diff --git a/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java b/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java index d8a5bd13452..424e7e80ad0 100644 --- a/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java +++ b/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ package compiler.compilercontrol.share.actions; import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.scenario.State; -import jdk.test.lib.Pair; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.util.Pair; +import jdk.test.lib.process.ProcessTools; import java.io.BufferedReader; import java.io.IOException; diff --git a/hotspot/test/compiler/compilercontrol/share/actions/CompileAction.java b/hotspot/test/compiler/compilercontrol/share/actions/CompileAction.java index e01c53395a8..515aced38ba 100644 --- a/hotspot/test/compiler/compilercontrol/share/actions/CompileAction.java +++ b/hotspot/test/compiler/compilercontrol/share/actions/CompileAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.scenario.State; import compiler.testlibrary.CompilerUtils; import jdk.test.lib.Asserts; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/compiler/compilercontrol/share/method/MethodDescriptor.java b/hotspot/test/compiler/compilercontrol/share/method/MethodDescriptor.java index 11848d8b1b6..30c9a4d78bb 100644 --- a/hotspot/test/compiler/compilercontrol/share/method/MethodDescriptor.java +++ b/hotspot/test/compiler/compilercontrol/share/method/MethodDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package compiler.compilercontrol.share.method; -import jdk.test.lib.Triple; +import jdk.test.lib.util.Triple; import java.lang.reflect.Executable; import java.util.function.Function; diff --git a/hotspot/test/compiler/compilercontrol/share/method/MethodGenerator.java b/hotspot/test/compiler/compilercontrol/share/method/MethodGenerator.java index 50f51366dd7..43f53bc38bb 100644 --- a/hotspot/test/compiler/compilercontrol/share/method/MethodGenerator.java +++ b/hotspot/test/compiler/compilercontrol/share/method/MethodGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,8 @@ package compiler.compilercontrol.share.method; import compiler.compilercontrol.share.method.MethodDescriptor.PatternType; import compiler.compilercontrol.share.method.MethodDescriptor.Separator; import compiler.compilercontrol.share.pool.PoolHelper; -import jdk.test.lib.Pair; -import jdk.test.lib.Triple; +import jdk.test.lib.util.Pair; +import jdk.test.lib.util.Triple; import jdk.test.lib.Utils; import java.lang.reflect.Executable; diff --git a/hotspot/test/compiler/compilercontrol/share/pool/MethodHolder.java b/hotspot/test/compiler/compilercontrol/share/pool/MethodHolder.java index a7b367a0383..4c3e01054b7 100644 --- a/hotspot/test/compiler/compilercontrol/share/pool/MethodHolder.java +++ b/hotspot/test/compiler/compilercontrol/share/pool/MethodHolder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package compiler.compilercontrol.share.pool; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import java.lang.reflect.Executable; import java.lang.reflect.Method; diff --git a/hotspot/test/compiler/compilercontrol/share/pool/PoolHelper.java b/hotspot/test/compiler/compilercontrol/share/pool/PoolHelper.java index ed06e1b98a6..4dccdff412e 100644 --- a/hotspot/test/compiler/compilercontrol/share/pool/PoolHelper.java +++ b/hotspot/test/compiler/compilercontrol/share/pool/PoolHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package compiler.compilercontrol.share.pool; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import java.lang.reflect.Executable; import java.util.ArrayList; diff --git a/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java b/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java index e9f23fcc546..9b7fc4c445c 100644 --- a/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java +++ b/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java @@ -1,6 +1,6 @@ package compiler.compilercontrol.share.pool; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import java.lang.reflect.Constructor; import java.lang.reflect.Executable; diff --git a/hotspot/test/compiler/compilercontrol/share/processors/CommandProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/CommandProcessor.java index 6d28e1eaed3..947f0a4ad96 100644 --- a/hotspot/test/compiler/compilercontrol/share/processors/CommandProcessor.java +++ b/hotspot/test/compiler/compilercontrol/share/processors/CommandProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ package compiler.compilercontrol.share.processors; import compiler.compilercontrol.share.scenario.CompileCommand; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import java.util.Iterator; import java.util.List; diff --git a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java index 0cfc7d6b5ce..98fce874cb1 100644 --- a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java +++ b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ import compiler.compilercontrol.share.method.MethodGenerator; import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.scenario.State; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import java.io.File; import java.io.FileNotFoundException; diff --git a/hotspot/test/compiler/compilercontrol/share/processors/PrintDirectivesProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/PrintDirectivesProcessor.java index 6abc192c435..51b28353277 100644 --- a/hotspot/test/compiler/compilercontrol/share/processors/PrintDirectivesProcessor.java +++ b/hotspot/test/compiler/compilercontrol/share/processors/PrintDirectivesProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ package compiler.compilercontrol.share.processors; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.scenario.CompileCommand; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import java.util.ArrayList; import java.util.Iterator; diff --git a/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java index 9fa00c10500..c023d013770 100644 --- a/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java +++ b/hotspot/test/compiler/compilercontrol/share/processors/PrintProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; import compiler.compilercontrol.share.pool.PoolHelper; import compiler.compilercontrol.share.scenario.State; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import java.lang.management.ManagementFactory; import java.lang.reflect.Executable; diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java index 21731287943..6d550c9d779 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/AbstractCommandBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.pool.PoolHelper; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import java.lang.reflect.Executable; import java.util.ArrayList; diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java index 124c265a342..3797d1f2810 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/DirectiveBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ import compiler.compilercontrol.share.JSONFile; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; import compiler.compilercontrol.share.pool.PoolHelper; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import java.lang.reflect.Executable; import java.util.ArrayList; diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java b/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java index bd387d9829e..fbd3f13259b 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/Executor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.actions.BaseAction; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.PidJcmdExecutor; diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java b/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java index bf12f9911bf..f36d5fb7f71 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/JcmdStateBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ package compiler.compilercontrol.share.scenario; import compiler.compilercontrol.share.method.MethodDescriptor; import compiler.compilercontrol.share.method.MethodGenerator; import compiler.compilercontrol.share.pool.PoolHelper; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import java.lang.reflect.Executable; import java.util.ArrayList; diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java index 8a1723f44c0..8c860de787a 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,8 +30,8 @@ import compiler.compilercontrol.share.processors.LogProcessor; import compiler.compilercontrol.share.processors.PrintDirectivesProcessor; import compiler.compilercontrol.share.processors.PrintProcessor; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.Pair; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.util.Pair; import java.lang.reflect.Executable; import java.util.ArrayList; diff --git a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java index b0df3892de0..68138af1ff7 100644 --- a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java +++ b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java @@ -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 * @bug 8020433 * @summary Crash when using -XX:+RestoreMXCSROnJNICalls - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -34,8 +34,8 @@ package compiler.cpuflags; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class RestoreMXCSR { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java index c5c4db0febd..5f3b533c39d 100644 --- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java +++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * @ignore 8146128 - * @build compiler.cpuflags.TestAESIntrinsicsOnSupportedConfig - * compiler.codegen.aes.TestAESMain + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -39,9 +38,9 @@ package compiler.cpuflags; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class TestAESIntrinsicsOnSupportedConfig extends AESIntrinsicsBase { diff --git a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java index caef413636e..4defa877afb 100644 --- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java +++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.cpuflags.TestAESIntrinsicsOnUnsupportedConfig - * compiler.codegen.aes.TestAESMain + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -39,8 +38,8 @@ package compiler.cpuflags; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.cli.predicate.NotPredicate; public class TestAESIntrinsicsOnUnsupportedConfig extends AESIntrinsicsBase { diff --git a/hotspot/test/compiler/debug/VerifyAdapterSharing.java b/hotspot/test/compiler/debug/VerifyAdapterSharing.java index 263f263e9b8..00ec0291131 100644 --- a/hotspot/test/compiler/debug/VerifyAdapterSharing.java +++ b/hotspot/test/compiler/debug/VerifyAdapterSharing.java @@ -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 * @bug 8030783 * @summary Regression test for 8026478 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -34,8 +34,8 @@ package compiler.debug; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class VerifyAdapterSharing { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java index e5dbe6a2532..a54e03002b0 100644 --- a/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java +++ b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java @@ -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 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox * -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort diff --git a/hotspot/test/compiler/floatingpoint/TestPow2.java b/hotspot/test/compiler/floatingpoint/TestPow2.java index 28e4f4c34e9..5cf0aeed751 100644 --- a/hotspot/test/compiler/floatingpoint/TestPow2.java +++ b/hotspot/test/compiler/floatingpoint/TestPow2.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8063086 * @summary X^2 special case for C2 yields different result than interpreter - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.floatingpoint.TestPow2 + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java index 483f99d7df5..7884673f148 100644 --- a/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java +++ b/hotspot/test/compiler/gcbarriers/PreserveFPRegistersTest.java @@ -26,7 +26,7 @@ * @test * @bug 8148175 * @requires vm.gc=="G1" | vm.gc=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -Xmx300m -XX:+UseG1GC * compiler.gcbarriers.PreserveFPRegistersTest diff --git a/hotspot/test/compiler/inlining/InlineAccessors.java b/hotspot/test/compiler/inlining/InlineAccessors.java index 10d9f8eea9e..df2c66d197d 100644 --- a/hotspot/test/compiler/inlining/InlineAccessors.java +++ b/hotspot/test/compiler/inlining/InlineAccessors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,15 +26,15 @@ * @bug 8140650 * @summary Method::is_accessor should cover getters and setters for all types * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run driver compiler.inlining.InlineAccessors */ package compiler.inlining; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class InlineAccessors { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/compiler/interpreter/DisableOSRTest.java b/hotspot/test/compiler/interpreter/DisableOSRTest.java index 8bdd1ce368b..6676c29f2a3 100644 --- a/hotspot/test/compiler/interpreter/DisableOSRTest.java +++ b/hotspot/test/compiler/interpreter/DisableOSRTest.java @@ -26,7 +26,7 @@ * @bug 8159620 * @summary testing that -XX:-UseOnStackReplacement works with both -XX:(+/-)TieredCompilation * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java index ddc5bd04f8a..2be9bf6aca4 100644 --- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java +++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java @@ -25,9 +25,9 @@ * @test * @bug 8130832 * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * - * @build compiler.intrinsics.IntrinsicAvailableTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java index 53cf827602f..3523aa66ce4 100644 --- a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java +++ b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ * @test * @bug 8138651 * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * - * @build compiler.intrinsics.IntrinsicDisabledTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java b/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java index 01f3ce72203..b524ca47b08 100644 --- a/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java +++ b/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -28,9 +28,9 @@ * @summary Verify that the Montgomery multiply and square intrinsic works and correctly checks their arguments. * @requires vm.flavor == "server" * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * - * @build compiler.intrinsics.bigInteger.MontgomeryMultiplyTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java b/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java index 7ca7784b319..bda3b5e2b05 100644 --- a/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java +++ b/hotspot/test/compiler/intrinsics/bmi/BMITestRunner.java @@ -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 @@ -25,8 +25,8 @@ package compiler.intrinsics.bmi; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import java.io.IOException; diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java index bb8f971c4c9..cee9666c781 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java @@ -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 @@ -27,12 +27,10 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of ANDN instruction - * @library /testlibrary /test/lib + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.intrinsics.bmi.TestAndnI - * compiler.intrinsics.bmi.BMITestRunner - * compiler.intrinsics.bmi.Expr + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java index 9409510a595..2516e144441 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of ANDN instruction - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestAndnL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java index a7bad9e3543..a7b37efc4b6 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of BLSI instruction - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestBlsiI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java index 90254f5e14b..42b358168a0 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of BLSI instruction - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestBlsiL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java index 818c141194a..78e7e76a7ac 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of BLSMSK instruction - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestBlsmskI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java index 8c5c6b5a052..657bd042420 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of BLSMSK instruction - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestBlsmskL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java index 1d759d6974b..0f24d4a2c7b 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of BLSR instruction - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestBlsrI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java index f299a779042..592e37ec8d6 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of BLSR instruction - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestBlsrL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java index 31ac4ea2fc0..d2bdada5416 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of intrinsic - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestLzcntI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java index f27f8457a99..c1750400de7 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of intrinsic - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestLzcntL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java index c75e28dc329..a679efa2fdc 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of intrinsic - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestTzcntI BMITestRunner Expr + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java index f56168198a6..040d08166f0 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031321 * @summary Verify that results of computations are the same w/ * and w/o usage of intrinsic - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.TestTzcntL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java index ae940d793f7..f307a3ec555 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.AndnTestI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java index cf2729e39b1..dd1bc571787 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.AndnTestL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java index 944d8745bec..a5e34b5f6a8 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.BlsiTestI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java index 5d98755b03c..72eb85a322f 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.BlsiTestL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java index 0ed1d9d9791..a5829a7e931 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.BlsmskTestI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java index 9554c5ef6e1..9198bc734fd 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.BlsmskTestL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java index b11e27580c6..2ab1c78dfba 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.BlsrTestI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java index 08038e17cef..3addea222c1 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.BlsrTestL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java index e2ba6930058..886d4623032 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.LZcntTestI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java index d68a32fe680..b6bf6b5c48f 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.LZcntTestL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java index 4ab25be7b78..8a5e86187b9 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.TZcntTestI + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java index 02359f6c4ac..44f79d03012 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8031321 * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.bmi.verifycode.TZcntTestL + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java b/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java index cb6d70c03f6..b2a9554060d 100644 --- a/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java +++ b/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java @@ -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,15 +26,13 @@ * @bug 8054492 * @summary Casting can result in redundant null checks in generated code * @requires vm.flavor == "server" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * - * @build ClassFileInstaller sun.hotspot.WhiteBox jdk.test.lib.* - * @build compiler.intrinsics.klass.CastNullCheckDroppingsTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * jdk.test.lib.Platform * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -Xmixed -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:CompileThreshold=1000 * -XX:CompileCommand=exclude,compiler.intrinsics.klass.CastNullCheckDroppingsTest::runTest diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java index c8f3c1a07b4..ab9f731fec6 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java @@ -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 * @bug 8024924 * @summary Test constant addExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java index 517abe27163..1c14f1cb83f 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java @@ -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 * @bug 8024924 * @summary Test non constant addExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java index a655e1e8d4f..b1f84f538ad 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java @@ -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 * @bug 8024924 * @summary Test non constant addExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java index d1f0d42eac5..82aba8ebde1 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java @@ -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 * @bug 8024924 * @summary Test non constant addExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java index 649962d2089..7cc4f522bc0 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java @@ -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 * @bug 8025657 * @summary Test repeating addExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java index 10cf900db1a..eb8c24e5231 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java @@ -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 * @bug 8026844 * @summary Test constant addExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java index 32765a52a3e..86f2d86a5c4 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java @@ -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 * @bug 8026844 * @summary Test non constant addExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java index 2f771747229..3ba628e3c99 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java @@ -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 * @bug 8026844 * @summary Test decrementExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java index a24db225f35..0a7225005a1 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java @@ -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 * @bug 8026844 * @summary Test decrementExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java index 8d38cf46ad6..6fa2588ff44 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java @@ -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 * @bug 8026844 * @summary Test incrementExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java index 36347647a0c..52f6ba13f6b 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java @@ -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 * @bug 8026844 * @summary Test incrementExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java index d30cb0d3f8a..1f3d9098e4a 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java @@ -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 * @bug 8026844 * @summary Test constant multiplyExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java index 7db6a1d14fd..49f909d8558 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java @@ -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 * @bug 8026844 * @summary Test multiplyExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java index 086b530e1d9..f948e3994b4 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java @@ -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 * @bug 8026844 * @summary Test loop dependent multiplyExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java index 2ef12eaf433..9079d1cb3a3 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java @@ -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 * @bug 8026844 * @summary Test non constant multiplyExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java index f1174d70400..b638542f132 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java @@ -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 * @bug 8026844 * @summary Test repeating multiplyExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java index b340670fe09..8a60b42dceb 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java @@ -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 * @bug 8026844 * @summary Test constant mulExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java index ef6acaea38d..9668f09240b 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java @@ -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 * @bug 8026844 * @summary Test non constant mulExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java index 85ef97aeb38..c979713d16e 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java @@ -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 * @bug 8026844 * @summary Test constant negExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java index 9b00f835d06..1a561309b0c 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java @@ -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 * @bug 8026844 * @summary Test negExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java index 48b02c05814..0ab86d34924 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java @@ -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 * @bug 8026844 * @summary Test negExact loop dependent - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java index 34a20d6643c..e751a21d4d4 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java @@ -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 * @bug 8026844 * @summary Test non constant negExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java index b1d086a7872..c36917e6037 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java @@ -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 * @bug 8026844 * @summary Test constant negExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java index f28d2983327..68dcacfe5d9 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java @@ -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 * @bug 8026844 * @summary Test constant negExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java index 95a177f4885..3ca4f72d859 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java @@ -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 * @bug 8026844 * @summary Test subtractExact as condition - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java index bcb9a1a1964..a0a2726f221 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java @@ -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 * @bug 8026844 * @summary Test constant subtractExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java index 186f6295335..0ee861e587c 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java @@ -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 * @bug 8026844 * @summary Test non constant subtractExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java index 880425e5efe..4bb55a20cc7 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java @@ -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 * @bug 8026844 * @summary Test non constant subtractExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java index 222649d5137..72d754cb610 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java @@ -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 * @bug 8026844 * @summary Test non constant subtractExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java index 49631cf076b..61db69fd534 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java @@ -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 * @bug 8026844 * @summary Test repeating subtractExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java index 996dab70e95..040f3eb00ae 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java @@ -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 @@ -26,7 +26,7 @@ * @bug 8026844 * @bug 8027353 * @summary Test constant subtractExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java index d1d11735d11..6ebe6fd4d4c 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java @@ -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 @@ -26,7 +26,7 @@ * @bug 8026844 * @bug 8027353 * @summary Test non constant subtractExact - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java index 5b701af0ab8..cc95c6e712c 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.AddExactIntTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java index 48dfddda317..1ef33c42458 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.AddExactLongTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java index ff178062918..6c996230c31 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.DecrementExactIntTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java index 2683a594eba..c1fad956ec1 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.DecrementExactLongTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java index 4c6569a9dd9..98133d758ae 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.IncrementExactIntTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java index fa67b740e8f..e5c4c3ca13c 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.IncrementExactLongTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java index 38838688db4..86a432bcce4 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.MultiplyExactIntTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java index 5000ea8df31..65cc2842419 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.MultiplyExactLongTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java index a67b4999f7d..f6ea0168066 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.NegateExactIntTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java index 038f0149c83..50e5095be1c 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.NegateExactLongTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java index c74b7f752b3..d64757dec5d 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java @@ -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,11 +23,11 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.mathexact.sanity.SubtractExactIntTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java index 263059d2dfb..f3a024ac471 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java @@ -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,10 +23,10 @@ /* * @test - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.intrinsics.mathexact.sanity.SubtractExactLongTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/object/TestClone.java b/hotspot/test/compiler/intrinsics/object/TestClone.java index 1e966322a70..8bd3e882f29 100644 --- a/hotspot/test/compiler/intrinsics/object/TestClone.java +++ b/hotspot/test/compiler/intrinsics/object/TestClone.java @@ -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 @@ -27,7 +27,7 @@ * @bug 8033626 * @summary assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main/othervm -XX:-TieredCompilation -Xbatch * -XX:CompileCommand=compileonly,compiler.intrinsics.object.TestClone::f diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java index 44fd2f3ab4f..7602829ce3b 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8035968 * @summary Verify UseSHA1Intrinsics option processing on supported CPU. - * @library /testlibrary /test/lib testcases / + * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnSupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java index a4d7f2a1694..558b4218f0b 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8035968 * @summary Verify UseSHA1Intrinsics option processing on unsupported CPU. - * @library /testlibrary /test/lib testcases / + * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.sha.cli.TestUseSHA1IntrinsicsOptionOnUnsupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java index 33e19ec322f..92e4c33eef9 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8035968 * @summary Verify UseSHA256Intrinsics option processing on supported CPU. - * @library /testlibrary /test/lib testcases / + * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnSupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java index c9f5ec5507a..3ed72bf0a99 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8035968 * @summary Verify UseSHA256Intrinsics option processing on unsupported CPU. - * @library /testlibrary /test/lib testcases / + * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.sha.cli.TestUseSHA256IntrinsicsOptionOnUnsupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java index b5f2ac242a3..d06494613fb 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8035968 * @summary Verify UseSHA512Intrinsics option processing on supported CPU. - * @library /testlibrary /test/lib testcases / + * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnSupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java index 26c989e256e..c05cf309dae 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8035968 * @summary Verify UseSHA512Intrinsics option processing on unsupported CPU. - * @library /testlibrary /test/lib testcases / + * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.sha.cli.TestUseSHA512IntrinsicsOptionOnUnsupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java index 7938712eca9..cc95d3c29ae 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java @@ -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 @@ -25,11 +25,11 @@ * @test * @bug 8035968 * @summary Verify UseSHA option processing on supported CPU. - * @library /testlibrary /test/lib testcases / + * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.intrinsics.sha.cli.TestUseSHAOptionOnSupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java index 4a5a34c7ed0..58ce5366bae 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java @@ -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 @@ -25,10 +25,10 @@ * @test * @bug 8035968 * @summary Verify UseSHA option processing on unsupported CPU. - * @library /testlibrary /test/lib testcases / + * @library /test/lib testcases / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.intrinsics.sha.cli.TestUseSHAOptionOnUnsupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java index 24487f8a424..9d894947cdc 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java @@ -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 @@ package compiler.intrinsics.sha.cli.testcases; import compiler.intrinsics.sha.cli.SHAOptionsBase; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.NotPredicate; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java index de67a394777..f072a2d60e8 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java @@ -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 @@ package compiler.intrinsics.sha.cli.testcases; import compiler.intrinsics.sha.cli.SHAOptionsBase; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java index 64e60e84a95..0c8543341d8 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java @@ -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 @@ package compiler.intrinsics.sha.cli.testcases; import compiler.intrinsics.sha.cli.SHAOptionsBase; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java index 469816055c6..196c23a3218 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java @@ -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 @@ package compiler.intrinsics.sha.cli.testcases; import compiler.intrinsics.sha.cli.SHAOptionsBase; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java index 2b90bed816c..3f94cdf2e6b 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java @@ -24,7 +24,7 @@ package compiler.intrinsics.sha.cli.testcases; import compiler.intrinsics.sha.cli.SHAOptionsBase; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java index 3618147de2e..e8b16e66056 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java @@ -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 @@ -25,7 +25,7 @@ package compiler.intrinsics.sha.cli.testcases; import compiler.intrinsics.sha.cli.SHAOptionsBase; import compiler.testlibrary.sha.predicate.IntrinsicPredicates; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java index 0a13cdb8c5e..63636149a13 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java @@ -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 @@ package compiler.intrinsics.sha.cli.testcases; import compiler.intrinsics.sha.cli.SHAOptionsBase; import compiler.testlibrary.sha.predicate.IntrinsicPredicates; import jdk.test.lib.Asserts; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java index 55e0f5b3ae8..4cb1a062e13 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java @@ -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 @@ package compiler.intrinsics.sha.cli.testcases; import compiler.intrinsics.sha.cli.SHAOptionsBase; import compiler.testlibrary.sha.predicate.IntrinsicPredicates; import jdk.test.lib.Asserts; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java index 71fd922ccf1..facfb7a4c8c 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java @@ -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 @@ -25,12 +25,11 @@ * @test * @bug 8035968 * @summary Verify that SHA-1 intrinsic is actually used. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.testlibrary.intrinsics.Verifier - * compiler.intrinsics.sha.sanity.TestSHA1Intrinsics + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java index ffc81850f2a..001dd7f7def 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java @@ -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 @@ -25,12 +25,11 @@ * @test * @bug 8035968 * @summary Verify that SHA-1 multi block intrinsic is actually used. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.testlibrary.intrinsics.Verifier - * compiler.intrinsics.sha.sanity.TestSHA1MultiBlockIntrinsics + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java index 85aa415fb7f..9a3c64397c5 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java @@ -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 @@ -25,12 +25,11 @@ * @test * @bug 8035968 * @summary Verify that SHA-256 intrinsic is actually used. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.testlibrary.intrinsics.Verifier - * compiler.intrinsics.sha.sanity.TestSHA256Intrinsics + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java index 292e0d07ae6..6d8592d59aa 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java @@ -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 @@ -25,12 +25,11 @@ * @test * @bug 8035968 * @summary Verify that SHA-256 multi block intrinsic is actually used. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.testlibrary.intrinsics.Verifier - * compiler.intrinsics.sha.sanity.TestSHA256MultiBlockIntrinsics + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java index de8be87349b..26cce563dc3 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java @@ -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 @@ -25,12 +25,11 @@ * @test * @bug 8035968 * @summary Verify that SHA-512 intrinsic is actually used. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.testlibrary.intrinsics.Verifier - * compiler.intrinsics.sha.sanity.TestSHA512Intrinsics + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java index 0086412db82..29151dd5d7a 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java @@ -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 @@ -25,12 +25,11 @@ * @test * @bug 8035968 * @summary Verify that SHA-512 multi block intrinsic is actually used. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.testlibrary.intrinsics.Verifier - * compiler.intrinsics.sha.sanity.TestSHA512MultiBlockIntrinsics + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java b/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java index df75e4d8a0d..df8dd7a04c1 100644 --- a/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java +++ b/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java @@ -30,7 +30,6 @@ * @library /compiler/patches * * @build java.base/java.lang.Helper - * @build compiler.intrinsics.string.TestHasNegatives * @run main compiler.intrinsics.string.TestHasNegatives */ diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java index 6918b52d441..053445d505e 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java @@ -26,7 +26,7 @@ * @bug 8144212 * @summary Check for correct memory flow with the String compress/inflate intrinsics. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main compiler.intrinsics.string.TestStringIntrinsicMemoryFlow */ diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java index c5ed25ca29a..3486950413e 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java @@ -27,9 +27,8 @@ * @test * @bug 8155608 * @summary Verifies that string intrinsics throw array out of bounds exceptions. - * @library /compiler/patches /testlibrary /test/lib + * @library /compiler/patches /test/lib * @build java.base/java.lang.Helper - * @build compiler.intrinsics.string.TestStringIntrinsicRangeChecks * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:-TieredCompilation compiler.intrinsics.string.TestStringIntrinsicRangeChecks */ package compiler.intrinsics.string; diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java index ef3ffe14ce5..5c4f334afb4 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java @@ -27,7 +27,7 @@ * @bug 8145336 * @summary PPC64: fix string intrinsics after CompactStrings change * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java index 5c2765378a3..e35a5d70ea6 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java +++ b/hotspot/test/compiler/intrinsics/unsafe/DirectByteBufferTest.java @@ -26,7 +26,7 @@ * @test * @bug 8026049 8151163 * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 DirectByteBufferTest * @run main/othervm -Djdk.test.lib.random.seed=0 DirectByteBufferTest * @summary Verify that direct byte buffers are correctly accessed. diff --git a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java index e09fa47fa2f..d548a69440a 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java +++ b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java @@ -27,7 +27,7 @@ * @bug 8026049 8151163 * @summary Verify that byte buffers are correctly accessed. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 * HeapByteBufferTest diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java index 7830744feb5..973b213e221 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java +++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @bug 8142386 * @summary Unsafe access to an array is wrongly marked as mismatched * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation * compiler.intrinsics.unsafe.TestUnsafeMismatchedArrayFieldAccess diff --git a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java index c1f92ef097c..ad4815add3d 100644 --- a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java +++ b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java @@ -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 * @bug 8022595 * @summary JSR292: deadlock during class loading of MethodHandles, MethodHandleImpl & MethodHandleNatives - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java index f932b627186..d9f2ddb1721 100644 --- a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java +++ b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java @@ -24,15 +24,15 @@ /** * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary / + * @library /test/lib / * * @run driver compiler.jsr292.ContinuousCallSiteTargetChange */ package compiler.jsr292; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.lang.invoke.CallSite; import java.lang.invoke.MethodHandle; diff --git a/hotspot/test/compiler/jsr292/MHInlineTest.java b/hotspot/test/compiler/jsr292/MHInlineTest.java index 150b79e9ec2..df73ea9d9db 100644 --- a/hotspot/test/compiler/jsr292/MHInlineTest.java +++ b/hotspot/test/compiler/jsr292/MHInlineTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,15 +26,15 @@ * @bug 8062280 * @summary C2: inlining failure due to access checks being too strict * @modules java.base/jdk.internal.misc - * @library /testlibrary / + * @library /test/lib / * * @run main/othervm compiler.jsr292.MHInlineTest */ package compiler.jsr292; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java b/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java index 93540ea0eab..32f29dff973 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/Agent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ package compiler.jsr292.NonInlinedCall; import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import java.io.File; import java.io.PrintStream; diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java index 02b06fa78d4..8ae54321848 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 8072008 - * @library /testlibrary /test/lib ../patches + * @library /test/lib ../patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.vm.annotation * diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java index 15ca369a2bb..c9569d09f54 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,12 @@ /* * @test * @bug 8072008 - * @library /testlibrary /test/lib / ../patches + * @library /test/lib / ../patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.vm.annotation * * @build java.base/java.lang.invoke.MethodHandleHelper * sun.hotspot.WhiteBox - * compiler.jsr292.NonInlinedCall.InvokeTest * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java index dbd9f927478..806b7490893 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java @@ -27,7 +27,7 @@ * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * java.base/jdk.internal.vm.annotation - * @library /testlibrary /test/lib / ../patches + * @library /test/lib / ../patches * @requires vm.flavor != "minimal" * * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/jsr292/PollutedTrapCounts.java b/hotspot/test/compiler/jsr292/PollutedTrapCounts.java index 9090513567b..438cefd8d78 100644 --- a/hotspot/test/compiler/jsr292/PollutedTrapCounts.java +++ b/hotspot/test/compiler/jsr292/PollutedTrapCounts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,15 +25,15 @@ * @test * @bug 8074551 * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * * @run driver compiler.jsr292.PollutedTrapCounts */ package compiler.jsr292; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; diff --git a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java index 28036f361a9..8abfeb20d92 100644 --- a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java +++ b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.runtime * @run main/othervm -XX:+UnlockExperimentalVMOptions diff --git a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java index 529f7acc6c1..5284fd2c4f4 100644 --- a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java +++ b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java index e9608ee4817..b6e9f7e73ca 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -33,9 +33,7 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.AllocateCompileIdTest - * @build sun.hotspot.WhiteBox + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. @@ -49,7 +47,7 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; import jdk.test.lib.Asserts; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.Utils; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java index dea8cb2d7f4..9fdb7c7589d 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,9 +34,7 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.CanInlineMethodTest - * @build sun.hotspot.WhiteBox + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java index 46beea77080..b3627b73387 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib/ + * @library / /test/lib/ * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.CollectCountersTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run main/othervm -XX:+UnlockExperimentalVMOptions * -XX:+EnableJVMCI * -XX:JVMCICounterSize=0 diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java index 697aee29904..7bc8b99c9ef 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ package compiler.jvmci.compilerToVM; import compiler.jvmci.common.CTVMUtilities; import compiler.testlibrary.CompilerUtils; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.Utils; import jdk.vm.ci.code.InstalledCode; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java index b2477b73639..13caa191f7d 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.DebugOutputTest * @run main/othervm compiler.jvmci.compilerToVM.DebugOutputTest */ @@ -38,8 +37,8 @@ package compiler.jvmci.compilerToVM; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.vm.ci.hotspot.CompilerToVMHelper; import java.util.Arrays; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java index 8bb3820593d..317ce0b6859 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -35,9 +35,7 @@ * jdk.vm.ci/jdk.vm.ci.code * * @ignore 8139700 - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build sun.hotspot.WhiteBox - * compiler.jvmci.compilerToVM.DisassembleCodeBlobTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java index 2390557a8ad..e9e1622a3da 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,9 +34,7 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.DoNotInlineOrCompileTest - * @build sun.hotspot.WhiteBox + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java index c6a36fc969a..90113dc5577 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java @@ -1,7 +1,7 @@ package compiler.jvmci.compilerToVM; import jdk.test.lib.Asserts; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.Utils; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.InvalidInstalledCodeException; @@ -17,7 +17,7 @@ import java.util.List; * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @ignore 8139383 * @modules java.base/jdk.internal.misc @@ -25,9 +25,7 @@ import java.util.List; * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.ExecuteInstalledCodeTest - * @build sun.hotspot.WhiteBox + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java index 5eccc6d1164..32959f2dd86 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -35,7 +35,6 @@ * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.FindUniqueConcreteMethodTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.FindUniqueConcreteMethodTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java index 6bd182bc293..ecfdc11bd1c 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,7 +34,6 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetBytecodeTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetBytecodeTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java index c20b668f17a..8204043b223 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetClassInitializerTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetClassInitializerTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java index 097d42e5235..3d8ab325044 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -36,7 +36,6 @@ * jdk.vm.ci/jdk.vm.ci.code * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetConstantPoolTest * @run main/othervm -Xbootclasspath/a:. * -XX:+UnlockDiagnosticVMOptions * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java index 3e5ada1383a..a479ba4401f 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,7 +34,6 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetExceptionTableTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetExceptionTableTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java index dd0841d5995..d9dd305aaf7 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib/ + * @library / /test/lib/ * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetImplementorTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetImplementorTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java index ac99a5c21f4..e86d2ab7675 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @library ../common/patches * @modules java.base/jdk.internal.misc @@ -35,7 +35,6 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetLineNumberTableTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetLineNumberTableTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java index 7d3b0971679..5c551360ca7 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -38,7 +38,6 @@ * @compile -g DummyAbstractClass.java * @compile -g DummyClass.java * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetLocalVariableTableTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetLocalVariableTableTest * @clean compiler.jvmci.compilerToVM.* diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java index fcdf29e3073..438eab27d05 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib/ + * @library / /test/lib/ * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetMaxCallTargetOffsetTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetMaxCallTargetOffsetTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java index b0c0d50a202..110c2cbe1bb 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,7 +34,6 @@ * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetNextStackFrameTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetNextStackFrameTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java index c8633398381..49a6e3826bf 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -35,7 +35,6 @@ * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetNextStackFrameTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetResolvedJavaMethodAtSlotTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java index a893c714eac..c04196acf5b 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,14 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject - * @build compiler.jvmci.compilerToVM.GetResolvedJavaMethodTest + * sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java index 2ed3686d321..4d0d5b84445 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot @@ -34,8 +34,7 @@ * @ignore 8158860 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject - * @build compiler.jvmci.compilerToVM.GetResolvedJavaTypeTest - * @build sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java index ec4458a657c..6f647dc06fe 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,7 +34,6 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetStackTraceElementTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetStackTraceElementTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java index 78922fa4ecf..d8f256f0b52 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,7 +34,6 @@ * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetSymbolTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetSymbolTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java index a8a83d1e8aa..50c66cc7cbc 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -33,7 +33,6 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.GetVtableIndexForInterfaceTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.GetVtableIndexForInterfaceTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java index 734964722bd..91c12f6b733 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,9 +34,7 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.HasCompiledCodeForOSRTest - * @build sun.hotspot.WhiteBox + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java index dfb0d78b88a..3c924901b59 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.HasFinalizableSubclassTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.HasFinalizableSubclassTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java index c4626d26264..5e8c75aee1a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.InitializeConfigurationTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.InitializeConfigurationTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java index 23ff0b9685a..5c245a07714 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -36,9 +36,7 @@ * jdk.vm.ci/jdk.vm.ci.runtime * * @ignore 8139700 - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest - * @build sun.hotspot.WhiteBox + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java index 1855ca27398..9668ec48c40 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,12 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * ../common/patches * @modules java.base/jdk.internal.misc * jdk.vm.ci/jdk.vm.ci.hotspot * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * compiler.jvmci.compilerToVM.IsMatureTest * sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java index ef32f138dd9..91645ac6304 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java index f036f0e2770..645871fad70 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java @@ -27,7 +27,7 @@ * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") * @summary Testing compiler.jvmci.CompilerToVM.lookupKlassInPool method - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -37,9 +37,7 @@ * 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 - * compiler.jvmci.compilerToVM.LookupKlassInPoolTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java index 6e1729689b9..5b47f4f51dc 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java @@ -26,7 +26,7 @@ * @test * @bug 8138708 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -36,9 +36,7 @@ * 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 - * compiler.jvmci.compilerToVM.LookupKlassRefIndexInPoolTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java index 4b4c498de05..bf6e66e946a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java @@ -26,7 +26,7 @@ * @test * @bug 8138708 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -36,9 +36,7 @@ * 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 + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java index 88cc6944444..d88031530db 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java @@ -26,7 +26,7 @@ * @test * @bug 8138708 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -36,9 +36,7 @@ * 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 - * compiler.jvmci.compilerToVM.LookupNameAndTypeRefIndexInPoolTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java index a43a45347d4..de25e244060 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java @@ -26,7 +26,7 @@ * @test * @bug 8138708 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -38,7 +38,6 @@ * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox - * compiler.jvmci.compilerToVM.LookupNameInPoolTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java index d5afc82d7a6..9eba654e77c 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java @@ -26,7 +26,7 @@ * @test * @bug 8138708 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -38,7 +38,6 @@ * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build sun.hotspot.WhiteBox - * compiler.jvmci.compilerToVM.LookupSignatureInPoolTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java index 437b5616f2a..20d57babd97 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.LookupTypeTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.LookupTypeTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java index 7607d39a6aa..c4068a1254d 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") * & (vm.compMode != "Xcomp" | vm.opt.TieredCompilation == null | vm.opt.TieredCompilation == true) * @summary no "-Xcomp -XX:-TieredCompilation" combination allowed until JDK-8140018 is resolved - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -36,9 +36,7 @@ * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest - * @build sun.hotspot.WhiteBox + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xmixed -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java index e732faa5bdb..41579035464 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.reflect @@ -35,7 +35,6 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.MethodIsIgnoredBySecurityStackWalkTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.MethodIsIgnoredBySecurityStackWalkTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java index d9aa0b17aff..70f9d5fe259 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 3) - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -35,9 +35,7 @@ * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta * - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build sun.hotspot.WhiteBox - * @build compiler.jvmci.compilerToVM.ReprofileTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java index ba23d6a432d..ca82575fe96 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -35,9 +35,7 @@ * 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 - * compiler.jvmci.compilerToVM.ResolveConstantInPoolTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java index 6d6035438aa..a7307936124 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java @@ -26,7 +26,7 @@ * @test * @bug 8138708 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -36,9 +36,7 @@ * 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 + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java index 389f5583c01..b6164e0c4d2 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -33,7 +33,6 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.ResolveMethodTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * compiler.jvmci.compilerToVM.ResolveMethodTest */ diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java index 49a3cbd1986..45c32d93c0c 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java @@ -26,7 +26,7 @@ * @test * @bug 8138708 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -36,9 +36,7 @@ * 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 - * compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java index 26fc8f86b85..3f7b85745a2 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java @@ -27,7 +27,7 @@ * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") * @summary Testing compiler.jvmci.CompilerToVM.resolveTypeInPool method - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.reflect @@ -36,9 +36,7 @@ * 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 - * compiler.jvmci.compilerToVM.ResolveTypeInPoolTest + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java index cbca06a757b..2e66c2eefec 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary /test/lib/ + * @library / /test/lib/ * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.ShouldDebugNonSafepointsTest * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI * -XX:+UnlockDiagnosticVMOptions * -XX:+DebugNonSafepoints diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java index c86ff4d7faa..61b702902a2 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -34,9 +34,7 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * - * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper - * @build compiler.jvmci.compilerToVM.ShouldInlineMethodTest - * @build sun.hotspot.WhiteBox + * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java index 1f696dfa341..4cc352451dc 100644 --- a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java +++ b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java @@ -31,7 +31,6 @@ * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.common * @compile CodeInstallerTest.java - * @build compiler.jvmci.errors.TestInvalidCompilationResult * @run junit/othervm -da:jdk.vm.ci... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.errors.TestInvalidCompilationResult */ diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java index bcfc52f64b7..276ca0a9975 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java @@ -25,7 +25,7 @@ * @test * @bug 8156034 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * java.base/jdk.internal.org.objectweb.asm @@ -37,7 +37,6 @@ * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.common.JVMCIHelpers - * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener @@ -46,9 +45,6 @@ * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener - * compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest - * jdk.test.lib.Asserts - * jdk.test.lib.Utils * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:. * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java index 6f5c83ab068..59ea3637691 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library / /testlibrary + * @library / /test/lib * @library ../common/patches * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm @@ -38,7 +38,6 @@ * * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.common.JVMCIHelpers - * compiler.jvmci.events.JvmciNotifyInstallEventTest * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener @@ -46,12 +45,7 @@ * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult - * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener - * compiler.jvmci.events.JvmciNotifyInstallEventTest - * compiler.jvmci.common.CTVMUtilities - * compiler.jvmci.common.testcases.SimpleClass - * jdk.test.lib.Asserts - * jdk.test.lib.Utils + * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Xbootclasspath/a:. -Xmixed * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI diff --git a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java index d01d2784195..da60be0f3ff 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java @@ -25,7 +25,7 @@ * @test * @bug 8136421 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code @@ -34,7 +34,6 @@ * * @build compiler.jvmci.common.JVMCIHelpers * compiler.jvmci.events.JvmciShutdownEventListener - * compiler.jvmci.events.JvmciShutdownEventTest * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/ * @run driver jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.config * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener @@ -49,7 +48,7 @@ package compiler.jvmci.events; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; public class JvmciShutdownEventTest { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java index c7bb20568d8..ccbc9d981a3 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java @@ -24,7 +24,7 @@ /** * @test * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64" - * @library /test/lib /testlibrary / + * @library /test/lib / * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.code.site diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java index 5c9c7c68ce1..c820b7ede33 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java @@ -29,7 +29,7 @@ * jdk.vm.ci/jdk.vm.ci.hotspot * java.base/jdk.internal.vm.annotation * java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src + * @library /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src * @build jdk.vm.ci.hotspot.test.DummyClass * @run driver ClassFileInstaller jdk.vm.ci.hotspot.test.DummyClass * @run testng/othervm/timeout=300 -Xbootclasspath/a:. diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java index 03e7f68c273..e99f7bbf9a5 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java @@ -25,7 +25,7 @@ * @test * @bug 8152341 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src + * @library /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.common * jdk.vm.ci/jdk.vm.ci.runtime diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java index c94d47a2bca..601b1925bea 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java @@ -26,7 +26,7 @@ * @bug 8152343 * @bug 8161068 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src + * @library /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java index f345bad4277..69323c14ab0 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java @@ -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 @@ -28,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.ConstantTest * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ConstantTest */ package jdk.vm.ci.runtime.test; diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java index a93f934ebc5..f56aa751d5f 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java @@ -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,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.RedefineClassTest * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.RedefineClassTest */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java index ab66c985554..5d91756350e 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.TestConstantReflectionProvider * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestConstantReflectionProvider */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java index 15e4959e043..622c25e0624 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.TestJavaField * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaField */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java index a7a2e748cf2..5af25f8057a 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.TestJavaMethod * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaMethod */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java index 4b38875b9fd..66e50693f9a 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.TestJavaType * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaType */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java index cae386efa47..4352654767d 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.TestMetaAccessProvider * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestMetaAccessProvider */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java index 50857482f1d..3c15295d277 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.TestResolvedJavaField * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaField */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java index 3333734e64e..7805d193ec1 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.TestResolvedJavaMethod * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaMethod */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java index 42d340fb1b9..84a6b0f0414 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java @@ -31,7 +31,6 @@ * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.common * java.base/jdk.internal.misc - * @build jdk.vm.ci.runtime.test.TestResolvedJavaType * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaType */ diff --git a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java index d06278e3923..25bc2a905db 100644 --- a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java +++ b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java @@ -25,7 +25,7 @@ * @test * @bug 8151664 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java index 77a9445642a..0bf9185f7f5 100644 --- a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java +++ b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 6869327 * @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @ignore 8146096 * @run driver compiler.loopopts.UseCountedLoopSafepoints @@ -34,8 +34,8 @@ package compiler.loopopts; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.util.concurrent.atomic.AtomicLong; diff --git a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java index 8ef4cde5806..02361b9719c 100644 --- a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java +++ b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @bug 8078497 * @summary Tests correct alignment of vectors with loop invariant offset. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @run main compiler.loopopts.superword.TestVectorizationWithInvariant */ diff --git a/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java b/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java index 97c3ab63dcf..903bc5fe1c8 100644 --- a/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java +++ b/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Azul Systems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -26,7 +26,7 @@ * @test TestOnSpinWait * @summary (x86 only) checks that java.lang.Thread.onSpinWait is intrinsified * @bug 8147844 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @requires os.arch=="x86" | os.arch=="amd64" | os.arch=="x86_64" * @run driver compiler.onSpinWait.TestOnSpinWait @@ -34,8 +34,8 @@ package compiler.onSpinWait; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestOnSpinWait { diff --git a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java index 10e71b43b11..39aaf59daf2 100644 --- a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java +++ b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java @@ -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 @@ -25,7 +25,7 @@ * @test CheckCompileCommandOption * @summary Checks parsing of -XX:CompileCommand=option * @bug 8055286 8056964 8059847 8069035 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver compiler.oracle.CheckCompileCommandOption @@ -33,8 +33,8 @@ package compiler.oracle; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.io.File; diff --git a/hotspot/test/compiler/oracle/GetMethodOptionTest.java b/hotspot/test/compiler/oracle/GetMethodOptionTest.java index 2da784c41c7..dad9e8952fd 100644 --- a/hotspot/test/compiler/oracle/GetMethodOptionTest.java +++ b/hotspot/test/compiler/oracle/GetMethodOptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ /* * @test * @bug 8074980 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc - * @build sun.hotspot.WhiteBox jdk.test.lib.Asserts compiler.oracle.GetMethodOptionTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/oracle/MethodMatcherTest.java b/hotspot/test/compiler/oracle/MethodMatcherTest.java index 3e7f1a09471..6855429d823 100644 --- a/hotspot/test/compiler/oracle/MethodMatcherTest.java +++ b/hotspot/test/compiler/oracle/MethodMatcherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test MethodMatcherTest * @summary Testing of compiler/MethodMatcher * @bug 8135068 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/oracle/TestCompileCommand.java b/hotspot/test/compiler/oracle/TestCompileCommand.java index d8ba4aa2987..7308e18f007 100644 --- a/hotspot/test/compiler/oracle/TestCompileCommand.java +++ b/hotspot/test/compiler/oracle/TestCompileCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test TestCompileCommand * @bug 8069389 * @summary Regression tests of -XX:CompileCommand - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver compiler.oracle.TestCompileCommand @@ -33,8 +33,8 @@ package compiler.oracle; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestCompileCommand { diff --git a/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java index a09d9d35268..15f60ac3e77 100644 --- a/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java +++ b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ /** * @test * @bug 8073154 - * @build compiler.print.TestProfileReturnTypePrinting * @run main/othervm -XX:TypeProfileLevel=020 * -XX:CompileCommand=compileonly,compiler.print.TestProfileReturnTypePrinting::testMethod * -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintLIR diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java index f0a30c6b6a5..98be2c9e1fd 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Agent.java @@ -24,10 +24,12 @@ package compiler.profiling.spectrapredefineclass; import com.sun.tools.attach.VirtualMachine; +import jdk.test.lib.Utils; import java.lang.instrument.ClassFileTransformer; import java.lang.instrument.Instrumentation; import java.lang.management.ManagementFactory; +import java.nio.file.Paths; import java.security.ProtectionDomain; class A { @@ -67,8 +69,7 @@ class Test { } public class Agent implements ClassFileTransformer { - - + public static final String AGENT_JAR = Paths.get(Utils.TEST_CLASSES, "agent.jar").toString(); static public boolean m2(A a) { boolean res = false; if (a.getClass() == B.class) { @@ -95,7 +96,7 @@ public class Agent implements ClassFileTransformer { // Redefine class try { VirtualMachine vm = VirtualMachine.attach(pid); - vm.loadAgent(System.getProperty("test.classes",".") + "/agent.jar", ""); + vm.loadAgent(AGENT_JAR, ""); vm.detach(); } catch (Exception e) { throw new RuntimeException(e); diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java index 95593898201..76740831dec 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java @@ -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,11 +24,11 @@ /* * @test * @bug 8038636 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.instrument * java.management - * @build compiler.profiling.spectrapredefineclass_classloaders.Agent + * @build compiler.profiling.spectrapredefineclass.Agent * @run driver ClassFileInstaller compiler.profiling.spectrapredefineclass.Agent * @run driver compiler.profiling.spectrapredefineclass.Launcher * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation @@ -39,23 +39,33 @@ package compiler.profiling.spectrapredefineclass; -import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.OutputAnalyzer; import java.io.File; +import java.io.IOException; import java.io.PrintWriter; public class Launcher { + private static final String MANIFEST = "MANIFEST.MF"; public static void main(String[] args) throws Exception { + try (PrintWriter pw = new PrintWriter(MANIFEST)) { + pw.println("Agent-Class: " + Agent.class.getName()); + pw.println("Can-Retransform-Classes: true"); + } - PrintWriter pw = new PrintWriter("MANIFEST.MF"); - pw.println("Agent-Class: " + Launcher.class.getPackage().getName() +".Agent"); - pw.println("Can-Retransform-Classes: true"); - pw.close(); + JDKToolLauncher jar = JDKToolLauncher.create("jar") + .addToolArg("cmf") + .addToolArg(MANIFEST) + .addToolArg(Agent.AGENT_JAR) + .addToolArg(Agent.class.getName().replace('.', File.separatorChar) + ".class"); - ProcessBuilder pb = new ProcessBuilder(); - pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", - System.getProperty("test.classes",".") + "/agent.jar", - "compiler/profiling/spectrapredefineclass/Agent.class".replace('/', File.separatorChar)}); - pb.start().waitFor(); + ProcessBuilder pb = new ProcessBuilder(jar.getCommand()); + try { + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } catch (IOException ex) { + throw new Error("TESTBUG: jar failed.", ex); + } } } diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java index 35f8523de42..e4a32e2a626 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Agent.java @@ -24,6 +24,7 @@ package compiler.profiling.spectrapredefineclass_classloaders; import com.sun.tools.attach.VirtualMachine; +import jdk.test.lib.Utils; import java.lang.instrument.ClassFileTransformer; import java.lang.instrument.Instrumentation; @@ -32,14 +33,16 @@ import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; +import java.nio.file.Path; import java.nio.file.Paths; import java.security.ProtectionDomain; public class Agent implements ClassFileTransformer { + public static final String AGENT_JAR = Paths.get(Utils.TEST_CLASSES, "agent.jar").toString(); public static ClassLoader newClassLoader() { try { return new URLClassLoader(new URL[] { - Paths.get(System.getProperty("test.classes",".")).toUri().toURL(), + Paths.get(Utils.TEST_CLASSES).toUri().toURL(), }, null); } catch (MalformedURLException e){ throw new RuntimeException("Unexpected URL conversion failure", e); @@ -76,7 +79,7 @@ public class Agent implements ClassFileTransformer { for (int i = 0; i < 2; i++) { try { VirtualMachine vm = VirtualMachine.attach(pid); - vm.loadAgent(System.getProperty("test.classes",".") + "/agent.jar", ""); + vm.loadAgent(AGENT_JAR, ""); vm.detach(); } catch (Exception e) { throw new RuntimeException(e); diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java index 328c5bc468e..1f785b6d55e 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java @@ -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 * @bug 8040237 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.instrument * java.management @@ -39,26 +39,36 @@ * -XX:ReservedCodeCacheSize=3M * compiler.profiling.spectrapredefineclass_classloaders.Agent */ + package compiler.profiling.spectrapredefineclass_classloaders; -import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.OutputAnalyzer; import java.io.File; +import java.io.IOException; import java.io.PrintWriter; public class Launcher { - public static void main(String[] args) throws Exception { + private static final String MANIFEST = "MANIFEST.MF"; + public static void main(String[] args) throws Exception { + try (PrintWriter pw = new PrintWriter(MANIFEST)) { + pw.println("Agent-Class: " + Agent.class.getName()); + pw.println("Can-Retransform-Classes: true"); + } - PrintWriter pw = new PrintWriter("MANIFEST.MF"); + JDKToolLauncher jar = JDKToolLauncher.create("jar") + .addToolArg("cmf") + .addToolArg(MANIFEST) + .addToolArg(Agent.AGENT_JAR) + .addToolArg(Agent.class.getName().replace('.', File.separatorChar) + ".class"); - pw.println("Agent-Class: " + Launcher.class.getPackage().getName() + ".Agent"); - pw.println("Can-Retransform-Classes: true"); - pw.close(); - - ProcessBuilder pb = new ProcessBuilder(); - pb.command(new String[]{JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", - System.getProperty("test.classes", ".") + "/agent.jar", - "compiler/profiling/spectrapredefineclass/Agent.class".replace('/', File.separatorChar)}); - pb.start().waitFor(); + ProcessBuilder pb = new ProcessBuilder(jar.getCommand()); + try { + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } catch (IOException ex) { + throw new Error("TESTBUG: jar failed.", ex); + } } } diff --git a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java index d712535fb03..232134d9fcd 100644 --- a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java +++ b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java @@ -25,11 +25,10 @@ * @test * @bug 8073480 * @summary explicit range checks should be recognized by C2 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc - * @build compiler.rangechecks.TestExplicitRangeChecks + * @build sun.hotspot.WhiteBox * @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,compiler.rangechecks.TestExplicitRangeChecks::test* diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java index 17c43270c51..a6e285a4737 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java @@ -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 @@ -25,12 +25,11 @@ * @test * @bug 8066103 * @summary C2's range check smearing allows out of bound array accesses - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rangechecks.TestRangeCheckSmearing + * @build sun.hotspot.WhiteBox * @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 * compiler.rangechecks.TestRangeCheckSmearing diff --git a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java index 50784c5cc48..7fa09b885f8 100644 --- a/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java +++ b/hotspot/test/compiler/rtm/cli/RTMGenericCommandLineOptionTest.java @@ -24,7 +24,7 @@ package compiler.rtm.cli; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java index aad6397e8fc..6fcc2799aa9 100644 --- a/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java +++ b/hotspot/test/compiler/rtm/cli/RTMLockingAwareTest.java @@ -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 @@ package compiler.rtm.cli; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java index e8c9d17d8f6..b1dbafe95d4 100644 --- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java +++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsBase.java @@ -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 @@ package compiler.rtm.cli; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java index e48cfecdb9d..02f8acdc356 100644 --- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify PrintPreciseRTMLockingStatistics on CPUs with * rtm support and on VM with rtm locking support, - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java index aeec5262805..3efcbf54eaa 100644 --- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java @@ -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 @@ -27,7 +27,7 @@ * @bug 8031320 * @summary Verify PrintPreciseRTMLockingStatistics on CPUs without * rtm support and/or unsupported VM. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java index 2d16a62c387..3a1e2ccc8da 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify RTMAbortRatio option processing on CPU with rtm * support and on VM with rtm locking support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMAbortRatioOptionOnSupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java index 5921ae7e657..1fec34e405f 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @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 / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMAbortRatioOptionOnUnsupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java index 7444280bf4a..10b87c2d9ad 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java @@ -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,11 +26,10 @@ * @test * @bug 8031320 * @summary Verify processing of RTMAbortThreshold option. - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMAbortThresholdOption * @run main/othervm compiler.rtm.cli.TestRTMAbortThresholdOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java index 35213b46ec6..161573a2076 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java @@ -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,11 +26,10 @@ * @test * @bug 8031320 * @summary Verify processing of RTMLockingCalculationDelay option. - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMLockingCalculationDelayOption * @run main/othervm compiler.rtm.cli.TestRTMLockingCalculationDelayOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java index 91a5bff7ee0..dab87dca926 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java @@ -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,11 +26,10 @@ * @test * @bug 8031320 * @summary Verify processing of RTMLockingThreshold option. - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMLockingThresholdOption * @run main/othervm compiler.rtm.cli.TestRTMLockingThresholdOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java index d77c0013a78..50b200a870b 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java @@ -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,11 +26,10 @@ * @test * @bug 8031320 * @summary Verify processing of RTMRetryCount option. - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMRetryCountOption * @run main/othervm compiler.rtm.cli.TestRTMRetryCountOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java index dc9ebf759ff..f8e0e64e470 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java @@ -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,11 +26,10 @@ * @test * @bug 8031320 * @summary Verify processing of RTMSpinLoopCount option. - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMSpinLoopCountOption * @run main/othervm compiler.rtm.cli.TestRTMSpinLoopCountOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java index b21aac408a2..60336331cb5 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify RTMTotalCountIncrRate option processing on CPU with * rtm support and on VM with rtm locking support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnSupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java index 886d0c339c2..fcbbfe7882e 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify RTMTotalCountIncrRate option processing on CPU without * rtm support and/or on VM without rtm locking support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestRTMTotalCountIncrRateOptionOnUnsupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java index 001a826ab88..e674b46ebd6 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify UseRTMDeopt option processing on CPUs with rtm support * when rtm locking is supported by VM. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMDeoptOptionOnSupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -43,7 +43,7 @@ package compiler.rtm.cli; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java index 385a7c70d3a..e6397317e8f 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify UseRTMDeopt option processing on CPUs without rtm support * or on VMs without rtm locking support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMDeoptOptionOnUnsupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java index 532e68dd5b4..9e2163bb26f 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify UseRTMForStackLocks option processing on CPU with * rtm support when VM supports rtm locking. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMForStackLocksOptionOnSupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -43,7 +43,7 @@ package compiler.rtm.cli; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java index 563fec15126..84251d57807 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify UseRTMForStackLocks option processing on CPUs without * rtm support and/or on VMs without rtm locking support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMForStackLocksOptionOnUnsupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -43,7 +43,7 @@ package compiler.rtm.cli; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; import jdk.test.lib.cli.predicate.NotPredicate; diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java index b82badc2858..b0694e7508d 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify UseRTMLocking option processing on CPU with rtm support and * on VM with rtm-locking support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMLockingOptionOnSupportedConfig + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -43,7 +43,7 @@ package compiler.rtm.cli; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java index 25e173e12f3..3df10408910 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify UseRTMLocking option processing on CPU without * rtm support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedCPU + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -43,7 +43,7 @@ package compiler.rtm.cli; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java index f042a9d3b64..510ede5c934 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java @@ -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 @@ -27,11 +27,11 @@ * @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 / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMLockingOptionOnUnsupportedVM + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -43,7 +43,7 @@ package compiler.rtm.cli; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; import jdk.test.lib.cli.predicate.NotPredicate; diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java index cc004bd0aac..3aeab02004d 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java @@ -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 @@ -27,11 +27,11 @@ * @bug 8031320 * @summary Verify processing of UseRTMLocking and UseBiasedLocking * options combination on CPU and VM with rtm support. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMLockingOptionWithBiasedLocking + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -43,7 +43,7 @@ package compiler.rtm.cli; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java index 5d365b7e7b3..ec8f3fec04a 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java @@ -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,11 +26,10 @@ * @test * @bug 8031320 * @summary Verify processing of UseRTMXendForLockBusy option. - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.rtm.cli.TestUseRTMXendForLockBusyOption * @run main/othervm compiler.rtm.cli.TestUseRTMXendForLockBusyOption */ diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java index 893fbc80bc2..6605ef1adcf 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that RTMAbortRatio affects amount of aborts before * deoptimization. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMAbortRatio + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -48,7 +48,7 @@ import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java index 2d8492ec8e9..6090fa19592 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that RTMAbortThreshold option affects * amount of aborts after which abort ratio is calculated. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMAbortThreshold + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -47,7 +47,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java index 606ed8cf7f8..4f43be68d4f 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java @@ -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 @@ -29,10 +29,10 @@ * 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 / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMAfterNonRTMDeopt + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -50,7 +50,7 @@ import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java index f53a32c9f58..0633d8ab016 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that on high abort ratio method will be recompiled * without rtm locking. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -47,7 +47,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java index 567ec6278a1..9386321d7d0 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java @@ -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,10 +26,10 @@ * @test * @bug 8031320 * @summary Verify that on low abort ratio method will be recompiled. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMDeoptOnLowAbortRatio + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -47,7 +47,7 @@ import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java index 7c6ee4658bc..33e263cb940 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that RTMLockingCalculationDelay affect when * abort ratio calculation is started. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMLockingCalculationDelay + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -46,7 +46,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java index d3ce56ca214..0f6ccbf591e 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that RTMLockingThreshold affects rtm state transition * ProfileRTM => UseRTM. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMLockingThreshold + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -48,7 +48,7 @@ import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java index 2a1fc7d8871..5526e096c91 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java @@ -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,10 +26,10 @@ * @test * @bug 8031320 * @summary Verify that RTMRetryCount affects actual amount of retries. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMRetryCount + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -46,7 +46,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java index f6e849e76eb..61dc2bcccb7 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that RTMSpinLoopCount affects time spent * between locking attempts. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMSpinLoopCount + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -47,7 +47,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java index 6ae82df25d4..29f560d39f0 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that RTMTotalCountIncrRate option affects * RTM locking statistics. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestRTMTotalCountIncrRate + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -48,7 +48,7 @@ import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.internal.misc.Unsafe; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java index be13c8096e3..f7a752f87fa 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java @@ -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 @@ -27,10 +27,10 @@ * @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 / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestUseRTMAfterLockInflation + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -47,7 +47,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java index 05578b60d72..d9cf61552e4 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that UseRTMDeopt affects uncommon trap installation in * copmpiled methods with synchronized block. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestUseRTMDeopt + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -46,7 +46,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java index 94c4978d1f2..038496e310a 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java @@ -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,10 +26,10 @@ * @test * @bug 8031320 * @summary Verify that rtm locking is used for inflated locks. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestUseRTMForInflatedLocks + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -45,7 +45,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java index 6bb2646b745..cdb854a8dcc 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java @@ -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,10 +26,10 @@ * @test * @bug 8031320 * @summary Verify that rtm locking is used for stack locks. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestUseRTMForStackLocks + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -46,7 +46,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java index d8dc7ca8f98..936e7c970b3 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java @@ -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 @@ -27,10 +27,10 @@ * @bug 8031320 * @summary Verify that UseRTMXendForLockBusy option affects * method behaviour if lock is busy. - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.locking.TestUseRTMXendForLockBusy + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -48,7 +48,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java index 30d747e0fe0..d92cb70bff8 100644 --- a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java +++ b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java @@ -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 @@ -27,10 +27,10 @@ * @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 / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.method_options.TestNoRTMLockElidingOption + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -47,7 +47,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java index 50808348c0e..b649715510f 100644 --- a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java +++ b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java @@ -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 @@ -28,10 +28,10 @@ * @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 / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.method_options.TestUseRTMLockElidingOption + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -48,7 +48,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java index adeed6d3ec5..e9ec090799b 100644 --- a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java +++ b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java @@ -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 @@ -29,10 +29,10 @@ * 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 / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.rtm.print.TestPrintPreciseRTMLockingStatistics + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -50,7 +50,7 @@ import compiler.testlibrary.rtm.RTMTestBase; import compiler.testlibrary.rtm.predicate.SupportedCPU; import compiler.testlibrary.rtm.predicate.SupportedVM; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; diff --git a/hotspot/test/compiler/runtime/Test8010927.java b/hotspot/test/compiler/runtime/Test8010927.java index 64dc5cab142..ba50aeb9647 100644 --- a/hotspot/test/compiler/runtime/Test8010927.java +++ b/hotspot/test/compiler/runtime/Test8010927.java @@ -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,9 +25,9 @@ * @test * @bug 8010927 * @summary Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy - * @library /test/lib /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc - * @build compiler.runtime.Test8010927 + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions diff --git a/hotspot/test/compiler/runtime/cr8015436/Test8015436.java b/hotspot/test/compiler/runtime/cr8015436/Test8015436.java index 256f352b87e..0e44c7e8fcd 100644 --- a/hotspot/test/compiler/runtime/cr8015436/Test8015436.java +++ b/hotspot/test/compiler/runtime/cr8015436/Test8015436.java @@ -25,10 +25,9 @@ * @test * @bug 8015436 * @summary the IK _initial_method_idnum value must be adjusted if overpass methods are added - * @library /test/lib/share/classes / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @build compiler.runtime.cr8015436.Test8015436 - * compiler.runtime.cr8015436.Driver8015436 * * @run driver compiler.runtime.cr8015436.Driver8015436 */ diff --git a/hotspot/test/compiler/stable/TestStableBoolean.java b/hotspot/test/compiler/stable/TestStableBoolean.java index dbb9705e0dd..505d0e3f643 100644 --- a/hotspot/test/compiler/stable/TestStableBoolean.java +++ b/hotspot/test/compiler/stable/TestStableBoolean.java @@ -26,11 +26,10 @@ /* * @test TestStableBoolean * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableBoolean * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableByte.java b/hotspot/test/compiler/stable/TestStableByte.java index 5561b4b34e6..b0d703fe89f 100644 --- a/hotspot/test/compiler/stable/TestStableByte.java +++ b/hotspot/test/compiler/stable/TestStableByte.java @@ -26,11 +26,10 @@ /* * @test TestStableByte * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableByte * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableChar.java b/hotspot/test/compiler/stable/TestStableChar.java index 8a1f51ec78e..bcd3154e89f 100644 --- a/hotspot/test/compiler/stable/TestStableChar.java +++ b/hotspot/test/compiler/stable/TestStableChar.java @@ -26,11 +26,10 @@ /* * @test TestStableChar * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableChar * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableDouble.java b/hotspot/test/compiler/stable/TestStableDouble.java index ff96b2c7c6a..6bc5644c78a 100644 --- a/hotspot/test/compiler/stable/TestStableDouble.java +++ b/hotspot/test/compiler/stable/TestStableDouble.java @@ -26,11 +26,10 @@ /* * @test TestStableDouble * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableDouble * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableFloat.java b/hotspot/test/compiler/stable/TestStableFloat.java index ab879c5c242..82696a5e56f 100644 --- a/hotspot/test/compiler/stable/TestStableFloat.java +++ b/hotspot/test/compiler/stable/TestStableFloat.java @@ -26,11 +26,10 @@ /* * @test TestStableFloat * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableFloat * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableInt.java b/hotspot/test/compiler/stable/TestStableInt.java index e203a269421..35a7ad5274a 100644 --- a/hotspot/test/compiler/stable/TestStableInt.java +++ b/hotspot/test/compiler/stable/TestStableInt.java @@ -26,11 +26,10 @@ /* * @test TestStableInt * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableInt * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableLong.java b/hotspot/test/compiler/stable/TestStableLong.java index 11e6a95416c..dd3cd8290b4 100644 --- a/hotspot/test/compiler/stable/TestStableLong.java +++ b/hotspot/test/compiler/stable/TestStableLong.java @@ -26,11 +26,10 @@ /* * @test TestStableLong * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableLong * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableObject.java b/hotspot/test/compiler/stable/TestStableObject.java index 58affb9a76b..70a3c8fce21 100644 --- a/hotspot/test/compiler/stable/TestStableObject.java +++ b/hotspot/test/compiler/stable/TestStableObject.java @@ -26,11 +26,10 @@ /* * @test TestStableObject * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableObject * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableShort.java b/hotspot/test/compiler/stable/TestStableShort.java index d893f8d56be..66825505e81 100644 --- a/hotspot/test/compiler/stable/TestStableShort.java +++ b/hotspot/test/compiler/stable/TestStableShort.java @@ -26,11 +26,10 @@ /* * @test TestStableShort * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableShort * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 diff --git a/hotspot/test/compiler/stable/TestStableUByte.java b/hotspot/test/compiler/stable/TestStableUByte.java index 5431345f757..6a6135f58f0 100644 --- a/hotspot/test/compiler/stable/TestStableUByte.java +++ b/hotspot/test/compiler/stable/TestStableUByte.java @@ -26,11 +26,10 @@ /* * @test TestStableUByte * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableUByte * * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp diff --git a/hotspot/test/compiler/stable/TestStableUShort.java b/hotspot/test/compiler/stable/TestStableUShort.java index 88f5cb46119..28b12a23144 100644 --- a/hotspot/test/compiler/stable/TestStableUShort.java +++ b/hotspot/test/compiler/stable/TestStableUShort.java @@ -26,11 +26,10 @@ /* * @test TestStableUShort * @summary tests on stable fields and arrays - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox - * @build compiler.stable.TestStableUShort * * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp diff --git a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java index 7abfc6314cb..0491e1c69fd 100644 --- a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java +++ b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java @@ -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 @@ -25,7 +25,7 @@ * @test * @bug 8034775 * @summary Ensures correct minimal number of compiler threads (provided by -XX:CICompilerCount=) - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -34,9 +34,9 @@ package compiler.startup; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class NumCompilerThreadsCheck { diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java index 2ff643765ab..a361baa1920 100644 --- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java +++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java @@ -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 @@ -27,7 +27,7 @@ * @summary Test ensures that there is no crash if there is not enough ReservedCodeCacheSize * to initialize all compiler threads. The option -Xcomp gives the VM more time to * trigger the old bug. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -37,8 +37,8 @@ package compiler.startup; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import static jdk.test.lib.Asserts.assertTrue; diff --git a/hotspot/test/compiler/startup/StartupOutput.java b/hotspot/test/compiler/startup/StartupOutput.java index b8cd3157d59..f299c65abf2 100644 --- a/hotspot/test/compiler/startup/StartupOutput.java +++ b/hotspot/test/compiler/startup/StartupOutput.java @@ -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,9 +23,9 @@ /* * @test - * @bug 8026949 + * @bug 8026949 8164091 * @summary Test ensures correct VM output during startup - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @@ -34,8 +34,8 @@ package compiler.startup; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class StartupOutput { public static void main(String[] args) throws Exception { @@ -45,7 +45,14 @@ public class StartupOutput { pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version"); out = new OutputAnalyzer(pb.start()); out.shouldNotContain("no space to run compilers"); - out.shouldHaveExitValue(0); + + pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:ReservedCodeCacheSize=1770K", "-XX:InitialCodeCacheSize=4K", "-version"); + out = new OutputAnalyzer(pb.start()); + // The VM should not crash but may return an error message because we don't have enough space for adapters + int exitCode = out.getExitValue(); + if (exitCode != 1 && exitCode != 0) { + throw new Exception("VM crashed with exit code " + exitCode); + } } } diff --git a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java index 65cbf0a65d7..5fde3f21753 100644 --- a/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java +++ b/hotspot/test/compiler/testlibrary/rtm/RTMTestBase.java @@ -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,8 +24,8 @@ package compiler.testlibrary.rtm; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import jdk.test.lib.cli.CommandLineOptionTest; diff --git a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java index 6393f5c9268..37288d50ee3 100644 --- a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java +++ b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java @@ -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,11 +24,11 @@ /** * @test ConstantGettersTransitionsTest * @summary Test the correctness of compilation level transitions for constant getters methods - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.tiered.TransitionsTestExecutor + * @build sun.hotspot.WhiteBox * compiler.tiered.ConstantGettersTransitionsTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/tiered/LevelTransitionTest.java b/hotspot/test/compiler/tiered/LevelTransitionTest.java index d49d995ef33..6730c181242 100644 --- a/hotspot/test/compiler/tiered/LevelTransitionTest.java +++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java @@ -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,12 +24,12 @@ /** * @test LevelTransitionTest * @summary Test the correctness of compilation level transitions for different methods - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * * @ignore 8067651 - * @build compiler.tiered.TransitionsTestExecutor compiler.tiered.LevelTransitionTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java index 3973bdc5d3a..45d039f7551 100644 --- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java @@ -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 @@ -24,11 +24,11 @@ /** * @test NonTieredLevelsTest * @summary Verify that only one level can be used - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * @requires vm.opt.TieredStopAtLevel==null - * @build compiler.tiered.NonTieredLevelsTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation diff --git a/hotspot/test/compiler/tiered/TieredLevelsTest.java b/hotspot/test/compiler/tiered/TieredLevelsTest.java index 768022ba3a0..1e23648f907 100644 --- a/hotspot/test/compiler/tiered/TieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java @@ -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 @@ -24,11 +24,11 @@ /** * @test TieredLevelsTest * @summary Verify that all levels < 'TieredStopAtLevel' can be used - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build compiler.tiered.TieredLevelsTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation diff --git a/hotspot/test/compiler/tiered/TransitionsTestExecutor.java b/hotspot/test/compiler/tiered/TransitionsTestExecutor.java index 832678bd862..1869842a860 100644 --- a/hotspot/test/compiler/tiered/TransitionsTestExecutor.java +++ b/hotspot/test/compiler/tiered/TransitionsTestExecutor.java @@ -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,8 +24,8 @@ package compiler.tiered; import compiler.whitebox.CompilerWhiteBoxTest; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; diff --git a/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java b/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java index a5cf25d090b..180508664ce 100644 --- a/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java +++ b/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java @@ -27,7 +27,7 @@ * @summary C2 can not handle returns with inccompatible interface arrays * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/types/correctness/CorrectnessTest.java b/hotspot/test/compiler/types/correctness/CorrectnessTest.java index 15a5bba240b..9198a3ea2f4 100644 --- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java +++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java @@ -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,12 +26,12 @@ * @bug 8038418 * @summary Tests correctness of type usage with type profiling and speculations * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * * @ignore 8066173 - * @build compiler.types.correctness.CorrectnessTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions diff --git a/hotspot/test/compiler/types/correctness/OffTest.java b/hotspot/test/compiler/types/correctness/OffTest.java index ad623fe2cb5..a88387e71c3 100644 --- a/hotspot/test/compiler/types/correctness/OffTest.java +++ b/hotspot/test/compiler/types/correctness/OffTest.java @@ -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,12 +24,12 @@ /* * @test CorrectnessTest * @bug 8038418 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * * @ignore 8066173 - * @build compiler.types.correctness.OffTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=1200 compiler.types.correctness.OffTest @@ -38,8 +38,8 @@ package compiler.types.correctness; import compiler.types.correctness.scenarios.ProfilingType; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import java.util.Random; diff --git a/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java b/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java index 03636892492..218eb2e3656 100644 --- a/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java +++ b/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java @@ -24,7 +24,7 @@ /* * @test * @bug 8146416 - * @library /test/lib /testlibrary / + * @library /test/lib / * * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/uncommontrap/Test8009761.java b/hotspot/test/compiler/uncommontrap/Test8009761.java index df9141e3db6..c9f4897c401 100644 --- a/hotspot/test/compiler/uncommontrap/Test8009761.java +++ b/hotspot/test/compiler/uncommontrap/Test8009761.java @@ -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 @@ -25,10 +25,10 @@ * @test * @bug 8009761 * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * - * @build compiler.uncommontrap.Test8009761 + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java index 25e4413949a..84f53c89246 100644 --- a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java +++ b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java @@ -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,16 +24,14 @@ /* * @test * @bug 8030976 8059226 - * @library /testlibrary /test/lib / + * @library /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 compiler.uncommontrap.TestUnstableIfTrap - * jdk.test.lib.* - * compiler.testlibrary.uncommontrap.Verifier + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbatch -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java index 82661b28271..e2e315818c9 100644 --- a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java +++ b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java @@ -26,7 +26,7 @@ /* * @test * @summary tests on constant folding of unsafe get operations - * @library /testlibrary + * @library /test/lib * * @requires vm.flavor == "server" * diff --git a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java index 956e993e2ce..bc321049b1d 100644 --- a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java +++ b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java @@ -26,7 +26,7 @@ /* * @test * @summary tests on constant folding of unsafe get operations from stable arrays - * @library /testlibrary + * @library /test/lib * * @requires vm.flavor == "server" * diff --git a/hotspot/test/compiler/unsafe/UnsafeRaw.java b/hotspot/test/compiler/unsafe/UnsafeRaw.java index af1a1cd0b96..269ca5483e9 100644 --- a/hotspot/test/compiler/unsafe/UnsafeRaw.java +++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java @@ -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 @@ -25,7 +25,7 @@ * @test * @bug 8058744 * @summary Invalid pattern-matching of address computations in raw unsafe - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -Xbatch compiler.unsafe.UnsafeRaw diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java index 8f6517621cf..def44007470 100644 --- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java +++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java @@ -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,10 +26,10 @@ * @test AllocationCodeBlobTest * @summary testing of WB::allocate/freeCodeBlob() * @bug 8059624 8064669 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.AllocationCodeBlobTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions @@ -45,7 +45,7 @@ package compiler.whitebox; import jdk.test.lib.Asserts; -import jdk.test.lib.InfiniteLoop; +import jdk.test.lib.wrappers.InfiniteLoop; import sun.hotspot.WhiteBox; import sun.hotspot.code.BlobType; diff --git a/hotspot/test/compiler/whitebox/BlockingCompilation.java b/hotspot/test/compiler/whitebox/BlockingCompilation.java index a89ab057e3d..d645352a7ae 100644 --- a/hotspot/test/compiler/whitebox/BlockingCompilation.java +++ b/hotspot/test/compiler/whitebox/BlockingCompilation.java @@ -26,9 +26,8 @@ * @bug 8150646 8153013 * @summary Add support for blocking compiles through whitebox API * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib / + * @library /test/lib / * @build sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm diff --git a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java index d0a06f99c56..55a0eaec92f 100644 --- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java +++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java @@ -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,10 +25,10 @@ * @test ClearMethodStateTest * @bug 8006683 8007288 8022832 * @summary testing of WB::clearMethodState() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.ClearMethodStateTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java index 2a718fcc3e2..3025b1e332b 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java @@ -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,10 +25,10 @@ * @test DeoptimizeAllTest * @bug 8006683 8007288 8022832 * @summary testing of WB::deoptimizeAll() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.DeoptimizeAllTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java index 62f4154fb42..87c66ceb39e 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java @@ -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 @@ -25,10 +25,10 @@ * @test DeoptimizeFramesTest * @bug 8028595 * @summary testing of WB::deoptimizeFrames() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.DeoptimizeFramesTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java index f505bbd5897..7331faeca0b 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java @@ -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,10 +25,10 @@ * @test DeoptimizeMethodTest * @bug 8006683 8007288 8022832 * @summary testing of WB::deoptimizeMethod() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.DeoptimizeMethodTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java index c5ec0286171..c3653b598dd 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java @@ -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 @@ -26,10 +26,10 @@ * @test DeoptimizeMultipleOSRTest * @bug 8061817 * @summary testing of WB::deoptimizeMethod() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.DeoptimizeMultipleOSRTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java index ccb8ab0675e..b2817b39660 100644 --- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java +++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java @@ -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,10 +25,10 @@ * @test EnqueueMethodForCompilationTest * @bug 8006683 8007288 8022832 * @summary testing of WB::enqueueMethodForCompilation() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.EnqueueMethodForCompilationTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java index f9b7cda0dbb..04ac558d9f5 100644 --- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java +++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java @@ -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,10 +26,10 @@ * @test * @bug 8059624 8064669 8153265 * @summary testing of WB::forceNMethodSweep - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.ForceNMethodSweepTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java index c6493c0abfa..305c888b7da 100644 --- a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java +++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java @@ -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,10 +26,10 @@ * @test GetCodeHeapEntriesTest * @bug 8059624 * @summary testing of WB::getCodeHeapEntries() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.GetCodeHeapEntriesTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java index 4b64a6c5236..91d8cb7342d 100644 --- a/hotspot/test/compiler/whitebox/GetNMethodTest.java +++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java @@ -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,10 +26,10 @@ * @test GetNMethodTest * @bug 8038240 * @summary testing of WB::getNMethod() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.GetNMethodTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java index 6b806574407..c5f4687ffa9 100644 --- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java +++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java @@ -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 @@ -26,16 +26,13 @@ * @bug 8007270 8006683 8007288 8022832 * @summary testing of WB::isMethodCompilable() * @requires vm.flavor == "server" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management * - * @build jdk.test.lib.* - * sun.hotspot.WhiteBox - * @build compiler.whitebox.IsMethodCompilableTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * jdk.test.lib.Platform * @run main/othervm/timeout=2400 -XX:-TieredCompilation -Xmixed * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * -XX:PerMethodRecompilationCutoff=3 -XX:-UseCounterDecay diff --git a/hotspot/test/compiler/whitebox/LockCompilationTest.java b/hotspot/test/compiler/whitebox/LockCompilationTest.java index e3b86823424..077cbf54e5c 100644 --- a/hotspot/test/compiler/whitebox/LockCompilationTest.java +++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java @@ -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 @@ -25,10 +25,10 @@ * @test LockCompilationTest * @bug 8059624 8152169 * @summary testing of WB::lock/unlockCompilation() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.LockCompilationTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java index 6722acecc22..8afec557e0d 100644 --- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java +++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java @@ -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,10 +25,10 @@ * @test MakeMethodNotCompilableTest * @bug 8012322 8006683 8007288 8022832 * @summary testing of WB::makeMethodNotCompilable() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.MakeMethodNotCompilableTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java index 5a8c7c33eeb..92d30221634 100644 --- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java @@ -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,10 +25,10 @@ * @test SetDontInlineMethodTest * @bug 8006683 8007288 8022832 * @summary testing of WB::testSetDontInlineMethod() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.SetDontInlineMethodTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java index f3e27e94827..5b346b55c5a 100644 --- a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java @@ -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,10 +25,10 @@ * @test SetForceInlineMethodTest * @bug 8006683 8007288 8022832 * @summary testing of WB::testSetForceInlineMethod() - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build compiler.whitebox.SetForceInlineMethodTest + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/gc/CondCardMark/Basic.java b/hotspot/test/gc/CondCardMark/Basic.java index a6cc3a02cbf..765584122a8 100644 --- a/hotspot/test/gc/CondCardMark/Basic.java +++ b/hotspot/test/gc/CondCardMark/Basic.java @@ -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 @@ -27,8 +27,6 @@ * @bug 8078438 * @summary Verify UseCondCardMark works * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build Basic * @run main/othervm -Xint Basic * @run main/othervm -Xint -XX:+UseCondCardMark Basic * @run main/othervm -XX:TieredStopAtLevel=1 Basic diff --git a/hotspot/test/gc/TestCardTablePageCommits.java b/hotspot/test/gc/TestCardTablePageCommits.java index 3577ebfe8fa..fe50587d95a 100644 --- a/hotspot/test/gc/TestCardTablePageCommits.java +++ b/hotspot/test/gc/TestCardTablePageCommits.java @@ -22,8 +22,8 @@ */ import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; /* @@ -32,7 +32,7 @@ import jdk.test.lib.Platform; * @bug 8059066 * @summary Tests that the card table does not commit the same page twice * @requires vm.gc.Parallel - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver TestCardTablePageCommits diff --git a/hotspot/test/gc/TestDisableExplicitGC.java b/hotspot/test/gc/TestDisableExplicitGC.java index 316f50c4314..6789df472fc 100644 --- a/hotspot/test/gc/TestDisableExplicitGC.java +++ b/hotspot/test/gc/TestDisableExplicitGC.java @@ -25,7 +25,7 @@ * @test TestDisableExplicitGC * @requires vm.opt.DisableExplicitGC == null * @summary Verify GC behavior with DisableExplicitGC flag. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules jdk.management/com.sun.management.internal * @run main/othervm -Xlog:gc=debug TestDisableExplicitGC diff --git a/hotspot/test/gc/TestObjectAlignment.java b/hotspot/test/gc/TestObjectAlignment.java index 2feaf63ba2b..9c6be10bd3f 100644 --- a/hotspot/test/gc/TestObjectAlignment.java +++ b/hotspot/test/gc/TestObjectAlignment.java @@ -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 @@ -26,7 +26,7 @@ * @key gc * @bug 8021823 * @summary G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=8 @@ -43,8 +43,8 @@ * @run main/othervm TestObjectAlignment -Xmx20M -XX:-ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=256 */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestObjectAlignment { diff --git a/hotspot/test/gc/TestSmallHeap.java b/hotspot/test/gc/TestSmallHeap.java index 9b791a54eb6..f604a4c5a06 100644 --- a/hotspot/test/gc/TestSmallHeap.java +++ b/hotspot/test/gc/TestSmallHeap.java @@ -26,10 +26,10 @@ * @bug 8067438 8152239 * @requires vm.gc=="null" * @summary Verify that starting the VM with a small heap works - * @library /testlibrary /test/lib /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management/sun.management - * @build TestSmallHeap + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestSmallHeap */ diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java index 380c9b882d4..6ea205757e7 100644 --- a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java +++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java @@ -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 @@ -25,10 +25,9 @@ * @test TestSoftReferencesBehaviorOnOOME * @key gc * @summary Tests that all SoftReferences has been cleared at time of OOM. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestSoftReferencesBehaviorOnOOME * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k diff --git a/hotspot/test/gc/TestVerifyDuringStartup.java b/hotspot/test/gc/TestVerifyDuringStartup.java index 3ac4cddb35e..7439e40c04e 100644 --- a/hotspot/test/gc/TestVerifyDuringStartup.java +++ b/hotspot/test/gc/TestVerifyDuringStartup.java @@ -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,14 +25,14 @@ * @key gc * @bug 8010463 8011343 8011898 * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.util.ArrayList; import java.util.Collections; diff --git a/hotspot/test/gc/TestVerifySilently.java b/hotspot/test/gc/TestVerifySilently.java index a387ae4df41..7d11c44c7c3 100644 --- a/hotspot/test/gc/TestVerifySilently.java +++ b/hotspot/test/gc/TestVerifySilently.java @@ -25,13 +25,13 @@ * @key gc * @bug 8032771 * @summary Test silent verification. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.util.ArrayList; import java.util.Collections; import jdk.test.lib.Utils; diff --git a/hotspot/test/gc/TestVerifySubSet.java b/hotspot/test/gc/TestVerifySubSet.java index 9208d478247..c43079475bc 100644 --- a/hotspot/test/gc/TestVerifySubSet.java +++ b/hotspot/test/gc/TestVerifySubSet.java @@ -25,13 +25,13 @@ * @key gc * @bug 8072725 * @summary Test VerifySubSet option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.util.ArrayList; import java.util.Collections; import jdk.test.lib.Utils; diff --git a/hotspot/test/testlibrary/jdk/test/lib/AllocationHelper.java b/hotspot/test/gc/arguments/AllocationHelper.java similarity index 97% rename from hotspot/test/testlibrary/jdk/test/lib/AllocationHelper.java rename to hotspot/test/gc/arguments/AllocationHelper.java index c8366e7a275..bd4a77111be 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/AllocationHelper.java +++ b/hotspot/test/gc/arguments/AllocationHelper.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,6 @@ * questions. */ -package jdk.test.lib; - import java.util.LinkedList; import java.util.concurrent.Callable; diff --git a/hotspot/test/testlibrary/jdk/test/lib/HeapRegionUsageTool.java b/hotspot/test/gc/arguments/HeapRegionUsageTool.java similarity index 96% rename from hotspot/test/testlibrary/jdk/test/lib/HeapRegionUsageTool.java rename to hotspot/test/gc/arguments/HeapRegionUsageTool.java index b89b77d5a33..1030012cf1a 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/HeapRegionUsageTool.java +++ b/hotspot/test/gc/arguments/HeapRegionUsageTool.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,6 @@ * questions. */ -package jdk.test.lib; - import java.lang.management.ManagementFactory; import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryUsage; diff --git a/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java b/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java index d06d3eec51c..1daa6d7128b 100644 --- a/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java +++ b/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java @@ -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 @@ -27,15 +27,15 @@ * The test helps verifying that size_t flags can be set/read. * @bug 8054823 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver TestArrayAllocatorMallocLimit */ import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.math.BigInteger; public class TestArrayAllocatorMallocLimit { diff --git a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java index 4e5fa74818c..50782ab3725 100644 --- a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java @@ -27,10 +27,10 @@ * @bug 8006088 * @requires vm.gc.ConcMarkSweep * @summary Tests argument processing for initial and maximum heap size for the CMS collector - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestCMSHeapSizeFlags TestMaxHeapSizeTools + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm TestCMSHeapSizeFlags diff --git a/hotspot/test/gc/arguments/TestCompressedClassFlags.java b/hotspot/test/gc/arguments/TestCompressedClassFlags.java index 3cc50ad5741..9d09084b254 100644 --- a/hotspot/test/gc/arguments/TestCompressedClassFlags.java +++ b/hotspot/test/gc/arguments/TestCompressedClassFlags.java @@ -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 @@ -21,14 +21,16 @@ * questions. */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.Platform; /* * @test * @bug 8015107 * @summary Tests that VM prints a warning when -XX:CompressedClassSpaceSize * is used together with -XX:-UseCompressedClassPointers - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/arguments/TestDisableDefaultGC.java b/hotspot/test/gc/arguments/TestDisableDefaultGC.java index 73ac9d446c2..4bbc4695531 100644 --- a/hotspot/test/gc/arguments/TestDisableDefaultGC.java +++ b/hotspot/test/gc/arguments/TestDisableDefaultGC.java @@ -26,15 +26,15 @@ * @summary Test that the VM complains when the default GC is disabled and no other GC is specified * @bug 8068579 * @key gc - * @library /testlibrary + * @library /test/lib * @requires vm.gc=="null" * @modules java.base/jdk.internal.misc * java.management * @run driver TestDisableDefaultGC */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestDisableDefaultGC { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java index 91935810e6d..c6d2b547357 100644 --- a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java @@ -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 @@ -30,7 +30,7 @@ import jdk.test.lib.DynamicVMOption; * @test TestDynMaxHeapFreeRatio * @bug 8028391 * @summary Verify that MaxHeapFreeRatio flag is manageable - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management * @run main TestDynMaxHeapFreeRatio diff --git a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java index f8dca9b8223..e21f066b0a0 100644 --- a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java @@ -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 @@ -25,7 +25,7 @@ * @test TestDynMinHeapFreeRatio * @bug 8028391 * @summary Verify that MinHeapFreeRatio flag is manageable - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management * @run main TestDynMinHeapFreeRatio diff --git a/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java b/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java index bd9e73a6b49..65536d5880f 100644 --- a/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java +++ b/hotspot/test/gc/arguments/TestG1ConcMarkStepDurationMillis.java @@ -26,12 +26,13 @@ * @key gc * @requires vm.gc.G1 * @summary Tests argument processing for double type flag, G1ConcMarkStepDurationMillis - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.util.*; import java.util.regex.*; diff --git a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java index fb91b9e4154..523994bccf5 100644 --- a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java +++ b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java @@ -27,12 +27,13 @@ * @bug 8047976 * @requires vm.gc.G1 * @summary Tests argument processing for G1ConcRefinementThreads - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.util.*; import java.util.regex.*; diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java index 7dd0fc5aa54..d69c2f066b7 100644 --- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java +++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java @@ -29,7 +29,7 @@ * @summary Verify that the flag G1HeapRegionSize is updated properly * @modules java.base/jdk.internal.misc * @modules java.management/sun.management - * @library /testlibrary + * @library /test/lib * @run main TestG1HeapRegionSize */ @@ -39,7 +39,8 @@ import java.util.regex.Pattern; import java.util.ArrayList; import java.util.Arrays; -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestG1HeapRegionSize { diff --git a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java index 034938862ec..73e600e5cf1 100644 --- a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java @@ -27,10 +27,10 @@ * @bug 8006088 * @requires vm.gc.G1 * @summary Tests argument processing for initial and maximum heap size for the G1 collector - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestG1HeapSizeFlags TestMaxHeapSizeTools + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm TestG1HeapSizeFlags diff --git a/hotspot/test/gc/arguments/TestG1PercentageOptions.java b/hotspot/test/gc/arguments/TestG1PercentageOptions.java index db193ef7184..3314e42e998 100644 --- a/hotspot/test/gc/arguments/TestG1PercentageOptions.java +++ b/hotspot/test/gc/arguments/TestG1PercentageOptions.java @@ -27,13 +27,14 @@ * @bug 8068942 * @requires vm.gc.G1 * @summary Test argument processing of various percentage options - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver TestG1PercentageOptions */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestG1PercentageOptions { diff --git a/hotspot/test/gc/arguments/TestHeapFreeRatio.java b/hotspot/test/gc/arguments/TestHeapFreeRatio.java index 4f97a7ce383..fd6df97535a 100644 --- a/hotspot/test/gc/arguments/TestHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestHeapFreeRatio.java @@ -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 @@ -26,13 +26,14 @@ * @key gc * @bug 8025661 * @summary Test parsing of -Xminf and -Xmaxf - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm TestHeapFreeRatio */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestHeapFreeRatio { diff --git a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java index a25e19e88b1..6fc2246488b 100644 --- a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java +++ b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java @@ -27,14 +27,15 @@ * @bug 8014765 * @requires vm.gc.Parallel * @summary Tests argument processing for initial tenuring threshold - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm TestInitialTenuringThreshold * @author thomas.schatzl@oracle.com */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestInitialTenuringThreshold { diff --git a/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java b/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java index 69bb75d00fe..98768c09469 100644 --- a/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java +++ b/hotspot/test/gc/arguments/TestMaxHeapSizeTools.java @@ -26,7 +26,8 @@ import java.util.regex.Pattern; import java.util.ArrayList; import java.util.Arrays; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.WhiteBox; class ErgoArgsPrinter { diff --git a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java index 3d26f946937..08a5b16fc3b 100644 --- a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java +++ b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java @@ -25,20 +25,18 @@ * @test TestMaxMinHeapFreeRatioFlags * @key gc * @summary Verify that heap size changes according to max and min heap free ratios. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestMaxMinHeapFreeRatioFlags * @run driver/timeout=240 TestMaxMinHeapFreeRatioFlags */ import java.util.LinkedList; import java.util.Arrays; import java.util.Collections; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; -import jdk.test.lib.HeapRegionUsageTool; import jdk.internal.misc.Unsafe; public class TestMaxMinHeapFreeRatioFlags { diff --git a/hotspot/test/gc/arguments/TestMaxNewSize.java b/hotspot/test/gc/arguments/TestMaxNewSize.java index 25eb279f455..1a5bd980f4b 100644 --- a/hotspot/test/gc/arguments/TestMaxNewSize.java +++ b/hotspot/test/gc/arguments/TestMaxNewSize.java @@ -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 @@ -27,10 +27,9 @@ * @bug 7057939 * @summary Make sure that MaxNewSize always has a useful value after argument * processing. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestMaxNewSize * @run main TestMaxNewSize -XX:+UseSerialGC * @run main TestMaxNewSize -XX:+UseParallelGC * @run main TestMaxNewSize -XX:+UseConcMarkSweepGC @@ -46,7 +45,8 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestMaxNewSize { diff --git a/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java b/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java index d58040bca0a..892426a29cd 100644 --- a/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java +++ b/hotspot/test/gc/arguments/TestMinAndInitialSurvivorRatioFlags.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,22 +25,20 @@ * @test TestMinAndInitialSurvivorRatioFlags * @key gc * @summary Verify that MinSurvivorRatio and InitialSurvivorRatio flags work - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestMinAndInitialSurvivorRatioFlags + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver TestMinAndInitialSurvivorRatioFlags */ -import jdk.test.lib.AllocationHelper; import java.lang.management.MemoryUsage; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; -import jdk.test.lib.HeapRegionUsageTool; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/arguments/TestMinInitialErgonomics.java b/hotspot/test/gc/arguments/TestMinInitialErgonomics.java index 784860a834d..ca354ba91a2 100644 --- a/hotspot/test/gc/arguments/TestMinInitialErgonomics.java +++ b/hotspot/test/gc/arguments/TestMinInitialErgonomics.java @@ -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 @@ -26,10 +26,10 @@ * @key gc * @bug 8006088 * @summary Test ergonomics decisions related to minimum and initial heap size. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestMinInitialErgonomics TestMaxHeapSizeTools + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm TestMinInitialErgonomics diff --git a/hotspot/test/gc/arguments/TestNewRatioFlag.java b/hotspot/test/gc/arguments/TestNewRatioFlag.java index 1f8cfb8dd4e..d95374a328c 100644 --- a/hotspot/test/gc/arguments/TestNewRatioFlag.java +++ b/hotspot/test/gc/arguments/TestNewRatioFlag.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,10 @@ * @key gc * @bug 8025166 * @summary Verify that heap devided among generations according to NewRatio - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestNewRatioFlag + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver TestNewRatioFlag */ @@ -37,9 +37,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; -import jdk.test.lib.HeapRegionUsageTool; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/arguments/TestNewSizeFlags.java b/hotspot/test/gc/arguments/TestNewSizeFlags.java index df016560e8e..a871361dbe6 100644 --- a/hotspot/test/gc/arguments/TestNewSizeFlags.java +++ b/hotspot/test/gc/arguments/TestNewSizeFlags.java @@ -26,23 +26,21 @@ * @key gc * @bug 8025166 * @summary Verify that young gen size conforms values specified by NewSize, MaxNewSize and Xmn options - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestNewSizeFlags + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver/timeout=240 TestNewSizeFlags */ -import jdk.test.lib.AllocationHelper; import java.io.IOException; import java.lang.management.MemoryUsage; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; -import jdk.test.lib.HeapRegionUsageTool; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java b/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java index d10dcf69660..fc487c2dd94 100644 --- a/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java +++ b/hotspot/test/gc/arguments/TestNewSizeThreadIncrease.java @@ -26,14 +26,17 @@ * @key gc * @bug 8144527 * @summary Tests argument processing for NewSizeThreadIncrease - * @library /testlibrary + * @library /test/lib * @requires vm.gc.Serial * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + // Range of NewSizeThreadIncrease is 0 ~ max_uintx. // Total of 5 threads will be created (1 GCTest thread and 4 TestThread). diff --git a/hotspot/test/gc/arguments/TestObjectTenuringFlags.java b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java index b30b365b95d..ed25dd8f6b9 100644 --- a/hotspot/test/gc/arguments/TestObjectTenuringFlags.java +++ b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java @@ -28,14 +28,14 @@ * @requires vm.gc.Parallel * @summary Tests argument processing for NeverTenure, AlwaysTenure, * and MaxTenuringThreshold - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestObjectTenuringFlags FlagsValue * @run main/othervm TestObjectTenuringFlags */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.util.*; diff --git a/hotspot/test/gc/arguments/TestParallelGCThreads.java b/hotspot/test/gc/arguments/TestParallelGCThreads.java index 44d24171128..f18aa43a8b2 100644 --- a/hotspot/test/gc/arguments/TestParallelGCThreads.java +++ b/hotspot/test/gc/arguments/TestParallelGCThreads.java @@ -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,13 +26,15 @@ * @key gc * @bug 8059527 8081382 * @summary Tests argument processing for ParallelGCThreads - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver TestParallelGCThreads */ -import jdk.test.lib.*; +import jdk.test.lib.Asserts; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestParallelGCThreads { diff --git a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java index af0b2a7922c..f9e4816ace2 100644 --- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java @@ -28,10 +28,10 @@ * @summary Tests argument processing for initial and maximum heap size for the * parallel collectors. * @requires vm.gc=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestParallelHeapSizeFlags TestMaxHeapSizeTools + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm TestParallelHeapSizeFlags diff --git a/hotspot/test/gc/arguments/TestSelectDefaultGC.java b/hotspot/test/gc/arguments/TestSelectDefaultGC.java index 0c39a6ba874..de770b283b8 100644 --- a/hotspot/test/gc/arguments/TestSelectDefaultGC.java +++ b/hotspot/test/gc/arguments/TestSelectDefaultGC.java @@ -26,14 +26,17 @@ * @summary Test selection of GC when no GC option is specified * @bug 8068582 * @key gc - * @library /testlibrary + * @library /test/lib * @requires vm.gc=="null" * @modules java.base/jdk.internal.misc * java.management * @run driver TestSelectDefaultGC */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + import java.util.regex.*; public class TestSelectDefaultGC { diff --git a/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java b/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java index 3ffd729d5cb..32533afd609 100644 --- a/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java @@ -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 @@ -26,10 +26,10 @@ * @key gc * @bug 8006088 * @summary Tests argument processing for initial and maximum heap size for the Serial collector - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestSerialHeapSizeFlags TestMaxHeapSizeTools + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm TestSerialHeapSizeFlags diff --git a/hotspot/test/gc/arguments/TestShrinkHeapInSteps.java b/hotspot/test/gc/arguments/TestShrinkHeapInSteps.java index 82dd54af734..de75055a560 100644 --- a/hotspot/test/gc/arguments/TestShrinkHeapInSteps.java +++ b/hotspot/test/gc/arguments/TestShrinkHeapInSteps.java @@ -25,10 +25,9 @@ * @test TestShrinkHeapInSteps * @key gc * @summary Verify that -XX:-ShrinkHeapInSteps works properly. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestMaxMinHeapFreeRatioFlags TestShrinkHeapInSteps * @run driver/timeout=240 TestShrinkHeapInSteps */ diff --git a/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java index e275e6b8799..332acf39026 100644 --- a/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java +++ b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java @@ -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 @@ -21,14 +21,14 @@ * questions. */ -import jdk.test.lib.ExitCode; +import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; /** * @test * @bug 8031323 * @summary Verify SurvivorAlignmentInBytes option processing. - * @library /testlibrary + * @library /test/lib * @requires vm.opt.SurvivorAlignmentInBytes == null * & vm.opt.ObjectAlignmentInBytes == null * & vm.opt.UnlockExperimentalVMOptions == null diff --git a/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java b/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java index b18da4b3cf6..d33d7733b68 100644 --- a/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java +++ b/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,22 +25,20 @@ * @test TestSurvivorRatioFlag * @key gc * @summary Verify that actual survivor ratio is equal to specified SurvivorRatio value - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestSurvivorRatioFlag + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver TestSurvivorRatioFlag */ -import jdk.test.lib.AllocationHelper; import java.lang.management.MemoryUsage; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; -import jdk.test.lib.HeapRegionUsageTool; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java index dd254e0e7a2..af91d12ddd3 100644 --- a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java +++ b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java @@ -27,15 +27,14 @@ * @summary Verify that option TargetSurvivorRatio affects survivor space occupancy after minor GC. * @requires (vm.opt.ExplicitGCInvokesConcurrent == null) | (vm.opt.ExplicitGCInvokesConcurrent == false) * @requires (vm.opt.UseJVMCICompiler == null) | (vm.opt.UseJVMCICompiler == false) - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestTargetSurvivorRatioFlag + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver TestTargetSurvivorRatioFlag */ -import jdk.test.lib.AllocationHelper; import java.lang.management.GarbageCollectorMXBean; import java.util.Arrays; import java.util.Collections; @@ -43,10 +42,9 @@ import java.util.LinkedList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.HeapRegionUsageTool; import jdk.internal.misc.Unsafe; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java index 3b33466ee96..f10bd70c465 100644 --- a/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java +++ b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java @@ -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 @@ -26,13 +26,14 @@ * @key gc * @bug 8017611 * @summary Tests handling unrecognized VM options - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm TestUnrecognizedVMOptionsHandling */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestUnrecognizedVMOptionsHandling { diff --git a/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java b/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java index effbfa5cbe5..218ee051c6c 100644 --- a/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java +++ b/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java @@ -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 @@ -26,10 +26,10 @@ * @key gc * @bug 8010722 * @summary Tests ergonomics for UseCompressedOops. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management/sun.management - * @build TestUseCompressedOopsErgo TestUseCompressedOopsErgoTools + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm TestUseCompressedOopsErgo -XX:+UseG1GC diff --git a/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java b/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java index 09072229b3f..d599fe3ce7e 100644 --- a/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java +++ b/hotspot/test/gc/arguments/TestUseCompressedOopsErgoTools.java @@ -29,7 +29,9 @@ import java.util.regex.Pattern; import java.util.ArrayList; import java.util.Arrays; -import jdk.test.lib.*; +import jdk.test.lib.Asserts; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.lang.management.ManagementFactory; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java b/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java index 85bb1de4cac..4eb11c57044 100644 --- a/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java +++ b/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java @@ -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 @@ -27,13 +27,13 @@ * ergonomics, on all platforms when UseNUMA feature is enabled. * @bug 8059614 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver TestUseNUMAInterleaving */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestUseNUMAInterleaving { diff --git a/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java b/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java index d092c11dbca..db2be6d6468 100644 --- a/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java +++ b/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ output contain or doesn't contain expected patterns * @modules java.base/jdk.internal.misc * @modules java.management - * @library /testlibrary + * @library /test/lib * @run driver TestVerifyBeforeAndAfterGCFlags */ @@ -38,17 +38,17 @@ import java.util.ArrayList; import java.util.Collections; import jdk.test.lib.Utils; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestVerifyBeforeAndAfterGCFlags { - // VerifyBeforeGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand C-heap code cache ] + // VerifyBeforeGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand code cache ] public static final String VERIFY_BEFORE_GC_PATTERN = "Verifying Before GC"; // VerifyBeforeGC: VerifyBeforeGC: VerifyBeforeGC: public static final String VERIFY_BEFORE_GC_CORRUPTED_PATTERN = "VerifyBeforeGC:(?!\\[Verifying[^]]+\\])"; - // VerifyAfterGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand C-heap code cache ] + // VerifyAfterGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand code cache ] public static final String VERIFY_AFTER_GC_PATTERN = "Verifying After GC"; // VerifyAfterGC: VerifyAfterGC: VerifyAfterGC: public static final String VERIFY_AFTER_GC_CORRUPTED_PATTERN = "VerifyAfterGC:(?!\\[Verifying[^]]+\\])"; diff --git a/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java b/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java index 732f0a74a3d..6b798256ab4 100644 --- a/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java +++ b/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java @@ -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 @@ -25,18 +25,18 @@ * @test * @key gc * @bug 8049831 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestCMSClassUnloadingEnabledHWM + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver TestCMSClassUnloadingEnabledHWM * @summary Test that -XX:-CMSClassUnloadingEnabled will trigger a Full GC when more than MetaspaceSize metadata is allocated. */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.lang.management.GarbageCollectorMXBean; import java.lang.management.ManagementFactory; import java.util.ArrayList; diff --git a/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java b/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java index 6b99caf7531..ad0ef23dbbf 100644 --- a/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java +++ b/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java @@ -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 @@ -25,18 +25,18 @@ * @test * @key gc * @bug 8049831 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestG1ClassUnloadingHWM + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver TestG1ClassUnloadingHWM * @summary Test that -XX:-ClassUnloadingWithConcurrentMark will trigger a Full GC when more than MetaspaceSize metadata is allocated. */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.util.ArrayList; import java.util.Arrays; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/cms/GuardShrinkWarning.java b/hotspot/test/gc/cms/GuardShrinkWarning.java index 58182678159..5790ba1dea6 100644 --- a/hotspot/test/gc/cms/GuardShrinkWarning.java +++ b/hotspot/test/gc/cms/GuardShrinkWarning.java @@ -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 @@ -27,14 +27,15 @@ * @bug 8012111 * @key gc * @key regression - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm GuardShrinkWarning * @author jon.masamitsu@oracle.com */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class GuardShrinkWarning { public static void main(String args[]) throws Exception { diff --git a/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java b/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java index 7b262fd3723..5040a9370a8 100644 --- a/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java +++ b/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java @@ -28,11 +28,11 @@ * @requires vm.gc=="null" * @key gc * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestDynamicNumberOfGCThreads { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/ergonomics/TestInitialGCThreadLogging.java b/hotspot/test/gc/ergonomics/TestInitialGCThreadLogging.java index 29a7602f83f..f68e8fa842b 100644 --- a/hotspot/test/gc/ergonomics/TestInitialGCThreadLogging.java +++ b/hotspot/test/gc/ergonomics/TestInitialGCThreadLogging.java @@ -28,11 +28,11 @@ * @requires vm.gc=="null" * @key gc * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestInitialGCThreadLogging { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/g1/Test2GbHeap.java b/hotspot/test/gc/g1/Test2GbHeap.java index 66bc2c74604..55e9927cbe4 100644 --- a/hotspot/test/gc/g1/Test2GbHeap.java +++ b/hotspot/test/gc/g1/Test2GbHeap.java @@ -30,15 +30,15 @@ * @requires vm.bits != "32" * @key gc * @key regression - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ import java.util.ArrayList; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class Test2GbHeap { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java index b29d9328cbd..71ec43de6ff 100644 --- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java +++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java @@ -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 @@ -27,7 +27,7 @@ * @summary Test to make sure that eager reclaim of humongous objects work. We simply try to fill * up the heap with humongous objects that should be eagerly reclaimable to avoid Full GC. * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ @@ -36,8 +36,8 @@ import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.LinkedList; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Asserts; class ReclaimRegionFast { diff --git a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java index 3e835bb49b7..a516e02185a 100644 --- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java +++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java @@ -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 @@ -27,7 +27,7 @@ * @summary Test to make sure that eager reclaim of humongous objects correctly clears * mark bitmaps at reclaim. * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ @@ -36,8 +36,8 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.Random; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; // An object that has a few references to other instances to slow down marking. class ObjectWithSomeRefs { diff --git a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java index ecd016451ac..6bfa89b00bf 100644 --- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java +++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java @@ -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 @@ -30,7 +30,7 @@ * referencing that we know is in the old gen. After changing this reference, the object * should still be eagerly reclaimable to avoid Full GC. * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ @@ -39,8 +39,8 @@ import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.LinkedList; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import static jdk.test.lib.Asserts.*; class RefHolder { diff --git a/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java b/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java index 57fcf2ce7a3..2c27eb276ab 100644 --- a/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java +++ b/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java @@ -27,13 +27,13 @@ * @summary Ensure that the output for a G1TraceEagerReclaimHumongousObjects * includes the expected necessary messages. * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.util.LinkedList; public class TestG1TraceEagerReclaimHumongousObjects { diff --git a/hotspot/test/gc/g1/TestGCLogMessages.java b/hotspot/test/gc/g1/TestGCLogMessages.java index ec9250c14fa..776ef7d826a 100644 --- a/hotspot/test/gc/g1/TestGCLogMessages.java +++ b/hotspot/test/gc/g1/TestGCLogMessages.java @@ -27,13 +27,13 @@ * @summary Ensure the output for a minor GC with G1 * includes the expected necessary messages. * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestGCLogMessages { diff --git a/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java b/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java index cd43193c3a1..c760c36db48 100644 --- a/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java +++ b/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,13 @@ * @test TestHumongousAllocInitialMark * @bug 7168848 * @summary G1: humongous object allocations should initiate marking cycles when necessary - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestHumongousAllocInitialMark { // Heap sizes < 224 MB are increased to 224 MB if vm_page_size == 64K to diff --git a/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java b/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java index a7a34442814..7c0d7a170c3 100644 --- a/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java +++ b/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,11 +27,12 @@ * @summary G1: humongous object allocations should work even when there is * not enough space in the heapRegion to fit a filler object. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @run driver TestHumongousAllocNearlyFullRegion */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestHumongousAllocNearlyFullRegion { // Heap sizes < 224 MB are increased to 224 MB if vm_page_size == 64K to diff --git a/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java b/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java index 00950cc188d..955474c99e6 100644 --- a/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java +++ b/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java @@ -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 @@ -26,17 +26,18 @@ * @key regression * @key gc * @bug 8027756 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestHumongousCodeCacheRoots + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @summary Humongous objects may have references from the code cache * @run main TestHumongousCodeCacheRoots */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import sun.hotspot.WhiteBox; import java.util.ArrayList; diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java index 62c452a715d..53bcbe077b8 100644 --- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java +++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java @@ -27,7 +27,7 @@ * @requires vm.gc.G1 * @summary Verify that heap shrinks after GC in the presence of fragmentation * due to humongous objects - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10 diff --git a/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java b/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java index 844e1524db5..3f173c355a7 100644 --- a/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java +++ b/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java @@ -27,10 +27,9 @@ * @bug 8058354 8079208 * @key gc * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @requires vm.gc.G1 - * @build jdk.test.lib.* sun.hotspot.WhiteBox - * @build TestLargePageUseForAuxMemory + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+IgnoreUnrecognizedVMOptions -XX:+UseLargePages TestLargePageUseForAuxMemory @@ -40,8 +39,10 @@ import java.lang.Math; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Asserts; +import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; public class TestLargePageUseForAuxMemory { diff --git a/hotspot/test/gc/g1/TestNoEagerReclaimOfHumongousRegions.java b/hotspot/test/gc/g1/TestNoEagerReclaimOfHumongousRegions.java index 5a1eefe7309..d8a6e29ea48 100644 --- a/hotspot/test/gc/g1/TestNoEagerReclaimOfHumongousRegions.java +++ b/hotspot/test/gc/g1/TestNoEagerReclaimOfHumongousRegions.java @@ -29,9 +29,9 @@ * might pass even if there are problems in the code, but it will never crash unless there is a problem. * @requires vm.gc.G1 * @key gc - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc - * @build TestNoEagerReclaimOfHumongousRegions + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xlog:gc,gc+humongous=debug -XX:+UseG1GC -XX:MaxTenuringThreshold=0 -XX:G1RSetSparseRegionEntries=32 -XX:G1HeapRegionSize=1m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestNoEagerReclaimOfHumongousRegions diff --git a/hotspot/test/gc/g1/TestPLABOutput.java b/hotspot/test/gc/g1/TestPLABOutput.java index 2f53c5c8a8b..53519fa9c05 100644 --- a/hotspot/test/gc/g1/TestPLABOutput.java +++ b/hotspot/test/gc/g1/TestPLABOutput.java @@ -28,7 +28,7 @@ * @requires vm.gc.G1 * @key gc * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver TestPLABOutput @@ -39,9 +39,9 @@ import sun.hotspot.WhiteBox; import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/gc/g1/TestPLABSizeBounds.java b/hotspot/test/gc/g1/TestPLABSizeBounds.java index e4faca68e44..0b29eb54eef 100644 --- a/hotspot/test/gc/g1/TestPLABSizeBounds.java +++ b/hotspot/test/gc/g1/TestPLABSizeBounds.java @@ -27,16 +27,16 @@ * @summary Regression test to ensure that G1 supports PLAB sizes of half a region size. * @requires vm.gc.G1 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ import java.util.ArrayList; -import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestPLABSizeBounds { diff --git a/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java b/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java index b0482083628..79b797b4286 100644 --- a/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java +++ b/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java @@ -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 @@ -26,14 +26,15 @@ * @key gc * @bug 8014240 * @summary Test output of G1PrintRegionRememberedSetInfo - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main TestPrintRegionRememberedSetInfo * @author thomas.schatzl@oracle.com */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.lang.Thread; import java.util.ArrayList; import java.util.Arrays; diff --git a/hotspot/test/gc/g1/TestRegionLivenessPrint.java b/hotspot/test/gc/g1/TestRegionLivenessPrint.java index 8e79b1efe32..3e0f3e2c7ad 100644 --- a/hotspot/test/gc/g1/TestRegionLivenessPrint.java +++ b/hotspot/test/gc/g1/TestRegionLivenessPrint.java @@ -27,9 +27,9 @@ * @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 + * @library /test/lib * @modules java.base/jdk.internal.misc - * @build TestRegionLivenessPrint + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC -Xmx128M -XX:G1HeapRegionSize=1m -Xlog:gc+liveness=trace TestRegionLivenessPrint diff --git a/hotspot/test/gc/g1/TestRemsetLogging.java b/hotspot/test/gc/g1/TestRemsetLogging.java index 146a16f9a87..f4e829603dd 100644 --- a/hotspot/test/gc/g1/TestRemsetLogging.java +++ b/hotspot/test/gc/g1/TestRemsetLogging.java @@ -25,10 +25,10 @@ * @test TestRemsetLogging.java * @requires vm.gc.G1 * @bug 8013895 8129977 8145534 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management/sun.management - * @build TestRemsetLoggingTools TestRemsetLogging + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @summary Verify output of -Xlog:gc+remset*=trace diff --git a/hotspot/test/gc/g1/TestRemsetLoggingPerRegion.java b/hotspot/test/gc/g1/TestRemsetLoggingPerRegion.java index e60d191940c..123f6166a66 100644 --- a/hotspot/test/gc/g1/TestRemsetLoggingPerRegion.java +++ b/hotspot/test/gc/g1/TestRemsetLoggingPerRegion.java @@ -25,10 +25,10 @@ * @test TestRemsetLoggingPerRegion.java * @requires vm.gc.G1 * @bug 8014078 8129977 8145534 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management/sun.management - * @build TestRemsetLoggingTools TestRemsetLoggingPerRegion + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @summary Verify output of -Xlog:gc+remset*=trace in regards to per-region type output diff --git a/hotspot/test/gc/g1/TestRemsetLoggingThreads.java b/hotspot/test/gc/g1/TestRemsetLoggingThreads.java index 2f0c712a87c..18b1f0536b6 100644 --- a/hotspot/test/gc/g1/TestRemsetLoggingThreads.java +++ b/hotspot/test/gc/g1/TestRemsetLoggingThreads.java @@ -26,7 +26,7 @@ * @requires vm.gc.G1 * @bug 8025441 8145534 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management/sun.management * @summary Ensure that various values of worker threads/concurrent @@ -36,8 +36,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestRemsetLoggingThreads { diff --git a/hotspot/test/gc/g1/TestRemsetLoggingTools.java b/hotspot/test/gc/g1/TestRemsetLoggingTools.java index e58eb9e8b14..6fdc4e51206 100644 --- a/hotspot/test/gc/g1/TestRemsetLoggingTools.java +++ b/hotspot/test/gc/g1/TestRemsetLoggingTools.java @@ -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 @@ -29,7 +29,8 @@ import com.sun.management.HotSpotDiagnosticMXBean; import com.sun.management.VMOption; import sun.hotspot.WhiteBox; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.lang.management.ManagementFactory; import java.util.ArrayList; import java.util.Arrays; diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java index 3b0907c6663..cb25eac90d8 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java @@ -22,9 +22,9 @@ */ import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import java.io.IOException; import java.lang.management.ManagementFactory; diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java index baed161da93..9f3b580952d 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java @@ -28,11 +28,10 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc.G1 * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.* sun.hotspot.WhiteBox - * TestShrinkAuxiliaryData TestShrinkAuxiliaryData00 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=720 TestShrinkAuxiliaryData00 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java index 846f91de654..1fa2ca5c873 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java @@ -28,11 +28,10 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc.G1 * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.* sun.hotspot.WhiteBox - * TestShrinkAuxiliaryData TestShrinkAuxiliaryData05 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=720 TestShrinkAuxiliaryData05 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java index 05b041da715..694e35f9c5a 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java @@ -28,11 +28,10 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc.G1 * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.* sun.hotspot.WhiteBox - * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=720 TestShrinkAuxiliaryData10 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java index ec0623bdf58..1bfbe489f2b 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java @@ -28,11 +28,10 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc.G1 * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.* sun.hotspot.WhiteBox - * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=720 TestShrinkAuxiliaryData15 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java index a89eb284a9d..0d037d2b661 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java @@ -28,11 +28,10 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc.G1 * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.* sun.hotspot.WhiteBox - * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=720 TestShrinkAuxiliaryData20 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java index 50d5d912169..a24111f977a 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java @@ -28,11 +28,10 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc.G1 * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.* sun.hotspot.WhiteBox - * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=720 TestShrinkAuxiliaryData25 diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java index 6432cdad2e0..5572a011ab8 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java @@ -28,11 +28,10 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc.G1 * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.* sun.hotspot.WhiteBox - * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=720 TestShrinkAuxiliaryData30 diff --git a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java index 34948e9797e..fa3126f2498 100644 --- a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java +++ b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java @@ -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 @@ -31,7 +31,7 @@ * "..................................H" * 3. invoke gc and check that memory returned to the system (amount of committed memory got down) * - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management/sun.management */ @@ -40,8 +40,8 @@ import java.lang.management.MemoryUsage; import java.util.ArrayList; import java.util.List; import static jdk.test.lib.Asserts.*; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import com.sun.management.HotSpotDiagnosticMXBean; public class TestShrinkDefragmentedHeap { diff --git a/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java b/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java index b09a32a6956..25e6a12ff5e 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java @@ -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 @@ * @summary Test string deduplication age threshold * @bug 8029075 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java b/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java index b725acbf8de..1c2ab7389c4 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java @@ -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 @@ * @summary Test string deduplication during full GC * @bug 8029075 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/g1/TestStringDeduplicationInterned.java b/hotspot/test/gc/g1/TestStringDeduplicationInterned.java index 3abe32d80ec..766c9f821b0 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationInterned.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationInterned.java @@ -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 @@ * @summary Test string deduplication of interned strings * @bug 8029075 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java b/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java index 62146e176d8..43940962f9b 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java @@ -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 @@ * @summary Test string deduplication print options * @bug 8029075 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java b/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java index d7c2f12c77b..5f466f3681d 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java @@ -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 @@ * @summary Test string deduplication table rehash * @bug 8029075 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java b/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java index 204efb5a4ce..1259869e4e5 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java @@ -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 @@ * @summary Test string deduplication table resize * @bug 8029075 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/g1/TestStringDeduplicationTools.java b/hotspot/test/gc/g1/TestStringDeduplicationTools.java index 3e725f78132..b4760317a12 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationTools.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationTools.java @@ -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 @@ -29,7 +29,8 @@ import java.lang.management.*; import java.lang.reflect.*; import java.security.*; import java.util.*; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import sun.misc.*; class TestStringDeduplicationTools { diff --git a/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java b/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java index 15ab52f67e5..a65e4ab3ce2 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java @@ -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 @@ * @summary Test string deduplication during young GC * @bug 8029075 * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/g1/TestStringSymbolTableStats.java b/hotspot/test/gc/g1/TestStringSymbolTableStats.java index e86187988b3..62994fa2d55 100644 --- a/hotspot/test/gc/g1/TestStringSymbolTableStats.java +++ b/hotspot/test/gc/g1/TestStringSymbolTableStats.java @@ -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 @@ -26,13 +26,13 @@ * @bug 8027476 8027455 * @summary Ensure that the G1TraceStringSymbolTableScrubbing prints the expected message. * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestStringSymbolTableStats { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java b/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java index 28bc484f4a2..86405e1c738 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java @@ -38,12 +38,10 @@ import java.util.List; * @test TestHeapCounters * @summary Checks that heap counters work as expected after humongous allocations/deallocations * @requires vm.gc.G1 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox - * gc.testlibrary.Helpers - * gc.g1.humongousObjects.TestHeapCounters * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java index 86bc2d22c9f..1db6259f8ca 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java @@ -41,15 +41,10 @@ import java.nio.file.Paths; * @requires vm.gc.G1 * @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M" * @requires vm.opt.ExplicitGCInvokesConcurrent != true - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox - * gc.testlibrary.Helpers - * gc.g1.humongousObjects.G1SampleClass - * gc.g1.humongousObjects.ClassLoaderGenerator - * gc.g1.humongousObjects.TestHumongousClassLoader - * * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java index a90c98d6953..755516c92bc 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java @@ -40,12 +40,10 @@ import java.util.stream.Collectors; * @test TestHumongousMovement * @summary Checks that Humongous objects are not moved during GC * @requires vm.gc.G1 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox - * gc.testlibrary.Helpers - * gc.g1.humongousObjects.TestHumongousMovement * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java index fcc9d7dedd3..2abcf4883e9 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java @@ -39,14 +39,10 @@ import java.nio.file.Paths; * @summary Checks that huge class' instances (ie with huge amount of fields) are allocated successfully * @requires vm.gc.G1 * @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox - * gc.testlibrary.Helpers - * gc.g1.humongousObjects.G1SampleClass - * gc.g1.humongousObjects.TestHumongousNonArrayAllocation - * * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java index cc1660e540e..76b35ab0055 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java @@ -32,12 +32,10 @@ import sun.hotspot.WhiteBox; * @test TestHumongousThreshold * @summary Checks that objects larger than half a region are allocated as humongous * @requires vm.gc.G1 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox - * gc.testlibrary.Helpers - * gc.g1.humongousObjects.TestHumongousThreshold * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * diff --git a/hotspot/test/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java b/hotspot/test/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java index bbd15683324..893b895a8f5 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java +++ b/hotspot/test/gc/g1/humongousObjects/TestNoAllocationsInHRegions.java @@ -36,12 +36,9 @@ import java.util.stream.Collectors; * @test TestNoAllocationsInHRegions * @summary Checks that no additional allocations are made in humongous regions * @requires vm.gc.G1 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.management java.base/jdk.internal.misc * @build sun.hotspot.WhiteBox - * gc.testlibrary.Helpers - * gc.g1.humongousObjects.TestNoAllocationsInHRegions - * * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * diff --git a/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java b/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java index 0cf5e2ce8d3..10ffe50f28f 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java +++ b/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java @@ -38,13 +38,10 @@ import java.lang.ref.WeakReference; * @summary checks that after different type of GCs weak/soft references to humongous object behave correspondingly to * actual object behavior * @requires vm.gc.G1 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox - * gc.testlibrary.Helpers - * gc.g1.humongousObjects.TestObjectCollected - * * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java index 07f7a3bc89d..bb7f3d29a60 100644 --- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java +++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java @@ -24,7 +24,7 @@ package gc.g1.humongousObjects.objectGraphTest; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.WhiteBox; import java.io.File; @@ -50,16 +50,9 @@ import java.util.stream.Collectors; * @summary Checks that objects' graph behave as expected after gc * @requires vm.gc.G1 * @requires vm.opt.ExplicitGCInvokesConcurrent != true - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.management java.base/jdk.internal.misc * @build sun.hotspot.WhiteBox - * gc.testlibrary.Helpers - * gc.g1.humongousObjects.objectGraphTest.GCTokens - * gc.g1.humongousObjects.objectGraphTest.ReferenceInfo - * gc.g1.humongousObjects.objectGraphTest.GC - * gc.g1.humongousObjects.objectGraphTest.ObjectGraph - * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC - * * @ignore 8156755 * * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/g1/ihop/TestIHOPErgo.java b/hotspot/test/gc/g1/ihop/TestIHOPErgo.java index d70c926e298..af46c523e2f 100644 --- a/hotspot/test/gc/g1/ihop/TestIHOPErgo.java +++ b/hotspot/test/gc/g1/ihop/TestIHOPErgo.java @@ -30,11 +30,9 @@ * @requires !vm.flightRecorder * @requires vm.opt.ExplicitGCInvokesConcurrent != true * @requires vm.opt.MaxGCPauseMillis == "null" - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management - * @build gc.g1.ihop.TestIHOPErgo - * gc.g1.ihop.lib.IhopUtils * @run driver/timeout=480 gc.g1.ihop.TestIHOPErgo */ package gc.g1.ihop; @@ -44,8 +42,8 @@ import java.util.Collections; import java.util.LinkedList; import java.util.List; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import gc.g1.ihop.lib.IhopUtils; diff --git a/hotspot/test/gc/g1/ihop/TestIHOPStatic.java b/hotspot/test/gc/g1/ihop/TestIHOPStatic.java index 0529af84206..0fcafaf6634 100644 --- a/hotspot/test/gc/g1/ihop/TestIHOPStatic.java +++ b/hotspot/test/gc/g1/ihop/TestIHOPStatic.java @@ -28,11 +28,9 @@ * @requires vm.gc.G1 * @requires !vm.flightRecorder * @requires vm.opt.ExplicitGCInvokesConcurrent != true - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management - * @build gc.g1.ihop.TestIHOPStatic - * gc.g1.ihop.lib.IhopUtils * @run driver/timeout=240 gc.g1.ihop.TestIHOPStatic */ package gc.g1.ihop; @@ -41,8 +39,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import gc.g1.ihop.lib.IhopUtils; diff --git a/hotspot/test/gc/g1/ihop/lib/IhopUtils.java b/hotspot/test/gc/g1/ihop/lib/IhopUtils.java index 0ca571b2a12..0cd25ea4c67 100644 --- a/hotspot/test/gc/g1/ihop/lib/IhopUtils.java +++ b/hotspot/test/gc/g1/ihop/lib/IhopUtils.java @@ -27,7 +27,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; /** diff --git a/hotspot/test/gc/g1/mixedgc/TestLogging.java b/hotspot/test/gc/g1/mixedgc/TestLogging.java index 29fd37f3201..d3231302c95 100644 --- a/hotspot/test/gc/g1/mixedgc/TestLogging.java +++ b/hotspot/test/gc/g1/mixedgc/TestLogging.java @@ -26,18 +26,18 @@ * @summary Check that a mixed GC is reflected in the gc logs * @requires vm.gc.G1 * @requires vm.opt.MaxGCPauseMillis == "null" - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management - * @build sun.hotspot.WhiteBox gc.g1.mixedgc.TestLogging + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver gc.g1.mixedgc.TestLogging */ package gc.g1.mixedgc; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Asserts; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java b/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java index 77f43d254a8..09d32865664 100644 --- a/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java +++ b/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java @@ -26,11 +26,9 @@ * @bug 8148376 * @summary Checks PLAB statistics on evacuation failure * @requires vm.gc.G1 - * @library /testlibrary / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management - * @build gc.g1.plab.lib.LogParser - * gc.g1.plab.lib.AppPLABEvacuationFailure * @run main gc.g1.plab.TestPLABEvacuationFailure */ package gc.g1.plab; @@ -43,8 +41,8 @@ import java.util.Collections; import java.util.regex.Pattern; import java.util.stream.Collectors; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import gc.g1.plab.lib.LogParser; diff --git a/hotspot/test/gc/g1/plab/TestPLABPromotion.java b/hotspot/test/gc/g1/plab/TestPLABPromotion.java index 95177e8b876..926ee806252 100644 --- a/hotspot/test/gc/g1/plab/TestPLABPromotion.java +++ b/hotspot/test/gc/g1/plab/TestPLABPromotion.java @@ -27,14 +27,10 @@ * @summary Test PLAB promotion * @requires vm.gc.G1 * @requires !vm.flightRecorder - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management - * @build ClassFileInstaller - * sun.hotspot.WhiteBox - * gc.g1.plab.lib.MemoryConsumer - * gc.g1.plab.lib.LogParser - * gc.g1.plab.lib.AppPLABPromotion + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/timeout=240 gc.g1.plab.TestPLABPromotion @@ -50,8 +46,8 @@ import gc.g1.plab.lib.LogParser; import gc.g1.plab.lib.PLABUtils; import gc.g1.plab.lib.PlabInfo; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; /** * Test checks PLAB promotion of different size objects. diff --git a/hotspot/test/gc/g1/plab/TestPLABResize.java b/hotspot/test/gc/g1/plab/TestPLABResize.java index 7b45914c1b9..9a4cfdbd2c4 100644 --- a/hotspot/test/gc/g1/plab/TestPLABResize.java +++ b/hotspot/test/gc/g1/plab/TestPLABResize.java @@ -27,15 +27,10 @@ * @summary Test for PLAB resizing * @requires vm.gc.G1 * @requires !vm.flightRecorder - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * @modules java.management - * @build ClassFileInstaller - * sun.hotspot.WhiteBox - * gc.g1.plab.lib.LogParser - * gc.g1.plab.lib.MemoryConsumer - * gc.g1.plab.lib.PLABUtils - * gc.g1.plab.lib.AppPLABResize + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main gc.g1.plab.TestPLABResize @@ -52,8 +47,8 @@ import gc.g1.plab.lib.PLABUtils; import gc.g1.plab.lib.AppPLABResize; import gc.g1.plab.lib.PlabReport; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; /** * Test for PLAB resizing. diff --git a/hotspot/test/gc/g1/plab/lib/PLABUtils.java b/hotspot/test/gc/g1/plab/lib/PLABUtils.java index 096441c14cb..0ae28ab9d55 100644 --- a/hotspot/test/gc/g1/plab/lib/PLABUtils.java +++ b/hotspot/test/gc/g1/plab/lib/PLABUtils.java @@ -26,7 +26,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; /** diff --git a/hotspot/test/gc/logging/TestDeprecatedPrintFlags.java b/hotspot/test/gc/logging/TestDeprecatedPrintFlags.java index fe2a8d71041..09ed8a0661c 100644 --- a/hotspot/test/gc/logging/TestDeprecatedPrintFlags.java +++ b/hotspot/test/gc/logging/TestDeprecatedPrintFlags.java @@ -26,12 +26,13 @@ * @bug 8145180 * @summary Verify PrintGC, PrintGCDetails and -Xloggc * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; diff --git a/hotspot/test/gc/logging/TestGCId.java b/hotspot/test/gc/logging/TestGCId.java index 1f89a33a0df..c2b134e1a3d 100644 --- a/hotspot/test/gc/logging/TestGCId.java +++ b/hotspot/test/gc/logging/TestGCId.java @@ -27,13 +27,13 @@ * @summary Ensure that the GCId is logged * @requires vm.gc=="null" * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestGCId { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/logging/TestPrintReferences.java b/hotspot/test/gc/logging/TestPrintReferences.java index 8181e0ca3aa..193263493be 100644 --- a/hotspot/test/gc/logging/TestPrintReferences.java +++ b/hotspot/test/gc/logging/TestPrintReferences.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,13 +26,13 @@ * @bug 8136991 * @summary Validate the reference processing logging * @key gc - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestPrintReferences { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java index 37fd5b251db..4c7838ec277 100644 --- a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java +++ b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java @@ -44,7 +44,7 @@ import java.util.Random; * @key gc * @key stress * @requires !vm.flightRecorder - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.management java.base/jdk.internal.misc * * @run main/othervm -Xmx256M -Xms256M diff --git a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java index ebe90eebae0..ea9ae05eb12 100644 --- a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java +++ b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java @@ -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,13 +25,16 @@ * @test CompressedClassSpaceSizeInJmapHeap * @bug 8004924 * @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:CompressedClassSpaceSize=50m CompressedClassSpaceSizeInJmapHeap */ -import jdk.test.lib.*; +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.nio.file.*; import java.io.File; import java.nio.charset.Charset; diff --git a/hotspot/test/testlibrary/jdk/test/lib/InputArguments.java b/hotspot/test/gc/metaspace/InputArguments.java similarity index 96% rename from hotspot/test/testlibrary/jdk/test/lib/InputArguments.java rename to hotspot/test/gc/metaspace/InputArguments.java index 7963b0a7037..35edb815bd8 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/InputArguments.java +++ b/hotspot/test/gc/metaspace/InputArguments.java @@ -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 @@ -21,8 +21,6 @@ * questions. */ -package jdk.test.lib; - import java.lang.management.RuntimeMXBean; import java.lang.management.ManagementFactory; import java.util.List; diff --git a/hotspot/test/gc/metaspace/PerfCounters.java b/hotspot/test/gc/metaspace/PerfCounters.java index 9dce3bd4e70..c1242b1bee5 100644 --- a/hotspot/test/gc/metaspace/PerfCounters.java +++ b/hotspot/test/gc/metaspace/PerfCounters.java @@ -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 @@ -26,7 +26,7 @@ import sun.jvmstat.monitor.MonitorException; import sun.jvmstat.monitor.MonitoredHost; import sun.jvmstat.monitor.MonitoredVm; import sun.jvmstat.monitor.VmIdentifier; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; /** * PerfCounters can be used to get a performance counter from the currently diff --git a/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java b/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java index 827aff5946e..0b748a25296 100644 --- a/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java +++ b/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java @@ -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 @@ -25,10 +25,10 @@ * @test * @key gc * @bug 8049831 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestCapacityUntilGCWrapAround + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestCapacityUntilGCWrapAround diff --git a/hotspot/test/gc/metaspace/TestMetaspaceCMSCancel.java b/hotspot/test/gc/metaspace/TestMetaspaceCMSCancel.java index 42357ff03dd..62e8fdfc509 100644 --- a/hotspot/test/gc/metaspace/TestMetaspaceCMSCancel.java +++ b/hotspot/test/gc/metaspace/TestMetaspaceCMSCancel.java @@ -28,9 +28,9 @@ import sun.hotspot.WhiteBox; /* @test TestMetaspaceCMSCancel * @bug 8026752 * @summary Tests cancel of CMS concurrent cycle for Metaspace after a full GC - * @library /testlibrary /test/lib /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc - * @build TestMetaspaceCMSCancel + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm TestMetaspaceCMSCancel */ diff --git a/hotspot/test/gc/metaspace/TestMetaspaceInitialization.java b/hotspot/test/gc/metaspace/TestMetaspaceInitialization.java index f6ac4141e81..418ea3c0940 100644 --- a/hotspot/test/gc/metaspace/TestMetaspaceInitialization.java +++ b/hotspot/test/gc/metaspace/TestMetaspaceInitialization.java @@ -27,7 +27,6 @@ import java.util.ArrayList; * @bug 8024945 * @summary Tests to initialize metaspace with a very low MetaspaceSize * @modules java.base/jdk.internal.misc - * @library /testlibrary * @run main/othervm -XX:MetaspaceSize=0 TestMetaspaceInitialization */ public class TestMetaspaceInitialization { diff --git a/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java b/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java index 64066ee2b62..370537992f6 100644 --- a/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java +++ b/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java @@ -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,14 +23,16 @@ import java.util.List; import java.lang.management.*; -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import static jdk.test.lib.Asserts.*; /* @test TestMetaspaceMemoryPool * @bug 8000754 * @summary Tests that a MemoryPoolMXBeans is created for metaspace and that a * MemoryManagerMXBean is created. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops TestMetaspaceMemoryPool diff --git a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java index f76d457a004..9db2d02193b 100644 --- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java +++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java @@ -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 @@ -21,21 +21,27 @@ * questions. */ +import java.lang.management.GarbageCollectorMXBean; import java.util.List; import java.util.ArrayList; -import jdk.test.lib.*; +import jdk.test.lib.ByteCodeLoader; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.Platform; + +import sun.management.ManagementFactoryHelper; + import static jdk.test.lib.Asserts.*; /* @test TestMetaspacePerfCounters * @bug 8014659 * @requires vm.gc=="null" - * @library /testlibrary + * @library /test/lib * @summary Tests that performance counters for metaspace and compressed class * space exists and works. * @modules java.base/jdk.internal.misc * java.compiler - * java.management + * java.management/sun.management * jdk.jvmstat/sun.jvmstat.monitor * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseSerialGC TestMetaspacePerfCounters * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseParallelGC -XX:+UseParallelOldGC TestMetaspacePerfCounters @@ -48,6 +54,7 @@ import static jdk.test.lib.Asserts.*; public class TestMetaspacePerfCounters { public static Class fooClass = null; private static final String[] counterNames = {"minCapacity", "maxCapacity", "capacity", "used"}; + private static final List gcBeans = ManagementFactoryHelper.getGarbageCollectorMXBeans(); public static void main(String[] args) throws Exception { String metaspace = "sun.gc.metaspace"; @@ -65,10 +72,27 @@ public class TestMetaspacePerfCounters { } private static void checkPerfCounters(String ns) throws Exception { - long minCapacity = getMinCapacity(ns); - long maxCapacity = getMaxCapacity(ns); - long capacity = getCapacity(ns); - long used = getUsed(ns); + long gcCountBefore; + long gcCountAfter; + long minCapacity; + long maxCapacity; + long capacity; + long used; + + // The perf counter values are updated during GC and to be able to + // do the assertions below we need to ensure that the values are from + // the same GC cycle. + do { + gcCountBefore = currentGCCount(); + + minCapacity = getMinCapacity(ns); + maxCapacity = getMaxCapacity(ns); + capacity = getCapacity(ns); + used = getUsed(ns); + + gcCountAfter = currentGCCount(); + assertGTE(gcCountAfter, gcCountBefore); + } while(gcCountAfter > gcCountBefore); assertGTE(minCapacity, 0L); assertGTE(used, minCapacity); @@ -127,4 +151,12 @@ public class TestMetaspacePerfCounters { private static long getUsed(String ns) throws Exception { return PerfCounters.findByName(ns + ".used").longValue(); } + + private static long currentGCCount() { + long gcCount = 0; + for (GarbageCollectorMXBean bean : gcBeans) { + gcCount += bean.getCollectionCount(); + } + return gcCount; + } } diff --git a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java index 639694c4547..b5ed60b50fb 100644 --- a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java +++ b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java @@ -22,15 +22,15 @@ */ import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; /* * @test TestMetaspaceSizeFlags * @key gc * @bug 8024650 * @summary Test that metaspace size flags can be set correctly - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ diff --git a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java index d42e51afdd8..cfdc4ff6cfd 100644 --- a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java +++ b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java @@ -24,12 +24,12 @@ import java.util.List; import java.lang.management.*; -import jdk.test.lib.*; +import jdk.test.lib.Platform; import static jdk.test.lib.Asserts.*; /* @test TestPerfCountersAndMemoryPools * @bug 8023476 - * @library /testlibrary + * @library /test/lib * @requires vm.gc.Serial * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace * report the same data. diff --git a/hotspot/test/gc/parallel/AdaptiveGCBoundary.java b/hotspot/test/gc/parallel/AdaptiveGCBoundary.java index 91ad282f1ea..23215afd679 100644 --- a/hotspot/test/gc/parallel/AdaptiveGCBoundary.java +++ b/hotspot/test/gc/parallel/AdaptiveGCBoundary.java @@ -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 @@ -27,14 +27,15 @@ * @bug 8014546 * @key gc * @key regression - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm AdaptiveGCBoundary * @author jon.masamitsu@oracle.com */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class AdaptiveGCBoundary { public static void main(String args[]) throws Exception { diff --git a/hotspot/test/gc/parallel/TestDynShrinkHeap.java b/hotspot/test/gc/parallel/TestDynShrinkHeap.java index 06534328c7c..4b6e7d21d24 100644 --- a/hotspot/test/gc/parallel/TestDynShrinkHeap.java +++ b/hotspot/test/gc/parallel/TestDynShrinkHeap.java @@ -28,7 +28,7 @@ * @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 - * @library /testlibrary + * @library /test/lib * @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Xmx1g -verbose:gc TestDynShrinkHeap */ import jdk.test.lib.DynamicVMOption; diff --git a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java index e25e0cebc6b..1069b417d47 100644 --- a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java +++ b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java @@ -28,7 +28,6 @@ * @key gc * @requires vm.gc.Parallel * @modules java.base/jdk.internal.misc - * @library /testlibrary * @run main/othervm -Xmx50m -XX:+UseParallelGC -Xlog:gc*=trace TestPrintGCDetailsVerbose */ public class TestPrintGCDetailsVerbose { diff --git a/hotspot/test/gc/serial/HeapChangeLogging.java b/hotspot/test/gc/serial/HeapChangeLogging.java index f3d0c0180a3..a8ef6f64464 100644 --- a/hotspot/test/gc/serial/HeapChangeLogging.java +++ b/hotspot/test/gc/serial/HeapChangeLogging.java @@ -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 @@ -24,10 +24,9 @@ /* * @test HeapChangeLogging.java * @bug 8027440 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build HeapChangeLogging * @summary Allocate to get a promotion failure and verify that that heap change logging is present. * @run main HeapChangeLogging */ @@ -35,7 +34,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class HeapChangeLogging { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/startup_warnings/TestCMS.java b/hotspot/test/gc/startup_warnings/TestCMS.java index 23e0c85e4d4..6ea63dabcaf 100644 --- a/hotspot/test/gc/startup_warnings/TestCMS.java +++ b/hotspot/test/gc/startup_warnings/TestCMS.java @@ -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 @@ -26,13 +26,13 @@ * @key gc * @bug 8006398 * @summary Test that CMS does not print a warning message -* @library /testlibrary +* @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestCMS { diff --git a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java index 1821464ce2f..f6aaacec0bf 100644 --- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java +++ b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java @@ -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 @@ -26,13 +26,13 @@ * @key gc * @bug 8065972 * @summary Test that the unsupported DefNew+CMS combination does not start -* @library /testlibrary +* @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestDefNewCMS { diff --git a/hotspot/test/gc/startup_warnings/TestG1.java b/hotspot/test/gc/startup_warnings/TestG1.java index 68bd4796166..253a16c0274 100644 --- a/hotspot/test/gc/startup_warnings/TestG1.java +++ b/hotspot/test/gc/startup_warnings/TestG1.java @@ -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 @@ -26,13 +26,13 @@ * @key gc * @bug 8006398 * @summary Test that the G1 collector does not print a warning message -* @library /testlibrary +* @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestG1 { diff --git a/hotspot/test/gc/startup_warnings/TestParNewCMS.java b/hotspot/test/gc/startup_warnings/TestParNewCMS.java index 7a332d985b0..82830abdc8d 100644 --- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java +++ b/hotspot/test/gc/startup_warnings/TestParNewCMS.java @@ -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 @@ -26,13 +26,13 @@ * @key gc * @bug 8065972 * @summary Test that specifying -XX:+UseParNewGC on the command line logs a warning message -* @library /testlibrary +* @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestParNewCMS { diff --git a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java index 18455c7f9ea..30843bf389a 100644 --- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java +++ b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java @@ -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 @@ -26,13 +26,13 @@ * @key gc * @bug 8065972 * @summary Test that the unsupported ParNew+SerialOld combination does not start -* @library /testlibrary +* @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestParNewSerialOld { diff --git a/hotspot/test/gc/startup_warnings/TestParallelGC.java b/hotspot/test/gc/startup_warnings/TestParallelGC.java index 6af5f762ddc..0a31ca9d1c1 100644 --- a/hotspot/test/gc/startup_warnings/TestParallelGC.java +++ b/hotspot/test/gc/startup_warnings/TestParallelGC.java @@ -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 @@ -26,13 +26,13 @@ * @key gc * @bug 8006398 * @summary Test that ParallelGC does not print a warning message -* @library /testlibrary +* @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestParallelGC { diff --git a/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java b/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java index e748b0ef7e1..9e404d1c36f 100644 --- a/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java +++ b/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java @@ -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 @@ -26,13 +26,13 @@ * @key gc * @bug 8006398 * @summary Test that the ParallelScavenge+SerialOld combination does not print a warning message -* @library /testlibrary +* @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestParallelScavengeSerialOld { diff --git a/hotspot/test/gc/startup_warnings/TestSerialGC.java b/hotspot/test/gc/startup_warnings/TestSerialGC.java index 2010980699a..35f69813c42 100644 --- a/hotspot/test/gc/startup_warnings/TestSerialGC.java +++ b/hotspot/test/gc/startup_warnings/TestSerialGC.java @@ -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 @@ -26,13 +26,13 @@ * @key gc * @bug 8006398 * @summary Test that SerialGC does not print a warning message -* @library /testlibrary +* @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestSerialGC { diff --git a/hotspot/test/gc/stress/TestMultiThreadStressRSet.java b/hotspot/test/gc/stress/TestMultiThreadStressRSet.java index dcfdb6c29e8..048762c6455 100644 --- a/hotspot/test/gc/stress/TestMultiThreadStressRSet.java +++ b/hotspot/test/gc/stress/TestMultiThreadStressRSet.java @@ -37,7 +37,7 @@ import sun.hotspot.WhiteBox; * * @summary Stress G1 Remembered Set using multiple threads * @modules java.base/jdk.internal.misc - * @library /test/lib /testlibrary + * @library /test/lib * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/stress/TestStressRSetCoarsening.java b/hotspot/test/gc/stress/TestStressRSetCoarsening.java index bb621bb28ff..36f775f59ee 100644 --- a/hotspot/test/gc/stress/TestStressRSetCoarsening.java +++ b/hotspot/test/gc/stress/TestStressRSetCoarsening.java @@ -34,7 +34,7 @@ import sun.hotspot.WhiteBox; * * @summary Stress G1 Remembered Set by creating a lot of cross region links * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java index 4ba5ae2c749..a6b1e2e2444 100644 --- a/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java +++ b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java @@ -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,10 +26,10 @@ * @bug 8031323 * @summary Verify that object's alignment in eden space is not affected by * SurvivorAlignmentInBytes option. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestAllocationInEden SurvivorAlignmentTestMain AlignmentHelper + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java index 92dcacd488c..44eddf9f603 100644 --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java @@ -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,11 +26,10 @@ * @bug 8031323 * @summary Verify that objects promoted from eden space to tenured space during * full GC are not aligned to SurvivorAlignmentInBytes value. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestPromotionFromEdenToTenured SurvivorAlignmentTestMain - * AlignmentHelper + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java index 0fec465cade..5596294e387 100644 --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java @@ -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,11 +26,10 @@ * @bug 8031323 * @summary Verify that objects promoted from survivor space to tenured space * during full GC are not aligned to SurvivorAlignmentInBytes value. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestPromotionFromSurvivorToTenuredAfterFullGC - * SurvivorAlignmentTestMain AlignmentHelper + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java index 488207d18e3..45c22827eda 100644 --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java @@ -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 @@ -27,11 +27,10 @@ * @summary Verify that objects promoted from survivor space to tenured space * when their age exceeded tenuring threshold are not aligned to * SurvivorAlignmentInBytes value. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestPromotionFromSurvivorToTenuredAfterMinorGC - * SurvivorAlignmentTestMain AlignmentHelper + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java index f5b2dc293f8..5c6dd81cafb 100644 --- a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java +++ b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java @@ -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,11 +26,10 @@ * @bug 8031323 * @summary Verify that objects promoted from eden space to survivor space after * minor GC are aligned to SurvivorAlignmentInBytes. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestPromotionToSurvivor - * SurvivorAlignmentTestMain AlignmentHelper + * @build sun.hotspot.WhiteBox * @ignore 8129886 * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/testlibrary/Helpers.java b/hotspot/test/gc/testlibrary/Helpers.java index b28d92dd406..e97d4a03ea9 100644 --- a/hotspot/test/gc/testlibrary/Helpers.java +++ b/hotspot/test/gc/testlibrary/Helpers.java @@ -25,7 +25,7 @@ package gc.testlibrary; import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.WhiteBox; import java.io.File; diff --git a/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java index ea3b30af1b6..c1d4b959327 100644 --- a/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java +++ b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java @@ -25,12 +25,12 @@ * @test TestConMarkCycleWB * @bug 8065579 * @requires vm.gc.G1 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build ClassFileInstaller jdk.test.lib.* sun.hotspot.WhiteBox TestConcMarkCycleWB + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC TestConcMarkCycleWB diff --git a/hotspot/test/gc/whitebox/TestWBGC.java b/hotspot/test/gc/whitebox/TestWBGC.java index 56eae949b63..acc75c9f921 100644 --- a/hotspot/test/gc/whitebox/TestWBGC.java +++ b/hotspot/test/gc/whitebox/TestWBGC.java @@ -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 @@ -25,14 +25,16 @@ * @test TestWBGC * @bug 8055098 * @summary Test verify that WB methods isObjectInOldGen and youngGC works correctly. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestWBGC + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver TestWBGC */ -import jdk.test.lib.*; +import jdk.test.lib.Asserts; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.WhiteBox; public class TestWBGC { diff --git a/hotspot/test/native/GTestWrapper.java b/hotspot/test/native/GTestWrapper.java index cedf63e4aa4..da90f816855 100644 --- a/hotspot/test/native/GTestWrapper.java +++ b/hotspot/test/native/GTestWrapper.java @@ -24,7 +24,7 @@ /* @test * @summary a jtreg wrapper for gtest tests - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * @run main/native GTestWrapper */ diff --git a/hotspot/test/native/logging/logTestFixture.cpp b/hotspot/test/native/logging/logTestFixture.cpp new file mode 100644 index 00000000000..d22a6f74d92 --- /dev/null +++ b/hotspot/test/native/logging/logTestFixture.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ +#include "precompiled.hpp" +#include "logTestFixture.hpp" +#include "logTestUtils.inline.hpp" +#include "logging/logConfiguration.hpp" +#include "memory/resourceArea.hpp" +#include "unittest.hpp" +#include "utilities/ostream.hpp" + +LogTestFixture::LogTestFixture() { + // Set up TestLogFileName to include PID, testcase name and test name + int ret = jio_snprintf(_filename, sizeof(_filename), "testlog.pid%d.%s.%s.log", + os::current_process_id(), + ::testing::UnitTest::GetInstance()->current_test_info()->test_case_name(), + ::testing::UnitTest::GetInstance()->current_test_info()->name()); + EXPECT_GT(ret, 0) << "_filename buffer issue"; + TestLogFileName = _filename; +} + +LogTestFixture::~LogTestFixture() { + restore_default_log_config(); + delete_file(TestLogFileName); +} + +bool LogTestFixture::set_log_config(const char* output, + const char* what, + const char* decorators, + const char* options, + bool allow_failure) { + ResourceMark rm; + stringStream stream; + bool success = LogConfiguration::parse_log_arguments(output, what, decorators, options, &stream); + if (!allow_failure) { + const char* errmsg = stream.as_string(); + EXPECT_STREQ("", errmsg) << "Unexpected error reported"; + EXPECT_TRUE(success) << "Shouldn't cause errors"; + } + return success; +} + +void LogTestFixture::restore_default_log_config() { + LogConfiguration::disable_logging(); + set_log_config("stdout", "all=warning"); +} diff --git a/hotspot/test/native/logging/logTestFixture.hpp b/hotspot/test/native/logging/logTestFixture.hpp new file mode 100644 index 00000000000..d9c1c8b02df --- /dev/null +++ b/hotspot/test/native/logging/logTestFixture.hpp @@ -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. + * + */ +#include "unittest.hpp" +#include "utilities/globalDefinitions.hpp" + +// A fixture base class for tests that need to change the log configuration, +// or use a log file. After each test, the fixture will automatically restore +// the log configuration and remove the test file (if used). +// Provides TestLogFileName which is unique for each test, and is automatically +// deleted after the test completes. +class LogTestFixture : public testing::Test { + private: + char _filename[2 * K]; + + protected: + const char* TestLogFileName; + + LogTestFixture(); + ~LogTestFixture(); + + static bool set_log_config(const char* output, + const char* what, + const char* decorators = "", + const char* options = "", + bool allow_failure = false); + + static void restore_default_log_config(); +}; + diff --git a/hotspot/test/native/logging/logTestUtils.inline.hpp b/hotspot/test/native/logging/logTestUtils.inline.hpp new file mode 100644 index 00000000000..bf39dfdbd9e --- /dev/null +++ b/hotspot/test/native/logging/logTestUtils.inline.hpp @@ -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. + * + */ +#include "runtime/os.hpp" +#include "unittest.hpp" + +#define LOG_TEST_STRING_LITERAL "a (hopefully) unique log message for testing" + +static inline bool string_contains_substring(const char* haystack, const char* needle) { + return strstr(haystack, needle) != NULL; +} + +static inline bool file_exists(const char* filename) { + struct stat st; + return os::stat(filename, &st) == 0; +} + +static inline void delete_file(const char* filename) { + if (!file_exists(filename)) { + return; + } + int ret = remove(filename); + EXPECT_TRUE(ret == 0 || errno == ENOENT) << "failed to remove file '" << filename << "': " + << os::strerror(errno) << " (" << errno << ")"; +} diff --git a/hotspot/test/native/logging/test_logConfiguration.cpp b/hotspot/test/native/logging/test_logConfiguration.cpp new file mode 100644 index 00000000000..528111ef31b --- /dev/null +++ b/hotspot/test/native/logging/test_logConfiguration.cpp @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ +#include "precompiled.hpp" +#include "logTestFixture.hpp" +#include "logTestUtils.inline.hpp" +#include "logging/logConfiguration.hpp" +#include "logging/logLevel.hpp" +#include "logging/logOutput.hpp" +#include "logging/logTag.hpp" +#include "logging/logTagSet.hpp" +#include "memory/resourceArea.hpp" +#include "unittest.hpp" +#include "utilities/ostream.hpp" + +class LogConfigurationTest : public LogTestFixture { + protected: + static char _all_decorators[256]; + + public: + static void SetUpTestCase(); +}; + +char LogConfigurationTest::_all_decorators[256]; + +// Prepare _all_decorators to contain the full list of decorators (comma separated) +void LogConfigurationTest::SetUpTestCase() { + char *pos = _all_decorators; + for (size_t i = 0; i < LogDecorators::Count; i++) { + pos += jio_snprintf(pos, sizeof(_all_decorators) - (pos - _all_decorators), "%s%s", + (i == 0 ? "" : ","), + LogDecorators::name(static_cast(i))); + } +} + +// Check if the given text is included by LogConfiguration::describe() +static bool is_described(const char* text) { + ResourceMark rm; + stringStream ss; + LogConfiguration::describe(&ss); + return string_contains_substring(ss.as_string(), text); +} + +TEST_F(LogConfigurationTest, describe) { + ResourceMark rm; + stringStream ss; + LogConfiguration::describe(&ss); + const char* description = ss.as_string(); + + // Verify that stdout and stderr are listed by default + EXPECT_PRED2(string_contains_substring, description, LogOutput::Stdout->name()); + EXPECT_PRED2(string_contains_substring, description, LogOutput::Stderr->name()); + + // Verify that each tag, level and decorator is listed + for (size_t i = 0; i < LogTag::Count; i++) { + EXPECT_PRED2(string_contains_substring, description, LogTag::name(static_cast(i))); + } + for (size_t i = 0; i < LogLevel::Count; i++) { + EXPECT_PRED2(string_contains_substring, description, LogLevel::name(static_cast(i))); + } + for (size_t i = 0; i < LogDecorators::Count; i++) { + EXPECT_PRED2(string_contains_substring, description, LogDecorators::name(static_cast(i))); + } + + // Verify that the default configuration is printed + char expected_buf[256]; + int ret = jio_snprintf(expected_buf, sizeof(expected_buf), "=%s", LogLevel::name(LogLevel::Default)); + ASSERT_NE(-1, ret); + EXPECT_PRED2(string_contains_substring, description, expected_buf); + EXPECT_PRED2(string_contains_substring, description, "#1: stderr all=off"); + + // Verify default decorators are listed + LogDecorators default_decorators; + expected_buf[0] = '\0'; + for (size_t i = 0; i < LogDecorators::Count; i++) { + LogDecorators::Decorator d = static_cast(i); + if (default_decorators.is_decorator(d)) { + ASSERT_LT(strlen(expected_buf), sizeof(expected_buf)); + ret = jio_snprintf(expected_buf + strlen(expected_buf), + sizeof(expected_buf) - strlen(expected_buf), + "%s%s", + strlen(expected_buf) > 0 ? "," : "", + LogDecorators::name(d)); + ASSERT_NE(-1, ret); + } + } + EXPECT_PRED2(string_contains_substring, description, expected_buf); + + // Add a new output and verify that it gets described after it has been added + const char* what = "all=trace"; + EXPECT_FALSE(is_described(TestLogFileName)) << "Test output already exists!"; + set_log_config(TestLogFileName, what); + EXPECT_TRUE(is_described(TestLogFileName)); + EXPECT_TRUE(is_described("logging=trace")); +} + +// Test updating an existing log output +TEST_F(LogConfigurationTest, update_output) { + // Update stdout twice, first using it's name, and the second time its index # + const char* test_outputs[] = { "stdout", "#0" }; + for (size_t i = 0; i < ARRAY_SIZE(test_outputs); i++) { + set_log_config(test_outputs[i], "all=info"); + + // Verify configuration using LogConfiguration::describe + EXPECT_TRUE(is_described("#0: stdout")); + EXPECT_TRUE(is_described("logging=info")); + + // Verify by iterating over tagsets + LogOutput* o = LogOutput::Stdout; + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_TRUE(ts->has_output(o)); + EXPECT_TRUE(ts->is_level(LogLevel::Info)); + EXPECT_FALSE(ts->is_level(LogLevel::Debug)); + } + + // Now change the level and verify the change propagated + set_log_config(test_outputs[i], "all=debug"); + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_TRUE(ts->has_output(o)); + EXPECT_TRUE(ts->is_level(LogLevel::Debug)); + EXPECT_FALSE(ts->is_level(LogLevel::Trace)); + } + } +} + +// Test adding a new output to the configuration +TEST_F(LogConfigurationTest, add_new_output) { + const char* what = "all=trace"; + + ASSERT_FALSE(is_described(TestLogFileName)); + set_log_config(TestLogFileName, what); + + // Verify new output using LogConfiguration::describe + EXPECT_TRUE(is_described(TestLogFileName)); + EXPECT_TRUE(is_described("logging=trace")); + + // Also verify by iterating over tagsets, checking levels on tagsets + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_TRUE(ts->is_level(LogLevel::Trace)); + } +} + +TEST_F(LogConfigurationTest, disable_logging) { + // Add TestLogFileName as an output + set_log_config(TestLogFileName, "logging=info"); + + LogConfiguration::disable_logging(); + + // Verify TestLogFileName was disabled + EXPECT_FALSE(is_described(TestLogFileName)); + + // Verify that no tagset has logging enabled + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_FALSE(ts->has_output(LogOutput::Stdout)); + EXPECT_FALSE(ts->has_output(LogOutput::Stderr)); + EXPECT_FALSE(ts->is_level(LogLevel::Error)); + } +} + +// Test disabling a particular output +TEST_F(LogConfigurationTest, disable_output) { + // Disable the default configuration for stdout + set_log_config("stdout", "all=off"); + + // Verify configuration using LogConfiguration::describe + EXPECT_TRUE(is_described("#0: stdout all=off")); + + // Verify by iterating over tagsets + LogOutput* o = LogOutput::Stdout; + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_FALSE(ts->has_output(o)); + EXPECT_FALSE(ts->is_level(LogLevel::Error)); + } + + // Add a new file output + const char* what = "all=debug"; + set_log_config(TestLogFileName, what); + EXPECT_TRUE(is_described(TestLogFileName)); + + // Now disable it, verifying it is removed completely + set_log_config(TestLogFileName, "all=off"); + EXPECT_FALSE(is_described(TestLogFileName)); + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_FALSE(ts->is_level(LogLevel::Error)); + } +} + +// Test reconfiguration of the selected decorators for an output +TEST_F(LogConfigurationTest, reconfigure_decorators) { + // Configure stderr with all decorators + set_log_config("stderr", "all=off", _all_decorators); + char buf[256]; + int ret = jio_snprintf(buf, sizeof(buf), "#1: stderr all=off %s", _all_decorators); + ASSERT_NE(-1, ret); + EXPECT_TRUE(is_described(buf)) << "'" << buf << "' not described after reconfiguration"; + + // Now reconfigure logging on stderr with no decorators + set_log_config("stderr", "all=off", "none"); + EXPECT_TRUE(is_described("#1: stderr all=off \n")) << "Expecting no decorators"; +} + +// Test that invalid options cause configuration errors +TEST_F(LogConfigurationTest, invalid_configure_options) { + LogConfiguration::disable_logging(); + const char* invalid_outputs[] = { "#2", "invalidtype=123", ":invalid/path}to*file?" }; + for (size_t i = 0; i < ARRAY_SIZE(invalid_outputs); i++) { + EXPECT_FALSE(set_log_config(invalid_outputs[i], "", "", "", true)) + << "Accepted invalid output '" << invalid_outputs[i] << "'"; + } + EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("all=invalid_level")); + EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("what=invalid")); + EXPECT_FALSE(LogConfiguration::parse_command_line_arguments("all::invalid_decorator")); +} + +// Test empty configuration options +TEST_F(LogConfigurationTest, parse_empty_command_line_arguments) { + const char* empty_variations[] = { "", ":", "::", ":::", "::::" }; + for (size_t i = 0; i < ARRAY_SIZE(empty_variations); i++) { + const char* cmdline = empty_variations[i]; + bool ret = LogConfiguration::parse_command_line_arguments(cmdline); + EXPECT_TRUE(ret) << "Error parsing command line arguments '" << cmdline << "'"; + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_EQ(LogLevel::Unspecified, ts->level_for(LogOutput::Stdout)); + } + } +} + +// Test basic command line parsing & configuration +TEST_F(LogConfigurationTest, parse_command_line_arguments) { + // Prepare a command line for logging*=debug on stderr with all decorators + int ret; + char buf[256]; + ret = jio_snprintf(buf, sizeof(buf), "logging*=debug:stderr:%s", _all_decorators); + ASSERT_NE(-1, ret); + + bool success = LogConfiguration::parse_command_line_arguments(buf); + EXPECT_TRUE(success) << "Error parsing valid command line arguments '" << buf << "'"; + // Ensure the new configuration applied + EXPECT_TRUE(is_described("logging=debug")); + EXPECT_TRUE(is_described(_all_decorators)); + + // Test the configuration of file outputs as well + ret = jio_snprintf(buf, sizeof(buf), ":%s", TestLogFileName); + ASSERT_NE(-1, ret); + EXPECT_TRUE(LogConfiguration::parse_command_line_arguments(buf)); +} + +// Test split up log configuration arguments +TEST_F(LogConfigurationTest, parse_log_arguments) { + ResourceMark rm; + stringStream ss; + // Verify that it's possible to configure each individual tag + for (size_t t = 1 /* Skip _NO_TAG */; t < LogTag::Count; t++) { + const LogTagType tag = static_cast(t); + EXPECT_TRUE(LogConfiguration::parse_log_arguments("stdout", LogTag::name(tag), "", "", &ss)); + } + // Same for each level + for (size_t l = 0; l < LogLevel::Count; l++) { + const LogLevelType level = static_cast(l); + char expected_buf[256]; + int ret = jio_snprintf(expected_buf, sizeof(expected_buf), "all=%s", LogLevel::name(level)); + ASSERT_NE(-1, ret); + EXPECT_TRUE(LogConfiguration::parse_log_arguments("stderr", expected_buf, "", "", &ss)); + } + // And for each decorator + for (size_t d = 0; d < LogDecorators::Count; d++) { + const LogDecorators::Decorator decorator = static_cast(d); + EXPECT_TRUE(LogConfiguration::parse_log_arguments("#0", "", LogDecorators::name(decorator), "", &ss)); + } + EXPECT_STREQ("", ss.as_string()) << "Error reported while parsing: " << ss.as_string(); +} diff --git a/hotspot/test/native/logging/test_logDecorations.cpp b/hotspot/test/native/logging/test_logDecorations.cpp new file mode 100644 index 00000000000..324792b24b8 --- /dev/null +++ b/hotspot/test/native/logging/test_logDecorations.cpp @@ -0,0 +1,186 @@ +/* + * 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 "logging/logDecorations.hpp" +#include "logging/logTagSet.hpp" +#include "runtime/os.hpp" +#include "unittest.hpp" +#include "utilities/globalDefinitions.hpp" + +static const LogTagSet& tagset = LogTagSetMapping::tagset(); +static const LogDecorators default_decorators; + +TEST(LogDecorations, level) { + for (uint l = LogLevel::First; l <= LogLevel::Last; l++) { + LogLevelType level = static_cast(l); + // Create a decorations object for the current level + LogDecorations decorations(level, tagset, default_decorators); + // Verify that the level decoration matches the specified level + EXPECT_STREQ(LogLevel::name(level), decorations.decoration(LogDecorators::level_decorator)); + + // Test changing level after object creation time + LogLevelType other_level; + if (l != LogLevel::Last) { + other_level = static_cast(l + 1); + } else { + other_level = static_cast(LogLevel::First); + } + decorations.set_level(other_level); + EXPECT_STREQ(LogLevel::name(other_level), decorations.decoration(LogDecorators::level_decorator)) + << "Decoration reports incorrect value after changing the level"; + } +} + +TEST(LogDecorations, uptime) { + // Verify the format of the decoration + int a, b; + char decimal_point; + LogDecorations decorations(LogLevel::Info, tagset, default_decorators); + const char* uptime = decorations.decoration(LogDecorators::uptime_decorator); + int read = sscanf(uptime, "%d%c%ds", &a, &decimal_point, &b); + EXPECT_EQ(3, read) << "Invalid uptime decoration: " << uptime; + EXPECT_TRUE(decimal_point == '.' || decimal_point == ',') << "Invalid uptime decoration: " << uptime; + + // Verify that uptime increases + double prev = 0; + for (int i = 0; i < 3; i++) { + os::naked_short_sleep(10); + LogDecorations d(LogLevel::Info, tagset, default_decorators); + double cur = strtod(d.decoration(LogDecorators::uptime_decorator), NULL); + ASSERT_LT(prev, cur); + prev = cur; + } +} + +TEST(LogDecorations, tags) { + char expected_tags[1 * K]; + tagset.label(expected_tags, sizeof(expected_tags)); + // Verify that the expected tags are included in the tags decoration + LogDecorations decorations(LogLevel::Info, tagset, default_decorators); + EXPECT_STREQ(expected_tags, decorations.decoration(LogDecorators::tags_decorator)); +} + +// Test each variation of the different timestamp decorations (ms, ns, uptime ms, uptime ns) +TEST(LogDecorations, timestamps) { + struct { + const LogDecorators::Decorator decorator; + const char* suffix; + } test_decorator[] = { + { LogDecorators::timemillis_decorator, "ms" }, + { LogDecorators::uptimemillis_decorator, "ms" }, + { LogDecorators::timenanos_decorator, "ns" }, + { LogDecorators::uptimenanos_decorator, "ns" } + }; + + for (uint i = 0; i < ARRAY_SIZE(test_decorator); i++) { + LogDecorators::Decorator decorator = test_decorator[i].decorator; + LogDecorators decorator_selection; + ASSERT_TRUE(decorator_selection.parse(LogDecorators::name(decorator))); + + // Create decorations with the decorator we want to test included + LogDecorations decorations(LogLevel::Info, tagset, decorator_selection); + const char* decoration = decorations.decoration(decorator); + + // Verify format of timestamp + const char* suffix; + for (suffix = decoration; isdigit(*suffix); suffix++) { + // Skip over digits + } + EXPECT_STREQ(test_decorator[i].suffix, suffix); + + // Verify timestamp values + julong prev = 0; + for (int i = 0; i < 3; i++) { + os::naked_short_sleep(5); + LogDecorations d(LogLevel::Info, tagset, decorator_selection); + julong val = strtoull(d.decoration(decorator), NULL, 10); + ASSERT_LT(prev, val); + prev = val; + } + } +} + +// Test the time decoration +TEST(LogDecorations, iso8601_time) { + LogDecorators decorator_selection; + ASSERT_TRUE(decorator_selection.parse("time")); + LogDecorations decorations(LogLevel::Info, tagset, decorator_selection); + + const char *timestr = decorations.decoration(LogDecorators::time_decorator); + time_t expected_ts = time(NULL); + + // Verify format + int y, M, d, h, m; + double s; + int read = sscanf(timestr, "%d-%d-%dT%d:%d:%lfZ", &y, &M, &d, &h, &m, &s); + ASSERT_EQ(6, read); + + // Verify reported time & date + struct tm reported_time = {0}; + reported_time.tm_year = y - 1900; + reported_time.tm_mon = M - 1; + reported_time.tm_mday = d; + reported_time.tm_hour = h; + reported_time.tm_min = m; + reported_time.tm_sec = s; + reported_time.tm_isdst = daylight; + time_t reported_ts = mktime(&reported_time); + expected_ts = mktime(localtime(&expected_ts)); + time_t diff = reported_ts - expected_ts; + if (diff < 0) { + diff = -diff; + } + // Allow up to 10 seconds in difference + ASSERT_LE(diff, 10) << "Reported time: " << reported_ts << " (" << timestr << ")" + << ", expected time: " << expected_ts; +} + +// Test the pid and tid decorations +TEST(LogDecorations, identifiers) { + LogDecorators decorator_selection; + ASSERT_TRUE(decorator_selection.parse("pid,tid")); + LogDecorations decorations(LogLevel::Info, tagset, decorator_selection); + + struct { + intx expected; + LogDecorators::Decorator decorator; + } ids[] = { + { os::current_process_id(), LogDecorators::pid_decorator }, + { os::current_thread_id(), LogDecorators::tid_decorator }, + }; + + for (uint i = 0; i < ARRAY_SIZE(ids); i++) { + const char* reported = decorations.decoration(ids[i].decorator); + + // Verify format + const char* str; + for (str = reported; isdigit(*str); str++) { + // Skip over digits + } + EXPECT_EQ('\0', *str) << "Should only contain digits"; + + // Verify value + EXPECT_EQ(ids[i].expected, strtol(reported, NULL, 10)); + } +} diff --git a/hotspot/test/native/logging/test_logDecorators.cpp b/hotspot/test/native/logging/test_logDecorators.cpp new file mode 100644 index 00000000000..beaa925e320 --- /dev/null +++ b/hotspot/test/native/logging/test_logDecorators.cpp @@ -0,0 +1,216 @@ +/* + * 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 "logging/logDecorators.hpp" +#include "unittest.hpp" + +static LogDecorators::Decorator decorator_array[] = { +#define DECORATOR(name, abbr) LogDecorators::name##_decorator, + DECORATOR_LIST +#undef DECORATOR +}; + +static const char* decorator_name_array[] = { +#define DECORATOR(name, abbr) #name, + DECORATOR_LIST +#undef DECORATOR +}; + +static const char* decorator_abbr_array[] = { +#define DECORATOR(name, abbr) #abbr, + DECORATOR_LIST +#undef DECORATOR +}; + +// Assert that the given decorators object has the default decorators (uptime, level, tags) +// If exclusive = true, also assert that no other decorators are selected +static void assert_default_decorators(LogDecorators* decorators, bool exclusive = true) { + for (int i = 0; i < LogDecorators::Count; i++) { + LogDecorators::Decorator decorator = decorator_array[i]; + if (decorator == LogDecorators::uptime_decorator || + decorator == LogDecorators::level_decorator || + decorator == LogDecorators::tags_decorator) { + EXPECT_TRUE(decorators->is_decorator(decorator)); + } else if (exclusive) { + EXPECT_FALSE(decorators->is_decorator(decorator)); + } + } +} + +TEST(LogDecorators, defaults) { + LogDecorators decorators; + assert_default_decorators(&decorators); +} + +// Test converting between name and decorator (string and enum) +TEST(LogDecorators, from_and_to_name) { + EXPECT_EQ(LogDecorators::Invalid, LogDecorators::from_string("unknown")); + EXPECT_EQ(LogDecorators::Invalid, LogDecorators::from_string("")); + + for (int i = 0; i < LogDecorators::Count; i++) { + LogDecorators::Decorator decorator = decorator_array[i]; + + const char* name = LogDecorators::name(decorator); + EXPECT_STREQ(decorator_name_array[i], name); + + LogDecorators::Decorator decorator2 = LogDecorators::from_string(name); + EXPECT_EQ(decorator, decorator2); + + // Test case insensitivity + char* name_cpy = strdup(name); + name_cpy[0] = toupper(name_cpy[0]); + decorator2 = LogDecorators::from_string(name_cpy); + free(name_cpy); + EXPECT_EQ(decorator, decorator2); + } +} + +// Test decorator abbreviations +TEST(LogDecorators, from_and_to_abbr) { + for (int i = 0; i < LogDecorators::Count; i++) { + LogDecorators::Decorator decorator = decorator_array[i]; + + const char* abbr = LogDecorators::abbreviation(decorator); + EXPECT_STREQ(decorator_abbr_array[i], abbr); + + LogDecorators::Decorator decorator2 = LogDecorators::from_string(abbr); + ASSERT_EQ(decorator, decorator2); + + // Test case insensitivity + char* abbr_cpy = strdup(abbr); + abbr_cpy[0] = toupper(abbr_cpy[0]); + decorator2 = LogDecorators::from_string(abbr_cpy); + free(abbr_cpy); + EXPECT_EQ(decorator, decorator2); + } +} + +TEST(LogDecorators, parse_default) { + LogDecorators decorators; + decorators.parse(""); // Empty string means we should use the default decorators + assert_default_decorators(&decorators); +} + +// Test that "none" gives no decorators at all +TEST(LogDecorators, parse_none) { + LogDecorators decorators; + decorators.parse("none"); + for (int i = 0; i < LogDecorators::Count; i++) { + EXPECT_FALSE(decorators.is_decorator(decorator_array[i])); + } +} + +// Test a few invalid decorator selections +TEST(LogDecorators, parse_invalid) { + LogDecorators decorators; + EXPECT_FALSE(decorators.parse("invalid")); + EXPECT_FALSE(decorators.parse(",invalid")); + EXPECT_FALSE(decorators.parse(",invalid,")); + assert_default_decorators(&decorators); +} + +// Assert that the given decorator has all decorators between first and last +static void assert_decorations_between(const LogDecorators* decorator, size_t first, size_t last) { + for (size_t i = 0; i < ARRAY_SIZE(decorator_array); i++) { + if (i >= first && i <= last) { + EXPECT_TRUE(decorator->is_decorator(decorator_array[i])); + } else { + EXPECT_FALSE(decorator->is_decorator(decorator_array[i])); + } + } +} + +TEST(LogDecorators, parse) { + LogDecorators decorators; + + // Verify a bunch of different decorator selections + char decstr[1 * K]; + decstr[0] = '\0'; + size_t written = 0; + for (size_t i = 0; i < ARRAY_SIZE(decorator_array); i++) { + for (size_t j = i; j < ARRAY_SIZE(decorator_array); j++) { + for (size_t k = i; k <= j; k++) { + ASSERT_LT(written, sizeof(decstr)) << "decstr overflow"; + int ret = jio_snprintf(decstr + written, sizeof(decstr) - written, "%s%s", + written == 0 ? "" : ",", + ((k + j) % 2 == 0) ? decorator_name_array[k] : decorator_abbr_array[k]); + ASSERT_NE(-1, ret); + written += ret; + } + EXPECT_TRUE(decorators.parse(decstr)) << "Valid decorator selection did not parse: " << decstr; + assert_decorations_between(&decorators, i, j); + written = 0; + decstr[0] = '\0'; + } + } +} + +TEST(LogDecorators, combine_with) { + LogDecorators dec1; + LogDecorators dec2; + + // Select first and third decorator for dec1 + char input[64]; + sprintf(input, "%s,%s", decorator_name_array[0], decorator_name_array[2]); + dec1.parse(input); + EXPECT_TRUE(dec1.is_decorator(decorator_array[0])); + EXPECT_TRUE(dec1.is_decorator(decorator_array[2])); + + // Select the default decorators for dec2 + EXPECT_FALSE(dec2.is_decorator(decorator_array[0])); + EXPECT_FALSE(dec2.is_decorator(decorator_array[2])); + assert_default_decorators(&dec2); + + // Combine and verify that the combination includes first, third and default decorators + dec2.combine_with(dec1); + EXPECT_TRUE(dec2.is_decorator(decorator_array[0])); + EXPECT_TRUE(dec2.is_decorator(decorator_array[2])); + assert_default_decorators(&dec2, false); +} + +TEST(LogDecorators, clear) { + // Start with default decorators and then clear it + LogDecorators dec; + EXPECT_FALSE(dec.is_empty()); + + dec.clear(); + EXPECT_TRUE(dec.is_empty()); + for (size_t i = 0; i < LogDecorators::Count; i++) { + EXPECT_FALSE(dec.is_decorator(decorator_array[i])); + } +} + +// Test the decorator constant None +TEST(LogDecorators, none) { + LogDecorators dec = LogDecorators::None; + for (size_t i = 0; i < LogDecorators::Count; i++) { + EXPECT_FALSE(dec.is_decorator(decorator_array[i])); + } +} + +TEST(LogDecorators, is_empty) { + LogDecorators def, none = LogDecorators::None; + EXPECT_FALSE(def.is_empty()); + EXPECT_TRUE(none.is_empty()); +} diff --git a/hotspot/test/native/logging/test_logFileOutput.cpp b/hotspot/test/native/logging/test_logFileOutput.cpp new file mode 100644 index 00000000000..da13e539412 --- /dev/null +++ b/hotspot/test/native/logging/test_logFileOutput.cpp @@ -0,0 +1,103 @@ +/* + * 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 "logging/logFileOutput.hpp" +#include "memory/resourceArea.hpp" +#include "runtime/os.hpp" +#include "unittest.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/ostream.hpp" + +static const char* name = "testlog.pid%p.%t.log"; + +// Test parsing a bunch of valid file output options +TEST(LogFileOutput, parse_valid) { + const char* valid_options[] = { + "", "filecount=10", "filesize=512", + "filecount=11,filesize=256", + "filesize=256,filecount=11", + "filesize=0", "filecount=1", + "filesize=1m", "filesize=1M", + "filesize=1k", "filesize=1G" + }; + + // Override LogOutput's vm_start time to get predictable file name + LogFileOutput::set_file_name_parameters(0); + char expected_filename[1 * K]; + int ret = jio_snprintf(expected_filename, sizeof(expected_filename), + "testlog.pid%d.1970-01-01_01-00-00.log", + os::current_process_id()); + ASSERT_GT(ret, 0) << "Buffer too small"; + + for (size_t i = 0; i < ARRAY_SIZE(valid_options); i++) { + ResourceMark rm; + stringStream ss; + { + LogFileOutput fo(name); + EXPECT_STREQ(name, fo.name()); + EXPECT_TRUE(fo.initialize(valid_options[i], &ss)) + << "Did not accept valid option(s) '" << valid_options[i] << "': " << ss.as_string(); + } + remove(expected_filename); + } +} + +// Test parsing a bunch of invalid file output options +TEST(LogFileOutput, parse_invalid) { + const char* invalid_options[] = { + "invalidopt", "filecount=", + "filesize=,filecount=10", + "fileco=10", "ilesize=512", + "filecount=11,,filesize=256", + ",filesize=256,filecount=11", + "filesize=256,filecount=11,", + "filesize=-1", "filecount=0.1", + "filecount=-2", "filecount=2.0", + "filecount= 2", "filesize=2 ", + "filecount=ab", "filesize=0xz", + "filecount=1MB", "filesize=99bytes", + "filesize=9999999999999999999999999" + "filecount=9999999999999999999999999" + }; + + for (size_t i = 0; i < ARRAY_SIZE(invalid_options); i++) { + ResourceMark rm; + stringStream ss; + LogFileOutput fo(name); + EXPECT_FALSE(fo.initialize(invalid_options[i], &ss)) + << "Accepted invalid option(s) '" << invalid_options[i] << "': " << ss.as_string(); + } +} + +// Test for overflows with filesize +TEST(LogFileOutput, filesize_overflow) { + char buf[256]; + int ret = jio_snprintf(buf, sizeof(buf), "filesize=" SIZE_FORMAT "K", SIZE_MAX); + ASSERT_GT(ret, 0) << "Buffer too small"; + + ResourceMark rm; + stringStream ss; + LogFileOutput fo(name); + EXPECT_FALSE(fo.initialize(buf, &ss)) << "Accepted filesize that overflows"; +} diff --git a/hotspot/test/native/logging/test_logLevel.cpp b/hotspot/test/native/logging/test_logLevel.cpp new file mode 100644 index 00000000000..00004bb334d --- /dev/null +++ b/hotspot/test/native/logging/test_logLevel.cpp @@ -0,0 +1,54 @@ +/* + * 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 "logging/logLevel.hpp" +#include "unittest.hpp" + +TEST(LogLevel, from_string) { + LogLevelType level; + + // Verify each name defined in the LOG_LEVEL_LIST +#define LOG_LEVEL(lname, lstring) \ + level = LogLevel::from_string(#lstring); \ + EXPECT_EQ(level, LogLevel::lname); + LOG_LEVEL_LIST +#undef LOG_LEVEL + + // Verify a few invalid level strings + EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("bad level")); + EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("debugger")); + EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("inf")); + EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("info ")); + EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string(" info")); + EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("=info")); + EXPECT_EQ(LogLevel::Invalid, LogLevel::from_string("infodebugwarning")); +} + +TEST(LogLevel, name) { + // Use names from macro as reference +#define LOG_LEVEL(lname, lstring) \ + EXPECT_STREQ(LogLevel::name(LogLevel::lname), #lstring); + LOG_LEVEL_LIST +#undef LOG_LEVEL +} diff --git a/hotspot/test/native/logging/test_logOutputList.cpp b/hotspot/test/native/logging/test_logOutputList.cpp new file mode 100644 index 00000000000..d5853526d89 --- /dev/null +++ b/hotspot/test/native/logging/test_logOutputList.cpp @@ -0,0 +1,255 @@ +/* + * 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 "logging/logLevel.hpp" +#include "logging/logOutput.hpp" +#include "logging/logOutputList.hpp" +#include "runtime/os.hpp" +#include "unittest.hpp" + +// Count the outputs in the given list, starting from the specified level +static size_t output_count(LogOutputList* list, LogLevelType from = LogLevel::Error) { + size_t count = 0; + for (LogOutputList::Iterator it = list->iterator(from); it != list->end(); it++) { + count++; + } + return count; +} + +// Get the level for an output in the given list +static LogLevelType find_output_level(LogOutputList* list, LogOutput* o) { + for (size_t levelnum = 1; levelnum < LogLevel::Count; levelnum++) { + LogLevelType level = static_cast(levelnum); + for (LogOutputList::Iterator it = list->iterator(level); it != list->end(); it++) { + if (*it == o) { + return level; + } + } + } + return LogLevel::Off; +} + +// Create a dummy output pointer with the specified id. +// This dummy pointer should not be used for anything +// but pointer comparisons with other dummies. +static LogOutput* dummy_output(size_t id) { + return reinterpret_cast(id + 1); +} + +// Randomly update and verify some outputs some number of times +TEST(LogOutputList, set_output_level_update) { + const size_t TestOutputCount = 10; + const size_t TestIterations = 10000; + LogOutputList list; + size_t outputs_on_level[LogLevel::Count]; + LogLevelType expected_level_for_output[TestOutputCount]; + + os::init_random(0x4711); + for (size_t i = 0; i < LogLevel::Count; i++) { + outputs_on_level[i] = 0; + } + outputs_on_level[LogLevel::Off] = TestOutputCount; + for (size_t i = 0; i < TestOutputCount; i++) { + expected_level_for_output[i] = LogLevel::Off; + } + + for (size_t iteration = 0; iteration < TestIterations; iteration++) { + size_t output_idx = os::random() % TestOutputCount; + size_t levelnum = os::random() % LogLevel::Count; + LogLevelType level = static_cast(levelnum); + + // Update the expectations + outputs_on_level[expected_level_for_output[output_idx]]--; + outputs_on_level[levelnum]++; + expected_level_for_output[output_idx] = level; + + // Update the actual list + list.set_output_level(dummy_output(output_idx), level); + + // Verify expected levels + for (size_t i = 0; i < TestOutputCount; i++) { + ASSERT_EQ(expected_level_for_output[i], find_output_level(&list, dummy_output(i))); + } + // Verify output counts + size_t expected_count = 0; + for (size_t i = 1; i < LogLevel::Count; i++) { + expected_count += outputs_on_level[i]; + ASSERT_EQ(expected_count, output_count(&list, static_cast(i))); + } + ASSERT_EQ(TestOutputCount, expected_count + outputs_on_level[LogLevel::Off]); + } +} + +// Test removing outputs from a LogOutputList +TEST(LogOutputList, set_output_level_remove) { + LogOutputList list; + + // Add three dummy outputs per loglevel + for (size_t i = 1; i < LogLevel::Count; i++) { + list.set_output_level(dummy_output(i), static_cast(i)); + list.set_output_level(dummy_output(i*10), static_cast(i)); + list.set_output_level(dummy_output(i*100), static_cast(i)); + } + + // Verify that they have been added successfully + // (Count - 1 since we don't count LogLevel::Off) + EXPECT_EQ(3u * (LogLevel::Count - 1), output_count(&list)); + // Now remove the second output from each loglevel + for (size_t i = 1; i < LogLevel::Count; i++) { + list.set_output_level(dummy_output(i*10), LogLevel::Off); + } + // Make sure they have been successfully removed + EXPECT_EQ(2u * (LogLevel::Count - 1), output_count(&list)); + + // Now remove the remaining outputs + for (size_t i = 1; i < LogLevel::Count; i++) { + list.set_output_level(dummy_output(i), LogLevel::Off); + list.set_output_level(dummy_output(i*100), LogLevel::Off); + } + EXPECT_EQ(0u, output_count(&list)); +} + +// Test adding to a LogOutputList +TEST(LogOutputList, set_output_level_add) { + LogOutputList list; + + // First add 5 outputs to Info level + for (size_t i = 10; i < 15; i++) { + list.set_output_level(dummy_output(i), LogLevel::Info); + } + + // Verify that they have been added successfully + size_t count = 0; + for (LogOutputList::Iterator it = list.iterator(); it != list.end(); it++) { + ASSERT_EQ(dummy_output(10 + count++), *it); + } + ASSERT_EQ(5u, count); + + // Now add more outputs, but on all different levels + for (size_t i = 5; i < 10; i++) { + list.set_output_level(dummy_output(i), LogLevel::Warning); + } + for (size_t i = 0; i < 5; i++) { + list.set_output_level(dummy_output(i), LogLevel::Error); + } + for (size_t i = 15; i < 20; i++) { + list.set_output_level(dummy_output(i), LogLevel::Debug); + } + for (size_t i = 20; i < 25; i++) { + list.set_output_level(dummy_output(i), LogLevel::Trace); + } + + // Verify that that all outputs have been added, and that the order is Error, Warning, Info, Debug, Trace + count = 0; + for (LogOutputList::Iterator it = list.iterator(); it != list.end(); it++) { + ASSERT_EQ(dummy_output(count++), *it); + } + ASSERT_EQ(25u, count); +} + +// Test is_level() on lists with a single output on different levels +TEST(LogOutputList, is_level_single_output) { + for (size_t i = LogLevel::First; i < LogLevel::Count; i++) { + LogLevelType level = static_cast(i); + LogOutputList list; + list.set_output_level(LogOutput::Stdout, level); + for (size_t j = LogLevel::First; j < LogLevel::Count; j++) { + LogLevelType other = static_cast(j); + // Verify that levels finer than the current level for stdout are reported as disabled, + // and levels equal to or included in the current level are reported as enabled + if (other >= level) { + EXPECT_TRUE(list.is_level(other)) + << LogLevel::name(other) << " >= " << LogLevel::name(level) << " but is_level() returns false"; + } else { + EXPECT_FALSE(list.is_level(other)) + << LogLevel::name(other) << " < " << LogLevel::name(level) << " but is_level() returns true"; + } + } + } +} + +// Test is_level() with an empty list +TEST(LogOutputList, is_level_empty) { + LogOutputList emptylist; + for (size_t i = LogLevel::First; i < LogLevel::Count; i++) { + LogLevelType other = static_cast(i); + EXPECT_FALSE(emptylist.is_level(other)) << "is_level() returns true even though the list is empty"; + } +} + +// Test is_level() on lists with two outputs on different levels +TEST(LogOutputList, is_level_multiple_outputs) { + for (size_t i = LogLevel::First; i < LogLevel::Count - 1; i++) { + LogOutput* dummy1 = LogOutput::Stdout; + LogOutput* dummy2 = LogOutput::Stderr; + LogLevelType first = static_cast(i); + LogLevelType second = static_cast(i + 1); + LogOutputList list; + list.set_output_level(dummy1, first); + list.set_output_level(dummy2, second); + for (size_t j = LogLevel::First; j < LogLevel::Count; j++) { + LogLevelType other = static_cast(j); + // The first output's level will be the finest, expect it's level to be reported by the list + if (other >= first) { + EXPECT_TRUE(list.is_level(other)) + << LogLevel::name(other) << " >= " << LogLevel::name(first) << " but is_level() returns false"; + } else { + EXPECT_FALSE(list.is_level(other)) + << LogLevel::name(other) << " < " << LogLevel::name(first) << " but is_level() returns true"; + } + } + } +} + +TEST(LogOutputList, level_for) { + LogOutputList list; + + // Ask the empty list about stdout, stderr + EXPECT_EQ(LogLevel::Off, list.level_for(LogOutput::Stdout)); + EXPECT_EQ(LogLevel::Off, list.level_for(LogOutput::Stderr)); + + // Ask for level in a list with two outputs on different levels + list.set_output_level(LogOutput::Stdout, LogLevel::Info); + list.set_output_level(LogOutput::Stderr, LogLevel::Trace); + EXPECT_EQ(LogLevel::Info, list.level_for(LogOutput::Stdout)); + EXPECT_EQ(LogLevel::Trace, list.level_for(LogOutput::Stderr)); + + // Remove and ask again + list.set_output_level(LogOutput::Stdout, LogLevel::Off); + EXPECT_EQ(LogLevel::Off, list.level_for(LogOutput::Stdout)); + EXPECT_EQ(LogLevel::Trace, list.level_for(LogOutput::Stderr)); + + // Ask about an unknown output + LogOutput* dummy = dummy_output(4711); + EXPECT_EQ(LogLevel::Off, list.level_for(dummy)); + + for (size_t i = LogLevel::First; i <= LogLevel::Last; i++) { + LogLevelType level = static_cast(i); + list.set_output_level(dummy, level); + EXPECT_EQ(level, list.level_for(dummy)); + } + + // Make sure the stderr level is still the same + EXPECT_EQ(LogLevel::Trace, list.level_for(LogOutput::Stderr)); +} diff --git a/hotspot/test/native/logging/test_logTag.cpp b/hotspot/test/native/logging/test_logTag.cpp new file mode 100644 index 00000000000..3017a2da4fb --- /dev/null +++ b/hotspot/test/native/logging/test_logTag.cpp @@ -0,0 +1,53 @@ +/* + * 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 "logging/logTag.hpp" +#include "unittest.hpp" + +TEST(LogTag, from_string) { + // Verify for all tags defined in LOG_TAG_LIST +#define LOG_TAG(tag) \ + EXPECT_EQ(PREFIX_LOG_TAG(tag), LogTag::from_string(#tag)); + LOG_TAG_LIST +#undef LOG_TAG + + // Verify a couple of invalid strings parsing as invalid tags + const char* invalid_tag[] = { + "bad tag", ".^@", "**", "*", "gcc", "+gc", "gc+", "gc+safepoint", + "gc+safepoint=warning", "warning", "=info", "gcsafepointlogging", + "gc+safepointlogging", "gclogging", "+", " gc", "logging ", "," + }; + for (size_t i = 0; i < sizeof(invalid_tag) / sizeof(*invalid_tag); i++) { + EXPECT_EQ(LogTag::__NO_TAG, LogTag::from_string(invalid_tag[i])) + << "'" << invalid_tag[i] << "' did not parse as an invalid tag"; + } +} + +TEST(LogTag, name) { + // Verify for each tag from the macro +#define LOG_TAG(tag) \ + EXPECT_STREQ(#tag, LogTag::name(PREFIX_LOG_TAG(tag))); + LOG_TAG_LIST +#undef LOG_TAG +} diff --git a/hotspot/test/native/logging/test_logTagLevelExpression.cpp b/hotspot/test/native/logging/test_logTagLevelExpression.cpp new file mode 100644 index 00000000000..72bd244a5ca --- /dev/null +++ b/hotspot/test/native/logging/test_logTagLevelExpression.cpp @@ -0,0 +1,183 @@ +/* + * 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 "logging/logLevel.hpp" +#include "logging/logTagLevelExpression.hpp" +#include "logging/logTagSet.hpp" +#include "unittest.hpp" +#include "utilities/globalDefinitions.hpp" + +TEST(LogTagLevelExpression, parse) { + char buf[256]; + const char* invalid_substr[] = { + "=", "+", " ", "+=", "+=*", "*+", " +", "**", "++", ".", ",", ",," ",+", + " *", "all+", "all*", "+all", "+all=Warning", "==Info", "=InfoWarning", + "BadTag+", "logging++", "logging*+", ",=", "gc+gc+gc+gc+gc+gc" + }; + const char* valid_expression[] = { + "all", "gc", "gc,logging", "gc+logging", "logging+gc", "logging+gc,gc", "logging+gc*", "gc=trace", + "gc=trace,logging=info", "logging+gc=trace", "logging+gc=trace,gc+logging=warning,logging", + "gc,all=info", "logging*", "logging*=info", "gc+logging*=error", "logging*,gc=info" + }; + + // Verify valid expressions parse without problems + for (size_t i = 0; i < ARRAY_SIZE(valid_expression); i++) { + LogTagLevelExpression expr; + EXPECT_TRUE(expr.parse(valid_expression[i])) << "Valid expression '" << valid_expression[i] << "' did not parse"; + } + + // Verify we can use 'all' with each available level + for (uint level = LogLevel::First; level <= LogLevel::Last; level++) { + char buf[32]; + int ret = jio_snprintf(buf, sizeof(buf), "all=%s", LogLevel::name(static_cast(level))); + ASSERT_NE(ret, -1); + + LogTagLevelExpression expr; + EXPECT_TRUE(expr.parse(buf)); + } + + // Verify invalid expressions do not parse + for (size_t i = 0; i < ARRAY_SIZE(valid_expression); i++) { + for (size_t j = 0; j < ARRAY_SIZE(invalid_substr); j++) { + // Prefix with invalid substr + LogTagLevelExpression expr; + jio_snprintf(buf, sizeof(buf), "%s%s", invalid_substr[j], valid_expression[i]); + EXPECT_FALSE(expr.parse(buf)) << "'" << buf << "'" << " considered legal"; + + // Suffix with invalid substr + LogTagLevelExpression expr1; + jio_snprintf(buf, sizeof(buf), "%s%s", valid_expression[i], invalid_substr[j]); + EXPECT_FALSE(expr1.parse(buf)) << "'" << buf << "'" << " considered legal"; + + // Use only the invalid substr + LogTagLevelExpression expr2; + EXPECT_FALSE(expr2.parse(invalid_substr[j])) << "'" << invalid_substr[j] << "'" << " considered legal"; + } + + // Suffix/prefix with some unique invalid prefixes/suffixes + LogTagLevelExpression expr; + jio_snprintf(buf, sizeof(buf), "*%s", valid_expression[i]); + EXPECT_FALSE(expr.parse(buf)) << "'" << buf << "'" << " considered legal"; + + LogTagLevelExpression expr1; + jio_snprintf(buf, sizeof(buf), "logging*%s", valid_expression[i]); + EXPECT_FALSE(expr1.parse(buf)) << "'" << buf << "'" << " considered legal"; + } +} + +// Test the level_for() function for an empty expression +TEST(LogTagLevelExpression, level_for_empty) { + LogTagLevelExpression emptyexpr; + ASSERT_TRUE(emptyexpr.parse("")); + // All tagsets should be unspecified since the expression doesn't involve any tagset + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_EQ(LogLevel::Unspecified, emptyexpr.level_for(*ts)); + } +} + +// Test level_for() with "all" without any specified level +TEST(LogTagLevelExpression, level_for_all) { + LogTagLevelExpression allexpr; + ASSERT_TRUE(allexpr.parse("all")); + // Level will be unspecified since no level was given + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_EQ(LogLevel::Unspecified, allexpr.level_for(*ts)); + } +} + +// Test level_for() with "all=debug" +TEST(LogTagLevelExpression, level_for_all_debug) { + LogTagLevelExpression alldebugexpr; + ASSERT_TRUE(alldebugexpr.parse("all=debug")); + // All tagsets should report debug level + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_EQ(LogLevel::Debug, alldebugexpr.level_for(*ts)); + } +} + +// Test level_for() with "all=off" +TEST(LogTagLevelExpression, level_for_all_off) { + LogTagLevelExpression alloffexpr; + ASSERT_TRUE(alloffexpr.parse("all=off")); + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + EXPECT_EQ(LogLevel::Off, alloffexpr.level_for(*ts)); + } +} + +// Test level_for() with an expression that has overlap (last subexpression should be used) +TEST(LogTagLevelExpression, level_for_overlap) { + LogTagLevelExpression overlapexpr; + // The all=warning will be overridden with gc=info and/or logging+safepoint*=trace + ASSERT_TRUE(overlapexpr.parse("all=warning,gc=info,logging+safepoint*=trace")); + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + if (ts->contains(PREFIX_LOG_TAG(gc)) && ts->ntags() == 1) { + EXPECT_EQ(LogLevel::Info, overlapexpr.level_for(*ts)); + } else if (ts->contains(PREFIX_LOG_TAG(logging)) && ts->contains(PREFIX_LOG_TAG(safepoint))) { + EXPECT_EQ(LogLevel::Trace, overlapexpr.level_for(*ts)); + } else { + EXPECT_EQ(LogLevel::Warning, overlapexpr.level_for(*ts)); + } + } + EXPECT_EQ(LogLevel::Warning, overlapexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Info, overlapexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Trace, overlapexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Trace, + overlapexpr.level_for(LogTagSetMapping::tagset())); +} + +// Test level_for() with an expression containing two independent subexpressions +TEST(LogTagLevelExpression, level_for_disjoint) { + LogTagLevelExpression reducedexpr; + ASSERT_TRUE(reducedexpr.parse("gc+logging=trace,class*=error")); + EXPECT_EQ(LogLevel::Error, reducedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Error, reducedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::NotMentioned, reducedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::NotMentioned, reducedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::NotMentioned, reducedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Trace, reducedexpr.level_for(LogTagSetMapping::tagset())); +} + +// Test level_for() with an expression that is completely overridden in the last part of the expression +TEST(LogTagLevelExpression, level_for_override) { + LogTagLevelExpression overrideexpr; + // No matter what, everything should be set to error level because of the last part + ASSERT_TRUE(overrideexpr.parse("logging,gc*=trace,all=error")); + EXPECT_EQ(LogLevel::Error, overrideexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Error, overrideexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Error, overrideexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Error, overrideexpr.level_for(LogTagSetMapping::tagset())); +} + +// Test level_for() with a mixed expression with a bit of everything +TEST(LogTagLevelExpression, level_for_mixed) { + LogTagLevelExpression mixedexpr; + ASSERT_TRUE(mixedexpr.parse("all=warning,gc*=debug,gc=trace,safepoint*=off")); + EXPECT_EQ(LogLevel::Warning, mixedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Warning, mixedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Debug, mixedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Off, mixedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Off, mixedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Debug, mixedexpr.level_for(LogTagSetMapping::tagset())); + EXPECT_EQ(LogLevel::Trace, mixedexpr.level_for(LogTagSetMapping::tagset())); +} diff --git a/hotspot/test/native/logging/test_logTagSet.cpp b/hotspot/test/native/logging/test_logTagSet.cpp new file mode 100644 index 00000000000..327a0afc9b2 --- /dev/null +++ b/hotspot/test/native/logging/test_logTagSet.cpp @@ -0,0 +1,130 @@ +/* + * 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 + * ac_heapanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ +#include "precompiled.hpp" +#include "logging/logLevel.hpp" +#include "logging/logOutput.hpp" +#include "logging/logTag.hpp" +#include "logging/logTagSet.hpp" +#include "unittest.hpp" + +// Test the default level for each tagset +TEST(LogTagSet, defaults) { + for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + char buf[256]; + ts->label(buf, sizeof(buf)); + SCOPED_TRACE(buf); + EXPECT_TRUE(ts->is_level(LogLevel::Error)); + EXPECT_TRUE(ts->is_level(LogLevel::Warning)); + EXPECT_FALSE(ts->is_level(LogLevel::Info)); + EXPECT_TRUE(ts->has_output(LogOutput::Stdout)); + EXPECT_FALSE(ts->has_output(LogOutput::Stderr)); + } +} + +TEST(LogTagSet, has_output) { + LogTagSet& ts = LogTagSetMapping::tagset(); + ts.set_output_level(LogOutput::Stderr, LogLevel::Trace); + EXPECT_TRUE(ts.has_output(LogOutput::Stderr)); + EXPECT_FALSE(ts.has_output(NULL)); + ts.set_output_level(LogOutput::Stderr, LogLevel::Off); + EXPECT_FALSE(ts.has_output(LogOutput::Stderr)); +} + +TEST(LogTagSet, ntags) { + const LogTagSet& ts = LogTagSetMapping::tagset(); + EXPECT_EQ(1u, ts.ntags()); + const LogTagSet& ts2 = LogTagSetMapping::tagset(); + EXPECT_EQ(5u, ts2.ntags()); +} + +TEST(LogTagSet, is_level) { + LogTagSet& ts = LogTagSetMapping::tagset(); + // Set info level on stdout and verify that is_level() reports correctly + ts.set_output_level(LogOutput::Stdout, LogLevel::Info); + EXPECT_TRUE(ts.is_level(LogLevel::Error)); + EXPECT_TRUE(ts.is_level(LogLevel::Warning)); + EXPECT_TRUE(ts.is_level(LogLevel::Info)); + EXPECT_FALSE(ts.is_level(LogLevel::Debug)); + EXPECT_FALSE(ts.is_level(LogLevel::Trace)); + ts.set_output_level(LogOutput::Stdout, LogLevel::Default); + EXPECT_TRUE(ts.is_level(LogLevel::Default)); +} + +TEST(LogTagSet, level_for) { + LogOutput* output = LogOutput::Stdout; + LogTagSet& ts = LogTagSetMapping::tagset(); + for (uint i = 0; i < LogLevel::Count; i++) { + LogLevelType level = static_cast(i); + // Set the level and verify that level_for() reports it back + ts.set_output_level(output, level); + EXPECT_EQ(level, ts.level_for(output)); + } + ts.set_output_level(output, LogLevel::Default); +} + +TEST(LogTagSet, contains) { + // Verify that contains works as intended for a few predetermined tagsets + const LogTagSet& ts = LogTagSetMapping::tagset(); + EXPECT_TRUE(ts.contains(PREFIX_LOG_TAG(logging))); + EXPECT_FALSE(ts.contains(PREFIX_LOG_TAG(gc))); + EXPECT_FALSE(ts.contains(PREFIX_LOG_TAG(class))); + + const LogTagSet& ts2 = LogTagSetMapping::tagset(); + EXPECT_TRUE(ts2.contains(PREFIX_LOG_TAG(logging))); + EXPECT_TRUE(ts2.contains(PREFIX_LOG_TAG(gc))); + EXPECT_FALSE(ts2.contains(PREFIX_LOG_TAG(class))); + + const LogTagSet& ts3 = LogTagSetMapping::tagset(); + EXPECT_TRUE(ts3.contains(PREFIX_LOG_TAG(logging))); + EXPECT_TRUE(ts3.contains(PREFIX_LOG_TAG(gc))); + EXPECT_TRUE(ts3.contains(PREFIX_LOG_TAG(class))); + EXPECT_FALSE(ts3.contains(PREFIX_LOG_TAG(safepoint))); + + const LogTagSet& ts4 = LogTagSetMapping::tagset(); + EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(logging))); + EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(gc))); + EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(class))); + EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(safepoint))); + EXPECT_TRUE(ts4.contains(PREFIX_LOG_TAG(heap))); +} + +TEST(LogTagSet, label) { + char buf[256]; + const LogTagSet& ts = LogTagSetMapping::tagset(); + ASSERT_NE(-1, ts.label(buf, sizeof(buf))); + EXPECT_STREQ("logging,safepoint", buf); + // Verify using a custom separator + ASSERT_NE(-1, ts.label(buf, sizeof(buf), "++")); + EXPECT_STREQ("logging++safepoint", buf); + + // Verify with three tags + const LogTagSet& ts1 = LogTagSetMapping::tagset(); + ASSERT_NE(-1, ts1.label(buf, sizeof(buf))); + EXPECT_STREQ("logging,safepoint,jni", buf); + + // Verify with a single tag + const LogTagSet& ts2 = LogTagSetMapping::tagset(); + ASSERT_NE(-1, ts2.label(buf, sizeof(buf))); + EXPECT_STREQ("logging", buf); +} diff --git a/hotspot/test/native/utilities/test_bitMap_setops.cpp b/hotspot/test/native/utilities/test_bitMap_setops.cpp new file mode 100644 index 00000000000..45b6d79a444 --- /dev/null +++ b/hotspot/test/native/utilities/test_bitMap_setops.cpp @@ -0,0 +1,417 @@ +/* + * 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 "utilities/bitMap.inline.hpp" +#include "utilities/copy.hpp" +#include "utilities/debug.hpp" +#include "utilities/globalDefinitions.hpp" +#include +#include "unittest.hpp" + +typedef BitMap::idx_t idx_t; +typedef BitMap::bm_word_t bm_word_t; + +class BitMapMemory { +private: + idx_t _words; + bm_word_t* _memory; + +public: + BitMapMemory(idx_t bits) : + _words(BitMap::calc_size_in_words(bits)), + _memory(static_cast(malloc(_words * sizeof(bm_word_t)))) + { } + + ~BitMapMemory() { + free(_memory); + } + + BitMapView make_view(idx_t bits, bm_word_t value) { + vmassert(BitMap::calc_size_in_words(bits) <= _words, "invalid request"); + STATIC_ASSERT(sizeof(bm_word_t) == sizeof(HeapWord)); + Copy::fill_to_aligned_words((HeapWord*)_memory, _words, value); + return BitMapView(_memory, bits); + } + + bm_word_t* memory() { return _memory; } +}; + +const idx_t aligned_size = 4 * BitsPerWord; +const idx_t unaligned_size = aligned_size - (BitsPerWord / 2); + +static bm_word_t make_even_bits() { + bm_word_t result = 1; + while (true) { + bm_word_t next = (result << 2) | 1; + if (next == result) { + return result; + } + result = next; + } +} + +const bm_word_t even_bits = make_even_bits(); +const bm_word_t odd_bits = ~even_bits; +const bm_word_t one_bits = ~bm_word_t(0); +const bm_word_t zero_bits = 0; + +// Scoped set a clear bit and restore to clear. +class WithBitSet { +private: + BitMap& _bm; + idx_t _index; + +public: + WithBitSet(BitMap& bm, idx_t index) : _bm(bm), _index(index) { + // Failure may indicate test bug; can't use ASSERT_xxx in constructor. + EXPECT_FALSE(_bm.at(_index)); + bm.set_bit(_index); + } + + ~WithBitSet() { + _bm.clear_bit(_index); + } +}; + +// Scoped clear a set bit and restore to set. +class WithBitClear { +private: + BitMap& _bm; + idx_t _index; + +public: + WithBitClear(BitMap& bm, idx_t index) : _bm(bm), _index(index) { + // Failure may indicate test bug; can't use ASSERT_xxx in constructor. + EXPECT_TRUE(_bm.at(_index)); + bm.clear_bit(_index); + } + + ~WithBitClear() { + _bm.set_bit(_index); + } +}; + +////////////////////////////////////////////////////////////////////////////// +// bool is_same(const BitMap& bits); + +TEST(BitMap, is_same__aligned) { + BitMapMemory mx(aligned_size); + BitMapMemory my(aligned_size); + + BitMapView x = mx.make_view(aligned_size, even_bits); + BitMapView y = my.make_view(aligned_size, even_bits); + EXPECT_TRUE(x.is_same(y)); + + WithBitClear wbc(x, aligned_size / 2); + EXPECT_FALSE(x.is_same(y)); +} + +TEST(BitMap, is_same__unaligned) { + BitMapMemory mx(aligned_size); + BitMapMemory my(aligned_size); + + BitMapView x = mx.make_view(unaligned_size, even_bits); + BitMapView y = my.make_view(unaligned_size, even_bits); + + // Check that a difference beyond the end of x/y doesn't count. + { + BitMapView aligned = BitMapView(mx.memory(), aligned_size); + const idx_t index = aligned_size - 2; + STATIC_ASSERT(unaligned_size <= index); + + WithBitClear wbc(aligned, index); + EXPECT_TRUE(x.is_same(y)); + } + + // Check that a difference in the final partial word does count. + { + idx_t index = unaligned_size - 2; + ASSERT_LE(BitMap::word_align_down(unaligned_size), index); + + WithBitClear wbc(y, index); + EXPECT_FALSE(x.is_same(y)); + } +} + +////////////////////////////////////////////////////////////////////////////// +// bool is_full(); +// bool is_empty(); + +TEST(BitMap, is_full_or_empty__aligned) { + BitMapMemory mx(aligned_size); + + { + BitMapView x = mx.make_view(aligned_size, even_bits); + EXPECT_FALSE(x.is_full()); + EXPECT_FALSE(x.is_empty()); + } + + { + BitMapView x = mx.make_view(aligned_size, zero_bits); + EXPECT_FALSE(x.is_full()); + EXPECT_TRUE(x.is_empty()); + } + + { + BitMapView x = mx.make_view(aligned_size, one_bits); + EXPECT_TRUE(x.is_full()); + EXPECT_FALSE(x.is_empty()); + } +} + +TEST(BitMap, is_full__unaligned) { + BitMapMemory mx(aligned_size); + + BitMapView x = mx.make_view(unaligned_size, one_bits); + EXPECT_TRUE(x.is_full()); + + // Check that a missing bit beyond the end doesn't count. + { + idx_t index = aligned_size - 1; + BitMapView aligned = BitMapView(mx.memory(), aligned_size); + + WithBitClear wcb(aligned, index); + EXPECT_FALSE(aligned.is_full()); + EXPECT_TRUE(x.is_full()); + } + + // Check that a missing bit in the final partial word does count. + { + WithBitClear wcb(x, unaligned_size - 1); + EXPECT_FALSE(x.is_full()); + } +} + +TEST(BitMap, is_empty__unaligned) { + BitMapMemory mx(aligned_size); + + BitMapView x = mx.make_view(unaligned_size, zero_bits); + EXPECT_TRUE(x.is_empty()); + + // Check that a set bit beyond the end doesn't count. + { + idx_t index = aligned_size - 1; + BitMapView aligned = BitMapView(mx.memory(), aligned_size); + + WithBitSet wbs(aligned, index); + EXPECT_FALSE(aligned.is_empty()); + EXPECT_TRUE(x.is_empty()); + } + + // Check that a set bit in the final partial word does count. + { + WithBitSet wbs(x, unaligned_size - 1); + EXPECT_FALSE(x.is_empty()); + } +} + +////////////////////////////////////////////////////////////////////////////// +// bool contains(const BitMap& bits); + +TEST(BitMap, contains__aligned) { + BitMapMemory mx(aligned_size); + BitMapMemory my(aligned_size); + + BitMapView x = mx.make_view(aligned_size, even_bits); + BitMapView y = my.make_view(aligned_size, even_bits); + EXPECT_TRUE(x.contains(y)); + + WithBitClear wbc(x, aligned_size / 2); + EXPECT_FALSE(x.contains(y)); +} + +TEST(BitMap, contains__unaligned) { + BitMapMemory mx(aligned_size); + BitMapMemory my(aligned_size); + + BitMapView x = mx.make_view(unaligned_size, even_bits); + BitMapView y = my.make_view(unaligned_size, even_bits); + + // Check that a missing bit beyond the end of x doesn't count. + { + BitMapView aligned = BitMapView(mx.memory(), aligned_size); + const idx_t index = aligned_size - 2; + STATIC_ASSERT(unaligned_size <= index); + + WithBitClear wbc(aligned, index); + EXPECT_TRUE(x.contains(y)); + } + + // Check that a missing bit in the final partial word does count. + { + idx_t index = unaligned_size - 2; + ASSERT_LE(BitMap::word_align_down(unaligned_size), index); + + WithBitClear wbc(x, index); + EXPECT_FALSE(x.contains(y)); + } +} + +////////////////////////////////////////////////////////////////////////////// +// bool intersects(const BitMap& bits); + +TEST(BitMap, intersects__aligned) { + BitMapMemory mx(aligned_size); + BitMapMemory my(aligned_size); + + BitMapView x = mx.make_view(aligned_size, even_bits); + BitMapView y = my.make_view(aligned_size, zero_bits); + EXPECT_FALSE(x.intersects(y)); + + ASSERT_TRUE(x.at(aligned_size / 2)); + WithBitSet wbs(y, aligned_size / 2); + EXPECT_TRUE(x.intersects(y)); +} + +TEST(BitMap, intersects__unaligned) { + BitMapMemory mx(aligned_size); + BitMapMemory my(aligned_size); + + BitMapView x = mx.make_view(unaligned_size, even_bits); + BitMapView y = my.make_view(unaligned_size, zero_bits); + EXPECT_FALSE(x.intersects(y)); + + // Check that adding a bit beyond the end of y doesn't count. + { + BitMapView aligned_x = BitMapView(mx.memory(), aligned_size); + BitMapView aligned_y = BitMapView(my.memory(), aligned_size); + const idx_t index = aligned_size - 2; + STATIC_ASSERT(unaligned_size <= index); + ASSERT_TRUE(aligned_x.at(index)); + + WithBitSet wbs(aligned_y, index); + EXPECT_FALSE(x.intersects(y)); + } + + // Check that adding a bit in the final partial word does count. + { + idx_t index = unaligned_size - 2; + ASSERT_LE(BitMap::word_align_down(unaligned_size), index); + ASSERT_TRUE(x.at(index)); + + WithBitSet wbs(y, index); + EXPECT_TRUE(x.intersects(y)); + } +} + +////////////////////////////////////////////////////////////////////////////// +// void set_from(const BitMap& bits); +// void set_union(const BitMap& bits); +// void set_difference(const BitMap& bits); +// void set_intersection(const BitMap& bits); +// +// bool set_union_with_result(const BitMap& bits); +// bool set_difference_with_result(const BitMap& bits); +// bool set_intersection_with_result(const BitMap& bits); + +static void check_tail_unmodified(BitMapMemory& mem, + idx_t bits, + bm_word_t fill_word) { + if (!BitMap::is_word_aligned(bits)) { + idx_t last_word_bit_index = BitMap::word_align_down(bits); + idx_t last_word_index = BitMap::calc_size_in_words(last_word_bit_index); + bm_word_t last_word = mem.memory()[last_word_index]; + idx_t shift = bits - last_word_bit_index; + EXPECT_EQ(fill_word >> shift, last_word >> shift); + } +} + +static void check_mod_setop(void (BitMap::*f)(const BitMap&), + idx_t bits, + bm_word_t wx, + bm_word_t wy, + bm_word_t wexp) { + BitMapMemory mx(bits); + BitMapMemory my(bits); + BitMapMemory mexp(bits); + + BitMapView x = mx.make_view(bits, wx); + BitMapView y = my.make_view(bits, wy); + BitMapView exp = mexp.make_view(bits, wexp); + + (x.*f)(y); + + EXPECT_TRUE(exp.is_same(x)); + check_tail_unmodified(mx, bits, wx); +} + +static void check_mod_setop_with_result(bool (BitMap::*f)(const BitMap&), + idx_t bits, + bm_word_t wx, + bm_word_t wy, + bm_word_t wexp) { + BitMapMemory mx(bits); + BitMapMemory my(bits); + BitMapMemory mexp(bits); + + BitMapView x = mx.make_view(bits, wx); + BitMapView y = my.make_view(bits, wy); + BitMapView exp = mexp.make_view(bits, wexp); + + bool value = (x.*f)(y); + EXPECT_EQ(value, wx != wexp); + + EXPECT_TRUE(exp.is_same(x)); + check_tail_unmodified(mx, bits, wx); +} + +#define CHECK_MOD_SETOP_AUX(checker, name, x, y, exp) \ + TEST(BitMap, name ## __ ## x ## _ ## y) { \ + checker(&BitMap::name, aligned_size, \ + x ## _bits, y ## _bits, exp ## _bits); \ + checker(&BitMap::name, unaligned_size, \ + x ## _bits, y ## _bits, exp ## _bits); \ + } + +#define CHECK_MOD_SETOP(name, x, y, exp) \ + CHECK_MOD_SETOP_AUX(check_mod_setop, name, x, y, exp) + +#define CHECK_MOD_SETOP_WITH_RESULT(name, x, y, exp) \ + CHECK_MOD_SETOP_AUX(check_mod_setop_with_result, name, x, y, exp) + +#define CHECK_MOD_SETOPS(name, x, y, exp) \ + CHECK_MOD_SETOP(name, x, y, exp) \ + CHECK_MOD_SETOP_WITH_RESULT(name ## _with_result, x, y, exp) + +CHECK_MOD_SETOP(set_from, even, even, even) +CHECK_MOD_SETOP(set_from, even, odd, odd) +CHECK_MOD_SETOP(set_from, even, one, one) +CHECK_MOD_SETOP(set_from, even, zero, zero) + +CHECK_MOD_SETOPS(set_union, even, even, even) +CHECK_MOD_SETOPS(set_union, even, odd, one) +CHECK_MOD_SETOPS(set_union, even, one, one) +CHECK_MOD_SETOPS(set_union, even, zero, even) + +CHECK_MOD_SETOPS(set_difference, even, even, zero) +CHECK_MOD_SETOPS(set_difference, even, odd, even) +CHECK_MOD_SETOPS(set_difference, even, one, zero) +CHECK_MOD_SETOPS(set_difference, even, zero, even) + +CHECK_MOD_SETOPS(set_intersection, even, even, even) +CHECK_MOD_SETOPS(set_intersection, even, odd, zero) +CHECK_MOD_SETOPS(set_intersection, even, one, even) +CHECK_MOD_SETOPS(set_intersection, even, zero, zero) + diff --git a/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java index a9f69d60f38..341b2a6ea8a 100644 --- a/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java +++ b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java @@ -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 @@ -26,7 +26,7 @@ * @bug 8026365 * @summary Test invokespecial of host class method from an anonymous class * @author Robert Field - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * @compile -XDignore.symbol.file InvokeSpecialAnonTest.java diff --git a/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java b/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java index fe77452c4a5..186b235f0de 100644 --- a/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java +++ b/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java @@ -25,13 +25,15 @@ * @test * @bug 6583051 * @summary Give error if java.lang.Object has been incompatibly overridden on the bootpath - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main BootstrapRedefine */ -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class BootstrapRedefine { diff --git a/hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java b/hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java index 6ce8cb1252c..7a85ad27433 100644 --- a/hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java +++ b/hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java @@ -25,7 +25,7 @@ * @bug 8149170 * @summary Test native functions return booleans as 0/1 but differently than java functions * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile BoolConstructor.java * @run main/native NativeSmallIntCallsTest */ diff --git a/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppend.java b/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppend.java index 28371979be0..a463f492d8b 100644 --- a/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppend.java +++ b/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppend.java @@ -25,11 +25,12 @@ * @test * @bug 8087154 * @summary Uninitialized system property jdk.boot.class.path.append causes SIGSEGV - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; // Test that system property jdk.boot.class.path.append is initialized. Otherwise, // -XX:+PrintCompilation does causes a SIGSEGV. diff --git a/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppendProp.java b/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppendProp.java index 0fd7830f46a..458b5ceda03 100644 --- a/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppendProp.java +++ b/hotspot/test/runtime/BootClassAppendProp/BootClassPathAppendProp.java @@ -25,7 +25,6 @@ import java.io.File; /* * @test - * @build BootClassPathAppendProp * @run main/othervm -Xbootclasspath/a:/usr/lib -showversion -Xbootclasspath/a:/i/dont/exist BootClassPathAppendProp * @run main/othervm --patch-module=no_module=/not/here -Xbootclasspath/a:/i/may/exist BootClassPathAppendProp * @run main/othervm -Djdk.boot.class.path.append=newdir BootClassPathAppendProp diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java index 34a417e54bc..5e5031c8df5 100644 --- a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java +++ b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java @@ -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,13 +25,15 @@ * @test * @bug 8003424 * @summary Testing UseCompressedClassPointers with CDS - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main CDSCompressedKPtrs */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CDSCompressedKPtrs { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java index b9242e17e75..885427cc265 100644 --- a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java +++ b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java @@ -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,13 +25,15 @@ * @test * @bug 8003424 * @summary Test that cannot use CDS if UseCompressedClassPointers is turned off. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main CDSCompressedKPtrsError */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CDSCompressedKPtrsError { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java index 9694382001a..425a2e5ba4e 100644 --- a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java +++ b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java @@ -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,13 +25,15 @@ * @test * @bug 8005933 * @summary Test that -Xshare:auto uses CDS when explicitly specified with -server. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main XShareAuto */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class XShareAuto { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/ClassFile/JsrRewriting.java b/hotspot/test/runtime/ClassFile/JsrRewriting.java index 4d9a3e6238f..55d56c6361b 100644 --- a/hotspot/test/runtime/ClassFile/JsrRewriting.java +++ b/hotspot/test/runtime/ClassFile/JsrRewriting.java @@ -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 @@ -33,14 +33,17 @@ * @bug 7185550 * @bug 7149464 * @key cte_test - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.desktop * java.management * @run main JsrRewriting */ -import jdk.test.lib.*; +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.io.File; public class JsrRewriting { diff --git a/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java b/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java index 9ab684a4b4b..a87aebb1434 100644 --- a/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java +++ b/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java @@ -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 @@ -33,15 +33,17 @@ * @bug 7037122 * @bug 7123945 * @bug 8016029 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.desktop * java.management * @run main OomWhileParsingRepeatedJsr */ -import jdk.test.lib.*; - +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class OomWhileParsingRepeatedJsr { diff --git a/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java b/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java index c3ca4676582..486bba9717c 100644 --- a/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java +++ b/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java @@ -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 @@ -23,7 +23,7 @@ /* * @test - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * java.management @@ -36,7 +36,8 @@ import java.io.FileOutputStream; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class UnsupportedClassFileVersion implements Opcodes { public static void main(String... args) throws Exception { diff --git a/hotspot/test/runtime/ClassUnload/KeepAliveClass.java b/hotspot/test/runtime/ClassUnload/KeepAliveClass.java index 9c0b50cbe7e..0d1d51a1f5a 100644 --- a/hotspot/test/runtime/ClassUnload/KeepAliveClass.java +++ b/hotspot/test/runtime/ClassUnload/KeepAliveClass.java @@ -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 @@ -25,10 +25,9 @@ * @test KeepAliveClass * @summary This test case uses a java.lang.Class instance to keep a class alive. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /runtime/testlibrary + * @library /test/lib /runtime/testlibrary * @library classes - * @build KeepAliveClass test.Empty - * @build ClassUnloadCommon + * @build sun.hotspot.WhiteBox test.Empty * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI KeepAliveClass diff --git a/hotspot/test/runtime/ClassUnload/KeepAliveClassLoader.java b/hotspot/test/runtime/ClassUnload/KeepAliveClassLoader.java index ec8fa0d621b..e519f674856 100644 --- a/hotspot/test/runtime/ClassUnload/KeepAliveClassLoader.java +++ b/hotspot/test/runtime/ClassUnload/KeepAliveClassLoader.java @@ -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 @@ -25,10 +25,9 @@ * @test KeepAliveClassLoader * @summary This test case uses a java.lang.ClassLoader instance to keep a class alive. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /runtime/testlibrary + * @library /test/lib /runtime/testlibrary * @library classes - * @build KeepAliveClassLoader test.Empty - * @build ClassUnloadCommon + * @build sun.hotspot.WhiteBox test.Empty * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI KeepAliveClassLoader diff --git a/hotspot/test/runtime/ClassUnload/KeepAliveObject.java b/hotspot/test/runtime/ClassUnload/KeepAliveObject.java index aca13b0ea0f..2ccdab8b42c 100644 --- a/hotspot/test/runtime/ClassUnload/KeepAliveObject.java +++ b/hotspot/test/runtime/ClassUnload/KeepAliveObject.java @@ -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 @@ -25,10 +25,9 @@ * @test KeepAliveObject * @summary This test case uses a class instance to keep the class alive. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /runtime/testlibrary + * @library /test/lib /runtime/testlibrary * @library classes - * @build KeepAliveObject test.Empty - * @build ClassUnloadCommon + * @build sun.hotspot.WhiteBox test.Empty * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI KeepAliveObject diff --git a/hotspot/test/runtime/ClassUnload/KeepAliveSoftReference.java b/hotspot/test/runtime/ClassUnload/KeepAliveSoftReference.java index e6321a5ff5f..d28babb5fff 100644 --- a/hotspot/test/runtime/ClassUnload/KeepAliveSoftReference.java +++ b/hotspot/test/runtime/ClassUnload/KeepAliveSoftReference.java @@ -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 @@ -25,10 +25,9 @@ * @test KeepAliveSoftReference * @summary This test case uses a java.lang.ref.SoftReference referencing a class instance to keep a class alive. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /runtime/testlibrary + * @library /test/lib /runtime/testlibrary * @library classes - * @build KeepAliveSoftReference test.Empty - * @build ClassUnloadCommon + * @build sun.hotspot.WhiteBox test.Empty * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI KeepAliveSoftReference diff --git a/hotspot/test/runtime/ClassUnload/UnloadTest.java b/hotspot/test/runtime/ClassUnload/UnloadTest.java index eada2704506..e995f7ebd58 100644 --- a/hotspot/test/runtime/ClassUnload/UnloadTest.java +++ b/hotspot/test/runtime/ClassUnload/UnloadTest.java @@ -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,10 +24,9 @@ /* * @test UnloadTest * @modules java.base/jdk.internal.misc - * @library /runtime/testlibrary /testlibrary /test/lib + * @library /runtime/testlibrary /test/lib * @library classes - * @build ClassUnloadCommon test.Empty - * @build UnloadTest + * @build sun.hotspot.WhiteBox test.Empty * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI UnloadTest diff --git a/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java b/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java index 218b014e3ea..7728db2cc6a 100644 --- a/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java +++ b/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java @@ -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,12 +25,13 @@ * @test * @bug 8006298 * @summary Setting an invalid value for a bool argument should result in a useful error message - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class BooleanFlagWithInvalidValue { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java b/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java index de46967d7e5..75466353982 100644 --- a/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java +++ b/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java @@ -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,13 +25,15 @@ * @test * @bug 7167142 * @summary Warn if unused .hotspot_compiler file is present - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ import java.io.PrintWriter; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; public class CompilerConfigFileWarning { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/ConfigFileParsing.java b/hotspot/test/runtime/CommandLine/ConfigFileParsing.java index 870240a1876..3b08bf1a1a9 100644 --- a/hotspot/test/runtime/CommandLine/ConfigFileParsing.java +++ b/hotspot/test/runtime/CommandLine/ConfigFileParsing.java @@ -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,13 +25,14 @@ * @test ConfigFileParsing * @bug 7158804 * @summary Improve config file parsing - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ import java.io.PrintWriter; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class ConfigFileParsing { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/ConfigFileWarning.java b/hotspot/test/runtime/CommandLine/ConfigFileWarning.java index 6fcbde3651c..a189b95c0e4 100644 --- a/hotspot/test/runtime/CommandLine/ConfigFileWarning.java +++ b/hotspot/test/runtime/CommandLine/ConfigFileWarning.java @@ -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,13 +25,15 @@ * @test * @bug 7167142 * @summary Warn if unused .hotspot_rc file is present - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ import java.io.PrintWriter; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; public class ConfigFileWarning { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java index 336ebaf98ef..c7b605832c1 100644 --- a/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java +++ b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java @@ -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,12 +25,13 @@ * @test * @bug 8006298 * @summary Setting a flag to an invalid value should print a useful error message - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class FlagWithInvalidValue { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java b/hotspot/test/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java index 20766a2db03..9c73503995d 100644 --- a/hotspot/test/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java +++ b/hotspot/test/runtime/CommandLine/IgnoreUnrecognizedVMOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,14 +21,16 @@ * questions. */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; /* * @test * @bug 8129855 * @summary -XX:+IgnoreUnrecognizedVMOptions should work according to the spec from JDK-8129855 * - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main IgnoreUnrecognizedVMOptions diff --git a/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java index 1f0ed1539ec..b10f021cbe0 100644 --- a/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java +++ b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java @@ -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,12 +25,13 @@ * @test * @bug 8006298 * @summary Using a bool (+/-) prefix on non-bool flag should result in a useful error message - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class NonBooleanFlagWithInvalidBooleanPrefix { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java index f2401c778d4..0362f0a8c8f 100644 --- a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java +++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java @@ -26,10 +26,11 @@ * @bug 8060449 8073989 * @summary Newly obsolete command line options should still give useful error messages when used improperly. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class ObsoleteFlagErrorMessage { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java b/hotspot/test/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java index b1ff1eabedf..d15d536b751 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestJcmdOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @summary Verify jcmd error message for out-of-range value and for * value which is not allowed by constraint. Also check that * jcmd does not print an error message to the target process output. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * jdk.management @@ -35,8 +35,8 @@ import jdk.test.lib.Asserts; import jdk.test.lib.DynamicVMOption; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.dcmd.PidJcmdExecutor; public class TestJcmdOutput { diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java index 890ac26463d..303912d4e20 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java @@ -24,12 +24,11 @@ /* * @test * @summary Test VM Options with ranges - * @library /testlibrary /runtime/CommandLine/OptionsValidation/common + * @library /test/lib /runtime/CommandLine/OptionsValidation/common * @modules java.base/jdk.internal.misc * java.management * jdk.attach/sun.tools.attach * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* TestOptionsWithRanges * @run main/othervm/timeout=900 TestOptionsWithRanges */ diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java index 3c8453c7ab2..d5f20b5d4d2 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRangesDynamic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @summary Test writeable VM Options with ranges. - * @library /testlibrary /runtime/CommandLine/OptionsValidation/common + * @library /test/lib /runtime/CommandLine/OptionsValidation/common * @modules java.base/jdk.internal.misc * jdk.attach/sun.tools.attach * java.management diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java index 031d6a2cc64..b10ac75c56e 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java @@ -30,8 +30,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import jdk.test.lib.DynamicVMOption; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; import sun.tools.attach.HotSpotVirtualMachine; diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java index cfde0ee0e3d..3c694560e76 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java @@ -37,9 +37,9 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.StringTokenizer; import java.util.function.Predicate; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class JVMOptionsUtils { diff --git a/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java b/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java index 2fd472e2af7..d855a16ab67 100644 --- a/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java +++ b/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,16 @@ * @bug 8025692 * @modules java.base/jdk.internal.misc * java.management - * @library /testlibrary + * @library /test/lib * @compile TestLogTouchedMethods.java PrintTouchedMethods.java * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+LogTouchedMethods PrintTouchedMethods */ import java.io.File; import java.util.List; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class PrintTouchedMethods { diff --git a/hotspot/test/runtime/CommandLine/TestHexArguments.java b/hotspot/test/runtime/CommandLine/TestHexArguments.java index 43f63c8c0f5..9b22fdd5a33 100644 --- a/hotspot/test/runtime/CommandLine/TestHexArguments.java +++ b/hotspot/test/runtime/CommandLine/TestHexArguments.java @@ -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,13 +26,14 @@ * @bug 8042885 * @summary Make sure there is no error using hexadecimal format in vm options * @author Yumin Qi - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ import java.io.File; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestHexArguments { public static void main(String args[]) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/TestLongUnrecognizedVMOption.java b/hotspot/test/runtime/CommandLine/TestLongUnrecognizedVMOption.java index 3566e5936e2..dfca97c552c 100644 --- a/hotspot/test/runtime/CommandLine/TestLongUnrecognizedVMOption.java +++ b/hotspot/test/runtime/CommandLine/TestLongUnrecognizedVMOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,14 @@ * @test * @bug 8129786 * @summary Verify that JVM correctly processes very long unrecognized VM option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management * @run main TestLongUnrecognizedVMOption */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestLongUnrecognizedVMOption { diff --git a/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java b/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java index f40f941fedd..c6df7bb3fef 100644 --- a/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java +++ b/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java @@ -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 @@ -21,13 +21,14 @@ * questions. */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; /* * @test TestNullTerminatedFlags * @bug 6522873 * @summary Test that the VM don't allow random junk characters at the end of valid command line flags. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver TestNullTerminatedFlags diff --git a/hotspot/test/runtime/CommandLine/TestVMOptions.java b/hotspot/test/runtime/CommandLine/TestVMOptions.java index f16e744d9f5..5fd7d88aa0c 100644 --- a/hotspot/test/runtime/CommandLine/TestVMOptions.java +++ b/hotspot/test/runtime/CommandLine/TestVMOptions.java @@ -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 @@ -25,13 +25,14 @@ * @test * @bug 8060256 * @summary Test various command line options - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main TestVMOptions */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.io.File; public class TestVMOptions { diff --git a/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java b/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java index bdffccbc33f..c9d348abab1 100644 --- a/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java +++ b/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java @@ -25,12 +25,13 @@ * @test * @bug 8048933 * @summary TraceExceptions output should have the exception message - useful for ClassNotFoundExceptions especially - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TraceExceptionsTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java b/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java index 62477aaa0b2..5f30d752f1f 100644 --- a/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java +++ b/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java @@ -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,12 +25,13 @@ * @test * @bug 8006298 * @summary Using an unrecognized VM option should print the name of the option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class UnrecognizedVMOption { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/VMAliasOptions.java b/hotspot/test/runtime/CommandLine/VMAliasOptions.java index ee516b9e9d2..eae37477c08 100644 --- a/hotspot/test/runtime/CommandLine/VMAliasOptions.java +++ b/hotspot/test/runtime/CommandLine/VMAliasOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,8 @@ * questions. */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.*; /* @@ -29,7 +30,7 @@ import jdk.test.lib.cli.*; * @bug 8061611 * @summary Test that various alias options correctly set the target options. See aliased_jvm_flags in arguments.cpp. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ public class VMAliasOptions { diff --git a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java index 5ea7653b7b9..06f73568460 100644 --- a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java +++ b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java @@ -21,7 +21,8 @@ * questions. */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.cli.*; /* @@ -29,7 +30,7 @@ import jdk.test.lib.cli.*; * @bug 8066821 * @summary Test that various options are deprecated. See deprecated_jvm_flags in arguments.cpp. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ public class VMDeprecatedOptions { diff --git a/hotspot/test/runtime/CommandLine/VMOptionWarning.java b/hotspot/test/runtime/CommandLine/VMOptionWarning.java index 08d762de219..c9c6f2187bc 100644 --- a/hotspot/test/runtime/CommandLine/VMOptionWarning.java +++ b/hotspot/test/runtime/CommandLine/VMOptionWarning.java @@ -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 @@ -25,12 +25,14 @@ * @test * @bug 8027314 * @summary Warn if diagnostic or experimental vm option is used and -XX:+UnlockDiagnosticVMOptions or -XX:+UnlockExperimentalVMOptions, respectively, isn't specified. Warn if develop or notproduct vm option is used with product version of VM. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; public class VMOptionWarning { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java b/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java index 0049548897f..865fb9b8556 100644 --- a/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java +++ b/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8061999 8135195 8136552 * @summary Test "-XX:VMOptionsFile" VM option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules jdk.management * @run main TestVMOptionsFile @@ -52,8 +52,8 @@ import java.util.Properties; import java.util.Set; import jdk.test.lib.Asserts; import jdk.test.lib.DynamicVMOption; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestVMOptionsFile { diff --git a/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java index ea0dbc2ec8c..610840033e1 100644 --- a/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java +++ b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java @@ -25,12 +25,14 @@ * @test * @bug 8024927 * @summary Testing address of compressed class pointer space as best as possible. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CompressedClassPointers { diff --git a/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java b/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java index d53672091b2..b1d9f8b3d72 100644 --- a/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java +++ b/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java @@ -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 @@ -25,12 +25,14 @@ * @test * @bug 8022865 * @summary Tests for the -XX:CompressedClassSpaceSize command line option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main CompressedClassSpaceSize */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CompressedClassSpaceSize { diff --git a/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java b/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java index 2ff8b27f87f..2d2b08dd00a 100644 --- a/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java +++ b/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java @@ -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 @@ -26,12 +26,14 @@ * @bug 8000968 * @key regression * @summary NPG: UseCompressedClassPointers asserts with ObjectAlignmentInBytes=32 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CompressedKlassPointerAndOops { diff --git a/hotspot/test/runtime/CompressedOops/ObjectAlignment.java b/hotspot/test/runtime/CompressedOops/ObjectAlignment.java index 00cc071a497..90e0564dd74 100644 --- a/hotspot/test/runtime/CompressedOops/ObjectAlignment.java +++ b/hotspot/test/runtime/CompressedOops/ObjectAlignment.java @@ -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 @@ -25,12 +25,15 @@ * @test * @bug 8022865 * @summary Tests for the -XX:ObjectAlignmentInBytes command line option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main ObjectAlignment */ -import jdk.test.lib.*; + +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class ObjectAlignment { diff --git a/hotspot/test/runtime/CompressedOops/UseCompressedOops.java b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java index 7c43cda4e89..4753dc6f901 100644 --- a/hotspot/test/runtime/CompressedOops/UseCompressedOops.java +++ b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java @@ -25,7 +25,7 @@ * @test * @bug 8022865 * @summary Tests for different combination of UseCompressedOops options - * @library /testlibrary + * @library /test/lib * @ignore 8079353 * @modules java.base/jdk.internal.misc * java.management @@ -33,7 +33,9 @@ */ import java.util.ArrayList; import java.util.Collections; -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class UseCompressedOops { diff --git a/hotspot/test/runtime/ConstantPool/BadMethodHandles.java b/hotspot/test/runtime/ConstantPool/BadMethodHandles.java index 6345166e022..f0eb9b1cc74 100644 --- a/hotspot/test/runtime/ConstantPool/BadMethodHandles.java +++ b/hotspot/test/runtime/ConstantPool/BadMethodHandles.java @@ -25,7 +25,6 @@ * @test * @bug 8087223 * @summary Adding constantTag to keep method call consistent with it. - * @library /testlibrary * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/runtime/ConstantPool/IntfMethod.java b/hotspot/test/runtime/ConstantPool/IntfMethod.java index 9602ff59979..f0a1dacc977 100644 --- a/hotspot/test/runtime/ConstantPool/IntfMethod.java +++ b/hotspot/test/runtime/ConstantPool/IntfMethod.java @@ -25,7 +25,6 @@ * @test * $bug 8087223 * @summary Adding constantTag to keep method call consistent with it. - * @library /testlibrary * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java index ccd0bd420d7..b5d58911298 100644 --- a/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java +++ b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java @@ -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 * @bug 8044738 - * @library /testlibrary + * @library /test/lib * @summary Check attribute_length of EnclosingMethod attribute * @modules java.base/jdk.internal.misc * java.management @@ -32,7 +32,8 @@ */ import java.io.File; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class EnclMethodAttr { diff --git a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java index e4f0f94bdb2..b6a7d1311a2 100644 --- a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java +++ b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,16 +23,18 @@ /* * @test - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* * @run driver CreateCoredumpOnCrash */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; public class CreateCoredumpOnCrash { diff --git a/hotspot/test/runtime/ErrorHandling/ErrorHandler.java b/hotspot/test/runtime/ErrorHandling/ErrorHandler.java index ba5cdbc7ab9..26882f59d61 100644 --- a/hotspot/test/runtime/ErrorHandling/ErrorHandler.java +++ b/hotspot/test/runtime/ErrorHandling/ErrorHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,11 +28,13 @@ * @summary Exercise HotSpot error handling code by invoking java with * -XX:ErrorHandlerTest option to cause an error report. Check the results. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @run driver ErrorHandler */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class ErrorHandler { diff --git a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java index 3ee548d2575..768ffae1994 100644 --- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java +++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java @@ -25,19 +25,19 @@ * @test * @bug 8050167 * @summary Test that error is not occurred during printing problematic frame - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* * @run driver ProblematicFrameTest */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; -import jdk.test.lib.Utils; public class ProblematicFrameTest { private static class Crasher { diff --git a/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java b/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java index c34e56a49a4..3cfd80166a2 100644 --- a/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java +++ b/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,16 +27,16 @@ import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.regex.Pattern; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; /* * @test * @bug 8074552 * @summary SafeFetch32 and SafeFetchN do not work in error handling * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @author Thomas Stuefe (SAP) */ diff --git a/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java b/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java index d82274ab3f2..65e1b7218de 100644 --- a/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java +++ b/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java @@ -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 @@ -26,7 +26,7 @@ * @test * @bug 8065896 * @summary Synchronous signals during error reporting may terminate or hang VM process - * @library /testlibrary + * @library /test/lib * @author Thomas Stuefe (SAP) * @modules java.base/jdk.internal.misc * java.management @@ -38,9 +38,9 @@ import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.regex.Pattern; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class SecondaryErrorTest { diff --git a/hotspot/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java b/hotspot/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java index d658401de68..38d50e488f4 100644 --- a/hotspot/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java +++ b/hotspot/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,13 @@ * @test TestCrashOnOutOfMemoryError * @summary Test using -XX:+CrashOnOutOfMemoryError * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.* + * @library /test/lib * @run driver TestCrashOnOutOfMemoryError * @bug 8138745 */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; diff --git a/hotspot/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java b/hotspot/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java index 79d064f6df8..34faa87a9d1 100644 --- a/hotspot/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java +++ b/hotspot/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,13 @@ * @test TestExitOnOutOfMemoryError * @summary Test using -XX:ExitOnOutOfMemoryError * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.* + * @library /test/lib * @run driver TestExitOnOutOfMemoryError * @bug 8138745 */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestExitOnOutOfMemoryError { diff --git a/hotspot/test/runtime/ErrorHandling/TestOnError.java b/hotspot/test/runtime/ErrorHandling/TestOnError.java index 4fa5c44c32b..e1dcf38714d 100644 --- a/hotspot/test/runtime/ErrorHandling/TestOnError.java +++ b/hotspot/test/runtime/ErrorHandling/TestOnError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,14 @@ * @test TestOnError * @summary Test using -XX:OnError= * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build TestOnError + * @library /test/lib * @run main TestOnError * @bug 8078470 */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; public class TestOnError { diff --git a/hotspot/test/runtime/ErrorHandling/TestOnOutOfMemoryError.java b/hotspot/test/runtime/ErrorHandling/TestOnOutOfMemoryError.java index c81cab5e699..a2302e25801 100644 --- a/hotspot/test/runtime/ErrorHandling/TestOnOutOfMemoryError.java +++ b/hotspot/test/runtime/ErrorHandling/TestOnOutOfMemoryError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,13 @@ * @test TestOnOutOfMemoryError * @summary Test using -XX:OnOutOfMemoryError= * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build TestOnOutOfMemoryError + * @library /test/lib * @run main TestOnOutOfMemoryError * @bug 8078470 */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestOnOutOfMemoryError { diff --git a/hotspot/test/runtime/Final/TestPutMain.java b/hotspot/test/runtime/Final/TestPutMain.java index 601a6dbad3b..bfdfdda94e6 100644 --- a/hotspot/test/runtime/Final/TestPutMain.java +++ b/hotspot/test/runtime/Final/TestPutMain.java @@ -26,7 +26,7 @@ * @test * @bug 8160527 * @summary The VM does not always perform checks added by 8157181 when updating final instance fields - * @library /testlibrary + * @library /test/lib * @compile TestPutField.jasm * @compile TestPutStatic.jasm * @compile TestPutMain.java diff --git a/hotspot/test/runtime/LoadClass/LoadClassNegative.java b/hotspot/test/runtime/LoadClass/LoadClassNegative.java index 08bd4dad6b5..8282f6a40bc 100644 --- a/hotspot/test/runtime/LoadClass/LoadClassNegative.java +++ b/hotspot/test/runtime/LoadClass/LoadClassNegative.java @@ -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 @@ -26,16 +26,16 @@ * @key regression * @bug 8020675 * @summary make sure there is no fatal error if a class is loaded from an invalid jar file which is in the bootclasspath - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @build TestForName - * @build LoadClassNegative * @run main LoadClassNegative */ import java.io.File; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class LoadClassNegative { diff --git a/hotspot/test/runtime/LocalVariableTable/TestLVT.java b/hotspot/test/runtime/LocalVariableTable/TestLVT.java index 42ad0b777c7..7c1ff98e1df 100644 --- a/hotspot/test/runtime/LocalVariableTable/TestLVT.java +++ b/hotspot/test/runtime/LocalVariableTable/TestLVT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,15 @@ * @test * @bug 8049632 * @summary Test ClassFileParser::copy_localvariable_table cases - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @compile -g -XDignore.symbol.file TestLVT.java * @run main TestLVT */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.util.*; public class TestLVT { diff --git a/hotspot/test/runtime/Metaspace/FragmentMetaspace.java b/hotspot/test/runtime/Metaspace/FragmentMetaspace.java index acd64cd3e25..47282a4c7a2 100644 --- a/hotspot/test/runtime/Metaspace/FragmentMetaspace.java +++ b/hotspot/test/runtime/Metaspace/FragmentMetaspace.java @@ -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 @@ -26,7 +26,6 @@ * @library /runtime/testlibrary * @modules java.base/jdk.internal.misc * @modules java.compiler - * @build GeneratedClassLoader * @run main/othervm/timeout=200 -Xmx300m FragmentMetaspace */ diff --git a/hotspot/test/runtime/MinimalVM/CDS.java b/hotspot/test/runtime/MinimalVM/CDS.java new file mode 100644 index 00000000000..e166d961fac --- /dev/null +++ b/hotspot/test/runtime/MinimalVM/CDS.java @@ -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. + */ + +/* + * @test + * @requires vm.flavor == "minimal" + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @run driver CDS + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class CDS { + + public static void main(String args[]) throws Exception { + ProcessBuilder pb; + + pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:dump"); + new OutputAnalyzer(pb.start()) + .shouldContain("Shared spaces are not supported in this VM") + .shouldHaveExitValue(1); + + pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:on"); + new OutputAnalyzer(pb.start()) + .shouldContain("Shared spaces are not supported in this VM") + .shouldHaveExitValue(1); + + pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xshare:auto", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("Shared spaces are not supported in this VM") + .shouldHaveExitValue(0); + } +} diff --git a/hotspot/test/runtime/MinimalVM/CheckJNI.java b/hotspot/test/runtime/MinimalVM/CheckJNI.java new file mode 100644 index 00000000000..14219653574 --- /dev/null +++ b/hotspot/test/runtime/MinimalVM/CheckJNI.java @@ -0,0 +1,43 @@ +/* + * 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 vm.flavor == "minimal" + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @run driver CheckJNI + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class CheckJNI { + + public static void main(String args[]) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xcheck:jni", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("Minimal VM warning: JNI CHECKING is not supported in this VM") + .shouldHaveExitValue(0); + } +} diff --git a/hotspot/test/runtime/MinimalVM/Instrumentation.java b/hotspot/test/runtime/MinimalVM/Instrumentation.java new file mode 100644 index 00000000000..c5c56cead35 --- /dev/null +++ b/hotspot/test/runtime/MinimalVM/Instrumentation.java @@ -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 + * @library /test/lib + * @requires vm.flavor == "minimal" + * @modules java.base/jdk.internal.misc + * java.instrument + * @run driver Instrumentation + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class Instrumentation { + + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-minimal", "-javaagent:redefineagent.jar", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("Instrumentation agents are not supported in this VM") + .shouldHaveExitValue(1); + } +} diff --git a/hotspot/test/runtime/MinimalVM/JMX.java b/hotspot/test/runtime/MinimalVM/JMX.java new file mode 100644 index 00000000000..e57325ebaa7 --- /dev/null +++ b/hotspot/test/runtime/MinimalVM/JMX.java @@ -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. + */ + +/* + * @test + * @requires vm.flavor == "minimal" + * @library /test/lib + * @run main/othervm JMX + */ + +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class JMX { + + public static void main(String args[]) throws Exception { + ProcessBuilder pb; + + pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:+ManagementServer", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("ManagementServer is not supported in this VM.") + .shouldHaveExitValue(1); + + pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Dcom.sun.management ", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("-Dcom.sun.management is not supported in this VM.") + .shouldHaveExitValue(1); + + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), Long.toString(ProcessTools.getProcessId()), "VM.print_threads"}); + new OutputAnalyzer(pb.start()) + .shouldContain("Could not find any processes matching ") + .shouldHaveExitValue(1); + } +} diff --git a/hotspot/test/testlibrary/jdk/test/lib/OutputBuffer.java b/hotspot/test/runtime/MinimalVM/JVMTI.java similarity index 52% rename from hotspot/test/testlibrary/jdk/test/lib/OutputBuffer.java rename to hotspot/test/runtime/MinimalVM/JVMTI.java index 31ad53b6b56..ef3f481d15d 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/OutputBuffer.java +++ b/hotspot/test/runtime/MinimalVM/JVMTI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,44 +21,27 @@ * questions. */ -package jdk.test.lib; - -/** - * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} +/* + * @test + * @requires vm.flavor == "minimal" + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @run driver JVMTI */ -@Deprecated -public class OutputBuffer { - private final String stdout; - private final String stderr; - /** - * Create an OutputBuffer, a class for storing and managing stdout and stderr - * results separately - * - * @param stdout stdout result - * @param stderr stderr result - */ - public OutputBuffer(String stdout, String stderr) { - this.stdout = stdout; - this.stderr = stderr; - } +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; - /** - * Returns the stdout result - * - * @return stdout result - */ - public String getStdout() { - return stdout; - } +public class JVMTI { - /** - * Returns the stderr result - * - * @return stderr result - */ - public String getStderr() { - return stderr; - } + public static void main(String args[]) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-minimal", + "-agentlib:jdwp=server=y,transport=dt_socket,address=5000,suspend=n", + "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("Debugging agents are not supported in this VM") + .shouldHaveExitValue(1); + + } } diff --git a/hotspot/test/runtime/MinimalVM/NMT.java b/hotspot/test/runtime/MinimalVM/NMT.java new file mode 100644 index 00000000000..815fa6d0195 --- /dev/null +++ b/hotspot/test/runtime/MinimalVM/NMT.java @@ -0,0 +1,57 @@ +/* + * 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 vm.flavor == "minimal" + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @run driver NMT + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class NMT { + + public static void main(String args[]) throws Exception { + ProcessBuilder pb; + + pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=detail", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("Native Memory Tracking is not supported in this VM") + .shouldHaveExitValue(1); + + pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=summary", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("Native Memory Tracking is not supported in this VM") + .shouldHaveExitValue(1); + + pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:NativeMemoryTracking=off", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("Native Memory Tracking is not supported in this VM") + .shouldHaveExitValue(1); + + + } +} diff --git a/hotspot/test/runtime/MinimalVM/Xprof.java b/hotspot/test/runtime/MinimalVM/Xprof.java new file mode 100644 index 00000000000..dd3e337cc66 --- /dev/null +++ b/hotspot/test/runtime/MinimalVM/Xprof.java @@ -0,0 +1,44 @@ +/* + * 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 vm.flavor == "minimal" + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @run driver Xprof + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class Xprof { + + public static void main(String args[]) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xprof", "-version"); + new OutputAnalyzer(pb.start()) + .shouldContain("Flat profiling is not supported in this VM.") + .shouldHaveExitValue(1); + + } +} diff --git a/hotspot/test/runtime/NMT/AutoshutdownNMT.java b/hotspot/test/runtime/NMT/AutoshutdownNMT.java index 90a02ff2bd3..d07103e810c 100644 --- a/hotspot/test/runtime/NMT/AutoshutdownNMT.java +++ b/hotspot/test/runtime/NMT/AutoshutdownNMT.java @@ -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 @@ -25,12 +25,13 @@ * @test * @key nmt * @summary Test for deprecated message if -XX:-AutoShutdownNMT is specified - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class AutoshutdownNMT { diff --git a/hotspot/test/runtime/NMT/BaselineWithParameter.java b/hotspot/test/runtime/NMT/BaselineWithParameter.java index b4982116fc2..cc7db563d99 100644 --- a/hotspot/test/runtime/NMT/BaselineWithParameter.java +++ b/hotspot/test/runtime/NMT/BaselineWithParameter.java @@ -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 @@ -26,13 +26,15 @@ * @bug 8004802 * @key nmt jcmd regression * @summary Regression test for invoking a jcmd with baseline=false, result was that the target VM crashed - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:NativeMemoryTracking=detail BaselineWithParameter */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class BaselineWithParameter { diff --git a/hotspot/test/runtime/NMT/ChangeTrackingLevel.java b/hotspot/test/runtime/NMT/ChangeTrackingLevel.java index e7905480665..f10493a4d13 100644 --- a/hotspot/test/runtime/NMT/ChangeTrackingLevel.java +++ b/hotspot/test/runtime/NMT/ChangeTrackingLevel.java @@ -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 @@ -27,14 +27,13 @@ * @summary Test that you can decrease NMT tracking level but not increase it. * @key nmt * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build ChangeTrackingLevel + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ChangeTrackingLevel */ -import jdk.test.lib.*; import sun.hotspot.WhiteBox; public class ChangeTrackingLevel { diff --git a/hotspot/test/runtime/NMT/CheckForProperDetailStackTrace.java b/hotspot/test/runtime/NMT/CheckForProperDetailStackTrace.java index 7936a9b7253..c053f660e9e 100644 --- a/hotspot/test/runtime/NMT/CheckForProperDetailStackTrace.java +++ b/hotspot/test/runtime/NMT/CheckForProperDetailStackTrace.java @@ -25,12 +25,14 @@ * @test * @key nmt * @summary Running with NMT detail should produce expected stack traces. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/hotspot/test/runtime/NMT/CommandLineDetail.java b/hotspot/test/runtime/NMT/CommandLineDetail.java index 70d914a53b2..9999ed66a5e 100644 --- a/hotspot/test/runtime/NMT/CommandLineDetail.java +++ b/hotspot/test/runtime/NMT/CommandLineDetail.java @@ -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,12 +25,13 @@ * @test * @key nmt * @summary Running with NMT detail should not result in an error - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CommandLineDetail { diff --git a/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java b/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java index 510c0024f29..d4cb23f53d5 100644 --- a/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java +++ b/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java @@ -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,12 +25,13 @@ * @test * @key nmt * @summary Empty argument to NMT should result in an informative error message - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CommandLineEmptyArgument { diff --git a/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java b/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java index 985e8e49dd1..53e751b5c08 100644 --- a/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java +++ b/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java @@ -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,12 +25,13 @@ * @test * @key nmt * @summary Invalid argument to NMT should result in an informative error message - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CommandLineInvalidArgument { diff --git a/hotspot/test/runtime/NMT/CommandLineSummary.java b/hotspot/test/runtime/NMT/CommandLineSummary.java index 67198395657..7017a3bb7e3 100644 --- a/hotspot/test/runtime/NMT/CommandLineSummary.java +++ b/hotspot/test/runtime/NMT/CommandLineSummary.java @@ -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,12 +25,13 @@ * @test * @key nmt * @summary Running with NMT summary should not result in an error - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CommandLineSummary { diff --git a/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java b/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java index 33893080957..46b219cee99 100644 --- a/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java +++ b/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java @@ -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,12 +25,13 @@ * @test * @key nmt * @summary Turning off NMT should not result in an error - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CommandLineTurnOffNMT { diff --git a/hotspot/test/runtime/NMT/CommitOverlappingRegions.java b/hotspot/test/runtime/NMT/CommitOverlappingRegions.java index 773378ce7e8..8e1b6ddbbcd 100644 --- a/hotspot/test/runtime/NMT/CommitOverlappingRegions.java +++ b/hotspot/test/runtime/NMT/CommitOverlappingRegions.java @@ -25,16 +25,18 @@ * @test * @summary Test commits of overlapping regions of memory. * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build CommitOverlappingRegions + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail CommitOverlappingRegions */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; public class CommitOverlappingRegions { diff --git a/hotspot/test/runtime/NMT/JcmdBaselineDetail.java b/hotspot/test/runtime/NMT/JcmdBaselineDetail.java index 1318dc339e3..91b033c2fac 100644 --- a/hotspot/test/runtime/NMT/JcmdBaselineDetail.java +++ b/hotspot/test/runtime/NMT/JcmdBaselineDetail.java @@ -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 @@ -25,13 +25,15 @@ * @test * @key nmt jcmd * @summary Verify that jcmd correctly reports that baseline succeeds with NMT enabled with detailed tracking. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:NativeMemoryTracking=detail JcmdBaselineDetail */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class JcmdBaselineDetail { diff --git a/hotspot/test/runtime/NMT/JcmdDetailDiff.java b/hotspot/test/runtime/NMT/JcmdDetailDiff.java index 962afd155f1..d149a83ae80 100644 --- a/hotspot/test/runtime/NMT/JcmdDetailDiff.java +++ b/hotspot/test/runtime/NMT/JcmdDetailDiff.java @@ -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 @@ -25,15 +25,17 @@ * @test * @summary run NMT baseline, allocate memory and verify output from detail.diff * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build JcmdDetailDiff + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail JcmdDetailDiff */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/NMT/JcmdScale.java b/hotspot/test/runtime/NMT/JcmdScale.java index b8d8e5686e2..c155a08e7cd 100644 --- a/hotspot/test/runtime/NMT/JcmdScale.java +++ b/hotspot/test/runtime/NMT/JcmdScale.java @@ -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,13 +25,15 @@ * @test * @key nmt jcmd * @summary Test the NMT scale parameter - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:NativeMemoryTracking=summary JcmdScale */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class JcmdScale { diff --git a/hotspot/test/runtime/NMT/JcmdScaleDetail.java b/hotspot/test/runtime/NMT/JcmdScaleDetail.java index 27cb8c8dc47..77f44b2c3e6 100644 --- a/hotspot/test/runtime/NMT/JcmdScaleDetail.java +++ b/hotspot/test/runtime/NMT/JcmdScaleDetail.java @@ -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 @@ -25,13 +25,15 @@ * @test * @key nmt jcmd * @summary Test the NMT scale parameter with detail tracking level - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:NativeMemoryTracking=detail JcmdScaleDetail */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class JcmdScaleDetail { diff --git a/hotspot/test/runtime/NMT/JcmdSummaryDiff.java b/hotspot/test/runtime/NMT/JcmdSummaryDiff.java index 2c0b39cf77d..005f14d5ce6 100644 --- a/hotspot/test/runtime/NMT/JcmdSummaryDiff.java +++ b/hotspot/test/runtime/NMT/JcmdSummaryDiff.java @@ -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 @@ -25,15 +25,17 @@ * @test * @summary run NMT baseline, allocate memory and verify output from summary.diff * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build JcmdSummaryDiff + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=summary JcmdSummaryDiff */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java b/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java index 40818656b8f..8df6da85a89 100644 --- a/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java +++ b/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java @@ -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,13 +25,15 @@ * @test * @key nmt jcmd * @summary Verify that jcmd correctly reports that NMT is not enabled - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main JcmdWithNMTDisabled 1 */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class JcmdWithNMTDisabled { static ProcessBuilder pb = new ProcessBuilder(); diff --git a/hotspot/test/runtime/NMT/MallocRoundingReportTest.java b/hotspot/test/runtime/NMT/MallocRoundingReportTest.java index b5ff6dda485..0dbb96fbc0d 100644 --- a/hotspot/test/runtime/NMT/MallocRoundingReportTest.java +++ b/hotspot/test/runtime/NMT/MallocRoundingReportTest.java @@ -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 @@ -25,16 +25,18 @@ * @test * @summary Test consistency of NMT by creating allocations of the Test type with various sizes and verifying visibility with jcmd * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build MallocRoundingReportTest + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocRoundingReportTest * */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java index 3bb39aa0afe..804c7b27f77 100644 --- a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java +++ b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java @@ -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 @@ -27,13 +27,15 @@ * @requires sun.arch.data.model == "32" * @key nmt jcmd stress * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build MallocSiteHashOverflow + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow */ -import jdk.test.lib.*; +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.WhiteBox; public class MallocSiteHashOverflow { diff --git a/hotspot/test/runtime/NMT/MallocStressTest.java b/hotspot/test/runtime/NMT/MallocStressTest.java index 8d7061f7ce2..b63166c0cda 100644 --- a/hotspot/test/runtime/NMT/MallocStressTest.java +++ b/hotspot/test/runtime/NMT/MallocStressTest.java @@ -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 @@ -25,10 +25,10 @@ * @test * @summary Stress test for malloc tracking * @key nmt jcmd stress - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build MallocStressTest + * @build sun.hotspot.WhiteBox * @ignore - This test is disabled since it will stress NMT and timeout during normal testing * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocStressTest @@ -38,7 +38,10 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.ArrayList; import java.util.List; import java.util.Random; -import jdk.test.lib.*; +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.WhiteBox; public class MallocStressTest { diff --git a/hotspot/test/runtime/NMT/MallocTestType.java b/hotspot/test/runtime/NMT/MallocTestType.java index 3ee5e481a01..624ec8dd8ce 100644 --- a/hotspot/test/runtime/NMT/MallocTestType.java +++ b/hotspot/test/runtime/NMT/MallocTestType.java @@ -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,16 +25,18 @@ * @test * @summary Test consistency of NMT by leaking a few select allocations of the Test type and then verify visibility with jcmd * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build MallocTestType + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocTestType */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; public class MallocTestType { diff --git a/hotspot/test/runtime/NMT/MallocTrackingVerify.java b/hotspot/test/runtime/NMT/MallocTrackingVerify.java index 0a77bd25bd4..d7ffdd28e31 100644 --- a/hotspot/test/runtime/NMT/MallocTrackingVerify.java +++ b/hotspot/test/runtime/NMT/MallocTrackingVerify.java @@ -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,10 +26,10 @@ * @bug 8054836 * @summary Test to verify correctness of malloc tracking * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build MallocTrackingVerify + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocTrackingVerify * @@ -38,7 +38,9 @@ import java.util.ArrayList; import java.util.Random; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/NMT/NMTWithCDS.java b/hotspot/test/runtime/NMT/NMTWithCDS.java index a4a409a0dd5..2df23514610 100644 --- a/hotspot/test/runtime/NMT/NMTWithCDS.java +++ b/hotspot/test/runtime/NMT/NMTWithCDS.java @@ -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 @@ -25,12 +25,13 @@ * @test * @bug 8055061 * @key nmt - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main NMTWithCDS */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class NMTWithCDS { diff --git a/hotspot/test/runtime/NMT/PrintNMTStatistics.java b/hotspot/test/runtime/NMT/PrintNMTStatistics.java index 11138ec0d48..93dfd571496 100644 --- a/hotspot/test/runtime/NMT/PrintNMTStatistics.java +++ b/hotspot/test/runtime/NMT/PrintNMTStatistics.java @@ -27,10 +27,11 @@ * @bug 8005936 8058606 * @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class PrintNMTStatistics { diff --git a/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java b/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java index 311d834bb4c..727085c57b3 100644 --- a/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java +++ b/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java @@ -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,12 +25,13 @@ * @test * @key nmt * @summary Trying to enable PrintNMTStatistics should result in a warning - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class PrintNMTStatisticsWithNMTDisabled { diff --git a/hotspot/test/runtime/NMT/ReleaseCommittedMemory.java b/hotspot/test/runtime/NMT/ReleaseCommittedMemory.java index c67b6227754..6893c2e432e 100644 --- a/hotspot/test/runtime/NMT/ReleaseCommittedMemory.java +++ b/hotspot/test/runtime/NMT/ReleaseCommittedMemory.java @@ -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 @@ -27,8 +27,8 @@ * @summary Release committed memory and make sure NMT handles it correctly * @key nmt regression * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build ReleaseCommittedMemory + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ReleaseCommittedMemory diff --git a/hotspot/test/runtime/NMT/ReleaseNoCommit.java b/hotspot/test/runtime/NMT/ReleaseNoCommit.java index 0d354115b06..b5e61e10144 100644 --- a/hotspot/test/runtime/NMT/ReleaseNoCommit.java +++ b/hotspot/test/runtime/NMT/ReleaseNoCommit.java @@ -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 @@ -25,17 +25,17 @@ * @test * @summary Release uncommitted memory and make sure NMT handles it correctly * @key nmt regression - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build ReleaseNoCommit + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=summary ReleaseNoCommit */ import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/NMT/ShutdownTwice.java b/hotspot/test/runtime/NMT/ShutdownTwice.java index d0a7c7777e4..fe312457b8f 100644 --- a/hotspot/test/runtime/NMT/ShutdownTwice.java +++ b/hotspot/test/runtime/NMT/ShutdownTwice.java @@ -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,13 +25,15 @@ * @test * @key nmt jcmd * @summary Run shutdown twice - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:NativeMemoryTracking=detail ShutdownTwice */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class ShutdownTwice { diff --git a/hotspot/test/runtime/NMT/SummaryAfterShutdown.java b/hotspot/test/runtime/NMT/SummaryAfterShutdown.java index aec1a808576..42d57da0ffa 100644 --- a/hotspot/test/runtime/NMT/SummaryAfterShutdown.java +++ b/hotspot/test/runtime/NMT/SummaryAfterShutdown.java @@ -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,13 +25,15 @@ * @test * @key nmt jcmd * @summary Verify that jcmd correctly reports that NMT is not enabled after a shutdown - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:NativeMemoryTracking=detail SummaryAfterShutdown */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class SummaryAfterShutdown { diff --git a/hotspot/test/runtime/NMT/SummarySanityCheck.java b/hotspot/test/runtime/NMT/SummarySanityCheck.java index 511596bb61d..174d710af2c 100644 --- a/hotspot/test/runtime/NMT/SummarySanityCheck.java +++ b/hotspot/test/runtime/NMT/SummarySanityCheck.java @@ -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,16 +25,18 @@ * @test * @key nmt jcmd * @summary Sanity check the output of NMT - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build SummarySanityCheck + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+WhiteBoxAPI SummarySanityCheck */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/hotspot/test/runtime/NMT/ThreadedMallocTestType.java b/hotspot/test/runtime/NMT/ThreadedMallocTestType.java index 2fee0c79f73..76050204600 100644 --- a/hotspot/test/runtime/NMT/ThreadedMallocTestType.java +++ b/hotspot/test/runtime/NMT/ThreadedMallocTestType.java @@ -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 @@ -24,16 +24,18 @@ /* * @test * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build ThreadedMallocTestType + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ThreadedMallocTestType */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; public class ThreadedMallocTestType { diff --git a/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java b/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java index 1611b6f345d..5513cddc12a 100644 --- a/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java +++ b/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java @@ -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 @@ -24,16 +24,18 @@ /* * @test * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build ThreadedVirtualAllocTestType + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ThreadedVirtualAllocTestType */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; public class ThreadedVirtualAllocTestType { diff --git a/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java b/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java index dabdcd443a2..f1cc44265fd 100644 --- a/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java +++ b/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java @@ -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 @@ -25,16 +25,18 @@ * @test * @summary Test reserve/commit/uncommit/release of virtual memory and that we track it correctly * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build VirtualAllocCommitUncommitRecommit + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail VirtualAllocCommitUncommitRecommit * */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/NMT/VirtualAllocTestType.java b/hotspot/test/runtime/NMT/VirtualAllocTestType.java index da611ab8b29..31722d3accd 100644 --- a/hotspot/test/runtime/NMT/VirtualAllocTestType.java +++ b/hotspot/test/runtime/NMT/VirtualAllocTestType.java @@ -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,16 +25,18 @@ * @test * @summary Test Reserve/Commit/Uncommit/Release of virtual memory and that we track it correctly * @key nmt jcmd - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build VirtualAllocTestType + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail VirtualAllocTestType */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import sun.hotspot.WhiteBox; public class VirtualAllocTestType { diff --git a/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java b/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java index 512dbc9914e..e136be8377c 100644 --- a/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java +++ b/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java @@ -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 @@ -25,7 +25,7 @@ * @test * @bug 8030955 * @summary Allow multiple calls to PerfMemory::destroy() without asserting. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main PerfMemDestroy @@ -33,7 +33,8 @@ import java.io.File; import java.util.Map; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class PerfMemDestroy { public static void main(String args[]) throws Throwable { diff --git a/hotspot/test/runtime/RedefineObject/TestRedefineObject.java b/hotspot/test/runtime/RedefineObject/TestRedefineObject.java index 9ebee649217..1b50e0efbb8 100644 --- a/hotspot/test/runtime/RedefineObject/TestRedefineObject.java +++ b/hotspot/test/runtime/RedefineObject/TestRedefineObject.java @@ -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 @@ -21,7 +21,10 @@ * questions. */ import java.io.PrintWriter; -import jdk.test.lib.*; + +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; /* * Test to redefine java/lang/Object and verify that it doesn't crash on vtable @@ -32,14 +35,14 @@ import jdk.test.lib.*; * @test * @bug 8005056 * @bug 8009728 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.instrument * java.management * @build Agent * @run main ClassFileInstaller Agent * @run main TestRedefineObject - * @run main/othervm -javaagent:agent.jar -XX:TraceRedefineClasses=5 Agent + * @run main/othervm -javaagent:agent.jar -Xlog:redefine+class+load=debug,redefine+class+timer=info Agent */ public class TestRedefineObject { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/RedefineTests/ModifyAnonymous.java b/hotspot/test/runtime/RedefineTests/ModifyAnonymous.java new file mode 100644 index 00000000000..700a8f04e93 --- /dev/null +++ b/hotspot/test/runtime/RedefineTests/ModifyAnonymous.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @library /test/lib + * @summary Test that retransforming and redefining anonymous classes gets UnmodifiableClassException + * @modules java.base/jdk.internal.misc + * @modules java.instrument + * jdk.jartool/sun.tools.jar + * @run main ModifyAnonymous buildagent + * @run main/othervm -javaagent:redefineagent.jar ModifyAnonymous + */ + +import java.io.FileNotFoundException; +import java.io.PrintWriter; +import java.lang.NoSuchFieldException; +import java.lang.NoSuchMethodException; +import java.lang.RuntimeException; +import java.lang.instrument.ClassDefinition; +import java.lang.instrument.ClassFileTransformer; +import java.lang.instrument.IllegalClassFormatException; +import java.lang.instrument.Instrumentation; +import java.security.ProtectionDomain; +import jdk.test.lib.*; + +public class ModifyAnonymous { + + public static class LambdaTransformer implements ClassFileTransformer { + @Override + public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined, + ProtectionDomain protectionDomain, byte[] classfileBuffer) + throws IllegalClassFormatException { + return null; + } + } + + static Instrumentation inst = null; + static volatile boolean done = false; + + public static void premain(String args, Instrumentation instrumentation) { + + inst = instrumentation; + System.out.println("javaagent in da house!"); + instrumentation.addTransformer(new LambdaTransformer()); + } + + private static void buildAgent() { + try { + ClassFileInstaller.main("ModifyAnonymous"); + } catch (Exception e) { + throw new RuntimeException("Could not write agent classfile", e); + } + + try { + PrintWriter pw = new PrintWriter("MANIFEST.MF"); + pw.println("Premain-Class: ModifyAnonymous"); + pw.println("Agent-Class: ModifyAnonymous"); + pw.println("Can-Retransform-Classes: true"); + pw.println("Can-Redefine-Classes: true"); + pw.close(); + } catch (FileNotFoundException e) { + throw new RuntimeException("Could not write manifest file for the agent", e); + } + + sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar"); + if (!jarTool.run(new String[] { "-cmf", "MANIFEST.MF", "redefineagent.jar", "ModifyAnonymous.class" })) { + throw new RuntimeException("Could not write the agent jar file"); + } + } + + public static class InstanceMethodCallSiteApp { + + public static void test() throws InterruptedException { + for (int i = 0; i < 2; i++) { + InstanceMethodCallSiteApp app = new InstanceMethodCallSiteApp(); + Runnable r = app::doWork; // this creates an anonymous class + while (!done) { + r.run(); + Thread.sleep(10); + } + } + } + + public void doWork() { + System.out.print("."); + } + } + + static void runTest() { + while (!done) { + Class[] allLoadedClasses = inst.getAllLoadedClasses(); + for (Class clazz : allLoadedClasses) { + final String name = clazz.getName(); + if (name.contains("$$Lambda$") && name.contains("App")) { + if (inst.isModifiableClass(clazz)) { + throw new RuntimeException ("Class should not be modifiable"); + } + // Try to modify them anyway. + try { + System.out.println("retransform called for " + name); + inst.retransformClasses(clazz); + } catch(java.lang.instrument.UnmodifiableClassException t) { + System.out.println("PASSED: expecting UnmodifiableClassException"); + t.printStackTrace(); + } + try { + System.out.println("redefine called for " + name); + String newclass = "class Dummy {}"; + byte[] bytecode = InMemoryJavaCompiler.compile("Dummy", newclass); + ClassDefinition cld = new ClassDefinition(clazz, bytecode); + inst.redefineClasses(new ClassDefinition[] { cld }); + } catch(java.lang.instrument.UnmodifiableClassException t) { + System.out.println("PASSED: expecting UnmodifiableClassException"); + t.printStackTrace(); + } catch(java.lang.ClassNotFoundException e) { + throw new RuntimeException ("ClassNotFoundException thrown"); + } + done = true; + } + } + } + } + + public static void main(String argv[]) throws InterruptedException, RuntimeException { + if (argv.length == 1 && argv[0].equals("buildagent")) { + buildAgent(); + return; + } + + if (inst == null) { + throw new RuntimeException("Instrumentation object was null"); + } + + new Thread() { + public void run() { + runTest(); + } + }.start(); + + // Test that NCDFE is not thrown for anonymous class: + // ModifyAnonymous$InstanceMethodCallSiteApp$$Lambda$18 + try { + ModifyAnonymous test = new ModifyAnonymous(); + InstanceMethodCallSiteApp.test(); + } catch (NoClassDefFoundError e) { + throw new RuntimeException("FAILED: NoClassDefFoundError thrown for " + e.getMessage()); + } + System.out.println("PASSED: NoClassDefFound error not thrown"); + } +} diff --git a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java index cfe4c97fae8..cd2cf685fa1 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java +++ b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java @@ -23,7 +23,7 @@ /* * @test - * @library /testlibrary + * @library /test/lib * @summary Test that type annotations are retained after a retransform * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm diff --git a/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java b/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java index de76aea5b1d..bf40e8de927 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java +++ b/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java @@ -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 @@ -25,12 +25,11 @@ * @test * @bug 6904403 * @summary Don't assert if we redefine finalize method - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument * jdk.jartool/sun.tools.jar - * @build RedefineClassHelper * @run main RedefineClassHelper * @run main/othervm -javaagent:redefineagent.jar RedefineFinalizer */ diff --git a/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java b/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java index 9921afb1809..d1c5545492e 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java +++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java @@ -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 @@ -25,14 +25,13 @@ * @test * @bug 8055008 * @summary Redefine EMCP and non-EMCP methods that are running in an infinite loop - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument * jdk.jartool/sun.tools.jar - * @build RedefineClassHelper * @run main RedefineClassHelper - * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethods + * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace RedefineRunningMethods */ public class RedefineRunningMethods { diff --git a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java index 283d08ddc6b..f8e1a26f6fa 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java +++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8087315 * @summary Get old method's stack trace elements after GC - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument * jdk.jartool/sun.tools.jar - * @build RedefineClassHelper * @run main RedefineClassHelper * @run main/othervm -javaagent:redefineagent.jar RedefineRunningMethodsWithBacktrace */ diff --git a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java index a56907ae0af..3560e9472c0 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java +++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java @@ -25,14 +25,13 @@ * @test * @bug 8076110 * @summary Redefine running methods that have cached resolution errors - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.instrument * jdk.jartool/sun.tools.jar - * @build RedefineClassHelper * @run main RedefineClassHelper - * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethodsWithResolutionErrors + * @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+iklass+add=trace,redefine+class+iklass+purge=trace RedefineRunningMethodsWithResolutionErrors */ import jdk.internal.org.objectweb.asm.ClassWriter; diff --git a/hotspot/test/runtime/ReservedStack/ReservedStackTest.java b/hotspot/test/runtime/ReservedStack/ReservedStackTest.java index a608077dfe1..6a095155349 100644 --- a/hotspot/test/runtime/ReservedStack/ReservedStackTest.java +++ b/hotspot/test/runtime/ReservedStack/ReservedStackTest.java @@ -23,10 +23,9 @@ /* * @test ReservedStackTest - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation - * @build jdk.test.lib.* * @run main/othervm -Xint ReservedStackTest * @run main/othervm -XX:-Inline -XX:CompileCommand=exclude,java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread ReservedStackTest */ diff --git a/hotspot/test/runtime/ReservedStack/ReservedStackTestCompiler.java b/hotspot/test/runtime/ReservedStack/ReservedStackTestCompiler.java index fa7ba474612..1bc41f61355 100644 --- a/hotspot/test/runtime/ReservedStack/ReservedStackTestCompiler.java +++ b/hotspot/test/runtime/ReservedStack/ReservedStackTestCompiler.java @@ -25,10 +25,9 @@ * @test ReservedStackTestCompiler * @summary Run ReservedStackTest with dedicated compilers C1 and C2. * @requires vm.flavor == "server" - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation - * @build jdk.test.lib.* ReservedStackTest * @run main/othervm -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-Inline -XX:CompileCommand=exclude,java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread ReservedStackTest * @run main/othervm -XX:-TieredCompilation -XX:-Inline -XX:CompileCommand=exclude,java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread ReservedStackTest */ diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java index c05da6b0476..dd559276d40 100644 --- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java +++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java @@ -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 @@ -25,16 +25,18 @@ * @test * @bug 8047290 * @summary Ensure that a Monitor::lock_without_safepoint_check fires an assert when it incorrectly acquires a lock which must always have safepoint checks. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build AssertSafepointCheckConsistency1 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main AssertSafepointCheckConsistency1 */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java index 8fc54bd36cb..04da67bea23 100644 --- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java +++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java @@ -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 @@ -25,16 +25,18 @@ * @test * @bug 8047290 * @summary Ensure that a Monitor::lock fires an assert when it incorrectly acquires a lock which must never have safepoint checks. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build AssertSafepointCheckConsistency2 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main AssertSafepointCheckConsistency2 */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java index f8bf4973910..7f681b65a38 100644 --- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java +++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java @@ -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 @@ -25,16 +25,18 @@ * @test * @bug 8047290 * @summary Ensure that Monitor::lock_without_safepoint_check does not assert when it correctly acquires a lock which must never have safepoint checks. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build AssertSafepointCheckConsistency3 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main AssertSafepointCheckConsistency3 */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java index 383174e0514..89ab9d416c6 100644 --- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java +++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java @@ -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 @@ -25,16 +25,18 @@ * @test * @bug 8047290 * @summary Ensure that Monitor::lock does not assert when it correctly acquires a lock which must always have safepoint checks. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build AssertSafepointCheckConsistency4 + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main AssertSafepointCheckConsistency4 */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/SameObject/SameObject.java b/hotspot/test/runtime/SameObject/SameObject.java index 10bb41d1a24..c0eecf51455 100644 --- a/hotspot/test/runtime/SameObject/SameObject.java +++ b/hotspot/test/runtime/SameObject/SameObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ import jdk.test.lib.Asserts; * Fixed in JDK1.3.1_10 * Fixed in JDK1.4.1_07 * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @run main/othervm/native -Xcheck:jni SameObject */ public class SameObject { diff --git a/hotspot/test/runtime/SelectionResolution/AbstractMethodErrorTest.java b/hotspot/test/runtime/SelectionResolution/AbstractMethodErrorTest.java index 0c2d98c5273..02b292d4287 100644 --- a/hotspot/test/runtime/SelectionResolution/AbstractMethodErrorTest.java +++ b/hotspot/test/runtime/SelectionResolution/AbstractMethodErrorTest.java @@ -27,7 +27,6 @@ * generate AbstractMethodErrorTest * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm/timeout=300 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies AbstractMethodErrorTest */ diff --git a/hotspot/test/runtime/SelectionResolution/IllegalAccessErrorTest.java b/hotspot/test/runtime/SelectionResolution/IllegalAccessErrorTest.java index 7bc2350ddb1..3af56c50f38 100644 --- a/hotspot/test/runtime/SelectionResolution/IllegalAccessErrorTest.java +++ b/hotspot/test/runtime/SelectionResolution/IllegalAccessErrorTest.java @@ -27,7 +27,6 @@ * generate IllegalAccessErrorTest * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies IllegalAccessErrorTest */ diff --git a/hotspot/test/runtime/SelectionResolution/InvokeInterfaceICCE.java b/hotspot/test/runtime/SelectionResolution/InvokeInterfaceICCE.java index b3bafc6b6b7..a775e857027 100644 --- a/hotspot/test/runtime/SelectionResolution/InvokeInterfaceICCE.java +++ b/hotspot/test/runtime/SelectionResolution/InvokeInterfaceICCE.java @@ -27,7 +27,6 @@ * generate IncompatibleClassChangeError * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm/timeout=500 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies InvokeInterfaceICCE */ diff --git a/hotspot/test/runtime/SelectionResolution/InvokeInterfaceSuccessTest.java b/hotspot/test/runtime/SelectionResolution/InvokeInterfaceSuccessTest.java index a4246742387..cf75021fa71 100644 --- a/hotspot/test/runtime/SelectionResolution/InvokeInterfaceSuccessTest.java +++ b/hotspot/test/runtime/SelectionResolution/InvokeInterfaceSuccessTest.java @@ -27,7 +27,6 @@ * generate InvokeInterfaceSuccessTest * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm/timeout=300 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies InvokeInterfaceSuccessTest */ diff --git a/hotspot/test/runtime/SelectionResolution/InvokeSpecialICCE.java b/hotspot/test/runtime/SelectionResolution/InvokeSpecialICCE.java index 9086689451e..9fee0111263 100644 --- a/hotspot/test/runtime/SelectionResolution/InvokeSpecialICCE.java +++ b/hotspot/test/runtime/SelectionResolution/InvokeSpecialICCE.java @@ -27,7 +27,6 @@ * generate IncompatibleClassChangeError * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies InvokeSpecialICCE */ diff --git a/hotspot/test/runtime/SelectionResolution/InvokeSpecialSuccessTest.java b/hotspot/test/runtime/SelectionResolution/InvokeSpecialSuccessTest.java index 71f266c2f0f..eb60df4148d 100644 --- a/hotspot/test/runtime/SelectionResolution/InvokeSpecialSuccessTest.java +++ b/hotspot/test/runtime/SelectionResolution/InvokeSpecialSuccessTest.java @@ -27,7 +27,6 @@ * generate InvokeSpecialSuccessTest * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies InvokeSpecialSuccessTest */ diff --git a/hotspot/test/runtime/SelectionResolution/InvokeStaticICCE.java b/hotspot/test/runtime/SelectionResolution/InvokeStaticICCE.java index 54ce64154bd..3ce93c5e03e 100644 --- a/hotspot/test/runtime/SelectionResolution/InvokeStaticICCE.java +++ b/hotspot/test/runtime/SelectionResolution/InvokeStaticICCE.java @@ -27,7 +27,6 @@ * generate IncompatibleClassChangeError * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies InvokeStaticICCE */ diff --git a/hotspot/test/runtime/SelectionResolution/InvokeStaticSuccessTest.java b/hotspot/test/runtime/SelectionResolution/InvokeStaticSuccessTest.java index 367816961b4..b10566694ad 100644 --- a/hotspot/test/runtime/SelectionResolution/InvokeStaticSuccessTest.java +++ b/hotspot/test/runtime/SelectionResolution/InvokeStaticSuccessTest.java @@ -27,7 +27,6 @@ * generate InvokeStaticSuccessTest * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main InvokeStaticSuccessTest */ diff --git a/hotspot/test/runtime/SelectionResolution/InvokeVirtualICCE.java b/hotspot/test/runtime/SelectionResolution/InvokeVirtualICCE.java index 8dbe06e498b..59fe0272e5b 100644 --- a/hotspot/test/runtime/SelectionResolution/InvokeVirtualICCE.java +++ b/hotspot/test/runtime/SelectionResolution/InvokeVirtualICCE.java @@ -27,7 +27,6 @@ * generate IncompatibleClassChangeError * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm/timeout=1200 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies InvokeVirtualICCE */ diff --git a/hotspot/test/runtime/SelectionResolution/InvokeVirtualSuccessTest.java b/hotspot/test/runtime/SelectionResolution/InvokeVirtualSuccessTest.java index 2b4deab2073..359537e5485 100644 --- a/hotspot/test/runtime/SelectionResolution/InvokeVirtualSuccessTest.java +++ b/hotspot/test/runtime/SelectionResolution/InvokeVirtualSuccessTest.java @@ -27,7 +27,6 @@ * generate InvokeVirtualSuccessTest * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main/othervm/timeout=400 -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies InvokeVirtualSuccessTest */ diff --git a/hotspot/test/runtime/SelectionResolution/NoSuchMethodErrorTest.java b/hotspot/test/runtime/SelectionResolution/NoSuchMethodErrorTest.java index ec239639db0..cf8055ff0b8 100644 --- a/hotspot/test/runtime/SelectionResolution/NoSuchMethodErrorTest.java +++ b/hotspot/test/runtime/SelectionResolution/NoSuchMethodErrorTest.java @@ -27,7 +27,6 @@ * generate NoSuchMethodError * @modules java.base/jdk.internal.org.objectweb.asm * @library /runtime/SelectionResolution/classes - * @build selectionresolution.* * @run main NoSuchMethodErrorTest */ diff --git a/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java b/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java index 009f8f4147a..728567a353c 100644 --- a/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java +++ b/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java @@ -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 @@ -27,13 +27,14 @@ * attempting to use CDS archive. JVM should exit gracefully * when sharing mode is ON, and continue w/o sharing if sharing * mode is AUTO. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main ArchiveDoesNotExist */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.io.File; public class ArchiveDoesNotExist { diff --git a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java index b354fcbf355..6510e605d76 100644 --- a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java +++ b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java @@ -24,7 +24,7 @@ /** * @test * @summary Testing -Xbootclasspath/a support for CDS - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * jdk.jvmstat/sun.jvmstat.monitor @@ -32,7 +32,7 @@ * @compile javax/sound/sampled/MyClass.jasm * @compile org/omg/CORBA/Context.jasm * @compile nonjdk/myPackage/MyClass.java - * @build jdk.test.lib.* LoadClass ClassFileInstaller + * @build LoadClass * @run main/othervm BootAppendTests */ @@ -44,8 +44,8 @@ import java.io.PrintStream; import java.nio.file.Path; import java.nio.file.Paths; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class BootAppendTests { private static final String APP_CLASS = "LoadClass"; diff --git a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java index 90422d294ab..51a341d0900 100644 --- a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java +++ b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java @@ -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,12 +25,13 @@ * @test CdsDifferentCompactStrings * @summary CDS (class data sharing) requires the same -XX:[+-]CompactStrings * setting between archive creation time and load time. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class CdsDifferentCompactStrings { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java index 7be3968b28a..7a233965d56 100644 --- a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java +++ b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java @@ -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 @@ -28,13 +28,15 @@ * This is a negative test; using object alignment for loading that * is different from object alignment for creating a CDS file * should fail when loading. - * @library /testlibrary + * @library /test/lib * @bug 8025642 * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; public class CdsDifferentObjectAlignment { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java b/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java index 6dc33f90ceb..83b8fd1fa0e 100644 --- a/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java +++ b/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java @@ -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,12 +25,14 @@ * @test CdsSameObjectAlignment * @summary Testing CDS (class data sharing) using varying object alignment. * Using same object alignment for each dump/load pair - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; public class CdsSameObjectAlignment { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java index 2fe4753bdbc..397a45f17cf 100644 --- a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java +++ b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java @@ -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 DefaultUseWithClient * @summary Test default behavior of sharing with -client - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @ignore 8154204 @@ -32,7 +32,9 @@ * @bug 8032224 */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; import java.io.File; public class DefaultUseWithClient { diff --git a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java index 4d24b549fd4..83ecda87901 100644 --- a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java +++ b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java @@ -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 @@ -25,13 +25,15 @@ * @test * @bug 8059510 * @summary Test jcmd VM.symboltable and VM.stringtable options - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:+UnlockDiagnosticVMOptions DumpSymbolAndStringTable */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class DumpSymbolAndStringTable { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java index 47304b4f287..c38b2e3b4b3 100644 --- a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java +++ b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java @@ -23,14 +23,16 @@ /* @test LimitSharedSizes * @summary Test handling of limits on shared space size - * @library /testlibrary /runtime/CommandLine/OptionsValidation/common + * @library /test/lib /runtime/CommandLine/OptionsValidation/common * @modules java.base/jdk.internal.misc * java.management * jdk.attach/sun.tools.attach * @run main LimitSharedSizes */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; import optionsvalidation.JVMOptionsUtils; public class LimitSharedSizes { diff --git a/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java b/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java index 8cef6b787e2..1adb658d6ca 100644 --- a/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java +++ b/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,13 @@ * @test * @bug 8067187 * @summary Testing CDS dumping with the -XX:MaxMetaspaceSize= option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class MaxMetaspaceSize { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java b/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java index 24bea75ea6f..0c496909c0e 100644 --- a/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java +++ b/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java @@ -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 @@ -25,12 +25,13 @@ * @test * @bug 8066670 * @summary Testing -XX:+PrintSharedArchiveAndExit option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class PrintSharedArchiveAndExit { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java index 2ba4f6d139d..65cb422adad 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java +++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java @@ -27,18 +27,21 @@ * Started failing on 2016.06.24 due to 8160376 on MacOS X so quarantine * it on that platform: * @requires os.family != "mac" - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.hotspot.agent/sun.jvm.hotspot.oops * jdk.hotspot.agent/sun.jvm.hotspot.memory * jdk.hotspot.agent/sun.jvm.hotspot.runtime * jdk.hotspot.agent/sun.jvm.hotspot.tools * java.management - * @build SASymbolTableTestAgent SASymbolTableTestAttachee jdk.test.lib.* + * @build SASymbolTableTestAgent SASymbolTableTestAttachee * @run main SASymbolTableTest */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Platform; /* * The purpose of this test is to validate that we can use SA to diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java b/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java index 2b1f03392e3..41cfb9d5a12 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java @@ -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,12 +25,13 @@ * @test * @bug 8014138 * @summary Testing new -XX:SharedArchiveFile= option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class SharedArchiveFile { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java b/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java index e5fee961c0f..b9dbf4b3d34 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java @@ -25,13 +25,14 @@ * @test SharedBaseAddress * @summary Test variety of values for SharedBaseAddress, making sure * VM handles normal values as well as edge values w/o a crash. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main SharedBaseAddress */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class SharedBaseAddress { diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java b/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java index 06feba0d586..3c82ccbf48d 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java @@ -29,14 +29,15 @@ * @requires (sun.arch.data.model != "32") & (os.family != "windows") * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) * @requires vm.gc.G1 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build SharedStringsWb SharedStrings ClassFileInstaller sun.hotspot.WhiteBox + * @build SharedStringsWb sun.hotspot.WhiteBox * @run main ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox * @run main SharedStrings */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class SharedStrings { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedStringsDedup.java b/hotspot/test/runtime/SharedArchiveFile/SharedStringsDedup.java index 432b36bffd8..fe0d36498f8 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedStringsDedup.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedStringsDedup.java @@ -28,13 +28,14 @@ * @requires (sun.arch.data.model != "32") & (os.family != "windows") * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) * @requires vm.gc.G1 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main SharedStringsDedup */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.io.File; // The main purpose is to test the interaction between shared strings diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java b/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java index d4290fe6568..70467c31bca 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedStringsRunAuto.java @@ -28,13 +28,14 @@ * @requires (sun.arch.data.model != "32") & (os.family != "windows") * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) * @requires vm.gc.G1 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main SharedStringsRunAuto */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.io.File; public class SharedStringsRunAuto { diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java b/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java index e99f218ec86..632769d04a9 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java @@ -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 @@ -25,12 +25,13 @@ * @test * @bug 8059510 * @summary Test SharedSymbolTableBucketSize option - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class SharedSymbolTableBucketSize { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java b/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java index 665a3aeef94..b8371fef918 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java +++ b/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java @@ -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,13 +24,14 @@ /* * @test SpaceUtilizationCheck * @summary Check if the space utilization for shared spaces is adequate - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main SpaceUtilizationCheck */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.util.regex.Pattern; import java.util.regex.Matcher; diff --git a/hotspot/test/runtime/Thread/Fibonacci.java b/hotspot/test/runtime/Thread/Fibonacci.java index 65ae1c320b1..271295a73cc 100644 --- a/hotspot/test/runtime/Thread/Fibonacci.java +++ b/hotspot/test/runtime/Thread/Fibonacci.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ * make this test inherently unstable on Windows with 32-bit VM data model. * @requires !(os.family == "windows" & sun.arch.data.model == "32") * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @run main/othervm Fibonacci 15 */ diff --git a/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java b/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java index 36f351da560..535aedbff79 100644 --- a/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java +++ b/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java @@ -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 @@ -28,7 +28,7 @@ * @summary Creates two threads contending for the same lock and checks * whether jstack reports "locked" by more than one thread. * - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm TestThreadDumpMonitorContention @@ -43,7 +43,9 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class TestThreadDumpMonitorContention { // jstack tends to be closely bound to the VM that we are running diff --git a/hotspot/test/runtime/Thread/ThreadPriorities.java b/hotspot/test/runtime/Thread/ThreadPriorities.java index a03d5d4a199..e445f2bb915 100644 --- a/hotspot/test/runtime/Thread/ThreadPriorities.java +++ b/hotspot/test/runtime/Thread/ThreadPriorities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @summary Creates several threads with different java priorities and checks * whether jstack reports correct priorities for them. * - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main ThreadPriorities @@ -38,7 +38,9 @@ import java.util.concurrent.CyclicBarrier; import java.util.regex.Matcher; import java.util.regex.Pattern; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; import static jdk.test.lib.Asserts.*; public class ThreadPriorities { diff --git a/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java b/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java index 55cee37ae31..fc923a1234a 100644 --- a/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java +++ b/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ import jdk.test.lib.Asserts; * @summary JDK 1.3.0 alters thread signal mask * @requires (vm.simpleArch == "sparcv9") * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile Prog.java * @run main/native ThreadSignalMask */ diff --git a/hotspot/test/runtime/Throwable/StackTraceLogging.java b/hotspot/test/runtime/Throwable/StackTraceLogging.java index 053ab24511b..da2244cd57a 100644 --- a/hotspot/test/runtime/Throwable/StackTraceLogging.java +++ b/hotspot/test/runtime/Throwable/StackTraceLogging.java @@ -25,18 +25,17 @@ * @test * @bug 8150778 * @summary check stacktrace logging - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @compile TestThrowable.java * @run driver StackTraceLogging */ import java.io.File; import java.util.Map; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class StackTraceLogging { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { diff --git a/hotspot/test/runtime/Throwable/TestThrowable.java b/hotspot/test/runtime/Throwable/TestThrowable.java index 052ed4604ed..fca76e1b927 100644 --- a/hotspot/test/runtime/Throwable/TestThrowable.java +++ b/hotspot/test/runtime/Throwable/TestThrowable.java @@ -26,7 +26,7 @@ * @bug 8150778 * @summary Test exception depths, and code to get stack traces * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @run main/othervm -XX:MaxJavaStackTraceDepth=1024 TestThrowable */ diff --git a/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java b/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java index 71f1dc22d46..ceeca290382 100644 --- a/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java +++ b/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java @@ -26,7 +26,6 @@ * @bug 8033735 * @summary check backtrace field introspection * @modules java.base/jdk.internal.misc - * @library /testlibrary * @run main ThrowableIntrospectionSegfault */ diff --git a/hotspot/test/runtime/TransitiveOverrideCFV50/TransitiveOverrideCFV50.java b/hotspot/test/runtime/TransitiveOverrideCFV50/TransitiveOverrideCFV50.java new file mode 100644 index 00000000000..909b694d8bc --- /dev/null +++ b/hotspot/test/runtime/TransitiveOverrideCFV50/TransitiveOverrideCFV50.java @@ -0,0 +1,200 @@ +/* + * 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 8163808 + * @modules java.base/jdk.internal.org.objectweb.asm + * @run main TransitiveOverrideCFV50 + */ + +import java.util.*; +import java.io.File; +import java.io.FileOutputStream; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.AnnotationVisitor; +import jdk.internal.org.objectweb.asm.Opcodes; + +/* + * Test mixed classfile version overriding handling. + * Key is to generate P2/C with an older classfile version <=50 + * Correct response is B.m:2 for older classfiles + * This test was added to ensure no assertions in debug + * note: for P2/C classfile version >=51, correct answer becomes C.m:3 + * public class P1.A { public int m() { return 1; } + * + * public class P1.B extends A { int m() { return 2; } + * + * public class P2.c extends P1.B { public int m() { return 3; } + */ + +public class TransitiveOverrideCFV50 implements Opcodes{ + static final String classP1A = "P1.A"; + static final String classP1B = "P1.B"; + static final String classP2C = "P2.C"; + + static final String callerName = classP2C; + + public static void main(String[] args) throws Exception { + ClassLoader cl = new ClassLoader() { + public Class loadClass(String name) throws ClassNotFoundException { + if (findLoadedClass(name) != null) { + return findLoadedClass(name); + } + + if (classP1A.equals(name)) { + byte[] classFile = dumpP1A(); + return defineClass(classP1A, classFile, 0, classFile.length); + } + if (classP1B.equals(name)) { + byte[] classFile = dumpP1B(); + return defineClass(classP1B, classFile, 0, classFile.length); + } + if (classP2C.equals(name)) { + byte[] classFile = dumpP2C(); + return defineClass(classP2C, classFile, 0, classFile.length); + } + + return super.loadClass(name); + } + }; + + cl.loadClass(classP1A); + cl.loadClass(classP1B); + cl.loadClass(classP2C); + + //cl.loadClass(callerName).getDeclaredMethod("test"); + cl.loadClass(callerName).newInstance(); + + int result = (Integer)cl.loadClass(callerName).getDeclaredMethod("test").invoke(null); + if (result != 2) { + throw new RuntimeException("expected B.m:2, got " + result); + } + } + + public static byte[] dumpP1A() { + + ClassWriter cw = new ClassWriter(0); + MethodVisitor mv; + + cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, "P1/A", null, "java/lang/Object", null); + + { + mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V", false); + mv.visitInsn(RETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } + { + mv = cw.visitMethod(ACC_PUBLIC, "m", "()I", null, null); + mv.visitCode(); + mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); + mv.visitLdcInsn("A.m"); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); + mv.visitIntInsn(BIPUSH, 1); + mv.visitInsn(IRETURN); + mv.visitMaxs(2, 1); + mv.visitEnd(); + } + cw.visitEnd(); + + return cw.toByteArray(); + } + public static byte[] dumpP1B() { + + ClassWriter cw = new ClassWriter(0); + MethodVisitor mv; + + cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "P1/B", null, "P1/A", null); + + { + mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "P1/A", "", "()V", false); + mv.visitInsn(RETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } + { + mv = cw.visitMethod(0, "m", "()I", null, null); + mv.visitCode(); + mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); + mv.visitLdcInsn("B.m"); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); + mv.visitIntInsn(BIPUSH, 2); + mv.visitInsn(IRETURN); + mv.visitMaxs(2, 1); + mv.visitEnd(); + } + cw.visitEnd(); + + return cw.toByteArray(); + } + public static byte[] dumpP2C() { + + ClassWriter cw = new ClassWriter(0); + MethodVisitor mv; + + cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, "P2/C", null, "P1/B", null); + + { + mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "P1/B", "", "()V", false); + mv.visitInsn(RETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } + { + mv = cw.visitMethod(ACC_PUBLIC, "m", "()I", null, null); + mv.visitCode(); + mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); + mv.visitLdcInsn("P2/C.m"); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); + mv.visitIntInsn(BIPUSH, 3); + mv.visitInsn(IRETURN); + mv.visitMaxs(2, 1); + mv.visitEnd(); + } + { + mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "test", "()I", null, null); + mv.visitCode(); + mv.visitTypeInsn(NEW, "P2/C"); + mv.visitInsn(DUP); + mv.visitMethodInsn(INVOKESPECIAL, "P2/C", "", "()V", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "P1/A", "m", "()I", false); + mv.visitInsn(IRETURN); + mv.visitMaxs(3, 2); + mv.visitEnd(); + } + + cw.visitEnd(); + + return cw.toByteArray(); + } +} diff --git a/hotspot/test/runtime/Unsafe/AllocateInstance.java b/hotspot/test/runtime/Unsafe/AllocateInstance.java index 6b283d3556b..56c7f8f95d0 100644 --- a/hotspot/test/runtime/Unsafe/AllocateInstance.java +++ b/hotspot/test/runtime/Unsafe/AllocateInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ /* * @test * @summary Verifies the behaviour of Unsafe.allocateInstance - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main AllocateInstance */ -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/AllocateMemory.java b/hotspot/test/runtime/Unsafe/AllocateMemory.java index d9f8a122afb..c32ef73664f 100644 --- a/hotspot/test/runtime/Unsafe/AllocateMemory.java +++ b/hotspot/test/runtime/Unsafe/AllocateMemory.java @@ -25,13 +25,13 @@ * @test * @requires vm.compMode != "Xcomp" * @summary Verifies behaviour of Unsafe.allocateMemory - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory */ -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/CopyMemory.java b/hotspot/test/runtime/Unsafe/CopyMemory.java index e2328d35851..3afe405db3a 100644 --- a/hotspot/test/runtime/Unsafe/CopyMemory.java +++ b/hotspot/test/runtime/Unsafe/CopyMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ /* * @test * @summary Verifies behaviour of Unsafe.copyMemory - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main CopyMemory */ -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/DefineClass.java b/hotspot/test/runtime/Unsafe/DefineClass.java index fa0d3b64ccd..44f8aeaef27 100644 --- a/hotspot/test/runtime/Unsafe/DefineClass.java +++ b/hotspot/test/runtime/Unsafe/DefineClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @summary Verifies the behaviour of Unsafe.defineClass - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management @@ -33,7 +33,8 @@ import java.security.ProtectionDomain; import java.io.InputStream; -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/FieldOffset.java b/hotspot/test/runtime/Unsafe/FieldOffset.java index abf62fc1adc..43bdf871e5f 100644 --- a/hotspot/test/runtime/Unsafe/FieldOffset.java +++ b/hotspot/test/runtime/Unsafe/FieldOffset.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verifies the behaviour of Unsafe.fieldOffset - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main FieldOffset */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import java.lang.reflect.*; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetField.java b/hotspot/test/runtime/Unsafe/GetField.java index f01d5deeb7d..3aa5ede2c0f 100644 --- a/hotspot/test/runtime/Unsafe/GetField.java +++ b/hotspot/test/runtime/Unsafe/GetField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ /* * @test * @summary Verifies behaviour of Unsafe.getField - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetField */ -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import java.lang.reflect.*; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutAddress.java b/hotspot/test/runtime/Unsafe/GetPutAddress.java index 1dd0a18de83..0b18d4d26c8 100644 --- a/hotspot/test/runtime/Unsafe/GetPutAddress.java +++ b/hotspot/test/runtime/Unsafe/GetPutAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,14 @@ /* * @test * Verify behaviour of Unsafe.get/putAddress and Unsafe.addressSize - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutAddress */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutBoolean.java b/hotspot/test/runtime/Unsafe/GetPutBoolean.java index 51e59cf4069..03bddbfd5dd 100644 --- a/hotspot/test/runtime/Unsafe/GetPutBoolean.java +++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verify behaviour of Unsafe.get/putBoolean - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutBoolean */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutByte.java b/hotspot/test/runtime/Unsafe/GetPutByte.java index 48f4700d95d..10ccbfdcf59 100644 --- a/hotspot/test/runtime/Unsafe/GetPutByte.java +++ b/hotspot/test/runtime/Unsafe/GetPutByte.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verify behaviour of Unsafe.get/putByte - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutByte */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutChar.java b/hotspot/test/runtime/Unsafe/GetPutChar.java index 86b5c80cc36..8a05acd7018 100644 --- a/hotspot/test/runtime/Unsafe/GetPutChar.java +++ b/hotspot/test/runtime/Unsafe/GetPutChar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verify behaviour of Unsafe.get/putChar - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutChar */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutDouble.java b/hotspot/test/runtime/Unsafe/GetPutDouble.java index 1073c8e1435..f9ccd548873 100644 --- a/hotspot/test/runtime/Unsafe/GetPutDouble.java +++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verify behaviour of Unsafe.get/putDouble - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutDouble */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutFloat.java b/hotspot/test/runtime/Unsafe/GetPutFloat.java index f49ac7541ed..005b2301591 100644 --- a/hotspot/test/runtime/Unsafe/GetPutFloat.java +++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verify behaviour of Unsafe.get/putFloat - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutFloat */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutInt.java b/hotspot/test/runtime/Unsafe/GetPutInt.java index 49f82d5d7b4..a43b7e17ef0 100644 --- a/hotspot/test/runtime/Unsafe/GetPutInt.java +++ b/hotspot/test/runtime/Unsafe/GetPutInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,14 +23,14 @@ /* * @test - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutInt */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutLong.java b/hotspot/test/runtime/Unsafe/GetPutLong.java index 8336c858f6b..8feef0bce3c 100644 --- a/hotspot/test/runtime/Unsafe/GetPutLong.java +++ b/hotspot/test/runtime/Unsafe/GetPutLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verify behaviour of Unsafe.get/putLong - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutLong */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutObject.java b/hotspot/test/runtime/Unsafe/GetPutObject.java index 6607db3b8f6..aa6c75dbbe0 100644 --- a/hotspot/test/runtime/Unsafe/GetPutObject.java +++ b/hotspot/test/runtime/Unsafe/GetPutObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verify behaviour of Unsafe.get/putObject - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutObject */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetPutShort.java b/hotspot/test/runtime/Unsafe/GetPutShort.java index 2ede76c1402..7a95ec23d61 100644 --- a/hotspot/test/runtime/Unsafe/GetPutShort.java +++ b/hotspot/test/runtime/Unsafe/GetPutShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Verify behaviour of Unsafe.get/putShort - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main GetPutShort */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetUncompressedObject.java b/hotspot/test/runtime/Unsafe/GetUncompressedObject.java index dc72a5e7209..f9a70e65450 100644 --- a/hotspot/test/runtime/Unsafe/GetUncompressedObject.java +++ b/hotspot/test/runtime/Unsafe/GetUncompressedObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,15 +23,14 @@ /* @test * @bug 8022853 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc - * @build jdk.test.lib.* * @run main GetUncompressedObject */ import static jdk.test.lib.Asserts.*; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; public class GetUncompressedObject { diff --git a/hotspot/test/runtime/Unsafe/NestedUnsafe.java b/hotspot/test/runtime/Unsafe/NestedUnsafe.java index f009d6dddd4..ea4e7e59fdf 100644 --- a/hotspot/test/runtime/Unsafe/NestedUnsafe.java +++ b/hotspot/test/runtime/Unsafe/NestedUnsafe.java @@ -24,7 +24,7 @@ /* * @test * @summary Creates an anonymous class inside of an anonymous class. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management @@ -34,7 +34,8 @@ import java.security.ProtectionDomain; import java.io.InputStream; import java.lang.*; -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; @@ -79,7 +80,7 @@ public class NestedUnsafe { " throw new RuntimeException(\"Exception: \" + ex.toString()); " + " } " + "} } ", - "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED"); + "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED"); Class klass2 = unsafe.defineAnonymousClass(NestedUnsafe.class, klassbuf2, new Object[0]); try { klass2.getMethod("doit").invoke(null); diff --git a/hotspot/test/runtime/Unsafe/PageSize.java b/hotspot/test/runtime/Unsafe/PageSize.java index 6ce5a1c5f47..39b6c7cf7fa 100644 --- a/hotspot/test/runtime/Unsafe/PageSize.java +++ b/hotspot/test/runtime/Unsafe/PageSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ /* * @test * @summary Make sure pageSize() returns a value that is a power of two - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main PageSize */ import java.lang.reflect.Field; -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java b/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java index f081efcaf80..ffe95401556 100644 --- a/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java +++ b/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java @@ -31,7 +31,6 @@ import jdk.internal.misc.Unsafe; * @test PrimitiveHostClass * @bug 8140665 * @summary Throws IllegalArgumentException if host class is a primitive class. - * @library /testlibrary * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * @compile -XDignore.symbol.file PrimitiveHostClass.java diff --git a/hotspot/test/runtime/Unsafe/RangeCheck.java b/hotspot/test/runtime/Unsafe/RangeCheck.java index 172af2a467d..76ccea330e5 100644 --- a/hotspot/test/runtime/Unsafe/RangeCheck.java +++ b/hotspot/test/runtime/Unsafe/RangeCheck.java @@ -25,12 +25,16 @@ * @test * @bug 8001071 * @summary Add simple range check into VM implemenation of Unsafe access methods - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; +import jdk.test.lib.Utils; + import jdk.internal.misc.Unsafe; public class RangeCheck { diff --git a/hotspot/test/runtime/Unsafe/Reallocate.java b/hotspot/test/runtime/Unsafe/Reallocate.java index b2fe5d939e2..5dec176fa04 100644 --- a/hotspot/test/runtime/Unsafe/Reallocate.java +++ b/hotspot/test/runtime/Unsafe/Reallocate.java @@ -25,13 +25,13 @@ * @test * @requires vm.compMode != "Xcomp" * @bug 8058897 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate */ -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/SetMemory.java b/hotspot/test/runtime/Unsafe/SetMemory.java index 8ff36cc788b..a426c741a3d 100644 --- a/hotspot/test/runtime/Unsafe/SetMemory.java +++ b/hotspot/test/runtime/Unsafe/SetMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ /* * @test * @summary Verifies that setMemory works correctly - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main SetMemory */ -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/ThrowException.java b/hotspot/test/runtime/Unsafe/ThrowException.java index c263aa18684..5056000acb3 100644 --- a/hotspot/test/runtime/Unsafe/ThrowException.java +++ b/hotspot/test/runtime/Unsafe/ThrowException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ /* * @test * @summary Verify that throwException() can throw an exception - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main ThrowException */ -import jdk.test.lib.*; +import jdk.test.lib.Utils; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java b/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java index 1cc20a1ef24..62cc40968ba 100644 --- a/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java +++ b/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java @@ -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 * @bug 7051189 8023393 * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main XCheckJSig @@ -33,7 +33,9 @@ import java.io.File; import java.util.Map; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; public class XCheckJSig { public static void main(String args[]) throws Throwable { diff --git a/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java b/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java index 2415cc22029..e7fba9fde42 100644 --- a/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java +++ b/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java @@ -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 * @bug 8040018 - * @library /testlibrary + * @library /test/lib * @summary Check for exception instead of assert. * @modules java.base/jdk.internal.misc * java.management @@ -32,7 +32,8 @@ */ import java.io.File; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class ClassFileParserBug { public static void main(String args[]) throws Throwable { diff --git a/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java b/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java index be0dc53dee9..0100d0433cf 100644 --- a/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java +++ b/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java @@ -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 TestEmptyBootstrapMethodsAttr * @bug 8041918 - * @library /testlibrary + * @library /test/lib * @summary Test empty bootstrap_methods table within BootstrapMethods attribute * @modules java.base/jdk.internal.misc * java.management @@ -33,7 +33,9 @@ */ import java.io.File; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.JDKToolFinder; public class TestEmptyBootstrapMethodsAttr { diff --git a/hotspot/test/runtime/contended/Options.java b/hotspot/test/runtime/contended/Options.java index cd11d8230f8..69892cc8e9c 100644 --- a/hotspot/test/runtime/contended/Options.java +++ b/hotspot/test/runtime/contended/Options.java @@ -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 @@ -21,14 +21,15 @@ * questions. */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; /* * @test * @bug 8006997 * @summary ContendedPaddingWidth should be range-checked * - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main Options diff --git a/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java index 8d1ddab89df..c2b6e759d42 100644 --- a/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java +++ b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java @@ -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 * @bug 8040292 - * @library /testlibrary + * @library /test/lib * @summary Throw exceptions when duplicate attributes are detected. * @modules java.base/jdk.internal.misc * java.management @@ -32,7 +32,8 @@ */ import java.io.File; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class DuplAttributesTest { diff --git a/hotspot/test/runtime/execstack/Testexecstack.java b/hotspot/test/runtime/execstack/Testexecstack.java index eb0b89f0117..7af23d7a41e 100644 --- a/hotspot/test/runtime/execstack/Testexecstack.java +++ b/hotspot/test/runtime/execstack/Testexecstack.java @@ -28,14 +28,15 @@ * @bug 8025519 * @summary Stack guard pages lost after loading library with executable stack. * @requires (os.family == "linux") - * @library /testlibrary - * @build jdk.test.lib.* + * @library /test/lib + * @modules java.base/jdk.internal.misc * @compile Test.java * @compile TestMT.java * @run driver Testexecstack */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class Testexecstack { diff --git a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java index cce37fa72ff..fb87f8fbc1e 100644 --- a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java +++ b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java @@ -26,14 +26,16 @@ * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.loader * java.desktop - * @library /testlibrary + * @library /test/lib * @run main/othervm GetSysPkgTest */ import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; // Test that JVM get_system_package() returns the module location for defined packages. public class GetSysPkgTest { diff --git a/hotspot/test/runtime/interned/SanityTest.java b/hotspot/test/runtime/interned/SanityTest.java index c0f2f726040..7ce22bb4238 100644 --- a/hotspot/test/runtime/interned/SanityTest.java +++ b/hotspot/test/runtime/interned/SanityTest.java @@ -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 @@ -25,8 +25,8 @@ * @test SanityTest * @summary Sanity check of String.intern() & GC * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build SanityTest + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SanityTest diff --git a/hotspot/test/runtime/jni/ToStringInInterfaceTest/ToStringTest.java b/hotspot/test/runtime/jni/ToStringInInterfaceTest/ToStringTest.java index 02d4d55365e..e9c0fa45f24 100644 --- a/hotspot/test/runtime/jni/ToStringInInterfaceTest/ToStringTest.java +++ b/hotspot/test/runtime/jni/ToStringInInterfaceTest/ToStringTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,8 +23,7 @@ /* @test * @bug 8072588 - * @build InterfaceWithToString - * @build ImplementationOfWithToString + * @build InterfaceWithToString ImplementationOfWithToString * @run main/native ToStringTest */ public final class ToStringTest { diff --git a/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java b/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java index 49201a7aa13..9d744f22f40 100644 --- a/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java +++ b/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,7 @@ * @summary make sure the Solaris Sparc M7 libadimalloc.so library generates SIGSEGV's on buffer overflow * @requires (os.family == "solaris" & os.arch == "sparcv9") * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.* + * @library /test/lib * @compile SEGVOverflow.java * @run driver Testlibadimalloc */ @@ -37,7 +36,7 @@ import java.io.*; import java.nio.file.*; import java.util.*; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class Testlibadimalloc { diff --git a/hotspot/test/runtime/logging/BiasedLockingTest.java b/hotspot/test/runtime/logging/BiasedLockingTest.java index 365f31934b0..75ea90b352b 100644 --- a/hotspot/test/runtime/logging/BiasedLockingTest.java +++ b/hotspot/test/runtime/logging/BiasedLockingTest.java @@ -25,15 +25,14 @@ * @test * @bug 8149383 * @summary -Xlog:biasedlocking should have logging from statements in the source code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver BiasedLockingTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class BiasedLockingTest { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { diff --git a/hotspot/test/runtime/logging/ClassInitializationTest.java b/hotspot/test/runtime/logging/ClassInitializationTest.java index 9ffd4d236fe..90a5bdb4353 100644 --- a/hotspot/test/runtime/logging/ClassInitializationTest.java +++ b/hotspot/test/runtime/logging/ClassInitializationTest.java @@ -26,15 +26,14 @@ * @test ClassInitializationTest * @bug 8142976 * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile BadMap50.jasm - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools * @run driver ClassInitializationTest */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class ClassInitializationTest { diff --git a/hotspot/test/runtime/logging/ClassLoadUnloadTest.java b/hotspot/test/runtime/logging/ClassLoadUnloadTest.java index e9c5d97ba83..1c2396327aa 100644 --- a/hotspot/test/runtime/logging/ClassLoadUnloadTest.java +++ b/hotspot/test/runtime/logging/ClassLoadUnloadTest.java @@ -26,13 +26,14 @@ * @test ClassLoadUnloadTest * @bug 8142506 * @modules java.base/jdk.internal.misc - * @library /testlibrary /runtime/testlibrary + * @library /test/lib /runtime/testlibrary * @library classes - * @build ClassUnloadCommon test.Empty jdk.test.lib.* jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools + * @build test.Empty * @run driver ClassLoadUnloadTest */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.lang.ref.WeakReference; import java.lang.reflect.Method; import java.util.ArrayList; diff --git a/hotspot/test/runtime/logging/ClassResolutionTest.java b/hotspot/test/runtime/logging/ClassResolutionTest.java index ceebd4c3ac0..32f43b13337 100644 --- a/hotspot/test/runtime/logging/ClassResolutionTest.java +++ b/hotspot/test/runtime/logging/ClassResolutionTest.java @@ -26,13 +26,12 @@ * @test ClassResolutionTest * @bug 8144874 * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools + * @library /test/lib * @run driver ClassResolutionTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.lang.ref.WeakReference; import java.lang.reflect.Method; diff --git a/hotspot/test/runtime/logging/CompressedOopsTest.java b/hotspot/test/runtime/logging/CompressedOopsTest.java index 2216f957d8c..aa5bcf9b95f 100644 --- a/hotspot/test/runtime/logging/CompressedOopsTest.java +++ b/hotspot/test/runtime/logging/CompressedOopsTest.java @@ -26,16 +26,15 @@ * @bug 8149991 * @requires (sun.arch.data.model == "64") * @summary -Xlog:gc+heap+coops=info should have output from the code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools * @run driver CompressedOopsTest */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class CompressedOopsTest { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { diff --git a/hotspot/test/runtime/logging/DefaultMethodsTest.java b/hotspot/test/runtime/logging/DefaultMethodsTest.java index e910bbb920c..3790689f9bf 100644 --- a/hotspot/test/runtime/logging/DefaultMethodsTest.java +++ b/hotspot/test/runtime/logging/DefaultMethodsTest.java @@ -25,15 +25,14 @@ * @test * @bug 8139564 * @summary defaultmethods=debug should have logging from each of the statements in the code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver DefaultMethodsTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class DefaultMethodsTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/logging/ExceptionsTest.java b/hotspot/test/runtime/logging/ExceptionsTest.java index 6d2e60f2b8b..27a12c8e930 100644 --- a/hotspot/test/runtime/logging/ExceptionsTest.java +++ b/hotspot/test/runtime/logging/ExceptionsTest.java @@ -25,17 +25,16 @@ * @test * @bug 8141211 8147477 * @summary exceptions=info output should have an exception message for interpreter methods - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver ExceptionsTest */ import java.io.File; import java.util.Map; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class ExceptionsTest { static void updateEnvironment(ProcessBuilder pb, String environmentVariable, String value) { diff --git a/hotspot/test/runtime/logging/ItablesTest.java b/hotspot/test/runtime/logging/ItablesTest.java index 44fb7b486e2..48ed3963570 100644 --- a/hotspot/test/runtime/logging/ItablesTest.java +++ b/hotspot/test/runtime/logging/ItablesTest.java @@ -26,7 +26,7 @@ * @bug 8141564 * @summary itables=trace should have logging from each of the statements * in the code - * @library /testlibrary + * @library /test/lib * @compile ClassB.java * ItablesVtableTest.java * @modules java.base/jdk.internal.misc @@ -34,7 +34,9 @@ * @run driver ItablesTest */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; public class ItablesTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/logging/LoaderConstraintsTest.java b/hotspot/test/runtime/logging/LoaderConstraintsTest.java index ea6e13b673e..49dc5d278da 100644 --- a/hotspot/test/runtime/logging/LoaderConstraintsTest.java +++ b/hotspot/test/runtime/logging/LoaderConstraintsTest.java @@ -26,13 +26,12 @@ * @test LoaderConstraintsTest * @bug 8149996 * @modules java.base/jdk.internal.misc - * @library /testlibrary /runtime/testlibrary - * @library classes - * @build ClassUnloadCommon test.Empty jdk.test.lib.* jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools + * @library /test/lib /runtime/testlibrary classes * @run driver LoaderConstraintsTest */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.lang.ref.WeakReference; import java.lang.reflect.Method; import java.util.ArrayList; diff --git a/hotspot/test/runtime/logging/ModulesTest.java b/hotspot/test/runtime/logging/ModulesTest.java index e1689fb41aa..13d4ed171a8 100644 --- a/hotspot/test/runtime/logging/ModulesTest.java +++ b/hotspot/test/runtime/logging/ModulesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,15 +24,14 @@ /* * @test * @summary modules=debug should have logging from statements in the code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run main ModulesTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class ModulesTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/logging/MonitorInflationTest.java b/hotspot/test/runtime/logging/MonitorInflationTest.java index dca42b223f0..ab927b4474c 100644 --- a/hotspot/test/runtime/logging/MonitorInflationTest.java +++ b/hotspot/test/runtime/logging/MonitorInflationTest.java @@ -25,15 +25,14 @@ * @test * @bug 8133885 * @summary monitorinflation=debug should have logging from each of the statements in the code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver MonitorInflationTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class MonitorInflationTest { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { diff --git a/hotspot/test/runtime/logging/MonitorMismatchTest.java b/hotspot/test/runtime/logging/MonitorMismatchTest.java index 0d7c76f0ce1..f0550841657 100644 --- a/hotspot/test/runtime/logging/MonitorMismatchTest.java +++ b/hotspot/test/runtime/logging/MonitorMismatchTest.java @@ -26,14 +26,13 @@ * @test MonitorMismatchTest * @bug 8150084 * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile MonitorMismatchHelper.jasm - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools jdk.test.lib.Platform * @run driver MonitorMismatchTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Platform; public class MonitorMismatchTest { diff --git a/hotspot/test/runtime/logging/OsCpuLoggingTest.java b/hotspot/test/runtime/logging/OsCpuLoggingTest.java index 94aba04f7b0..93ed049f6bf 100644 --- a/hotspot/test/runtime/logging/OsCpuLoggingTest.java +++ b/hotspot/test/runtime/logging/OsCpuLoggingTest.java @@ -25,16 +25,17 @@ * @test * @bug 8151939 * @summary os+cpu output should contain some os,cpu information - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver OsCpuLoggingTest */ import java.io.File; import java.util.Map; -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class OsCpuLoggingTest { diff --git a/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java b/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java index 919d9582074..1d145047e86 100644 --- a/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java +++ b/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java @@ -25,14 +25,13 @@ * @test ProtectionDomainVerificationTest * @bug 8149064 * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools + * @library /test/lib * @run driver ProtectionDomainVerificationTest */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class ProtectionDomainVerificationTest { diff --git a/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java b/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java index 47d61d1b0f2..a53749812a0 100644 --- a/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java +++ b/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java @@ -26,11 +26,12 @@ * @test RemovedDevelopFlagsTest * @bug 8146632 * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools + * @library /test/lib * @run driver RemovedDevelopFlagsTest */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class RemovedDevelopFlagsTest { public static ProcessBuilder pb; diff --git a/hotspot/test/runtime/logging/SafepointCleanupTest.java b/hotspot/test/runtime/logging/SafepointCleanupTest.java index cbec3cb5763..1f52daca0c7 100644 --- a/hotspot/test/runtime/logging/SafepointCleanupTest.java +++ b/hotspot/test/runtime/logging/SafepointCleanupTest.java @@ -25,15 +25,14 @@ * @test * @bug 8149991 * @summary safepoint+cleanup=info should have output from the code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver SafepointCleanupTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class SafepointCleanupTest { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { diff --git a/hotspot/test/runtime/logging/SafepointTest.java b/hotspot/test/runtime/logging/SafepointTest.java index 184706b9516..161302fdb36 100644 --- a/hotspot/test/runtime/logging/SafepointTest.java +++ b/hotspot/test/runtime/logging/SafepointTest.java @@ -25,16 +25,15 @@ * @test * @bug 8140348 * @summary safepoint=trace should have output from each log statement in the code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver SafepointTest */ import java.lang.ref.WeakReference; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class SafepointTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/logging/StartupTimeTest.java b/hotspot/test/runtime/logging/StartupTimeTest.java index 1c5a77e8730..dfd3514be4a 100644 --- a/hotspot/test/runtime/logging/StartupTimeTest.java +++ b/hotspot/test/runtime/logging/StartupTimeTest.java @@ -25,15 +25,14 @@ * @test * @bug 8148630 * @summary -Xlog:startuptime should produce logging from the source code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver StartupTimeTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class StartupTimeTest { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { diff --git a/hotspot/test/runtime/logging/ThreadLoggingTest.java b/hotspot/test/runtime/logging/ThreadLoggingTest.java index e3cc0695ec0..1f06e0594d9 100644 --- a/hotspot/test/runtime/logging/ThreadLoggingTest.java +++ b/hotspot/test/runtime/logging/ThreadLoggingTest.java @@ -26,18 +26,17 @@ * @test * @bug 8149036 8150619 * @summary os+thread output should contain logging calls for thread start stop attaches detaches - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver ThreadLoggingTest * @author Thomas Stuefe (SAP) */ import java.io.File; import java.util.Map; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class ThreadLoggingTest { diff --git a/hotspot/test/runtime/logging/VMOperationTest.java b/hotspot/test/runtime/logging/VMOperationTest.java index 9ffe8632d58..b72410bf497 100644 --- a/hotspot/test/runtime/logging/VMOperationTest.java +++ b/hotspot/test/runtime/logging/VMOperationTest.java @@ -25,16 +25,15 @@ * @test * @bug 8143157 * @summary vmoperation=debug should have logging output - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver VMOperationTest */ import java.lang.ref.WeakReference; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class VMOperationTest { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/runtime/logging/VerificationTest.java b/hotspot/test/runtime/logging/VerificationTest.java index d49b7b3547f..de64713cbd8 100644 --- a/hotspot/test/runtime/logging/VerificationTest.java +++ b/hotspot/test/runtime/logging/VerificationTest.java @@ -25,15 +25,14 @@ * @test * @bug 8150083 * @summary verification=info output should have output from the code - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver VerificationTest */ -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class VerificationTest { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { diff --git a/hotspot/test/runtime/logging/VtablesTest.java b/hotspot/test/runtime/logging/VtablesTest.java index b23fec00b3a..e5bd5be3c4a 100644 --- a/hotspot/test/runtime/logging/VtablesTest.java +++ b/hotspot/test/runtime/logging/VtablesTest.java @@ -25,7 +25,7 @@ * @test * @bug 8141564 * @summary vtables=trace should have logging from each of the statements in the code - * @library /testlibrary + * @library /test/lib * @compile ClassB.java * p1/A.java * p2/B.jcod @@ -36,7 +36,9 @@ * @run driver VtablesTest */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class VtablesTest { public static void main(String[] args) throws Exception { @@ -46,10 +48,10 @@ public class VtablesTest { output.shouldContain("copy vtable from ClassA to ClassB"); output.shouldContain("Initializing: ClassB"); output.shouldContain("adding ClassB.Method1()V"); - output.shouldContain("] overriding with ClassB::ClassB.Method2()V"); + output.shouldContain("] overriding with ClassB.Method2()V"); output.shouldContain("invokevirtual resolved method: caller-class:ClassB"); output.shouldContain("invokevirtual selected method: receiver-class:ClassB"); - output.shouldContain("NOT overriding with p2.D::p2.D.nooverride()V"); + output.shouldContain("NOT overriding with p2.D.nooverride()V"); output.shouldHaveExitValue(0); pb = ProcessTools.createJavaProcessBuilder("-Xlog:vtables=trace", "p1/C"); diff --git a/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java b/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java index 0b86e9d11a8..37b06f71936 100644 --- a/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java +++ b/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java @@ -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,15 +24,15 @@ /* @test TestLargePageSizeInBytes * @summary Tests that the flag -XX:LargePageSizeInBytes does not cause warnings on Solaris * @bug 8049536 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver TestLargePageSizeInBytes */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; public class TestLargePageSizeInBytes { private static long M = 1024L * 1024L; diff --git a/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java b/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java index 2cfb5a70ace..90075297489 100644 --- a/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java +++ b/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java @@ -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,15 +23,15 @@ /* @test TestLargePagesFlags * @summary Tests how large pages are choosen depending on the given large pages flag combinations. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main TestLargePagesFlags */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; import java.util.ArrayList; public class TestLargePagesFlags { diff --git a/hotspot/test/runtime/memory/ReadFromNoaccessArea.java b/hotspot/test/runtime/memory/ReadFromNoaccessArea.java index e47aa48ea2f..6beef36a27e 100644 --- a/hotspot/test/runtime/memory/ReadFromNoaccessArea.java +++ b/hotspot/test/runtime/memory/ReadFromNoaccessArea.java @@ -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 @@ -24,16 +24,18 @@ /* * @test * @summary Test that touching noaccess area in class ReservedHeapSpace results in SIGSEGV/ACCESS_VIOLATION - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build ReadFromNoaccessArea + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ReadFromNoaccessArea */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import sun.hotspot.WhiteBox; public class ReadFromNoaccessArea { diff --git a/hotspot/test/runtime/memory/ReadVMPageSize.java b/hotspot/test/runtime/memory/ReadVMPageSize.java index aa83ce0b582..f9bf76fe9f6 100644 --- a/hotspot/test/runtime/memory/ReadVMPageSize.java +++ b/hotspot/test/runtime/memory/ReadVMPageSize.java @@ -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 @@ -25,13 +25,12 @@ * @test * @summary Using WhiteBox to get VM page size * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build ReadVMPageSize + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ReadVMPageSize */ -import jdk.test.lib.*; import sun.hotspot.WhiteBox; public class ReadVMPageSize { diff --git a/hotspot/test/runtime/memory/ReserveMemory.java b/hotspot/test/runtime/memory/ReserveMemory.java index c9d80302174..2a248313d7d 100644 --- a/hotspot/test/runtime/memory/ReserveMemory.java +++ b/hotspot/test/runtime/memory/ReserveMemory.java @@ -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 @@ -28,16 +28,17 @@ * @bug 8012015 * @requires !(os.family == "aix") * @summary Make sure reserved (but uncommitted) memory is not accessible - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build ReserveMemory + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ReserveMemory */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; diff --git a/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java b/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java index c03cf8afa9c..d3bb7bdaf54 100644 --- a/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java +++ b/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java @@ -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 @@ -24,16 +24,16 @@ /* * @test * @summary Test launches unit tests inside vm concurrently - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build RunUnitTestsConcurrently + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI RunUnitTestsConcurrently 30 15000 */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; import sun.hotspot.WhiteBox; public class RunUnitTestsConcurrently { diff --git a/hotspot/test/runtime/memory/StressVirtualSpaceResize.java b/hotspot/test/runtime/memory/StressVirtualSpaceResize.java index 4fd0534b873..9a1e7dae485 100644 --- a/hotspot/test/runtime/memory/StressVirtualSpaceResize.java +++ b/hotspot/test/runtime/memory/StressVirtualSpaceResize.java @@ -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 @@ -25,8 +25,8 @@ * @test * @summary Stress test that expands/shrinks VirtualSpace * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build StressVirtualSpaceResize + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI StressVirtualSpaceResize diff --git a/hotspot/test/runtime/modules/AccModuleTest.java b/hotspot/test/runtime/modules/AccModuleTest.java index 45d9bb394ad..8deac7f327e 100644 --- a/hotspot/test/runtime/modules/AccModuleTest.java +++ b/hotspot/test/runtime/modules/AccModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,15 +23,12 @@ /* * @test - * @library /testlibrary * @modules java.base/jdk.internal.misc * @compile acc_module.jcod - * @build AccModuleTest * @run main AccModuleTest */ import java.io.File; -import jdk.test.lib.*; public class AccModuleTest { diff --git a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java index 71435b1718f..986fd092cc3 100644 --- a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java @@ -28,11 +28,10 @@ * @summary Test that if module m1 can not read module m2, then class p1.c1 * in module m1 can not access p2.c2 in module m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build CheckRead * @run main/othervm -Xbootclasspath/a:. CheckRead */ diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java index 3342d8f9073..e084f73e8df 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java @@ -28,11 +28,10 @@ * @summary Test that if module m1 can not read module m2, then class p1.c1 * in module m1 can not access p2.c2 in module m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build DiffCL_CheckRead * @run main/othervm -Xbootclasspath/a:. DiffCL_CheckRead */ diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java index 3d2bb9eda86..edbca757818 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java @@ -29,11 +29,10 @@ * is exported specifically to module m3, then class p1.c1 in m1 can not * access p2.c2 in m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build DiffCL_ExpQualOther * @run main/othervm -Xbootclasspath/a:. DiffCL_ExpQualOther */ diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java index 5854c4530ea..32098106e7f 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java @@ -28,11 +28,10 @@ * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in m2. * Access allowed since m1 can read m2 and package p2 is exported to m1. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build DiffCL_ExpQualToM1 * @run main/othervm -Xbootclasspath/a:. DiffCL_ExpQualToM1 */ diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java index 57490768b2f..c8d156e73e5 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java @@ -28,11 +28,10 @@ * @summary Test that if module m1 can read module m2, and package p2 in m2 is * exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build DiffCL_ExpUnqual * @run main/othervm -Xbootclasspath/a:. DiffCL_ExpUnqual */ diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java index 9b1bd9613cc..afc3ec811ce 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java @@ -28,11 +28,10 @@ * @summary Test that if module m1 can read module m2, but package p2 in m2 is not * exported, then class p1.c1 in m1 can not read p2.c2 in m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build DiffCL_PkgNotExp * @run main/othervm -Xbootclasspath/a:. DiffCL_PkgNotExp */ diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java index 09488b60327..5f88ede128b 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java @@ -26,7 +26,7 @@ /* * @test * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.module * @compile myloaders/MyDiffClassLoader.java @@ -34,7 +34,6 @@ * @compile p1/c1.java * @compile p1/c1ReadEdgeDiffLoader.java * @compile p1/c1Loose.java - * @build DiffCL_Umod * @run main/othervm -Xbootclasspath/a:. DiffCL_Umod */ diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java index 3ce98422ec6..b7bb37072e9 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java @@ -28,12 +28,11 @@ * @summary class p3.c3 defined in module m1 tries to access c4 defined in an unnamed package * and an unnamed module. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile c4.java * @compile p3/c3.jcod * @compile p3/c3ReadEdgeDiffLoader.jcod - * @build DiffCL_UmodUpkg * @run main/othervm -Xbootclasspath/a:. DiffCL_UmodUpkg */ diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java index 5cf5132ece9..d1c4b207af2 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java @@ -29,11 +29,10 @@ * is exported specifically to module m3, then class p1.c1 in m1 can not * access p2.c2 in m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build ExpQualOther * @run main/othervm -Xbootclasspath/a:. ExpQualOther */ diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java index 4a7822fb4d7..035008cb1b7 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java @@ -28,11 +28,10 @@ * @summary Test that if module m1 can read module m2, AND package p2 in m2 is * exported qualifiedly to m1, then class p1.c1 in m1 can read p2.c2 in m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build ExpQualToM1 * @run main/othervm -Xbootclasspath/a:. ExpQualToM1 */ diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java index 67e69ea42e0..2c321ceb9b2 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java @@ -28,11 +28,10 @@ * @summary Test that if module m1 can read module m2, AND package p2 in module2 is * exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build ExpUnqual * @run main/othervm -Xbootclasspath/a:. ExpUnqual */ diff --git a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java index 3762f13b696..7d5fb596aaf 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java @@ -27,13 +27,12 @@ * @test * @summary Test if package p2 in module m2 is exported to all unnamed, * then class p1.c1 in an unnamed module can read p2.c2 in module m2. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.module * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build ExportAllUnnamed * @run main/othervm -Xbootclasspath/a:. ExportAllUnnamed */ diff --git a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java index 0b044974fa8..86e26c5cc8e 100644 --- a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java @@ -28,11 +28,10 @@ * @summary Test that if module m1 can read module m2, but package p2 in m2 is not * exported, then class p1.c1 in m1 can not read p2.c2 in m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build PkgNotExp * @run main/othervm -Xbootclasspath/a:. PkgNotExp */ diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod.java b/hotspot/test/runtime/modules/AccessCheck/Umod.java index c61bcf45896..e8d0a04d050 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod.java @@ -26,7 +26,7 @@ /* * @test * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.module * @compile myloaders/MySameClassLoader.java @@ -34,7 +34,6 @@ * @compile p1/c1.java * @compile p1/c1ReadEdge.java * @compile p1/c1Loose.java - * @build Umod * @run main/othervm -Xbootclasspath/a:. Umod */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java index cde2644146d..2a9db0f2733 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java @@ -29,11 +29,10 @@ * Access is denied, since an unnamed module can read all modules but p2 in module * m2 is exported specifically to module m1, not to all modules. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build UmodDiffCL_ExpQualOther * @run main/othervm -Xbootclasspath/a:. UmodDiffCL_ExpQualOther */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java index 93b2f14428a..c83998de6bc 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java @@ -29,11 +29,10 @@ * Access allowed, an unnamed module can read all modules and p2 in module m2 * which is exported unqualifiedly. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build UmodDiffCL_ExpUnqual * @run main/othervm -Xbootclasspath/a:. UmodDiffCL_ExpUnqual */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java index aca576bd721..b4d0461a1cd 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java @@ -29,10 +29,9 @@ * Access is denied since even though unnamed module can read all modules, p2 * in module m2 is not exported at all. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p1/c1.java - * @build UmodDiffCL_PkgNotExp * @run main/othervm -Xbootclasspath/a:. UmodDiffCL_PkgNotExp */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_Umod.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_Umod.java index 6fd267961b1..f164908558e 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_Umod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,6 @@ * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build UmodDiffCL_Umod * @run main/othervm -Xbootclasspath/a:. UmodDiffCL_Umod */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_UmodUpkg.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_UmodUpkg.java index 909ab0ffb29..d9d0414ca26 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_UmodUpkg.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_UmodUpkg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ * @compile myloaders/MyDiffClassLoader.java * @compile c4.java * @compile p3/c3.jcod - * @build UmodDiffCL_UmodUpkg * @run main/othervm -Xbootclasspath/a:. UmodDiffCL_UmodUpkg */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java index 36035e9c4d2..4ad9b24a0ea 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java @@ -27,12 +27,11 @@ * @test * @summary class p3.c3 defined in module m1 tries to access c4 defined in unnamed module. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile c4.java * @compile p3/c3.jcod * @compile p3/c3ReadEdge.jcod - * @build UmodUPkg * @run main/othervm -Xbootclasspath/a:. UmodUPkg */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java index ed81b24fc7f..3a64481c561 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java @@ -29,11 +29,10 @@ * Access is denied, since an unnamed module can read all modules but p6 in module * m2 is exported specifically to module m1, not to all modules. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p6/c6.java * @compile c5.java - * @build UmodUpkgDiffCL_ExpQualOther * @run main/othervm -Xbootclasspath/a:. UmodUpkgDiffCL_ExpQualOther */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java index 11d42b74673..b06cf17e04d 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java @@ -28,11 +28,10 @@ * @summary class c5 in an unnamed module can read module m2, but package p6 in module m2 is not exported. * Access denied since even though unnamed module can read all modules, p6 in module m2 is not exported at all. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p6/c6.java * @compile c5.java - * @build UmodUpkgDiffCL_NotExp * @run main/othervm -Xbootclasspath/a:. UmodUpkgDiffCL_NotExp */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_Umod.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_Umod.java index 597389546d8..5411255a643 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_Umod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,6 @@ * @compile myloaders/MyDiffClassLoader.java * @compile p6/c6.java * @compile c5.java - * @build UmodUpkgDiffCL_Umod * @run main/othervm -Xbootclasspath/a:. UmodUpkgDiffCL_Umod */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java index 8ea1cdd1daa..33f7482dc33 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java @@ -28,11 +28,10 @@ * @summary Test that if class c5 in an unnamed module can read package p6 in module m2, but package p6 in module m2 is * exported qualifiedly to module m3, then class c5 in an unnamed module can not read p6.c6 in module m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p6/c6.java * @compile c5.java - * @build UmodUpkg_ExpQualOther * @run main/othervm -Xbootclasspath/a:. UmodUpkg_ExpQualOther */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java index ebf9b5e8a2a..f3cda29cea8 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java @@ -28,11 +28,10 @@ * @summary Test if package p6 in module m2 is not exported, then class c5 * in an unnamed module can not access p6.c2 in module m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p6/c6.java * @compile c5.java - * @build UmodUpkg_NotExp * @run main/othervm -Xbootclasspath/a:. UmodUpkg_NotExp */ diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_Umod.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_Umod.java index 7a96e5c2afb..400c41d7b88 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_Umod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,6 @@ * @compile myloaders/MySameClassLoader.java * @compile p6/c6.java * @compile c5.java - * @build UmodUpkg_Umod * @run main/othervm -Xbootclasspath/a:. UmodUpkg_Umod */ diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java index 3c58cdb1a34..74288ef865d 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java @@ -28,11 +28,10 @@ * @summary Test that if package p2 in module m2 is exported to module m3, * then class p1.c1 in an unnamed module can not read p2.c2 in module m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build Umod_ExpQualOther * @run main/othervm -Xbootclasspath/a:. Umod_ExpQualOther */ diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java index 6f8f83f0e59..dd69c1318b1 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java @@ -28,11 +28,10 @@ * @summary Test if package p2 in module m2 is exported unqualifiedly, * then class p1.c1 in an unnamed module can read p2.c2 in module m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build Umod_ExpUnqual * @run main/othervm -Xbootclasspath/a:. Umod_ExpUnqual */ diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java index 90c071cb345..e15687ebb8b 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java @@ -28,11 +28,10 @@ * @summary Test if package p2 in module m2 is not exported, then class p1.c1 * in an unnamed module can not access p2.c2 in module m2. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java * @compile p1/c1.java - * @build Umod_PkgNotExp * @run main/othervm -Xbootclasspath/a:. Umod_PkgNotExp */ diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_UmodUpkg.java b/hotspot/test/runtime/modules/AccessCheck/Umod_UmodUpkg.java index 23abc1e5a35..7adfe52b1be 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_UmodUpkg.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_UmodUpkg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ * @compile myloaders/MySameClassLoader.java * @compile c4.java * @compile p3/c3.jcod - * @build Umod_UmodUpkg * @run main/othervm -Xbootclasspath/a:. Umod_UmodUpkg */ diff --git a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java index 8846108567f..7872d0d3306 100644 --- a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java @@ -27,7 +27,7 @@ import static jdk.test.lib.Asserts.*; /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/AccessCheckExp.java b/hotspot/test/runtime/modules/AccessCheckExp.java index 0adbd72c553..fa624b0783a 100644 --- a/hotspot/test/runtime/modules/AccessCheckExp.java +++ b/hotspot/test/runtime/modules/AccessCheckExp.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/AccessCheckJavaBase.java b/hotspot/test/runtime/modules/AccessCheckJavaBase.java index dc1b691cf17..24f2f77e115 100644 --- a/hotspot/test/runtime/modules/AccessCheckJavaBase.java +++ b/hotspot/test/runtime/modules/AccessCheckJavaBase.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/AccessCheckRead.java b/hotspot/test/runtime/modules/AccessCheckRead.java index 320ba55ec7c..a36268ace02 100644 --- a/hotspot/test/runtime/modules/AccessCheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheckRead.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox @@ -34,7 +34,6 @@ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AccessCheckRead */ -import jdk.test.lib.*; import java.lang.reflect.Module; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/modules/AccessCheckSuper.java b/hotspot/test/runtime/modules/AccessCheckSuper.java index 663679b48c9..594c1921e0f 100644 --- a/hotspot/test/runtime/modules/AccessCheckSuper.java +++ b/hotspot/test/runtime/modules/AccessCheckSuper.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p3/c3.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/AccessCheckUnnamed.java b/hotspot/test/runtime/modules/AccessCheckUnnamed.java index 319ee7402c2..4a2ab3e4951 100644 --- a/hotspot/test/runtime/modules/AccessCheckUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheckUnnamed.java @@ -27,7 +27,7 @@ import static jdk.test.lib.Asserts.*; /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/AccessCheckWorks.java b/hotspot/test/runtime/modules/AccessCheckWorks.java index 63de8ca8b2a..48d6660f195 100644 --- a/hotspot/test/runtime/modules/AccessCheckWorks.java +++ b/hotspot/test/runtime/modules/AccessCheckWorks.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/ExportTwice.java b/hotspot/test/runtime/modules/ExportTwice.java index 93f4e682ac4..538c65926c0 100644 --- a/hotspot/test/runtime/modules/ExportTwice.java +++ b/hotspot/test/runtime/modules/ExportTwice.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java b/hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java index 833182b09b3..3714a9ee97a 100644 --- a/hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java +++ b/hotspot/test/runtime/modules/IgnoreModulePropertiesTest.java @@ -26,10 +26,11 @@ * @bug 8136930 * @summary Test that the VM ignores explicitly specified module internal properties. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; // Test that the VM ignores module related properties such as "jdk.module.addmods" // and jdk.module.addreads.0" that can only be set using module options. diff --git a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java index 8ea4f6b1106..7a08787c696 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/JVMAddModuleExports.java b/hotspot/test/runtime/modules/JVMAddModuleExports.java index 1f0dcae38c0..689523639f4 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExports.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExports.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java index 9f6e69fc6cf..80db658a99d 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java @@ -27,7 +27,7 @@ import static jdk.test.lib.Asserts.*; /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @compile p1/c1.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/JVMAddModulePackage.java b/hotspot/test/runtime/modules/JVMAddModulePackage.java index 359e3f2b132..502b4497b51 100644 --- a/hotspot/test/runtime/modules/JVMAddModulePackage.java +++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/JVMAddReadsModule.java b/hotspot/test/runtime/modules/JVMAddReadsModule.java index dda62822367..a25bcfc64f6 100644 --- a/hotspot/test/runtime/modules/JVMAddReadsModule.java +++ b/hotspot/test/runtime/modules/JVMAddReadsModule.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/JVMCanReadModule.java b/hotspot/test/runtime/modules/JVMCanReadModule.java index daabd21d213..c6707d20cee 100644 --- a/hotspot/test/runtime/modules/JVMCanReadModule.java +++ b/hotspot/test/runtime/modules/JVMCanReadModule.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/JVMDefineModule.java b/hotspot/test/runtime/modules/JVMDefineModule.java index 82f50650dfc..f4a838ac55a 100644 --- a/hotspot/test/runtime/modules/JVMDefineModule.java +++ b/hotspot/test/runtime/modules/JVMDefineModule.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java index 88ff93a5040..1f58193c676 100644 --- a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java +++ b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @compile p2/c2.java * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/JVMIsExportedToModule.java b/hotspot/test/runtime/modules/JVMIsExportedToModule.java index 2d465001ce2..3f58cb5d66a 100644 --- a/hotspot/test/runtime/modules/JVMIsExportedToModule.java +++ b/hotspot/test/runtime/modules/JVMIsExportedToModule.java @@ -24,7 +24,7 @@ /* * @test * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/LoadUnloadModuleStress.java b/hotspot/test/runtime/modules/LoadUnloadModuleStress.java index ec30f58d2e3..1f27ba9b432 100644 --- a/hotspot/test/runtime/modules/LoadUnloadModuleStress.java +++ b/hotspot/test/runtime/modules/LoadUnloadModuleStress.java @@ -25,7 +25,7 @@ * @test * @summary Ensure module information is cleaned when owning class loader unloads * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib /compiler/whitebox .. + * @library /test/lib .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/ModuleOptionsTest.java b/hotspot/test/runtime/modules/ModuleOptionsTest.java index 2efb8bc0ad5..a1dec0141d4 100644 --- a/hotspot/test/runtime/modules/ModuleOptionsTest.java +++ b/hotspot/test/runtime/modules/ModuleOptionsTest.java @@ -27,10 +27,11 @@ * @summary Test that the VM only recognizes the last specified --add-modules * and --list-modules options * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; // Test that the VM behaves correctly when processing module related options. public class ModuleOptionsTest { diff --git a/hotspot/test/runtime/modules/ModuleOptionsWarn.java b/hotspot/test/runtime/modules/ModuleOptionsWarn.java index e595c555e17..7ad1f9b2ca9 100644 --- a/hotspot/test/runtime/modules/ModuleOptionsWarn.java +++ b/hotspot/test/runtime/modules/ModuleOptionsWarn.java @@ -26,10 +26,11 @@ * @bug 8162415 * @summary Test warnings for ignored properties. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; // Test that the VM behaves correctly when processing command line module system properties. public class ModuleOptionsWarn { diff --git a/hotspot/test/runtime/modules/ModuleStress/ExportModuleStressTest.java b/hotspot/test/runtime/modules/ModuleStress/ExportModuleStressTest.java index e170d5eabb1..389e5144082 100644 --- a/hotspot/test/runtime/modules/ModuleStress/ExportModuleStressTest.java +++ b/hotspot/test/runtime/modules/ModuleStress/ExportModuleStressTest.java @@ -26,15 +26,15 @@ * @bug 8156871 * @summary package in the boot layer is repeatedly exported to unique module created in layers on top of the boot layer * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile ../CompilerUtils.java - * @build ExportModuleStressTest * @run main/othervm ExportModuleStressTest */ import java.nio.file.Path; import java.nio.file.Paths; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class ExportModuleStressTest { diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java index d7791e9b43a..2da921d4d8c 100644 --- a/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStress.java @@ -28,16 +28,17 @@ * @bug 8159262 * @summary Test differing scenarios where a module's readability list and a package's exportability list should be walked * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile ../AccessCheck/ModuleLibrary.java * @compile ModuleSameCLMain.java * @compile ModuleNonBuiltinCLMain.java * @compile CustomSystemClassLoader.java - * @build ModuleStress * @run main/othervm ModuleStress */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.InMemoryJavaCompiler; import java.io.File; public class ModuleStress { diff --git a/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java b/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java index 8ee2fb8a6f3..9db70d4b137 100644 --- a/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java +++ b/hotspot/test/runtime/modules/ModuleStress/ModuleStressGC.java @@ -26,15 +26,15 @@ * @bug 8159262 * @summary layers over the boot layer are repeatedly created, during this iteration, GCs are forced to verify correct walk of module and package lists. * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib + * @library /test/lib * @compile ../CompilerUtils.java - * @build ModuleStressGC * @run main/othervm ModuleStressGC */ import java.nio.file.Path; import java.nio.file.Paths; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class ModuleStressGC { diff --git a/hotspot/test/runtime/modules/PatchModule/BasicJarBuilder.java b/hotspot/test/runtime/modules/PatchModule/BasicJarBuilder.java index ab8955cb0f7..b3242ba2cb2 100644 --- a/hotspot/test/runtime/modules/PatchModule/BasicJarBuilder.java +++ b/hotspot/test/runtime/modules/PatchModule/BasicJarBuilder.java @@ -29,8 +29,6 @@ * Output: A jar containing compiled classes, placed in a test classes folder */ -import jdk.test.lib.*; - import java.io.File; import java.util.ArrayList; import sun.tools.jar.Main; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModule2Dirs.java b/hotspot/test/runtime/modules/PatchModule/PatchModule2Dirs.java index 8b04db22632..5af477b5c30 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModule2Dirs.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModule2Dirs.java @@ -25,12 +25,14 @@ * @test * @summary Make sure --patch-module works with multiple directories. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile PatchModule2DirsMain.java * @run main PatchModule2Dirs */ -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.io.File; public class PatchModule2Dirs { diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java index 3ad5dab8014..a7f4784223b 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java @@ -23,13 +23,14 @@ /* * @test - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @run main PatchModuleCDS */ import java.io.File; -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleCDS { diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleDupJavaBase.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleDupJavaBase.java index e1d29adfc8b..6b19f288d1a 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleDupJavaBase.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleDupJavaBase.java @@ -25,10 +25,11 @@ * @test * @summary VM exit initialization results if java.base is specificed more than once to --patch-module. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleDupJavaBase { // The VM should exit initialization if java.base is specified diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java index 2b56665de2b..f87a582d30a 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleDupModule.java @@ -25,10 +25,11 @@ * @test * @summary Module system initialization exception results if a module is specificed twice to --patch-module. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleDupModule { diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleJavaBase.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleJavaBase.java index c9d957f96f3..e43325703e9 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleJavaBase.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleJavaBase.java @@ -26,12 +26,14 @@ * @bug 8130399 * @summary Make sure --patch-module works for java.base. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile PatchModuleMain.java * @run main PatchModuleJavaBase */ -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleJavaBase { diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleTest.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleTest.java index c85c88e99dd..a5eb563a230 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleTest.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleTest.java @@ -26,12 +26,14 @@ * @bug 8130399 * @summary Make sure --patch-module works for modules besides java.base. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile PatchModuleMain.java * @run main PatchModuleTest */ -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleTest { diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJar.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJar.java index c9ed80939a5..c7775c0c136 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJar.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJar.java @@ -24,15 +24,16 @@ /* * @test * @summary Make sure --patch-module works when a jar file is specified for a module - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar - * @build BasicJarBuilder * @compile PatchModuleMain.java * @run main PatchModuleTestJar */ -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleTestJar { private static String moduleJar; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJarDir.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJarDir.java index 4220816b322..18cc2597c2b 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJarDir.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleTestJarDir.java @@ -24,17 +24,18 @@ /* * @test * @summary Make sure --patch-module works when a jar file and a directory is specified for a module - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar - * @build BasicJarBuilder * @compile PatchModule2DirsMain.java * @run main PatchModuleTestJarDir */ import java.io.File; import java.nio.file.Files; -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleTestJarDir { private static String moduleJar; diff --git a/hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java b/hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java index 0d3bdeac0d1..7dda4a51d55 100644 --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java @@ -27,13 +27,15 @@ * @summary Make sure -Xlog:classload=info works properly with "modules" jimage, --patch-module, and with -Xbootclasspath/a * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile PatchModuleMain.java * @run main PatchModuleTraceCL */ import java.io.File; -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleTraceCL { diff --git a/hotspot/test/runtime/modules/Visibility/PatchModuleVisibility.java b/hotspot/test/runtime/modules/Visibility/PatchModuleVisibility.java index 89afde3376d..95fbce1b125 100644 --- a/hotspot/test/runtime/modules/Visibility/PatchModuleVisibility.java +++ b/hotspot/test/runtime/modules/Visibility/PatchModuleVisibility.java @@ -26,7 +26,7 @@ * @summary Ensure that a newly introduced java.base package placed within the --patch-module * directory is considered part of the boot loader's visibility boundary * @requires !(os.family == "windows") - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm PatchModuleVisibility @@ -36,7 +36,9 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class PatchModuleVisibility { diff --git a/hotspot/test/runtime/modules/Visibility/XbootcpNoVisibility.java b/hotspot/test/runtime/modules/Visibility/XbootcpNoVisibility.java index 3f92fd3dfe1..5f56b2573eb 100644 --- a/hotspot/test/runtime/modules/Visibility/XbootcpNoVisibility.java +++ b/hotspot/test/runtime/modules/Visibility/XbootcpNoVisibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,15 @@ * @test * @summary Ensure that a class defined within a java.base package can not * be located via -Xbootclasspath/a - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm XbootcpNoVisibility */ -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class XbootcpNoVisibility { public static void main(String args[]) throws Exception { diff --git a/hotspot/test/runtime/modules/Visibility/XbootcpVisibility.java b/hotspot/test/runtime/modules/Visibility/XbootcpVisibility.java index c58ff0b606d..1530d8bed13 100644 --- a/hotspot/test/runtime/modules/Visibility/XbootcpVisibility.java +++ b/hotspot/test/runtime/modules/Visibility/XbootcpVisibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @summary Ensure that a package whose module has not been defined to the boot loader * is correctly located with -Xbootclasspath/a * @requires !(os.family == "windows") - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm XbootcpVisibility @@ -36,7 +36,9 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class XbootcpVisibility { diff --git a/hotspot/test/runtime/os/AvailableProcessors.java b/hotspot/test/runtime/os/AvailableProcessors.java index a60757391ee..29a496ccabb 100644 --- a/hotspot/test/runtime/os/AvailableProcessors.java +++ b/hotspot/test/runtime/os/AvailableProcessors.java @@ -21,8 +21,8 @@ * questions. */ import java.io.File; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import java.util.ArrayList; /* @@ -31,8 +31,7 @@ import java.util.ArrayList; * @summary Check that availableProcessors reports the correct value when running in a cpuset on linux * @requires os.family == "linux" * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.* + * @library /test/lib * @run driver AvailableProcessors */ public class AvailableProcessors { diff --git a/hotspot/test/runtime/verifier/OverriderMsg.java b/hotspot/test/runtime/verifier/OverriderMsg.java index dffa43885e6..8e484da4b39 100644 --- a/hotspot/test/runtime/verifier/OverriderMsg.java +++ b/hotspot/test/runtime/verifier/OverriderMsg.java @@ -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,12 +26,13 @@ import java.io.FileOutputStream; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.MethodVisitor; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; /* * @test OverriderMsg * @bug 8026894 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/runtime/verifier/TestANewArray.java b/hotspot/test/runtime/verifier/TestANewArray.java index 4414e88f80a..a94ce25ef8c 100644 --- a/hotspot/test/runtime/verifier/TestANewArray.java +++ b/hotspot/test/runtime/verifier/TestANewArray.java @@ -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 @@ -28,12 +28,13 @@ import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.MethodVisitor; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; /* * @test * @summary Test that anewarray bytecode is valid only if it specifies 255 or fewer dimensions. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/runtime/verifier/TestMultiANewArray.java b/hotspot/test/runtime/verifier/TestMultiANewArray.java index 96e22064cde..7e53ce27734 100644 --- a/hotspot/test/runtime/verifier/TestMultiANewArray.java +++ b/hotspot/test/runtime/verifier/TestMultiANewArray.java @@ -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,12 +26,13 @@ import java.io.FileOutputStream; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.MethodVisitor; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; /* * @test TestMultiANewArray * @bug 8038076 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc * java.management diff --git a/hotspot/test/runtime/verifier/TraceClassRes.java b/hotspot/test/runtime/verifier/TraceClassRes.java index c8b5d5e95db..8e6ef28f7d8 100644 --- a/hotspot/test/runtime/verifier/TraceClassRes.java +++ b/hotspot/test/runtime/verifier/TraceClassRes.java @@ -26,10 +26,11 @@ * @bug 8076318 * @summary split verifier needs to add TraceClassResolution * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; // Test that the verifier outputs the classes it loads if -XX:+TraceClassResolution is specified" public class TraceClassRes { diff --git a/hotspot/test/runtime/whitebox/WBStackSize.java b/hotspot/test/runtime/whitebox/WBStackSize.java index 9bc117b3927..c1429bbc694 100644 --- a/hotspot/test/runtime/whitebox/WBStackSize.java +++ b/hotspot/test/runtime/whitebox/WBStackSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 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 @@ -25,8 +25,8 @@ * @test WBStackSize * @summary verify that whitebox functions getThreadFullStackSize() and getThreadRemainingStackSize are working * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build WBStackSize + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xss512k WBStackSize diff --git a/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java b/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java index a6f442476d2..fb992393c0e 100644 --- a/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java +++ b/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java @@ -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 @@ -27,7 +27,7 @@ * @summary verify that whitebox can be used even if not all functions are declared in java-part * @author igor.ignatyev@oracle.com * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @compile WhiteBox.java * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-CheckIntrinsics sun.hotspot.WhiteBox diff --git a/hotspot/test/sanity/WBApi.java b/hotspot/test/sanity/WBApi.java index e24e672bc82..bc5aa61f22b 100644 --- a/hotspot/test/sanity/WBApi.java +++ b/hotspot/test/sanity/WBApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test WBApi * @summary verify that whitebox functions can be linked and executed * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build WBApi + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI WBApi diff --git a/hotspot/test/serviceability/ParserTest.java b/hotspot/test/serviceability/ParserTest.java index 58ef23bdf86..2fca0ec4c81 100644 --- a/hotspot/test/serviceability/ParserTest.java +++ b/hotspot/test/serviceability/ParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @summary Test that the diagnostic command arguemnt parser works * @modules java.base/jdk.internal.misc - * @library /testlibrary /test/lib - * @build ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.parser.* + * @library /test/lib + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ParserTest diff --git a/hotspot/test/serviceability/attach/AttachSetGetFlag.java b/hotspot/test/serviceability/attach/AttachSetGetFlag.java index 81e3a01fccb..3b48759cc23 100644 --- a/hotspot/test/serviceability/attach/AttachSetGetFlag.java +++ b/hotspot/test/serviceability/attach/AttachSetGetFlag.java @@ -25,13 +25,12 @@ * @test * @bug 8054823 * @summary Tests the setFlag and printFlag attach command - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.attach/sun.tools.attach * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* AttachSetGetFlag * @run main AttachSetGetFlag */ @@ -47,7 +46,7 @@ import sun.tools.attach.HotSpotVirtualMachine; import jdk.test.lib.Asserts; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; import com.sun.tools.attach.VirtualMachine; public class AttachSetGetFlag { diff --git a/hotspot/test/serviceability/attach/AttachWithStalePidFile.java b/hotspot/test/serviceability/attach/AttachWithStalePidFile.java index 5cc42cab22f..8be22f0988a 100644 --- a/hotspot/test/serviceability/attach/AttachWithStalePidFile.java +++ b/hotspot/test/serviceability/attach/AttachWithStalePidFile.java @@ -28,12 +28,12 @@ * @summary Regression test for attach issue where stale pid files in /tmp lead to connection issues * @modules java.base/jdk.internal.misc * @modules jdk.attach/sun.tools.attach - * @library /testlibrary - * @build jdk.test.lib.* AttachWithStalePidFileTarget + * @library /test/lib * @run main AttachWithStalePidFile */ -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.ProcessTools; import com.sun.tools.attach.VirtualMachine; import sun.tools.attach.HotSpotVirtualMachine; import java.lang.reflect.Field; diff --git a/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java b/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java index 4bbf6b1d0b8..07251f32597 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java @@ -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,13 +24,11 @@ /* * @test CodeCacheTest * @bug 8054889 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng/othervm -XX:+SegmentedCodeCache CodeCacheTest * @run testng/othervm -XX:-SegmentedCodeCache CodeCacheTest * @run testng/othervm -Xint -XX:+SegmentedCodeCache CodeCacheTest @@ -40,7 +38,7 @@ import org.testng.annotations.Test; import org.testng.Assert; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; diff --git a/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java b/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java index 7125a57f9bb..e0bdd408012 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java @@ -24,15 +24,12 @@ /* * @test CodelistTest * @bug 8054889 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * jdk.test.lib.dcmd.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -Xmixed CodelistTest @@ -48,7 +45,7 @@ import compiler.testlibrary.CompilerUtils; import compiler.whitebox.CompilerWhiteBoxTest; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; import org.testng.annotations.Test; diff --git a/hotspot/test/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java b/hotspot/test/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java index 7851431ba7e..c43dfafa56f 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,18 +24,15 @@ /* * @test CompilerDirectivesDCMDTest * @bug 8137167 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* - * @run main ClassFileInstaller jdk.test.lib.Platform * @run testng/othervm CompilerDirectivesDCMDTest * @summary Test of diagnostic command */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; import jdk.test.lib.Platform; diff --git a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java index 217e9c29fa8..3640bbcebbb 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java @@ -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,16 +24,13 @@ /* * @test CompilerQueueTest * @bug 8054889 - * @library /testlibrary /test/lib / + * @library /test/lib / * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor * @summary Test of diagnostic command Compiler.queue - * @build jdk.test.lib.* - * jdk.test.lib.dcmd.* - * sun.hotspot.WhiteBox - * compiler.testlibrary.CompilerUtils + * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -Xmixed -XX:+WhiteBoxAPI CompilerQueueTest @@ -42,7 +39,7 @@ */ import compiler.testlibrary.CompilerUtils; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; import org.testng.annotations.Test; diff --git a/hotspot/test/serviceability/dcmd/framework/HelpTest.java b/hotspot/test/serviceability/dcmd/framework/HelpTest.java index 012bcf878ca..b172db8e7ca 100644 --- a/hotspot/test/serviceability/dcmd/framework/HelpTest.java +++ b/hotspot/test/serviceability/dcmd/framework/HelpTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.PidJcmdExecutor; import jdk.test.lib.dcmd.MainClassJcmdExecutor; @@ -32,13 +32,11 @@ import org.testng.annotations.Test; /* * @test * @summary Test of diagnostic command help (tests all DCMD executors) - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng/othervm -XX:+UsePerfData HelpTest */ public class HelpTest { diff --git a/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java b/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java index afd3755714b..be8a4d8560d 100644 --- a/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java +++ b/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.PidJcmdExecutor; import jdk.test.lib.dcmd.MainClassJcmdExecutor; @@ -32,13 +32,11 @@ import org.testng.annotations.Test; /* * @test * @summary Test of invalid diagnostic command (tests all DCMD executors) - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng/othervm -XX:+UsePerfData InvalidCommandTest */ public class InvalidCommandTest { diff --git a/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java b/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java index 7daa95fcaf5..dadaf3113b2 100644 --- a/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java +++ b/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.PidJcmdExecutor; import jdk.test.lib.dcmd.MainClassJcmdExecutor; @@ -33,13 +33,11 @@ import org.testng.annotations.Test; /* * @test * @summary Test of diagnostic command VM.version (tests all DCMD executors) - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng/othervm -XX:+UsePerfData VMVersionTest */ public class VMVersionTest { diff --git a/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java b/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java index 331421af297..bc2f3e2eb15 100644 --- a/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java +++ b/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,11 @@ /* * @test * @summary Test of diagnostic command GC.class_histogram -all=true - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* - * @build ClassHistogramTest * @run testng ClassHistogramAllTest */ public class ClassHistogramAllTest extends ClassHistogramTest { diff --git a/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java b/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java index 996074a5a67..5b4f017ec40 100644 --- a/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java +++ b/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java @@ -25,20 +25,18 @@ import org.testng.annotations.Test; import java.util.regex.Pattern; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; /* * @test * @summary Test of diagnostic command GC.class_histogram - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng ClassHistogramTest */ public class ClassHistogramTest { diff --git a/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java b/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java index 05b06270bcf..c5d27b9a1b5 100644 --- a/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java +++ b/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java @@ -28,19 +28,17 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.PidJcmdExecutor; /* * @test * @summary - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.xml * java.management - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng FinalizerInfoTest */ public class FinalizerInfoTest { diff --git a/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java b/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java index ca38cbb5332..257acea6b10 100644 --- a/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java +++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java @@ -24,19 +24,11 @@ /* * @test * @summary Test of diagnostic command GC.heap_dump -all=true - * @library /testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* - * @build jdk.test.lib.hprof.* - * @build jdk.test.lib.hprof.model.* - * @build jdk.test.lib.hprof.parser.* - * @build jdk.test.lib.hprof.util.* - * @build HeapDumpTest * @run testng HeapDumpAllTest */ public class HeapDumpAllTest extends HeapDumpTest { diff --git a/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java b/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java index 0329cb625aa..257a30f899c 100644 --- a/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java +++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java @@ -33,25 +33,18 @@ import jdk.test.lib.hprof.HprofParser; import jdk.test.lib.hprof.model.Snapshot; import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.PidJcmdExecutor; /* * @test * @summary Test of diagnostic command GC.heap_dump - * @library /testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* - * @build jdk.test.lib.hprof.* - * @build jdk.test.lib.hprof.model.* - * @build jdk.test.lib.hprof.parser.* - * @build jdk.test.lib.hprof.util.* * @run testng HeapDumpTest */ public class HeapDumpTest { diff --git a/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java b/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java index 5193e6c6821..b2297552b35 100644 --- a/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java +++ b/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java @@ -28,18 +28,16 @@ import java.io.IOException; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.PidJcmdExecutor; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; /* * @test * @summary Test of diagnostic command GC.heap_info - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.xml * java.management - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng HeapInfoTest */ public class HeapInfoTest { diff --git a/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java b/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java index 9e22ada4602..22af05f0523 100644 --- a/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java +++ b/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,16 +30,12 @@ import jdk.test.lib.process.ProcessTools; /* * @test * @summary Test of diagnostic command GC.run_finalization - * @library /testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* - * @build jdk.test.lib.process.* - * @build RunFinalizationTest FinalizationRunner + * @build FinalizationRunner * @run main RunFinalizationTest */ public class RunFinalizationTest { diff --git a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java index 7813605933c..44bd09a6268 100644 --- a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java +++ b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,20 +29,18 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; /* * @test * @summary Test of diagnostic command GC.run - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng/othervm -Xlog:gc=debug:RunGC.gclog -XX:-ExplicitGCInvokesConcurrent RunGCTest */ public class RunGCTest { diff --git a/hotspot/test/serviceability/dcmd/jvmti/DataDumpDcmdTest.java b/hotspot/test/serviceability/dcmd/jvmti/DataDumpDcmdTest.java index b25999a77bd..189f9a7e392 100644 --- a/hotspot/test/serviceability/dcmd/jvmti/DataDumpDcmdTest.java +++ b/hotspot/test/serviceability/dcmd/jvmti/DataDumpDcmdTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; import jdk.test.lib.dcmd.PidJcmdExecutor; @@ -32,8 +32,7 @@ import org.testng.annotations.Test; * @bug 8054890 * @summary Test of JVMTI.data_dump diagnostic command * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.* + * @library /test/lib * @run testng DataDumpDcmdTest */ diff --git a/hotspot/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java b/hotspot/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java index f27bd3aaca6..82b563bafdd 100644 --- a/hotspot/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java +++ b/hotspot/test/serviceability/dcmd/jvmti/LoadAgentDcmdTest.java @@ -26,7 +26,8 @@ import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; -import jdk.test.lib.*; +import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.*; import org.testng.annotations.Test; @@ -35,13 +36,13 @@ import org.testng.annotations.Test; * * @test * @bug 8147388 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.instrument * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build ClassFileInstaller jdk.test.lib.* SimpleJvmtiAgent + * @build SimpleJvmtiAgent * @ignore 8150318 * @run main ClassFileInstaller SimpleJvmtiAgent * @run testng LoadAgentDcmdTest @@ -59,7 +60,7 @@ public class LoadAgentDcmdTest { "'-Dtest.jdk=/path/to/jdk'."); } - Path libpath = Paths.get(jdkPath, Platform.jdkLibPath(), Platform.sharedObjectName("instrument")); + Path libpath = Paths.get(jdkPath, jdkLibPath(), sharedObjectName("instrument")); if (!libpath.toFile().exists()) { throw new FileNotFoundException( @@ -129,6 +130,32 @@ public class LoadAgentDcmdTest { throw new RuntimeException(e); } } + /** + * return path to library inside jdk tree + */ + public static String jdkLibPath() { + if (Platform.isWindows()) { + return "bin"; + } + if (Platform.isOSX()) { + return "lib"; + } + + return "lib/" + Platform.getOsArch(); + } + + /** + * Build name of shared object according to platform rules + */ + public static String sharedObjectName(String name) { + if (Platform.isWindows()) { + return name + ".dll"; + } + if (Platform.isOSX()) { + return "lib" + name + ".dylib"; + } + return "lib" + name + ".so"; + } @Test public void jmx() throws Throwable { diff --git a/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java b/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java index 55e0728e030..b931c42019e 100644 --- a/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java +++ b/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,11 @@ /* * @test * @summary Test of diagnostic command Thread.print -l=true - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* - * @build PrintTest * @run testng PrintConcurrentLocksTest */ public class PrintConcurrentLocksTest extends PrintTest { diff --git a/hotspot/test/serviceability/dcmd/thread/PrintTest.java b/hotspot/test/serviceability/dcmd/thread/PrintTest.java index 79f9b04fa77..77e22e1d8c5 100644 --- a/hotspot/test/serviceability/dcmd/thread/PrintTest.java +++ b/hotspot/test/serviceability/dcmd/thread/PrintTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ import org.testng.annotations.Test; import org.testng.Assert; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; @@ -37,13 +37,11 @@ import java.util.regex.Pattern; /* * @test * @summary Test of diagnostic command Thread.print - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng PrintTest */ public class PrintTest { diff --git a/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java b/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java index 63c509d935c..aee55b5cc31 100644 --- a/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java +++ b/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,20 +24,18 @@ /* * @test * @summary Test of diagnostic command VM.class_hierarchy - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng ClassHierarchyTest */ import org.testng.annotations.Test; import org.testng.Assert; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; diff --git a/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java b/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java index fcabb137ed0..d2230e33d8b 100644 --- a/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java +++ b/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java @@ -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,20 +24,18 @@ /* * @test * @summary Test of diagnostic command VM.classloader_stats - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng ClassLoaderStatsTest */ import org.testng.annotations.Test; import org.testng.Assert; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; diff --git a/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java b/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java index 6d8c174544a..ac04d02b382 100644 --- a/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java +++ b/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import org.testng.annotations.Test; import jdk.test.lib.dcmd.CommandExecutor; @@ -30,13 +30,11 @@ import jdk.test.lib.dcmd.JMXExecutor; /* * @test * @summary Test of diagnostic command VM.command_line - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+ThereShouldNotBeAnyVMOptionNamedLikeThis CommandLineTest */ public class CommandLineTest { diff --git a/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java b/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java index b8c2fbe8cd0..5bd7a087a06 100644 --- a/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java +++ b/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java @@ -1,13 +1,13 @@ import org.testng.annotations.Test; import org.testng.Assert; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; /* - * Copyright (c) 2013, 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 @@ -32,13 +32,11 @@ import jdk.test.lib.dcmd.JMXExecutor; /* * @test * @summary Test of VM.dynlib diagnostic command via MBean - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng DynLibsTest */ diff --git a/hotspot/test/serviceability/dcmd/vm/FlagsTest.java b/hotspot/test/serviceability/dcmd/vm/FlagsTest.java index 1ed2da18436..f83ab760a49 100644 --- a/hotspot/test/serviceability/dcmd/vm/FlagsTest.java +++ b/hotspot/test/serviceability/dcmd/vm/FlagsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; import org.testng.annotations.Test; @@ -29,13 +29,11 @@ import org.testng.annotations.Test; /* * @test * @summary Test of diagnostic command VM.flags - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng/othervm -Xmx129m -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+ThereShouldNotBeAnyVMOptionNamedLikeThis_Right -XX:-TieredCompilation FlagsTest */ public class FlagsTest { diff --git a/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java b/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java index 663a7bc6a2f..3d8b02958a1 100644 --- a/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java +++ b/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; import org.testng.annotations.Test; @@ -32,9 +32,7 @@ import static org.testng.Assert.*; * @bug 8054890 * @summary Test of VM.set_flag diagnostic command * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* + * @library /test/lib * @run testng SetVMFlagTest */ diff --git a/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java b/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java index ae3d6ae6370..71ec4e17139 100644 --- a/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java +++ b/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,20 +23,18 @@ import org.testng.annotations.Test; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; /* * @test * @summary Test of diagnostic command VM.system_properties - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng SystemPropertiesTest */ public class SystemPropertiesTest { diff --git a/hotspot/test/serviceability/dcmd/vm/UptimeTest.java b/hotspot/test/serviceability/dcmd/vm/UptimeTest.java index 02783bfdb73..a907421d5da 100644 --- a/hotspot/test/serviceability/dcmd/vm/UptimeTest.java +++ b/hotspot/test/serviceability/dcmd/vm/UptimeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ import org.testng.annotations.Test; import org.testng.Assert; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; @@ -34,13 +34,11 @@ import java.text.ParseException; /* * @test * @summary Test of diagnostic command VM.uptime - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* - * @build jdk.test.lib.dcmd.* * @run testng UptimeTest */ public class UptimeTest { diff --git a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java index 90855ba9f01..5fa6c9e4402 100644 --- a/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java +++ b/hotspot/test/serviceability/jvmti/GetModulesInfo/JvmtiGetAllModulesTest.java @@ -24,7 +24,7 @@ /** * @test * @summary Verifies the JVMTI GetAllModules API - * @library /testlibrary + * @library /test/lib * @run main/othervm -agentlib:JvmtiGetAllModulesTest JvmtiGetAllModulesTest * */ diff --git a/hotspot/test/serviceability/jvmti/GetObjectSizeClass.java b/hotspot/test/serviceability/jvmti/GetObjectSizeClass.java index cec03f32947..1030675d8f3 100644 --- a/hotspot/test/serviceability/jvmti/GetObjectSizeClass.java +++ b/hotspot/test/serviceability/jvmti/GetObjectSizeClass.java @@ -21,19 +21,22 @@ * questions. */ import java.io.PrintWriter; -import jdk.test.lib.*; +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + /* * @test * @bug 8075030 * @summary JvmtiEnv::GetObjectSize reports incorrect java.lang.Class instance size - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.instrument * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build ClassFileInstaller jdk.test.lib.* GetObjectSizeClassAgent + * @build GetObjectSizeClassAgent * @run main ClassFileInstaller GetObjectSizeClassAgent * @run main GetObjectSizeClass */ diff --git a/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java b/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java index 562dda8d4f5..e2a801aaef8 100644 --- a/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java +++ b/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java @@ -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 @@ -21,20 +21,23 @@ * questions. */ import java.io.PrintWriter; -import jdk.test.lib.*; +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.Platform; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; /* * Test to verify GetObjectSize does not overflow on a 600M element int[] * * @test * @bug 8027230 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.instrument * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build ClassFileInstaller jdk.test.lib.* GetObjectSizeOverflowAgent + * @build GetObjectSizeOverflowAgent * @run main ClassFileInstaller GetObjectSizeOverflowAgent * @run main GetObjectSizeOverflow */ diff --git a/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java b/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java index aeda7a1db69..9d59fc65835 100644 --- a/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java +++ b/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java @@ -1,6 +1,6 @@ /* - * 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 @@ -26,7 +26,7 @@ * @test * @bug 8008678 * @summary JSR 292: constant pool reconstitution must support pseudo strings - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.instrument * java.management @@ -46,9 +46,9 @@ import java.nio.file.Paths; import java.security.ProtectionDomain; import java.util.Arrays; -import jdk.test.lib.ExitCode; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ExitCode; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestLambdaFormRetransformation { private static String MANIFEST = String.format("Manifest-Version: 1.0\n" + diff --git a/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java b/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java index 85840996a29..4a9bb2606fe 100644 --- a/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java +++ b/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java @@ -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 @@ -25,22 +25,22 @@ * @test * @summary Redefine a class with an UnresolvedClass reference in the constant pool. * @bug 8035150 - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.instrument * java.management * jdk.jartool/sun.tools.jar * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* UnresolvedClassAgent + * @build UnresolvedClassAgent * @run main TestRedefineWithUnresolvedClass */ import java.io.File; import java.util.Arrays; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class TestRedefineWithUnresolvedClass { diff --git a/hotspot/test/serviceability/logging/TestBasicLogOutput.java b/hotspot/test/serviceability/logging/TestBasicLogOutput.java index 345e3737932..6c7b260ab4a 100644 --- a/hotspot/test/serviceability/logging/TestBasicLogOutput.java +++ b/hotspot/test/serviceability/logging/TestBasicLogOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ * @test TestBasicLogOutput * @summary Ensure logging can be enabled and successfully prints to stdout. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestBasicLogOutput { diff --git a/hotspot/test/serviceability/logging/TestDefaultLogOutput.java b/hotspot/test/serviceability/logging/TestDefaultLogOutput.java index cd55cc608d7..575832b8d7e 100644 --- a/hotspot/test/serviceability/logging/TestDefaultLogOutput.java +++ b/hotspot/test/serviceability/logging/TestDefaultLogOutput.java @@ -25,11 +25,11 @@ * @test TestDefaultLogOutput * @summary Ensure logging is default on stdout. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestDefaultLogOutput { diff --git a/hotspot/test/serviceability/logging/TestLogRotation.java b/hotspot/test/serviceability/logging/TestLogRotation.java index 3e3696b3fb0..f1eaf41acc2 100644 --- a/hotspot/test/serviceability/logging/TestLogRotation.java +++ b/hotspot/test/serviceability/logging/TestLogRotation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ /* * @test TestLogRotation.java * @summary test flags for log rotation - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main/othervm/timeout=600 TestLogRotation * */ -import jdk.test.lib.*; +import jdk.test.lib.process.ProcessTools; import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; diff --git a/hotspot/test/serviceability/logging/TestMultipleXlogArgs.java b/hotspot/test/serviceability/logging/TestMultipleXlogArgs.java index dfc62f7ca10..6d3af8f4148 100644 --- a/hotspot/test/serviceability/logging/TestMultipleXlogArgs.java +++ b/hotspot/test/serviceability/logging/TestMultipleXlogArgs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ * @test TestMultipleXlogArgs * @summary Ensure multiple -Xlog arguments aggregate the logging options. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestMultipleXlogArgs { diff --git a/hotspot/test/serviceability/logging/TestQuotedLogOutputs.java b/hotspot/test/serviceability/logging/TestQuotedLogOutputs.java index 77b4e007412..6d9d8987bfd 100644 --- a/hotspot/test/serviceability/logging/TestQuotedLogOutputs.java +++ b/hotspot/test/serviceability/logging/TestQuotedLogOutputs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test TestQuotedLogOutputs * @summary Ensure proper parsing of quoted output names for -Xlog arguments. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ import java.io.File; @@ -33,8 +33,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import jdk.test.lib.Asserts; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; public class TestQuotedLogOutputs { diff --git a/hotspot/test/serviceability/sa/DeadlockDetectionTest.java b/hotspot/test/serviceability/sa/DeadlockDetectionTest.java index 85e5529509d..415a849c886 100644 --- a/hotspot/test/serviceability/sa/DeadlockDetectionTest.java +++ b/hotspot/test/serviceability/sa/DeadlockDetectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,19 +32,15 @@ import jdk.test.lib.apps.LingeredAppWithDeadlock; import jdk.test.lib.Utils; import jdk.test.lib.Platform; import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; /* * @test * @summary Test deadlock detection - * @library /test/lib/share/classes - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management - * @build jdk.test.lib.* - * @build jdk.test.lib.apps.* - * @build DeadlockDetectionTest * @run main DeadlockDetectionTest */ diff --git a/hotspot/test/serviceability/sa/TestInstanceKlassSize.java b/hotspot/test/serviceability/sa/TestInstanceKlassSize.java index 6ab0a921609..db1ed0f180f 100644 --- a/hotspot/test/serviceability/sa/TestInstanceKlassSize.java +++ b/hotspot/test/serviceability/sa/TestInstanceKlassSize.java @@ -31,8 +31,8 @@ import java.util.stream.Collectors; import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import jdk.test.lib.apps.LingeredApp; import jdk.test.lib.Asserts; @@ -42,16 +42,16 @@ import java.util.*; /* * @test - * @library /test/lib/share/classes - * @library /testlibrary - * @build jdk.test.lib.* - * @build jdk.test.lib.apps.* + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules jdk.hotspot.agent * @modules jdk.hotspot.agent/sun.jvm.hotspot * @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities * @modules jdk.hotspot.agent/sun.jvm.hotspot.oops - * @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent TestInstanceKlassSize.java + * @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent + * -XaddExports:java.base/jdk.internal.misc=jdk.hotspot.agent + * -XaddExports:java.management/java.lang.management=jdk.hotspot.agent + * TestInstanceKlassSize.java * @run main/othervm TestInstanceKlassSize */ diff --git a/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java b/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java index c2c0c61b9a9..0c23373e6e3 100644 --- a/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java +++ b/hotspot/test/serviceability/sa/TestInstanceKlassSizeForInterface.java @@ -29,23 +29,23 @@ import sun.jvm.hotspot.debugger.*; import jdk.test.lib.JDKToolLauncher; import jdk.test.lib.JDKToolFinder; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; import jdk.test.lib.Asserts; /* * @test - * @library /test/lib/share/classes - * @library /testlibrary - * @build jdk.test.lib.* - * @build jdk.test.lib.apps.* + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules jdk.hotspot.agent * @modules jdk.hotspot.agent/sun.jvm.hotspot * @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities * @modules jdk.hotspot.agent/sun.jvm.hotspot.oops - * @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent TestInstanceKlassSizeForInterface.java + * @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent + * -XaddExports:java.base/jdk.internal.misc=jdk.hotspot.agent + * -XaddExports:java.management/java.lang.management=jdk.hotspot.agent + * TestInstanceKlassSizeForInterface.java * @run main/othervm TestInstanceKlassSizeForInterface */ diff --git a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java index 0328e393339..6af55b5fdf9 100644 --- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java +++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java @@ -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 @@ -22,9 +22,9 @@ */ import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.OutputBuffer; +import jdk.test.lib.process.OutputBuffer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; import java.io.File; @@ -32,12 +32,11 @@ import java.io.File; * @test * @bug 8028623 * @summary Test hashing of extended characters in Serviceability Agent. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* * @compile -encoding utf8 Test8028623.java * @run main/othervm -XX:+UsePerfData Test8028623 */ diff --git a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java index a1b297adc06..3469bdf6315 100644 --- a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java +++ b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java @@ -32,11 +32,10 @@ import java.util.Arrays; import java.util.Scanner; import jdk.test.lib.Asserts; -import jdk.test.lib.JDKToolFinder; import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; /* * @test @@ -46,12 +45,12 @@ import jdk.test.lib.ProcessTools; * Started failing on 2016.06.24 due to 8160376 on MacOS X so quarantine * it on that platform: * @requires os.family != "mac" - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management/sun.management * jdk.jvmstat/sun.jvmstat.monitor - * @build jdk.test.lib.* JMapHProfLargeHeapProc + * @build JMapHProfLargeHeapProc * @run main JMapHProfLargeHeapTest */ diff --git a/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java b/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java index a9cf6e53119..51b18469f7f 100644 --- a/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java +++ b/hotspot/test/serviceability/sa/sadebugd/SADebugDTest.java @@ -26,7 +26,7 @@ * @summary Checks that the jshdb debugd utility sucessfully starts * and tries to attach to a running process * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * * @ignore 8163805 * @run main/othervm SADebugDTest diff --git a/hotspot/test/serviceability/threads/TestFalseDeadLock.java b/hotspot/test/serviceability/threads/TestFalseDeadLock.java index e4654f4a266..d32760bf4d2 100644 --- a/hotspot/test/serviceability/threads/TestFalseDeadLock.java +++ b/hotspot/test/serviceability/threads/TestFalseDeadLock.java @@ -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 @@ -31,7 +31,7 @@ import java.util.Random; * @bug 8016304 * @summary Make sure no deadlock is reported for this program which has no deadlocks. * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib * @run main/othervm TestFalseDeadLock */ diff --git a/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java b/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java index cebd2c7d65f..23bba681fc1 100644 --- a/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,8 @@ * @summary Create daemon and non-deamon threads. * Check the correctness of thread's status from jstack. * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * * @run main/othervm -XX:+UsePerfData DaemonThreadTest */ import common.ToolResults; diff --git a/hotspot/test/serviceability/tmtools/jstack/JstackThreadTest.java b/hotspot/test/serviceability/tmtools/jstack/JstackThreadTest.java index 2d0eb05686c..2de069b1b21 100644 --- a/hotspot/test/serviceability/tmtools/jstack/JstackThreadTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/JstackThreadTest.java @@ -23,8 +23,8 @@ import java.util.Arrays; import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import utils.Utils; import java.util.concurrent.CountDownLatch; @@ -33,8 +33,7 @@ import java.util.concurrent.CountDownLatch; * @bug 8151442 * @summary jstack doesn't close quotation marks properly with threads' name greater than 1996 characters * @modules java.base/jdk.internal.misc - * @library /testlibrary - * @build jdk.test.lib.* + * @library /test/lib * @run main JstackThreadTest */ public class JstackThreadTest { diff --git a/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java b/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java index 884c8d2bfa3..8f3be8153c6 100644 --- a/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,10 +28,8 @@ * After checking that lock info is correct invoke another method * and get the lock again. Repeat this action. * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * * @run main/othervm -XX:+UsePerfData SpreadLockTest */ import common.ToolResults; diff --git a/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java b/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java index 282bfda2186..6402c2265c4 100644 --- a/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,10 +25,8 @@ * @test * @summary Checks that jstack correctly prints the thread names * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * * @run main/othervm -XX:+UsePerfData ThreadNamesTest */ import common.ToolResults; diff --git a/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java b/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java index 174bcdb7257..9a87d6bdc13 100644 --- a/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,10 +28,8 @@ * After checking that lock info is correct free the lock and * invoke another method. Repeat this action. * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * * @run main/othervm -XX:+UsePerfData TraveledLockTest */ import common.ToolResults; diff --git a/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java b/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java index 6f87c0a04b3..9b5a5449326 100644 --- a/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,10 +28,8 @@ * monitor info have to disappear from the stack. * Repeats the same scenario calling interrupt() method * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * * @run main/othervm -XX:+UsePerfData WaitNotifyThreadTest */ import common.ToolResults; diff --git a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java index 8e2f56e8b37..08b72d1f2aa 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java @@ -28,11 +28,9 @@ import utils.*; * @summary Test checks the consistency of the output * displayed with jstat -gccapacity. * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true - * @build common.* - * @build utils.* * @run main/othervm -XX:+UsePerfData -Xmx128M GcCapacityTest */ public class GcCapacityTest { diff --git a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java index 688670f3d9d..60c0a60c092 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java @@ -29,12 +29,9 @@ * collection runs jstat. jstat should show that after garbage collection number of GC events and garbage * collection time increase. * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true - * @build common.* - * @build utils.* - * * @run main/othervm -XX:+UsePerfData -Xmx128M GcCauseTest01 */ import utils.*; diff --git a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java index 0efd59fe764..0e886ffe1b1 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java @@ -28,11 +28,8 @@ * tests forces debuggee application eat ~70% of heap and runs jstat. * jstat should show that ~70% of heap (OC/OU ~= 70%). * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * @build utils.* - * * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcCauseTest02 */ import utils.*; diff --git a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java index a014c373fac..91ebd0ffcee 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java @@ -28,11 +28,8 @@ * test forces debuggee application call System.gc(), runs jstat and checks that * cause of last garbage collection displayed by jstat (LGCC) is 'System.gc()'. * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * @build utils.* - * * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcCauseTest03 */ import utils.*; diff --git a/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java b/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java index 4e2fbdc801b..10a8e60cd2a 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java @@ -30,10 +30,8 @@ import utils.*; * collection runs jstat. jstat should show that after garbage collection number of GC events and garbage * collection time increase. * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * @build utils.* * @run main/othervm -XX:+UsePerfData -Xmx128M GcNewTest */ diff --git a/hotspot/test/serviceability/tmtools/jstat/GcTest01.java b/hotspot/test/serviceability/tmtools/jstat/GcTest01.java index 5738da18fc3..cabfc9ec80a 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcTest01.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcTest01.java @@ -32,12 +32,9 @@ * number of GC events and garbage * collection time increase. * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true - * @build common.* - * @build utils.* - * * @run main/othervm -XX:+UsePerfData -Xmx128M GcTest01 */ import utils.*; diff --git a/hotspot/test/serviceability/tmtools/jstat/GcTest02.java b/hotspot/test/serviceability/tmtools/jstat/GcTest02.java index 171b87b78e5..0c022358edc 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcTest02.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcTest02.java @@ -29,10 +29,8 @@ import utils.*; * tests forces debuggee application eat ~70% of heap and runs jstat. * jstat should show that ~70% of heap is utilized (OC/OU ~= 70%). * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @library ../share - * @build common.* - * @build utils.* * @ignore 8155570 * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcTest02 */ diff --git a/hotspot/test/testlibrary/jdk/test/lib/Asserts.java b/hotspot/test/testlibrary/jdk/test/lib/Asserts.java deleted file mode 100644 index c07a3f38fe5..00000000000 --- a/hotspot/test/testlibrary/jdk/test/lib/Asserts.java +++ /dev/null @@ -1,454 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib; - -/** - * Asserts that can be used for verifying assumptions in tests. - * - * An assertion will throw a {@link RuntimeException} if the assertion isn't - * valid. All the asserts can be imported into a test by using a static - * import: - * - *

- * {@code
- * import static jdk.test.lib.Asserts.*;
- * }
- *
- * Always provide a message describing the assumption if the line number of the
- * failing assertion isn't enough to understand why the assumption failed. For
- * example, if the assertion is in a loop or in a method that is called
- * multiple times, then the line number won't provide enough context to
- * understand the failure.
- * 
- * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public class Asserts { - - /** - * Shorthand for {@link #assertLessThan(T, T)}. - * - * @see #assertLessThan(T, T) - */ - public static > void assertLT(T lhs, T rhs) { - assertLessThan(lhs, rhs); - } - - /** - * Shorthand for {@link #assertLessThan(T, T, String)}. - * - * @see #assertLessThan(T, T, String) - */ - public static > void assertLT(T lhs, T rhs, String msg) { - assertLessThan(lhs, rhs, msg); - } - - /** - * Calls {@link #assertLessThan(T, T, String)} with a default message. - * - * @see #assertLessThan(T, T, String) - */ - public static > void assertLessThan(T lhs, T rhs) { - assertLessThan(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is less than {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static >void assertLessThan(T lhs, T rhs, String msg) { - assertTrue(compare(lhs, rhs, msg) < 0, getMessage(lhs, rhs, "<", msg)); - } - - /** - * Shorthand for {@link #assertLessThanOrEqual(T, T)}. - * - * @see #assertLessThanOrEqual(T, T) - */ - public static > void assertLTE(T lhs, T rhs) { - assertLessThanOrEqual(lhs, rhs); - } - - /** - * Shorthand for {@link #assertLessThanOrEqual(T, T, String)}. - * - * @see #assertLessThanOrEqual(T, T, String) - */ - public static > void assertLTE(T lhs, T rhs, String msg) { - assertLessThanOrEqual(lhs, rhs, msg); - } - - /** - * Calls {@link #assertLessThanOrEqual(T, T, String)} with a default message. - * - * @see #assertLessThanOrEqual(T, T, String) - */ - public static > void assertLessThanOrEqual(T lhs, T rhs) { - assertLessThanOrEqual(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is less than or equal to {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static > void assertLessThanOrEqual(T lhs, T rhs, String msg) { - assertTrue(compare(lhs, rhs, msg) <= 0, getMessage(lhs, rhs, "<=", msg)); - } - - /** - * Shorthand for {@link #assertEquals(T, T)}. - * - * @see #assertEquals(T, T) - */ - public static void assertEQ(Object lhs, Object rhs) { - assertEquals(lhs, rhs); - } - - /** - * Shorthand for {@link #assertEquals(T, T, String)}. - * - * @see #assertEquals(T, T, String) - */ - public static void assertEQ(Object lhs, Object rhs, String msg) { - assertEquals(lhs, rhs, msg); - } - - /** - * Calls {@link #assertEquals(T, T, String)} with a default message. - * - * @see #assertEquals(T, T, String) - */ - public static void assertEquals(Object lhs, Object rhs) { - assertEquals(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is equal to {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static void assertEquals(Object lhs, Object rhs, String msg) { - if (lhs == null) { - if (rhs != null) { - error(msg); - } - } else { - assertTrue(lhs.equals(rhs), getMessage(lhs, rhs, "==", msg)); - } - } - - /** - * Shorthand for {@link #assertGreaterThanOrEqual(T, T)}. - * - * @see #assertGreaterThanOrEqual(T, T) - */ - public static > void assertGTE(T lhs, T rhs) { - assertGreaterThanOrEqual(lhs, rhs); - } - - /** - * Shorthand for {@link #assertGreaterThanOrEqual(T, T, String)}. - * - * @see #assertGreaterThanOrEqual(T, T, String) - */ - public static > void assertGTE(T lhs, T rhs, String msg) { - assertGreaterThanOrEqual(lhs, rhs, msg); - } - - /** - * Calls {@link #assertGreaterThanOrEqual(T, T, String)} with a default message. - * - * @see #assertGreaterThanOrEqual(T, T, String) - */ - public static > void assertGreaterThanOrEqual(T lhs, T rhs) { - assertGreaterThanOrEqual(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is greater than or equal to {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static > void assertGreaterThanOrEqual(T lhs, T rhs, String msg) { - assertTrue(compare(lhs, rhs, msg) >= 0, getMessage(lhs, rhs, ">=", msg)); - } - - /** - * Shorthand for {@link #assertGreaterThan(T, T)}. - * - * @see #assertGreaterThan(T, T) - */ - public static > void assertGT(T lhs, T rhs) { - assertGreaterThan(lhs, rhs); - } - - /** - * Shorthand for {@link #assertGreaterThan(T, T, String)}. - * - * @see #assertGreaterThan(T, T, String) - */ - public static > void assertGT(T lhs, T rhs, String msg) { - assertGreaterThan(lhs, rhs, msg); - } - - /** - * Calls {@link #assertGreaterThan(T, T, String)} with a default message. - * - * @see #assertGreaterThan(T, T, String) - */ - public static > void assertGreaterThan(T lhs, T rhs) { - assertGreaterThan(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is greater than {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static > void assertGreaterThan(T lhs, T rhs, String msg) { - assertTrue(compare(lhs, rhs, msg) > 0, getMessage(lhs, rhs, ">", msg)); - } - - /** - * Shorthand for {@link #assertNotEquals(T, T)}. - * - * @see #assertNotEquals(T, T) - */ - public static void assertNE(Object lhs, Object rhs) { - assertNotEquals(lhs, rhs); - } - - /** - * Shorthand for {@link #assertNotEquals(T, T, String)}. - * - * @see #assertNotEquals(T, T, String) - */ - public static void assertNE(Object lhs, Object rhs, String msg) { - assertNotEquals(lhs, rhs, msg); - } - - /** - * Calls {@link #assertNotEquals(T, T, String)} with a default message. - * - * @see #assertNotEquals(T, T, String) - */ - public static void assertNotEquals(Object lhs, Object rhs) { - assertNotEquals(lhs, rhs, null); - } - - /** - * Asserts that {@code lhs} is not equal to {@code rhs}. - * - * @param lhs The left hand side of the comparison. - * @param rhs The right hand side of the comparison. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static void assertNotEquals(Object lhs, Object rhs, String msg) { - if (lhs == null) { - if (rhs == null) { - error(msg); - } - } else { - assertFalse(lhs.equals(rhs), getMessage(lhs, rhs,"!=", msg)); - } - } - - /** - * Calls {@link #assertNull(Object, String)} with a default message. - * - * @see #assertNull(Object, String) - */ - public static void assertNull(Object o) { - assertNull(o, "Expected " + format(o) + " to be null"); - } - - /** - * Asserts that {@code o} is null. - * - * @param o The reference assumed to be null. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static void assertNull(Object o, String msg) { - assertEquals(o, null, msg); - } - - /** - * Calls {@link #assertNotNull(Object, String)} with a default message. - * - * @see #assertNotNull(Object, String) - */ - public static void assertNotNull(Object o) { - assertNotNull(o, "Expected non null reference"); - } - - /** - * Asserts that {@code o} is not null. - * - * @param o The reference assumed not to be null, - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static void assertNotNull(Object o, String msg) { - assertNotEquals(o, null, msg); - } - - /** - * Calls {@link #assertFalse(boolean, String)} with a default message. - * - * @see #assertFalse(boolean, String) - */ - public static void assertFalse(boolean value) { - assertFalse(value, "Expected value to be false"); - } - - /** - * Asserts that {@code value} is {@code false}. - * - * @param value The value assumed to be false. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static void assertFalse(boolean value, String msg) { - assertTrue(!value, msg); - } - - /** - * Calls {@link #assertTrue(boolean, String)} with a default message. - * - * @see #assertTrue(boolean, String) - */ - public static void assertTrue(boolean value) { - assertTrue(value, "Expected value to be true"); - } - - /** - * Asserts that {@code value} is {@code true}. - * - * @param value The value assumed to be true. - * @param msg A description of the assumption. - * @throws RuntimeException if the assertion isn't valid. - */ - public static void assertTrue(boolean value, String msg) { - if (!value) { - error(msg); - } - } - - /** - * Asserts that two strings are equal. - * - * If strings are not equals, then exception message - * will contain {@code msg} followed by list of mismatched lines. - * - * @param str1 First string to compare. - * @param str2 Second string to compare. - * @param msg A description of the assumption. - * @throws RuntimeException if strings are not equal. - */ - public static void assertStringsEqual(String str1, String str2, - String msg) { - String lineSeparator = System.getProperty("line.separator"); - String str1Lines[] = str1.split(lineSeparator); - String str2Lines[] = str2.split(lineSeparator); - - int minLength = Math.min(str1Lines.length, str2Lines.length); - String longestStringLines[] = ((str1Lines.length == minLength) ? - str2Lines : str1Lines); - - boolean stringsAreDifferent = false; - - StringBuilder messageBuilder = new StringBuilder(msg); - - messageBuilder.append("\n"); - - for (int line = 0; line < minLength; line++) { - if (!str1Lines[line].equals(str2Lines[line])) { - messageBuilder.append(String. - format("[line %d] '%s' differs " + - "from '%s'\n", - line, - str1Lines[line], - str2Lines[line])); - stringsAreDifferent = true; - } - } - - if (minLength < longestStringLines.length) { - String stringName = ((longestStringLines == str1Lines) ? - "first" : "second"); - messageBuilder.append(String.format("Only %s string contains " + - "following lines:\n", - stringName)); - stringsAreDifferent = true; - for(int line = minLength; line < longestStringLines.length; line++) { - messageBuilder.append(String. - format("[line %d] '%s'", line, - longestStringLines[line])); - } - } - - if (stringsAreDifferent) { - error(messageBuilder.toString()); - } - } - - private static > int compare(T lhs, T rhs, String msg) { - assertNotNull(lhs, msg); - assertNotNull(rhs, msg); - return lhs.compareTo(rhs); - } - - private static String format(Object o) { - return o == null? "null" : o.toString(); - } - - private static void error(String msg) { - throw new RuntimeException(msg); - } - - private static String getMessage(Object lhs, Object rhs, String op, String msg) { - return (msg == null ? "" : msg + " ") + "(assert failed: " + format(lhs) + " " + op + " " + format(rhs) + ")"; - } -} - diff --git a/hotspot/test/testlibrary/jdk/test/lib/JDKToolFinder.java b/hotspot/test/testlibrary/jdk/test/lib/JDKToolFinder.java deleted file mode 100644 index dc924bbfc39..00000000000 --- a/hotspot/test/testlibrary/jdk/test/lib/JDKToolFinder.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib; - -import java.io.FileNotFoundException; -import java.nio.file.Path; -import java.nio.file.Paths; - -/** - * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public final class JDKToolFinder { - - private JDKToolFinder() { - } - - /** - * Returns the full path to an executable in jdk/bin based on System - * property {@code test.jdk} or {@code compile.jdk} (both are set by the jtreg test suite) - * - * @return Full path to an executable in jdk/bin - */ - public static String getJDKTool(String tool) { - - // First try to find the executable in test.jdk - try { - return getTool(tool, "test.jdk"); - } catch (FileNotFoundException e) { - - } - - // Now see if it's available in compile.jdk - try { - return getTool(tool, "compile.jdk"); - } catch (FileNotFoundException e) { - throw new RuntimeException("Failed to find " + tool + - ", looked in test.jdk (" + System.getProperty("test.jdk") + - ") and compile.jdk (" + System.getProperty("compile.jdk") + ")"); - } - } - - /** - * Returns the full path to an executable in jdk/bin based on System - * property {@code compile.jdk} - * - * @return Full path to an executable in jdk/bin - */ - public static String getCompileJDKTool(String tool) { - try { - return getTool(tool, "compile.jdk"); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } - } - - /** - * Returns the full path to an executable in jdk/bin based on System - * property {@code test.jdk} - * - * @return Full path to an executable in jdk/bin - */ - public static String getTestJDKTool(String tool) { - try { - return getTool(tool, "test.jdk"); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } - } - - private static String getTool(String tool, String property) throws FileNotFoundException { - String jdkPath = System.getProperty(property); - - if (jdkPath == null) { - throw new RuntimeException( - "System property '" + property + "' not set. This property is normally set by jtreg. " - + "When running test separately, set this property using '-D" + property + "=/path/to/jdk'."); - } - - Path toolName = Paths.get("bin", tool + (Platform.isWindows() ? ".exe" : "")); - - Path jdkTool = Paths.get(jdkPath, toolName.toString()); - if (!jdkTool.toFile().exists()) { - throw new FileNotFoundException("Could not find file " + jdkTool.toAbsolutePath()); - } - - return jdkTool.toAbsolutePath().toString(); - } -} diff --git a/hotspot/test/testlibrary/jdk/test/lib/JDKToolLauncher.java b/hotspot/test/testlibrary/jdk/test/lib/JDKToolLauncher.java deleted file mode 100644 index eba1859121a..00000000000 --- a/hotspot/test/testlibrary/jdk/test/lib/JDKToolLauncher.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * A utility for constructing command lines for starting JDK tool processes. - * - * The JDKToolLauncher can in particular be combined with a - * java.lang.ProcessBuilder to easily run a JDK tool. For example, the following - * code run {@code jmap -heap} against a process with GC logging turned on for - * the {@code jmap} process: - * - *
- * {@code
- * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
- *                                       .addVMArg("-XX:+PrintGC");
- *                                       .addVMArg("-XX:+PrintGCDetails")
- *                                       .addToolArg("-heap")
- *                                       .addToolArg(pid);
- * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
- * Process p = pb.start();
- * }
- * 
- * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public class JDKToolLauncher { - private final String executable; - private final List vmArgs = new ArrayList(); - private final List toolArgs = new ArrayList(); - - private JDKToolLauncher(String tool, boolean useCompilerJDK) { - if (useCompilerJDK) { - executable = JDKToolFinder.getJDKTool(tool); - } else { - executable = JDKToolFinder.getTestJDKTool(tool); - } - vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs())); - } - - /** - * Creates a new JDKToolLauncher for the specified tool. Using tools path - * from the compiler JDK. - * - * @param tool - * The name of the tool - * @return A new JDKToolLauncher - */ - public static JDKToolLauncher create(String tool) { - return new JDKToolLauncher(tool, true); - } - - /** - * Creates a new JDKToolLauncher for the specified tool in the Tested JDK. - * - * @param tool - * The name of the tool - * - * @return A new JDKToolLauncher - */ - public static JDKToolLauncher createUsingTestJDK(String tool) { - return new JDKToolLauncher(tool, false); - } - - /** - * Adds an argument to the JVM running the tool. - * - * The JVM arguments are passed to the underlying JVM running the tool. - * Arguments will automatically be prepended with "-J". - * - * Any platform specific arguments required for running the tool are - * automatically added. - * - * - * @param arg - * The argument to VM running the tool - * @return The JDKToolLauncher instance - */ - public JDKToolLauncher addVMArg(String arg) { - vmArgs.add(arg); - return this; - } - - /** - * Adds an argument to the tool. - * - * @param arg - * The argument to the tool - * @return The JDKToolLauncher instance - */ - public JDKToolLauncher addToolArg(String arg) { - toolArgs.add(arg); - return this; - } - - /** - * Returns the command that can be used for running the tool. - * - * @return An array whose elements are the arguments of the command. - */ - public String[] getCommand() { - List command = new ArrayList(); - command.add(executable); - // Add -J in front of all vmArgs - for (String arg : vmArgs) { - command.add("-J" + arg); - } - command.addAll(toolArgs); - return command.toArray(new String[command.size()]); - } -} diff --git a/hotspot/test/testlibrary/jdk/test/lib/Platform.java b/hotspot/test/testlibrary/jdk/test/lib/Platform.java deleted file mode 100644 index d0906636400..00000000000 --- a/hotspot/test/testlibrary/jdk/test/lib/Platform.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib; - -import java.util.regex.Pattern; - -/** - * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public class Platform { - public static final String vmName = System.getProperty("java.vm.name"); - public static final String vmInfo = System.getProperty("java.vm.info"); - private static final String osName = System.getProperty("os.name"); - private static final String dataModel = System.getProperty("sun.arch.data.model"); - private static final String vmVersion = System.getProperty("java.vm.version"); - private static final String jdkDebug = System.getProperty("jdk.debug"); - private static final String osArch = System.getProperty("os.arch"); - private static final String userName = System.getProperty("user.name"); - private static final String compiler = System.getProperty("sun.management.compiler"); - - public static boolean isClient() { - return vmName.endsWith(" Client VM"); - } - - public static boolean isServer() { - return vmName.endsWith(" Server VM"); - } - - public static boolean isGraal() { - return vmName.endsWith(" Graal VM"); - } - - public static boolean isZero() { - return vmName.endsWith(" Zero VM"); - } - - public static boolean isMinimal() { - return vmName.endsWith(" Minimal VM"); - } - - public static boolean isTieredSupported() { - return compiler.contains("Tiered Compilers"); - } - - public static boolean isInt() { - return vmInfo.contains("interpreted"); - } - - public static boolean isMixed() { - return vmInfo.contains("mixed"); - } - - public static boolean isComp() { - return vmInfo.contains("compiled"); - } - - public static boolean is32bit() { - return dataModel.equals("32"); - } - - public static boolean is64bit() { - return dataModel.equals("64"); - } - - public static boolean isAix() { - return isOs("aix"); - } - - public static boolean isLinux() { - return isOs("linux"); - } - - public static boolean isOSX() { - return isOs("mac"); - } - - public static boolean isSolaris() { - return isOs("sunos"); - } - - public static boolean isWindows() { - return isOs("win"); - } - - private static boolean isOs(String osname) { - return osName.toLowerCase().startsWith(osname.toLowerCase()); - } - - public static String getOsName() { - return osName; - } - - public static boolean isDebugBuild() { - return (jdkDebug.toLowerCase().contains("debug")); - } - - public static String getVMVersion() { - return vmVersion; - } - - // Returns true for sparc and sparcv9. - public static boolean isSparc() { - return isArch("sparc.*"); - } - - public static boolean isARM() { - return isArch("arm.*"); - } - - public static boolean isPPC() { - return isArch("ppc.*"); - } - - public static boolean isX86() { - // On Linux it's 'i386', Windows 'x86' without '_64' suffix. - return isArch("(i386)|(x86(?!_64))"); - } - - public static boolean isX64() { - // On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64' - return isArch("(amd64)|(x86_64)"); - } - - public static boolean isAArch64() { - return isArch("aarch64"); - } - - private static boolean isArch(String archnameRE) { - return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE) - .matcher(osArch) - .matches(); - } - - public static String getOsArch() { - return osArch; - } - - /** - * Return a boolean for whether we expect to be able to attach - * the SA to our own processes on this system. - */ - public static boolean shouldSAAttach() throws Exception { - - if (isAix()) { - return false; // SA not implemented. - } else if (isLinux()) { - return canPtraceAttachLinux(); - } else if (isOSX()) { - return canAttachOSX(); - } else { - // Other platforms expected to work: - return true; - } - } - - /** - * On Linux, first check the SELinux boolean "deny_ptrace" and return false - * as we expect to be denied if that is "1". Then expect permission to attach - * if we are root, so return true. Then return false for an expected denial - * if "ptrace_scope" is 1, and true otherwise. - */ - public static boolean canPtraceAttachLinux() throws Exception { - - // SELinux deny_ptrace: - String deny_ptrace = Utils.fileAsString("/sys/fs/selinux/booleans/deny_ptrace"); - if (deny_ptrace != null && deny_ptrace.contains("1")) { - // ptrace will be denied: - return false; - } - - if (userName.equals("root")) { - return true; - } - - // ptrace_scope: - String ptrace_scope = Utils.fileAsString("/proc/sys/kernel/yama/ptrace_scope"); - if (ptrace_scope != null && ptrace_scope.contains("1")) { - // ptrace will be denied: - return false; - } - - // Otherwise expect to be permitted: - return true; - } - - /** - * On OSX, expect permission to attach only if we are root. - */ - public static boolean canAttachOSX() throws Exception { - return userName.equals("root"); - } - - /** - * return path to library inside jdk tree - */ - public static String jdkLibPath() { - if (isWindows()) { - return "bin"; - } - if (isOSX()) { - return "lib"; - } - - return "lib/" + getOsArch(); - } - - /** - * Build name of shared object according to platform rules - */ - public static String sharedObjectName(String name) { - if (isWindows()) { - return name + ".dll"; - } - if (isOSX()) { - return "lib" + name + ".dylib"; - } - return "lib" + name + ".so"; - } -} diff --git a/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java b/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java deleted file mode 100644 index 21ff4159761..00000000000 --- a/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.lang.management.ManagementFactory; -import java.lang.management.RuntimeMXBean; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} - */ -@Deprecated -public final class ProcessTools { - - private ProcessTools() { - } - - /** - * Pumps stdout and stderr from running the process into a String. - * - * @param processBuilder ProcessBuilder to run. - * @return Output from process. - * @throws IOException If an I/O error occurs. - */ - public static OutputBuffer getOutput(ProcessBuilder processBuilder) throws IOException { - return getOutput(processBuilder.start()); - } - - /** - * Pumps stdout and stderr the running process into a String. - * - * @param process Process to pump. - * @return Output from process. - * @throws IOException If an I/O error occurs. - */ - public static OutputBuffer getOutput(Process process) throws IOException { - ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream(); - ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream(); - StreamPumper outPumper = new StreamPumper(process.getInputStream(), stdoutBuffer); - StreamPumper errPumper = new StreamPumper(process.getErrorStream(), stderrBuffer); - Thread outPumperThread = new Thread(outPumper); - Thread errPumperThread = new Thread(errPumper); - - outPumperThread.setDaemon(true); - errPumperThread.setDaemon(true); - - outPumperThread.start(); - errPumperThread.start(); - - try { - process.waitFor(); - outPumperThread.join(); - errPumperThread.join(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return null; - } - - return new OutputBuffer(stdoutBuffer.toString(), stderrBuffer.toString()); - } - - /** - * Get the process id of the current running Java process - * - * @return Process id - */ - public static long getProcessId() throws Exception { - return ProcessHandle.current().getPid(); - } - - /** - * Gets the array of strings containing input arguments passed to the VM - * - * @return arguments - */ - public static String[] getVmInputArgs() { - RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); - List args = runtime.getInputArguments(); - return args.toArray(new String[args.size()]); - } - - /** - * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris) - * - * @return String[] with platform specific arguments, empty if there are none - */ - public static String[] getPlatformSpecificVMArgs() { - - if (Platform.is64bit() && Platform.isSolaris()) { - return new String[] { "-d64" }; - } - - return new String[] {}; - } - - /** - * Create ProcessBuilder using the java launcher from the jdk to be tested and - * with any platform specific arguments prepended - */ - public static ProcessBuilder createJavaProcessBuilder(String... command) throws Exception { - return createJavaProcessBuilder(false, command); - } - - public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception { - String javapath = JDKToolFinder.getJDKTool("java"); - - ArrayList args = new ArrayList<>(); - args.add(javapath); - Collections.addAll(args, getPlatformSpecificVMArgs()); - - args.add("-cp"); - args.add(System.getProperty("java.class.path")); - - if (addTestVmAndJavaOptions) { - Collections.addAll(args, Utils.getTestJavaOpts()); - } - - Collections.addAll(args, command); - - // Reporting - StringBuilder cmdLine = new StringBuilder(); - for (String cmd : args) { - cmdLine.append(cmd).append(' '); - } - System.out.println("Command line: [" + cmdLine.toString() + "]"); - - return new ProcessBuilder(args.toArray(new String[args.size()])); - } - - /** - * Executes a test jvm process, waits for it to finish and returns the process output. - * The default jvm options from jtreg, test.vm.opts and test.java.opts, are added. - * The java from the test.jdk is used to execute the command. - * - * The command line will be like: - * {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds - * - * @param cmds User specifed arguments. - * @return The output from the process. - */ - public static OutputAnalyzer executeTestJvm(String... cmds) throws Throwable { - ProcessBuilder pb = createJavaProcessBuilder(Utils.addTestJavaOpts(cmds)); - return executeProcess(pb); - } - - /** - * Executes a test jvm process, waits for it to finish and returns the process output. - * The default jvm options from the test's run command, jtreg, test.vm.opts and test.java.opts, are added. - * The java from the test.jdk is used to execute the command. - * - * The command line will be like: - * {test.jdk}/bin/java {test.fromRun.opts} {test.vm.opts} {test.java.opts} cmds - * - * @param cmds User specifed arguments. - * @return The output from the process. - */ - public static OutputAnalyzer executeTestJvmAllArgs(String... cmds) throws Throwable { - List argsList = new ArrayList<>(); - String[] testArgs = getVmInputArgs(); - Collections.addAll(argsList, testArgs); - Collections.addAll(argsList, Utils.addTestJavaOpts(cmds)); - ProcessBuilder pb = createJavaProcessBuilder(argsList.toArray(new String[argsList.size()])); - return executeProcess(pb); - } - - /** - * Executes a process, waits for it to finish and returns the process output. - * The process will have exited before this method returns. - * @param pb The ProcessBuilder to execute. - * @return The {@linkplain OutputAnalyzer} instance wrapping the process. - */ - public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Exception { - OutputAnalyzer output = null; - Process p = null; - boolean failed = false; - try { - p = pb.start(); - output = new OutputAnalyzer(p); - p.waitFor(); - - return output; - } catch (Throwable t) { - if (p != null) { - p.destroyForcibly().waitFor(); - } - - failed = true; - System.out.println("executeProcess() failed: " + t); - throw t; - } finally { - if (failed) { - System.err.println(getProcessLog(pb, output)); - } - } - } - - /** - * Executes a process, waits for it to finish and returns the process output. - * @param cmds The command line to execute. - * @return The output from the process. - */ - public static OutputAnalyzer executeProcess(String... cmds) throws Throwable { - return executeProcess(new ProcessBuilder(cmds)); - } - - /** - * Used to log command line, stdout, stderr and exit code from an executed process. - * @param pb The executed process. - * @param output The output from the process. - */ - public static String getProcessLog(ProcessBuilder pb, OutputAnalyzer output) { - String stderr = output == null ? "null" : output.getStderr(); - String stdout = output == null ? "null" : output.getStdout(); - String exitValue = output == null ? "null": Integer.toString(output.getExitValue()); - StringBuilder logMsg = new StringBuilder(); - final String nl = System.getProperty("line.separator"); - logMsg.append("--- ProcessLog ---" + nl); - logMsg.append("cmd: " + getCommandLine(pb) + nl); - logMsg.append("exitvalue: " + exitValue + nl); - logMsg.append("stderr: " + stderr + nl); - logMsg.append("stdout: " + stdout + nl); - return logMsg.toString(); - } - - /** - * @return The full command line for the ProcessBuilder. - */ - public static String getCommandLine(ProcessBuilder pb) { - if (pb == null) { - return "null"; - } - StringBuilder cmd = new StringBuilder(); - for (String s : pb.command()) { - cmd.append(s).append(" "); - } - return cmd.toString().trim(); - } -} diff --git a/hotspot/test/testlibrary/jdk/test/lib/StreamPumper.java b/hotspot/test/testlibrary/jdk/test/lib/StreamPumper.java deleted file mode 100644 index 399ecb179ce..00000000000 --- a/hotspot/test/testlibrary/jdk/test/lib/StreamPumper.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib; - -import java.io.OutputStream; -import java.io.InputStream; -import java.io.IOException; - -/** - * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} - */ -@Deprecated -public final class StreamPumper implements Runnable { - - private static final int BUF_SIZE = 256; - - private final OutputStream out; - private final InputStream in; - - /** - * Create a StreamPumper that reads from in and writes to out. - * - * @param in The stream to read from. - * @param out The stream to write to. - */ - public StreamPumper(InputStream in, OutputStream out) { - this.in = in; - this.out = out; - } - - /** - * Implements Thread.run(). Continuously read from in and write - * to out until in has reached end of stream. Abort - * on interruption. Abort on IOExceptions. - */ - @Override - public void run() { - int length; - InputStream localIn = in; - OutputStream localOut = out; - byte[] buffer = new byte[BUF_SIZE]; - - try { - while (!Thread.interrupted() && (length = localIn.read(buffer)) > 0) { - localOut.write(buffer, 0, length); - } - } catch (IOException e) { - // Just abort if something like this happens. - e.printStackTrace(); - } finally { - try { - localOut.flush(); - in.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } -} diff --git a/hotspot/test/testlibrary/jdk/test/lib/Utils.java b/hotspot/test/testlibrary/jdk/test/lib/Utils.java deleted file mode 100644 index 6925f73d0e4..00000000000 --- a/hotspot/test/testlibrary/jdk/test/lib/Utils.java +++ /dev/null @@ -1,648 +0,0 @@ -/* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib; - -import java.io.File; -import static jdk.test.lib.Asserts.assertTrue; -import java.io.IOException; -import java.lang.reflect.Field; -import java.net.InetAddress; -import java.net.MalformedURLException; -import java.net.ServerSocket; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.UnknownHostException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; -import java.util.Random; -import java.util.function.BooleanSupplier; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import jdk.internal.misc.Unsafe; - -/** - * Common library for various test helper functions. - * - * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} - */ -@Deprecated -public final class Utils { - - /** - * Returns the value of 'test.class.path' system property. - */ - public static final String TEST_CLASS_PATH = System.getProperty("test.class.path", "."); - - /** - * Returns the sequence used by operating system to separate lines. - */ - public static final String NEW_LINE = System.getProperty("line.separator"); - - /** - * Returns the value of 'test.vm.opts' system property. - */ - public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "").trim(); - - /** - * Returns the value of 'test.java.opts' system property. - */ - public static final String JAVA_OPTIONS = System.getProperty("test.java.opts", "").trim(); - - /** - * Returns the value of 'test.src' system property. - */ - public static final String TEST_SRC = System.getProperty("test.src", ".").trim(); - - /* - * Returns the value of 'test.jdk' system property - */ - public static final String TEST_JDK = System.getProperty("test.jdk"); - - /** - * Returns the value of 'test.classes' system property - */ - public static final String TEST_CLASSES = System.getProperty("test.classes", "."); - - private static Unsafe unsafe = null; - - /** - * Defines property name for seed value. - */ - public static final String SEED_PROPERTY_NAME = "jdk.test.lib.random.seed"; - - /* (non-javadoc) - * Random generator with (or without) predefined seed. Depends on - * "jdk.test.lib.random.seed" property value. - */ - private static volatile Random RANDOM_GENERATOR; - - /** - * Contains the seed value used for {@link java.util.Random} creation. - */ - public static final long SEED = Long.getLong(SEED_PROPERTY_NAME, new Random().nextLong()); - /** - * Returns the value of 'test.timeout.factor' system property - * converted to {@code double}. - */ - public static final double TIMEOUT_FACTOR; - static { - String toFactor = System.getProperty("test.timeout.factor", "1.0"); - TIMEOUT_FACTOR = Double.parseDouble(toFactor); - } - - /** - * Returns the value of JTREG default test timeout in milliseconds - * converted to {@code long}. - */ - public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120); - - private Utils() { - // Private constructor to prevent class instantiation - } - - /** - * Returns the list of VM options. - * - * @return List of VM options - */ - public static List getVmOptions() { - return Arrays.asList(safeSplitString(VM_OPTIONS)); - } - - /** - * Returns the list of VM options with -J prefix. - * - * @return The list of VM options with -J prefix - */ - public static List getForwardVmOptions() { - String[] opts = safeSplitString(VM_OPTIONS); - for (int i = 0; i < opts.length; i++) { - opts[i] = "-J" + opts[i]; - } - return Arrays.asList(opts); - } - - /** - * Returns the default JTReg arguments for a jvm running a test. - * This is the combination of JTReg arguments test.vm.opts and test.java.opts. - * @return An array of options, or an empty array if no options. - */ - public static String[] getTestJavaOpts() { - List opts = new ArrayList(); - Collections.addAll(opts, safeSplitString(VM_OPTIONS)); - Collections.addAll(opts, safeSplitString(JAVA_OPTIONS)); - return opts.toArray(new String[0]); - } - - /** - * Returns the default JTReg arguments for a jvm running a test without - * options that matches regular expressions in {@code filters}. - * This is the combination of JTReg arguments test.vm.opts and test.java.opts. - * @param filters Regular expressions used to filter out options. - * @return An array of options, or an empty array if no options. - */ - public static String[] getFilteredTestJavaOpts(String... filters) { - String options[] = getTestJavaOpts(); - - if (filters.length == 0) { - return options; - } - - List filteredOptions = new ArrayList(options.length); - Pattern patterns[] = new Pattern[filters.length]; - for (int i = 0; i < filters.length; i++) { - patterns[i] = Pattern.compile(filters[i]); - } - - for (String option : options) { - boolean matched = false; - for (int i = 0; i < patterns.length && !matched; i++) { - Matcher matcher = patterns[i].matcher(option); - matched = matcher.find(); - } - if (!matched) { - filteredOptions.add(option); - } - } - - return filteredOptions.toArray(new String[filteredOptions.size()]); - } - - /** - * Combines given arguments with default JTReg arguments for a jvm running a test. - * This is the combination of JTReg arguments test.vm.opts and test.java.opts - * @return The combination of JTReg test java options and user args. - */ - public static String[] addTestJavaOpts(String... userArgs) { - List opts = new ArrayList(); - Collections.addAll(opts, getTestJavaOpts()); - Collections.addAll(opts, userArgs); - return opts.toArray(new String[0]); - } - - /** - * Splits a string by white space. - * Works like String.split(), but returns an empty array - * if the string is null or empty. - */ - private static String[] safeSplitString(String s) { - if (s == null || s.trim().isEmpty()) { - return new String[] {}; - } - return s.trim().split("\\s+"); - } - - /** - * @return The full command line for the ProcessBuilder. - */ - public static String getCommandLine(ProcessBuilder pb) { - StringBuilder cmd = new StringBuilder(); - for (String s : pb.command()) { - cmd.append(s).append(" "); - } - return cmd.toString(); - } - - /** - * Returns the free port on the local host. - * The function will spin until a valid port number is found. - * - * @return The port number - * @throws InterruptedException if any thread has interrupted the current thread - * @throws IOException if an I/O error occurs when opening the socket - */ - public static int getFreePort() throws InterruptedException, IOException { - int port = -1; - - while (port <= 0) { - Thread.sleep(100); - - ServerSocket serverSocket = null; - try { - serverSocket = new ServerSocket(0); - port = serverSocket.getLocalPort(); - } finally { - serverSocket.close(); - } - } - - return port; - } - - /** - * Returns the name of the local host. - * - * @return The host name - * @throws UnknownHostException if IP address of a host could not be determined - */ - public static String getHostname() throws UnknownHostException { - InetAddress inetAddress = InetAddress.getLocalHost(); - String hostName = inetAddress.getHostName(); - - assertTrue((hostName != null && !hostName.isEmpty()), - "Cannot get hostname"); - - return hostName; - } - - /** - * Uses "jcmd -l" to search for a jvm pid. This function will wait - * forever (until jtreg timeout) for the pid to be found. - * @param key Regular expression to search for - * @return The found pid. - */ - public static int waitForJvmPid(String key) throws Throwable { - final long iterationSleepMillis = 250; - System.out.println("waitForJvmPid: Waiting for key '" + key + "'"); - System.out.flush(); - while (true) { - int pid = tryFindJvmPid(key); - if (pid >= 0) { - return pid; - } - Thread.sleep(iterationSleepMillis); - } - } - - /** - * Searches for a jvm pid in the output from "jcmd -l". - * - * Example output from jcmd is: - * 12498 sun.tools.jcmd.JCmd -l - * 12254 /tmp/jdk8/tl/jdk/JTwork/classes/com/sun/tools/attach/Application.jar - * - * @param key A regular expression to search for. - * @return The found pid, or -1 if not found. - * @throws Exception If multiple matching jvms are found. - */ - public static int tryFindJvmPid(String key) throws Throwable { - OutputAnalyzer output = null; - try { - JDKToolLauncher jcmdLauncher = JDKToolLauncher.create("jcmd"); - jcmdLauncher.addToolArg("-l"); - output = ProcessTools.executeProcess(jcmdLauncher.getCommand()); - output.shouldHaveExitValue(0); - - // Search for a line starting with numbers (pid), followed by the key. - Pattern pattern = Pattern.compile("^([0-9]+)\\s.*(" + key + ")", Pattern.MULTILINE); - Matcher matcher = pattern.matcher(output.getStdout()); - - int pid = -1; - if (matcher.find()) { - pid = Integer.parseInt(matcher.group(1)); - System.out.println("findJvmPid.pid: " + pid); - if (matcher.find()) { - throw new Exception("Found multiple JVM pids for key: " + key); - } - } - return pid; - } catch (Throwable t) { - System.out.println(String.format("Utils.findJvmPid(%s) failed: %s", key, t)); - throw t; - } - } - - /** - * Return the contents of the named file as a single String, - * or null if not found. - * @param filename name of the file to read - * @return String contents of file, or null if file not found. - * @throws IOException - * if an I/O error occurs reading from the file or a malformed or - * unmappable byte sequence is read - */ - public static String fileAsString(String filename) throws IOException { - Path filePath = Paths.get(filename); - if (!Files.exists(filePath)) return null; - return new String(Files.readAllBytes(filePath)); - } - - /** - * @return Unsafe instance. - */ - public static synchronized Unsafe getUnsafe() { - if (unsafe == null) { - try { - Field f = Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - unsafe = (Unsafe) f.get(null); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new RuntimeException("Unable to get Unsafe instance.", e); - } - } - return unsafe; - } - private static final char[] hexArray = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - - /** - * Returns hex view of byte array - * - * @param bytes byte array to process - * @return Space separated hexadecimal string representation of bytes - */ - - public static String toHexString(byte[] bytes) { - char[] hexView = new char[bytes.length * 3]; - int i = 0; - for (byte b : bytes) { - hexView[i++] = hexArray[(b >> 4) & 0x0F]; - hexView[i++] = hexArray[b & 0x0F]; - hexView[i++] = ' '; - } - return new String(hexView); - } - - /** - * Returns {@link java.util.Random} generator initialized with particular seed. - * The seed could be provided via system property {@link Utils#SEED_PROPERTY_NAME} - * In case no seed is provided, the method uses a random number. - * The used seed printed to stdout. - * @return {@link java.util.Random} generator with particular seed. - */ - public static Random getRandomInstance() { - if (RANDOM_GENERATOR == null) { - synchronized (Utils.class) { - if (RANDOM_GENERATOR == null) { - RANDOM_GENERATOR = new Random(SEED); - System.out.printf("For random generator using seed: %d%n", SEED); - System.out.printf("To re-run test with same seed value please add \"-D%s=%d\" to command line.%n", SEED_PROPERTY_NAME, SEED); - } - } - } - return RANDOM_GENERATOR; - } - - /** - * Returns random element of non empty collection - * - * @param a type of collection element - * @param collection collection of elements - * @return random element of collection - * @throws IllegalArgumentException if collection is empty - */ - public static T getRandomElement(Collection collection) - throws IllegalArgumentException { - if (collection.isEmpty()) { - throw new IllegalArgumentException("Empty collection"); - } - Random random = getRandomInstance(); - int elementIndex = 1 + random.nextInt(collection.size() - 1); - Iterator iterator = collection.iterator(); - while (--elementIndex != 0) { - iterator.next(); - } - return iterator.next(); - } - - /** - * Returns random element of non empty array - * - * @param a type of array element - * @param array array of elements - * @return random element of array - * @throws IllegalArgumentException if array is empty - */ - public static T getRandomElement(T[] array) - throws IllegalArgumentException { - if (array == null || array.length == 0) { - throw new IllegalArgumentException("Empty or null array"); - } - Random random = getRandomInstance(); - return array[random.nextInt(array.length)]; - } - - /** - * Wait for condition to be true - * - * @param condition, a condition to wait for - */ - public static final void waitForCondition(BooleanSupplier condition) { - waitForCondition(condition, -1L, 100L); - } - - /** - * Wait until timeout for condition to be true - * - * @param condition, a condition to wait for - * @param timeout a time in milliseconds to wait for condition to be true - * specifying -1 will wait forever - * @return condition value, to determine if wait was successful - */ - public static final boolean waitForCondition(BooleanSupplier condition, - long timeout) { - return waitForCondition(condition, timeout, 100L); - } - - /** - * Wait until timeout for condition to be true for specified time - * - * @param condition, a condition to wait for - * @param timeout a time in milliseconds to wait for condition to be true, - * specifying -1 will wait forever - * @param sleepTime a time to sleep value in milliseconds - * @return condition value, to determine if wait was successful - */ - public static final boolean waitForCondition(BooleanSupplier condition, - long timeout, long sleepTime) { - long startTime = System.currentTimeMillis(); - while (!(condition.getAsBoolean() || (timeout != -1L - && ((System.currentTimeMillis() - startTime) > timeout)))) { - try { - Thread.sleep(sleepTime); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Error(e); - } - } - return condition.getAsBoolean(); - } - - /** - * Adjusts the provided timeout value for the TIMEOUT_FACTOR - * @param tOut the timeout value to be adjusted - * @return The timeout value adjusted for the value of "test.timeout.factor" - * system property - */ - public static long adjustTimeout(long tOut) { - return Math.round(tOut * Utils.TIMEOUT_FACTOR); - } - - /** - * Ensures a requested class is loaded - * @param aClass class to load - */ - public static void ensureClassIsLoaded(Class aClass) { - if (aClass == null) { - throw new Error("Requested null class"); - } - try { - Class.forName(aClass.getName(), /* initialize = */ true, - ClassLoader.getSystemClassLoader()); - } catch (ClassNotFoundException e) { - throw new Error("Class not found", e); - } - } - /** - * @param parent a class loader to be the parent for the returned one - * @return an UrlClassLoader with urls made of the 'test.class.path' jtreg - * property and with the given parent - */ - public static URLClassLoader getTestClassPathURLClassLoader(ClassLoader parent) { - URL[] urls = Arrays.stream(TEST_CLASS_PATH.split(File.pathSeparator)) - .map(Paths::get) - .map(Path::toUri) - .map(x -> { - try { - return x.toURL(); - } catch (MalformedURLException ex) { - throw new Error("Test issue. JTREG property" - + " 'test.class.path'" - + " is not defined correctly", ex); - } - }).toArray(URL[]::new); - return new URLClassLoader(urls, parent); - } - - /** - * Runs runnable and checks that it throws expected exception. If exceptionException is null it means - * that we expect no exception to be thrown. - * @param runnable what we run - * @param expectedException expected exception - */ - public static void runAndCheckException(Runnable runnable, Class expectedException) { - runAndCheckException(runnable, t -> { - if (t == null) { - if (expectedException != null) { - throw new AssertionError("Didn't get expected exception " + expectedException.getSimpleName()); - } - } else { - String message = "Got unexpected exception " + t.getClass().getSimpleName(); - if (expectedException == null) { - throw new AssertionError(message, t); - } else if (!expectedException.isAssignableFrom(t.getClass())) { - message += " instead of " + expectedException.getSimpleName(); - throw new AssertionError(message, t); - } - } - }); - } - - /** - * Runs runnable and makes some checks to ensure that it throws expected exception. - * @param runnable what we run - * @param checkException a consumer which checks that we got expected exception and raises a new exception otherwise - */ - public static void runAndCheckException(Runnable runnable, Consumer checkException) { - try { - runnable.run(); - checkException.accept(null); - } catch (Throwable t) { - checkException.accept(t); - } - } - - /** - * Converts to VM type signature - * - * @param type Java type to convert - * @return string representation of VM type - */ - public static String toJVMTypeSignature(Class type) { - if (type.isPrimitive()) { - if (type == boolean.class) { - return "Z"; - } else if (type == byte.class) { - return "B"; - } else if (type == char.class) { - return "C"; - } else if (type == double.class) { - return "D"; - } else if (type == float.class) { - return "F"; - } else if (type == int.class) { - return "I"; - } else if (type == long.class) { - return "J"; - } else if (type == short.class) { - return "S"; - } else if (type == void.class) { - return "V"; - } else { - throw new Error("Unsupported type: " + type); - } - } - String result = type.getName().replaceAll("\\.", "/"); - if (!type.isArray()) { - return "L" + result + ";"; - } - return result; - } - - public static Object[] getNullValues(Class... types) { - Object[] result = new Object[types.length]; - int i = 0; - for (Class type : types) { - result[i++] = NULL_VALUES.get(type); - } - return result; - } - private static Map, Object> NULL_VALUES = new HashMap<>(); - static { - NULL_VALUES.put(boolean.class, false); - NULL_VALUES.put(byte.class, (byte) 0); - NULL_VALUES.put(short.class, (short) 0); - NULL_VALUES.put(char.class, '\0'); - NULL_VALUES.put(int.class, 0); - NULL_VALUES.put(long.class, 0L); - NULL_VALUES.put(float.class, 0.0f); - NULL_VALUES.put(double.class, 0.0d); - } - - /** - * Returns mandatory property value - * @param propName is a name of property to request - * @return a String with requested property value - */ - public static String getMandatoryProperty(String propName) { - Objects.requireNonNull(propName, "Requested null property"); - String prop = System.getProperty(propName); - Objects.requireNonNull(prop, - String.format("A mandatory property '%s' isn't set", propName)); - return prop; - } -} - diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java index 334911c3a03..866c485e895 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ package jdk.test.lib.jittester; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.factories.IRNodeBuilder; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.utils.FixedTrees; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java index 719a1794f5a..2db4018d120 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.BinaryOperator; import jdk.test.lib.jittester.IRNode; import jdk.test.lib.jittester.OperatorKind; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java index a6d12a83daa..2d2dc81dc53 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.BuiltInType; import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java index 3925db13ae9..183995c169f 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryComparisonOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryComparisonOperatorFactory.java index d7250bd620e..3787ac3f9ae 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryComparisonOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryComparisonOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryEqualityOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryEqualityOperatorFactory.java index 2ad173533d7..19bf9125086 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryEqualityOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryEqualityOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryLogicOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryLogicOperatorFactory.java index cb6477f6839..9bbe91a68bc 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryLogicOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryLogicOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.BinaryOperator; import jdk.test.lib.jittester.IRNode; import jdk.test.lib.jittester.OperatorKind; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryOperatorFactory.java index 73f0e41ca78..613d5f83306 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.BinaryOperator; import jdk.test.lib.jittester.IRNode; import jdk.test.lib.jittester.OperatorKind; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java index 5f185003df2..66e13701dd2 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryStringPlusFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryStringPlusFactory.java index b7a5808aec7..55045ba1acf 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryStringPlusFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryStringPlusFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java index f8e00582d6c..16f835aac3e 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.BinaryOperator; import jdk.test.lib.jittester.IRNode; import jdk.test.lib.jittester.OperatorKind; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java index f87b495970f..73fabc71874 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.BinaryOperator; import jdk.test.lib.jittester.IRNode; import jdk.test.lib.jittester.OperatorKind; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java index f534df8d2c3..07cfacde334 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.jittester.factories; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.BinaryOperator; import jdk.test.lib.jittester.IRNode; import jdk.test.lib.jittester.OperatorKind; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java index 72613da0049..651f6739726 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ package jdk.test.lib.jittester.jtreg; import jdk.test.lib.Asserts; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; import java.io.IOException; import java.nio.file.Files; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/visitors/ByteCodeVisitor.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/visitors/ByteCodeVisitor.java index 8d5b11d1da9..a333f6209f6 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/visitors/ByteCodeVisitor.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/visitors/ByteCodeVisitor.java @@ -39,7 +39,7 @@ import jdk.internal.org.objectweb.asm.FieldVisitor; import jdk.internal.org.objectweb.asm.Label; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.test.lib.Pair; +import jdk.test.lib.util.Pair; import jdk.test.lib.jittester.BinaryOperator; import jdk.test.lib.jittester.Block; import jdk.test.lib.jittester.BuiltInType; diff --git a/hotspot/test/testlibrary_tests/AssertsTest.java b/hotspot/test/testlibrary_tests/AssertsTest.java index 449126cb31e..fd0ca96c270 100644 --- a/hotspot/test/testlibrary_tests/AssertsTest.java +++ b/hotspot/test/testlibrary_tests/AssertsTest.java @@ -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 @@ -26,7 +26,7 @@ import static jdk.test.lib.Asserts.*; /* @test * @summary Tests the different assertions in the Assert class * @modules java.base/jdk.internal.misc - * @library /testlibrary + * @library /test/lib */ public class AssertsTest { private static class Foo implements Comparable { diff --git a/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java b/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java index d708ebb829a..c8abc6f50f1 100644 --- a/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java +++ b/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java @@ -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 @@ -27,7 +27,7 @@ * @summary Test the OutputAnalyzer reporting functionality, * such as printing additional diagnostic info * (exit code, stdout, stderr, command line, etc.) - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ @@ -35,8 +35,8 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; public class OutputAnalyzerReportingTest { diff --git a/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java b/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java index 7f64529610b..6faedf4a8c5 100644 --- a/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java +++ b/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java @@ -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 @@ -24,12 +24,12 @@ /* * @test * @summary Test the OutputAnalyzer utility class - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; public class OutputAnalyzerTest { diff --git a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java index f242d2f7d28..9f4ea33e66d 100644 --- a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java +++ b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java @@ -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 * @summary Verify correctnes of the random generator from Utility.java - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run driver RandomGeneratorTest SAME_SEED @@ -38,8 +38,8 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Random; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; /** diff --git a/hotspot/test/testlibrary_tests/RedefineClassTest.java b/hotspot/test/testlibrary_tests/RedefineClassTest.java index 739352a815e..63f30055d10 100644 --- a/hotspot/test/testlibrary_tests/RedefineClassTest.java +++ b/hotspot/test/testlibrary_tests/RedefineClassTest.java @@ -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 @@ -23,19 +23,17 @@ /* * @test - * @library /testlibrary + * @library /test/lib * @summary Proof of concept test for RedefineClassHelper * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument * jdk.jartool/sun.tools.jar - * @build RedefineClassHelper * @run main RedefineClassHelper * @run main/othervm -javaagent:redefineagent.jar RedefineClassTest */ import static jdk.test.lib.Asserts.*; -import jdk.test.lib.*; /* * Proof of concept test for the test utility class RedefineClassHelper diff --git a/hotspot/test/testlibrary_tests/SimpleClassFileLoadHookTest.java b/hotspot/test/testlibrary_tests/SimpleClassFileLoadHookTest.java index d81d6d0ea6c..0da025a8112 100644 --- a/hotspot/test/testlibrary_tests/SimpleClassFileLoadHookTest.java +++ b/hotspot/test/testlibrary_tests/SimpleClassFileLoadHookTest.java @@ -23,7 +23,7 @@ /* * @test - * @library /testlibrary + * @library /test/lib * @requires vm.flavor != "minimal" * @run main/othervm/native -agentlib:SimpleClassFileLoadHook=Foo,XXX,YYY * SimpleClassFileLoadHookTest diff --git a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java index 98cf13b1dbf..399535944f6 100644 --- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java +++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java @@ -38,7 +38,7 @@ import java.util.Set; * @summary Verify that for each group of mutually exclusive predicates defined * in jdk.test.lib.Platform one and only one predicate * evaluates to true. - * @library /testlibrary + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * @run main TestMutuallyExclusivePlatformPredicates @@ -48,7 +48,7 @@ public class TestMutuallyExclusivePlatformPredicates { ARCH("isARM", "isPPC", "isSparc", "isX86", "isX64", "isAArch64"), BITNESS("is32bit", "is64bit"), OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"), - VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero"), + VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"), MODE("isInt", "isMixed", "isComp"), IGNORED("isDebugBuild", "shouldSAAttach", "canPtraceAttachLinux", "canAttachOSX", "isTieredSupported"); diff --git a/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java b/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java index c9a5beabbcb..b5172689052 100644 --- a/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java +++ b/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java @@ -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 @@ -28,10 +28,10 @@ import sun.hotspot.WhiteBox; /** * @test * @summary Verifies that Platform::isTieredSupported returns correct value. - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @build TestPlatformIsTieredSupported + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java index eb29c5bfb58..31f24081fa1 100644 --- a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java +++ b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java @@ -24,12 +24,12 @@ /* * @test * @bug 8012447 - * @library /testlibrary /test/lib /testlibrary/ctw/src + * @library /test/lib /testlibrary/ctw/src * @modules java.base/jdk.internal.jimage * java.base/jdk.internal.misc * java.base/jdk.internal.reflect * java.management - * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar + * @build sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassesDirTest prepare diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java index 873180c5300..c2823de598c 100644 --- a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java +++ b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java @@ -24,12 +24,12 @@ /* * @test * @bug 8012447 - * @library /testlibrary /test/lib /testlibrary/ctw/src + * @library /test/lib /testlibrary/ctw/src * @modules java.base/jdk.internal.jimage * java.base/jdk.internal.misc * java.base/jdk.internal.reflect * java.management - * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar + * @build sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main ClassesListTest prepare diff --git a/hotspot/test/testlibrary_tests/ctw/CtwTest.java b/hotspot/test/testlibrary_tests/ctw/CtwTest.java index 3e62a058519..06b16b631b9 100644 --- a/hotspot/test/testlibrary_tests/ctw/CtwTest.java +++ b/hotspot/test/testlibrary_tests/ctw/CtwTest.java @@ -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 @@ -37,7 +37,7 @@ import java.nio.file.StandardCopyOption; import java.nio.charset.Charset; import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; public abstract class CtwTest { protected final String[] shouldContain; diff --git a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java index 57f12a6c4b5..a784bda84ad 100644 --- a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java +++ b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java @@ -24,14 +24,14 @@ /* * @test * @bug 8012447 - * @library /testlibrary /test/lib /testlibrary/ctw/src + * @library /test/lib /testlibrary/ctw/src * @modules java.base/jdk.internal.jimage * java.base/jdk.internal.misc * java.base/jdk.internal.reflect * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build ClassFileInstaller jdk.test.lib.* sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar + * @build sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main JarDirTest prepare @@ -45,7 +45,7 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; public class JarDirTest extends CtwTest { private static final String[] SHOULD_CONTAIN diff --git a/hotspot/test/testlibrary_tests/ctw/JarsTest.java b/hotspot/test/testlibrary_tests/ctw/JarsTest.java index e9bc05c1201..16af1639854 100644 --- a/hotspot/test/testlibrary_tests/ctw/JarsTest.java +++ b/hotspot/test/testlibrary_tests/ctw/JarsTest.java @@ -24,14 +24,14 @@ /* * @test * @bug 8012447 - * @library /testlibrary /test/lib /testlibrary/ctw/src + * @library /test/lib /testlibrary/ctw/src * @modules java.base/jdk.internal.jimage * java.base/jdk.internal.misc * java.base/jdk.internal.reflect * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor - * @build ClassFileInstaller jdk.test.lib.* sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar + * @build sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main JarsTest prepare @@ -41,7 +41,7 @@ * @author igor.ignatyev@oracle.com */ -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; public class JarsTest extends CtwTest { private static final String[] SHOULD_CONTAIN diff --git a/hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java b/hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java index 3146339e093..32369638233 100644 --- a/hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,10 +24,10 @@ /* * @test BlobSanityTest * @bug 8132980 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management/sun.management - * @build BlobSanityTest + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BlobSanityTest diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java index 23e6afd02bd..302f77c3d31 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java @@ -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,12 +24,12 @@ /* * @test BooleanTest * @bug 8028756 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.compiler * java.management/sun.management * jdk.jvmstat/sun.jvmstat.monitor - * @build BooleanTest ClassFileInstaller sun.hotspot.WhiteBox jdk.test.lib.* + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BooleanTest @@ -38,7 +38,8 @@ */ import sun.hotspot.WhiteBox; -import jdk.test.lib.*; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import sun.management.*; import com.sun.management.*; diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java index 2694ba7046a..350f1f4888b 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java @@ -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,10 +24,10 @@ /* * @test DoubleTest * @bug 8028756 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management/sun.management - * @build DoubleTest + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DoubleTest diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java index 56ffc53302d..16e9eba6f6e 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java @@ -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,10 +24,10 @@ /* * @test IntxTest * @bug 8038756 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management/sun.management - * @build IntxTest + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xint -XX:-ProfileInterpreter IntxTest diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java index 22886802363..2d52d887a73 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java @@ -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,10 +24,10 @@ /* * @test SizeTTest * @bug 8054823 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management/sun.management - * @build SizeTTest + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions SizeTTest diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java index f8b98fa4daa..8bf9cabb9d4 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java @@ -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,10 +24,10 @@ /* * @test StringTest * @bug 8028756 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management/sun.management - * @build StringTest + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI StringTest diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java index 015c02eba49..c2d34f1e683 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java @@ -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,10 +24,10 @@ /* * @test Uint64Test * @bug 8028756 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * @modules java.management/sun.management - * @build Uint64Test + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI Uint64Test diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java index 97149afd248..18e802182b1 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java @@ -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,10 +24,10 @@ /* * @test UintxTest * @bug 8028756 - * @library /testlibrary /test/lib + * @library /test/lib * @modules java.base/jdk.internal.misc * java.management/sun.management - * @build UintxTest + * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI UintxTest diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java index f1ce343cfe8..35d2ffa43a1 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java @@ -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 @@ import java.util.function.Function; import sun.hotspot.WhiteBox; import sun.management.*; import com.sun.management.*; -import jdk.test.lib.*; +import jdk.test.lib.Asserts; import java.lang.management.ManagementFactory; public final class VmFlagTest { diff --git a/jdk/.hgtags b/jdk/.hgtags index 4639f93e55b..5a179a2c6bd 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -376,3 +376,4 @@ c40c8739bcdc88892ff58ebee3fd8a3f287be94d jdk-9+123 8c57f4c293bbc5609928308a6d91ba765760b5f9 jdk-9+131 d5c70818cd8a82e76632c8c815bdb4f75f53aeaf jdk-9+132 3cdae27c90b5e41afe75eab904fda19fac076330 jdk-9+133 +803adcd526d74ae0b64948d1f8260c2dbe514779 jdk-9+134 diff --git a/jdk/make/GenerateClasslist.gmk b/jdk/make/GenerateClasslist.gmk index 279cf9da012..3863a57d670 100644 --- a/jdk/make/GenerateClasslist.gmk +++ b/jdk/make/GenerateClasslist.gmk @@ -50,6 +50,8 @@ TARGETS += $(CLASSLIST_JAR) CLASSLIST_FILE := $(SUPPORT_OUTPUTDIR)/classlist/classlist +JLI_TRACE_FILE := $(SUPPORT_OUTPUTDIR)/classlist/jli_trace.out + # If an external buildjdk has been supplied, we don't build a separate interim # image, so just use the external build jdk instead. ifeq ($(EXTERNAL_BUILDJDK), true) @@ -59,13 +61,11 @@ endif $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) $(call MakeDir, $(@D)) $(call LogInfo, Generating lib/classlist) - $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.tmp \ - -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \ - build.tools.classlist.HelloClasslist $(LOG_DEBUG) 2>&1 - # Filter out generated classes, remove after JDK-8149977 $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@ \ - -Xshare:dump -XX:SharedClassListFile=$@.tmp $(LOG_DEBUG) 2>&1 - $(RM) $@.tmp + -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \ + -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \ + build.tools.classlist.HelloClasslist \ + $(LOG_DEBUG) 2>&1 > $(JLI_TRACE_FILE) TARGETS += $(CLASSLIST_FILE) diff --git a/jdk/make/gensrc/GensrcVarHandles.gmk b/jdk/make/gensrc/GensrcVarHandles.gmk index 3ad7e630e9c..b4a2bab9873 100644 --- a/jdk/make/gensrc/GensrcVarHandles.gmk +++ b/jdk/make/gensrc/GensrcVarHandles.gmk @@ -44,6 +44,10 @@ define GenerateVarHandle $1_ARGS += -KAtomicAdd endif + ifneq ($$(findstring $$($1_Type), Boolean Byte Short Char Int Long), ) + $1_ARGS += -KBitwise + endif + ifneq ($$(findstring $$($1_Type), Byte Short Char), ) $1_ARGS += -KShorterThanInt endif @@ -101,6 +105,7 @@ define GenerateVarHandleByteArray $1_ARGS += -KCAS $1_ARGS += -KAtomicAdd + $1_ARGS += -KBitwise endif ifeq ($$($1_Type), Long) @@ -113,6 +118,7 @@ define GenerateVarHandleByteArray $1_ARGS += -KCAS $1_ARGS += -KAtomicAdd + $1_ARGS += -KBitwise endif ifeq ($$($1_Type), Float) diff --git a/jdk/make/mapfiles/libawt/mapfile-mawt-vers b/jdk/make/mapfiles/libawt/mapfile-mawt-vers index 247e29698e2..0200c499f79 100644 --- a/jdk/make/mapfiles/libawt/mapfile-mawt-vers +++ b/jdk/make/mapfiles/libawt/mapfile-mawt-vers @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2014, 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 @@ -22,259 +22,261 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# Java_java_awt_KeyboardFocusManager_getGlobalHeavyweightFocusOwner; # Define public interface. # These are the libmawt exports. See mapfile-vers for the libawt exports SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; - Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; - Java_java_awt_AWTEvent_nativeSetSource; - Java_java_awt_Checkbox_initIDs; - Java_java_awt_Component_initIDs; - Java_java_awt_Dialog_initIDs; - Java_java_awt_Font_initIDs; - Java_java_awt_KeyboardFocusManager_initIDs; - Java_java_awt_Menu_initIDs; - Java_java_awt_MenuComponent_initIDs; - Java_java_awt_MenuItem_initIDs; - Java_java_awt_Scrollbar_initIDs; - Java_java_awt_ScrollPane_initIDs; - Java_java_awt_TextArea_initIDs; - Java_sun_awt_FontDescriptor_initIDs; - Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner; - Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner; - Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow; - Java_sun_awt_UNIXToolkit_check_1gtk; - Java_sun_awt_UNIXToolkit_load_1gtk; - Java_sun_awt_UNIXToolkit_unload_1gtk; - Java_sun_awt_UNIXToolkit_load_1stock_1icon; - Java_sun_awt_UNIXToolkit_load_1gtk_1icon; - Java_sun_awt_UNIXToolkit_nativeSync; - Java_sun_awt_X11InputMethod_disposeXIC; - Java_sun_awt_X11InputMethod_isCompositionEnabledNative; - Java_sun_awt_X11InputMethod_resetXIC; - Java_sun_awt_X11InputMethod_setCompositionEnabledNative; - Java_sun_awt_X11InputMethod_turnoffStatusWindow; - Java_sun_awt_SunToolkit_closeSplashScreen; - Java_sun_awt_PlatformFont_initIDs; - Java_sun_awt_X11GraphicsConfig_init; - Java_sun_awt_X11GraphicsConfig_dispose; - Java_sun_awt_X11GraphicsConfig_pGetBounds; - Java_sun_awt_X11GraphicsConfig_getNumColors; - Java_sun_awt_X11GraphicsConfig_getXResolution; - Java_sun_awt_X11GraphicsConfig_getYResolution; - Java_sun_awt_X11GraphicsConfig_createBackBuffer; - Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; - Java_sun_awt_X11GraphicsConfig_swapBuffers; - Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; - Java_sun_awt_X11GraphicsDevice_isDBESupported; - Java_sun_awt_X11GraphicsDevice_getDisplay; - Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; - Java_sun_awt_X11GraphicsDevice_getNumConfigs; - Java_sun_awt_X11GraphicsDevice_initIDs; - Java_sun_awt_X11GraphicsDevice_initXrandrExtension; - Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive; - Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive; - Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode; - Java_sun_awt_X11GraphicsDevice_enumDisplayModes; - Java_sun_awt_X11GraphicsDevice_configDisplayMode; - Java_sun_awt_X11GraphicsDevice_resetNativeData; - Java_sun_awt_X11GraphicsEnvironment_checkShmExt; - Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; - Java_sun_awt_X11GraphicsEnvironment_getDisplayString; - Java_sun_awt_X11GraphicsEnvironment_getNumScreens; - Java_sun_awt_X11GraphicsEnvironment_initDisplay; - Java_sun_awt_X11GraphicsEnvironment_initGLX; - Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; - Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; - Java_sun_awt_X11GraphicsEnvironment_initXRender; - Java_java_awt_AWTEvent_initIDs; - Java_java_awt_Button_initIDs; - Java_java_awt_Container_initIDs; - Java_java_awt_Cursor_finalizeImpl; - Java_java_awt_Cursor_initIDs; - Java_java_awt_Event_initIDs; - Java_java_awt_event_InputEvent_initIDs; - Java_java_awt_event_KeyEvent_initIDs; - Java_java_awt_FileDialog_initIDs; - Java_java_awt_Frame_initIDs; - Java_java_awt_Insets_initIDs; - Java_java_awt_TextField_initIDs; - Java_java_awt_Window_initIDs; - Java_sun_awt_X11GraphicsConfig_init; - Java_sun_awt_X11GraphicsConfig_initIDs; - Java_sun_awt_X11GraphicsConfig_makeColorModel; - Java_sun_awt_X11GraphicsDevice_getConfigVisualId; - Java_sun_awt_X11GraphicsDevice_getConfigColormap; - Java_sun_awt_X11GraphicsDevice_getConfigDepth; + Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; + Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; + Java_java_awt_AWTEvent_nativeSetSource; + Java_java_awt_Checkbox_initIDs; + Java_java_awt_Component_initIDs; + Java_java_awt_Dialog_initIDs; + Java_java_awt_Font_initIDs; + Java_java_awt_KeyboardFocusManager_initIDs; + Java_java_awt_Menu_initIDs; + Java_java_awt_MenuComponent_initIDs; + Java_java_awt_MenuItem_initIDs; + Java_java_awt_Scrollbar_initIDs; + Java_java_awt_ScrollPane_initIDs; + Java_java_awt_TextArea_initIDs; + Java_sun_awt_FontDescriptor_initIDs; + Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner; + Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner; + Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow; + Java_sun_awt_UNIXToolkit_check_1gtk; + Java_sun_awt_UNIXToolkit_load_1gtk; + Java_sun_awt_UNIXToolkit_unload_1gtk; + Java_sun_awt_UNIXToolkit_load_1stock_1icon; + Java_sun_awt_UNIXToolkit_load_1gtk_1icon; + Java_sun_awt_UNIXToolkit_nativeSync; + Java_sun_awt_X11InputMethod_disposeXIC; + Java_sun_awt_X11InputMethod_isCompositionEnabledNative; + Java_sun_awt_X11InputMethod_resetXIC; + Java_sun_awt_X11InputMethod_setCompositionEnabledNative; + Java_sun_awt_X11InputMethod_turnoffStatusWindow; + Java_sun_awt_SunToolkit_closeSplashScreen; + Java_sun_awt_PlatformFont_initIDs; + Java_sun_awt_X11GraphicsConfig_init; + Java_sun_awt_X11GraphicsConfig_dispose; + Java_sun_awt_X11GraphicsConfig_pGetBounds; + Java_sun_awt_X11GraphicsConfig_getNumColors; + Java_sun_awt_X11GraphicsConfig_getXResolution; + Java_sun_awt_X11GraphicsConfig_getYResolution; + Java_sun_awt_X11GraphicsConfig_createBackBuffer; + Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; + Java_sun_awt_X11GraphicsConfig_swapBuffers; + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; + Java_sun_awt_X11GraphicsDevice_isDBESupported; + Java_sun_awt_X11GraphicsDevice_getDisplay; + Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; + Java_sun_awt_X11GraphicsDevice_getNumConfigs; + Java_sun_awt_X11GraphicsDevice_initIDs; + Java_sun_awt_X11GraphicsDevice_initXrandrExtension; + Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive; + Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive; + Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode; + Java_sun_awt_X11GraphicsDevice_enumDisplayModes; + Java_sun_awt_X11GraphicsDevice_configDisplayMode; + Java_sun_awt_X11GraphicsDevice_resetNativeData; + Java_sun_awt_X11GraphicsEnvironment_checkShmExt; + Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; + Java_sun_awt_X11GraphicsEnvironment_getDisplayString; + Java_sun_awt_X11GraphicsEnvironment_getNumScreens; + Java_sun_awt_X11GraphicsEnvironment_initDisplay; + Java_sun_awt_X11GraphicsEnvironment_initGLX; + Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; + Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; + Java_sun_awt_X11GraphicsEnvironment_initXRender; + Java_java_awt_AWTEvent_initIDs; + Java_java_awt_Button_initIDs; + Java_java_awt_Container_initIDs; + Java_java_awt_Cursor_finalizeImpl; + Java_java_awt_Cursor_initIDs; + Java_java_awt_Event_initIDs; + Java_java_awt_event_InputEvent_initIDs; + Java_java_awt_event_KeyEvent_initIDs; + Java_java_awt_FileDialog_initIDs; + Java_java_awt_Frame_initIDs; + Java_java_awt_Insets_initIDs; + Java_java_awt_TextField_initIDs; + Java_java_awt_Window_initIDs; + Java_sun_awt_X11GraphicsConfig_init; + Java_sun_awt_X11GraphicsConfig_initIDs; + Java_sun_awt_X11GraphicsConfig_makeColorModel; + Java_sun_awt_X11GraphicsDevice_getConfigVisualId; + Java_sun_awt_X11GraphicsDevice_getConfigColormap; + Java_sun_awt_X11GraphicsDevice_getConfigDepth; - Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; - Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask; - Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; - Java_sun_java2d_x11_X11Renderer_XFillSpans; - Java_sun_java2d_x11_X11Renderer_XDrawArc; - Java_sun_java2d_x11_X11Renderer_XDrawLine; - Java_sun_java2d_x11_X11Renderer_XDrawOval; - Java_sun_java2d_x11_X11Renderer_XDrawPoly; - Java_sun_java2d_x11_X11Renderer_XDrawRect; - Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; - Java_sun_java2d_x11_X11Renderer_XDoPath; - Java_sun_java2d_x11_X11Renderer_XFillArc; - Java_sun_java2d_x11_X11Renderer_XFillOval; - Java_sun_java2d_x11_X11Renderer_XFillPoly; - Java_sun_java2d_x11_X11Renderer_XFillRect; - Java_sun_java2d_x11_X11Renderer_XFillRoundRect; - Java_sun_java2d_x11_X11Renderer_devCopyArea; - Java_sun_java2d_x11_X11SurfaceData_initIDs; - Java_sun_java2d_x11_X11SurfaceData_initOps; - Java_sun_java2d_x11_X11SurfaceData_initSurface; - Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; - Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; - Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; - Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; - Java_sun_java2d_x11_X11SurfaceData_XSetForeground; + Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; + Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask; + Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; + Java_sun_java2d_x11_X11Renderer_XFillSpans; + Java_sun_java2d_x11_X11Renderer_XDrawArc; + Java_sun_java2d_x11_X11Renderer_XDrawLine; + Java_sun_java2d_x11_X11Renderer_XDrawOval; + Java_sun_java2d_x11_X11Renderer_XDrawPoly; + Java_sun_java2d_x11_X11Renderer_XDrawRect; + Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; + Java_sun_java2d_x11_X11Renderer_XDoPath; + Java_sun_java2d_x11_X11Renderer_XFillArc; + Java_sun_java2d_x11_X11Renderer_XFillOval; + Java_sun_java2d_x11_X11Renderer_XFillPoly; + Java_sun_java2d_x11_X11Renderer_XFillRect; + Java_sun_java2d_x11_X11Renderer_XFillRoundRect; + Java_sun_java2d_x11_X11Renderer_devCopyArea; + Java_sun_java2d_x11_X11SurfaceData_initIDs; + Java_sun_java2d_x11_X11SurfaceData_initOps; + Java_sun_java2d_x11_X11SurfaceData_initSurface; + Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; + Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; + Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; + Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; + Java_sun_java2d_x11_X11SurfaceData_XSetForeground; - Java_sun_java2d_x11_XSurfaceData_initOps; - Java_sun_java2d_x11_XSurfaceData_XCreateGC; - Java_sun_java2d_x11_XSurfaceData_XResetClip; - Java_sun_java2d_x11_XSurfaceData_XSetClip; - Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; - Java_sun_java2d_x11_XSurfaceData_isDrawableValid; - Java_sun_java2d_x11_XSurfaceData_setInvalid; - Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; - Java_sun_java2d_xr_XRSurfaceData_initXRPicture; - Java_sun_java2d_xr_XRSurfaceData_initIDs; - Java_sun_java2d_xr_XRSurfaceData_XRInitSurface; - Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; - Java_sun_java2d_xr_XRBackendNative_initIDs; - Java_sun_java2d_xr_XIDGenerator_bufferXIDs; - Java_sun_java2d_xr_XRBackendNative_freeGC; - Java_sun_java2d_xr_XRBackendNative_createGC; - Java_sun_java2d_xr_XRBackendNative_createPixmap; - Java_sun_java2d_xr_XRBackendNative_createPictureNative; - Java_sun_java2d_xr_XRBackendNative_freePicture; - Java_sun_java2d_xr_XRBackendNative_freePixmap; - Java_sun_java2d_xr_XRBackendNative_setPictureRepeat; - Java_sun_java2d_xr_XRBackendNative_setGCExposures; - Java_sun_java2d_xr_XRBackendNative_setGCForeground; - Java_sun_java2d_xr_XRBackendNative_copyArea; - Java_sun_java2d_xr_XRBackendNative_renderComposite; - Java_sun_java2d_xr_XRBackendNative_renderRectangle; - Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative; - Java_sun_java2d_xr_XRBackendNative_XRSetTransformNative; - Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative; - Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative; - Java_sun_java2d_xr_XRBackendNative_setFilter; - Java_sun_java2d_xr_XRBackendNative_XRSetClipNative; - Java_sun_java2d_xr_XRBackendNative_putMaskNative; - Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative; - Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative; - Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative; - Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; - Java_sun_java2d_xr_XRBackendNative_setGCMode; - Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; - Java_sun_java2d_xr_XRUtils_initFormatPtrs; - Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; - XRT_DrawGlyphList; + Java_sun_java2d_x11_XSurfaceData_initOps; + Java_sun_java2d_x11_XSurfaceData_XCreateGC; + Java_sun_java2d_x11_XSurfaceData_XResetClip; + Java_sun_java2d_x11_XSurfaceData_XSetClip; + Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; + Java_sun_java2d_x11_XSurfaceData_isDrawableValid; + Java_sun_java2d_x11_XSurfaceData_setInvalid; + Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; + Java_sun_java2d_xr_XRSurfaceData_initXRPicture; + Java_sun_java2d_xr_XRSurfaceData_initIDs; + Java_sun_java2d_xr_XRSurfaceData_XRInitSurface; + Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; + Java_sun_java2d_xr_XRBackendNative_initIDs; + Java_sun_java2d_xr_XIDGenerator_bufferXIDs; + Java_sun_java2d_xr_XRBackendNative_freeGC; + Java_sun_java2d_xr_XRBackendNative_createGC; + Java_sun_java2d_xr_XRBackendNative_createPixmap; + Java_sun_java2d_xr_XRBackendNative_createPictureNative; + Java_sun_java2d_xr_XRBackendNative_freePicture; + Java_sun_java2d_xr_XRBackendNative_freePixmap; + Java_sun_java2d_xr_XRBackendNative_setPictureRepeat; + Java_sun_java2d_xr_XRBackendNative_setGCExposures; + Java_sun_java2d_xr_XRBackendNative_setGCForeground; + Java_sun_java2d_xr_XRBackendNative_copyArea; + Java_sun_java2d_xr_XRBackendNative_renderComposite; + Java_sun_java2d_xr_XRBackendNative_renderRectangle; + Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative; + Java_sun_java2d_xr_XRBackendNative_XRSetTransformNative; + Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative; + Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative; + Java_sun_java2d_xr_XRBackendNative_setFilter; + Java_sun_java2d_xr_XRBackendNative_XRSetClipNative; + Java_sun_java2d_xr_XRBackendNative_putMaskNative; + Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative; + Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative; + Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative; + Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; + Java_sun_java2d_xr_XRBackendNative_setGCMode; + Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; + Java_sun_java2d_xr_XRUtils_initFormatPtrs; + Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; + XRT_DrawGlyphList; - Java_sun_java2d_opengl_OGLContext_getOGLIdString; - Java_sun_java2d_opengl_OGLMaskFill_maskFill; - Java_sun_java2d_opengl_OGLRenderer_drawPoly; - Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer; - Java_sun_java2d_opengl_OGLSurfaceData_initTexture; - Java_sun_java2d_opengl_OGLSurfaceData_initFBObject; - Java_sun_java2d_opengl_OGLSurfaceData_initFlipBackbuffer; - Java_sun_java2d_opengl_OGLSurfaceData_getTextureID; - Java_sun_java2d_opengl_OGLSurfaceData_getTextureTarget; - Java_sun_java2d_opengl_OGLTextRenderer_drawGlyphList; - Java_sun_java2d_opengl_GLXGraphicsConfig_getGLXConfigInfo; - Java_sun_java2d_opengl_GLXGraphicsConfig_initConfig; - Java_sun_java2d_opengl_GLXGraphicsConfig_getOGLCapabilities; - Java_sun_java2d_opengl_GLXSurfaceData_initOps; + Java_sun_java2d_opengl_OGLContext_getOGLIdString; + Java_sun_java2d_opengl_OGLMaskFill_maskFill; + Java_sun_java2d_opengl_OGLRenderer_drawPoly; + Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer; + Java_sun_java2d_opengl_OGLSurfaceData_initTexture; + Java_sun_java2d_opengl_OGLSurfaceData_initFBObject; + Java_sun_java2d_opengl_OGLSurfaceData_initFlipBackbuffer; + Java_sun_java2d_opengl_OGLSurfaceData_getTextureID; + Java_sun_java2d_opengl_OGLSurfaceData_getTextureTarget; + Java_sun_java2d_opengl_OGLTextRenderer_drawGlyphList; + Java_sun_java2d_opengl_GLXGraphicsConfig_getGLXConfigInfo; + Java_sun_java2d_opengl_GLXGraphicsConfig_initConfig; + Java_sun_java2d_opengl_GLXGraphicsConfig_getOGLCapabilities; + Java_sun_java2d_opengl_GLXSurfaceData_initOps; - Java_sun_print_CUPSPrinter_initIDs; - Java_sun_print_CUPSPrinter_getCupsServer; - Java_sun_print_CUPSPrinter_getCupsPort; - Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; - Java_sun_print_CUPSPrinter_canConnect; - Java_sun_print_CUPSPrinter_getMedia; - Java_sun_print_CUPSPrinter_getPageSizes; - Java_sun_print_CUPSPrinter_getResolutions; + Java_sun_print_CUPSPrinter_initIDs; + Java_sun_print_CUPSPrinter_getCupsServer; + Java_sun_print_CUPSPrinter_getCupsPort; + Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; + Java_sun_print_CUPSPrinter_canConnect; + Java_sun_print_CUPSPrinter_getMedia; + Java_sun_print_CUPSPrinter_getPageSizes; + Java_sun_print_CUPSPrinter_getResolutions; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box_1gap; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1check; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1expander; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1extension; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1flat_1box; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1focus; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1handle; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1hline; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1option; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1shadow; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1slider; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1vline; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1background; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeStartPainting; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeFinishPainting; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1switch_1theme; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1get_1gtk_1setting; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeSetRangeValue; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetXThickness; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetColorForState; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box_1gap; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1check; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1expander; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1extension; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1flat_1box; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1focus; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1handle; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1hline; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1option; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1shadow; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1slider; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1vline; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1background; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeStartPainting; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeFinishPainting; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1switch_1theme; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1get_1gtk_1setting; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeSetRangeValue; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetXThickness; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetColorForState; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName; - awt_display; - awt_Lock; - awt_Unlock; - awt_GetDrawingSurface; - awt_FreeDrawingSurface; - awt_GetComponent; + awt_display; + awt_Lock; + awt_Unlock; + awt_GetDrawingSurface; + awt_FreeDrawingSurface; + awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; - X11SurfaceData_GetOps; - getDefaultConfig; - Java_sun_font_FontConfigManager_getFontConfig; - Java_sun_font_FontConfigManager_getFontConfigAASettings; - Java_sun_awt_FcFontManager_getFontPathNative; - Java_sun_font_SunFontManager_populateFontFileNameMap; + X11SurfaceData_GetOps; + getDefaultConfig; + Java_sun_font_FontConfigManager_getFontConfig; + Java_sun_font_FontConfigManager_getFontConfigAASettings; + Java_sun_awt_FcFontManager_getFontPathNative; + Java_sun_font_SunFontManager_populateFontFileNameMap; - # CDE private entry point - Java_sun_awt_motif_XsessionWMcommand; - Java_sun_awt_motif_XsessionWMcommand_New; + # CDE private entry point + Java_sun_awt_motif_XsessionWMcommand; + Java_sun_awt_motif_XsessionWMcommand_New; - # libfontmanager entry points - AWTIsHeadless; - AWTCountFonts; - AWTLoadFont; - AWTFreeFont; - AWTFontAscent; - AWTFontDescent; - AWTFontMinByte1; - AWTFontMaxByte1; - AWTFontMinCharOrByte2; - AWTFontMaxCharOrByte2; - AWTFontDefaultChar; - AWTFontPerChar; - AWTFontMaxBounds; - AWTFontTextExtents16; - AWTFreeChar; - AWTFontGenerateImage; - AWTCharAdvance; - AWTCharLBearing; - AWTCharRBearing; - AWTCharAscent; - AWTCharDescent; - AWTDrawGlyphList; - AccelGlyphCache_RemoveAllCellInfos; + # libfontmanager entry points + AWTIsHeadless; + AWTCountFonts; + AWTLoadFont; + AWTFreeFont; + AWTFontAscent; + AWTFontDescent; + AWTFontMinByte1; + AWTFontMaxByte1; + AWTFontMinCharOrByte2; + AWTFontMaxCharOrByte2; + AWTFontDefaultChar; + AWTFontPerChar; + AWTFontMaxBounds; + AWTFontTextExtents16; + AWTFreeChar; + AWTFontGenerateImage; + AWTCharAdvance; + AWTCharLBearing; + AWTCharRBearing; + AWTCharAscent; + AWTCharDescent; + AWTDrawGlyphList; + AccelGlyphCache_RemoveAllCellInfos; - local: - *; + local: + *; }; diff --git a/jdk/make/mapfiles/libawt/mapfile-vers b/jdk/make/mapfiles/libawt/mapfile-vers index 4624977e75c..9d8a34d3f37 100644 --- a/jdk/make/mapfiles/libawt/mapfile-vers +++ b/jdk/make/mapfiles/libawt/mapfile-vers @@ -27,163 +27,163 @@ # These are the libawt exports, mapfile-mawt-vers contains the libmawt exports. SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_java_awt_CheckboxMenuItem_initIDs; - Java_java_awt_Color_initIDs; - Java_java_awt_FontMetrics_initIDs; - Java_java_awt_image_BufferedImage_initIDs; - Java_sun_awt_image_DataBufferNative_getElem; - Java_sun_awt_image_DataBufferNative_setElem; - Java_java_awt_image_ColorModel_initIDs; - Java_java_awt_image_IndexColorModel_initIDs; - Java_java_awt_image_Kernel_initIDs; - Java_java_awt_image_Raster_initIDs; - Java_java_awt_image_SampleModel_initIDs; - Java_java_awt_Label_initIDs; - Java_java_awt_MenuBar_initIDs; - Java_java_awt_ScrollPaneAdjustable_initIDs; - Java_java_awt_Toolkit_initIDs; - Java_sun_awt_DebugSettings_setCTracingOn__Z; - Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2; - Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2I; - Java_sun_awt_image_ByteComponentRaster_initIDs; - Java_sun_awt_image_GifImageDecoder_initIDs; - Java_sun_awt_image_GifImageDecoder_parseImage; - Java_sun_awt_image_ImageRepresentation_initIDs; - Java_sun_awt_image_ImageRepresentation_setDiffICM; - Java_sun_awt_image_ImageRepresentation_setICMpixels; - Java_sun_awt_image_ImagingLib_convolveBI; - Java_sun_awt_image_ImagingLib_convolveRaster; - Java_sun_awt_image_ImagingLib_init; - Java_sun_awt_image_ImagingLib_transformBI; - Java_sun_awt_image_ImagingLib_transformRaster; - Java_sun_awt_image_IntegerComponentRaster_initIDs; - Java_sun_awt_image_ShortComponentRaster_initIDs; - Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile; - Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans; - Java_sun_java2d_pipe_SpanClipRenderer_eraseTile; - Java_sun_java2d_pipe_SpanClipRenderer_fillTile; - Java_sun_java2d_pipe_ShapeSpanIterator_addSegment; - Java_sun_java2d_pipe_ShapeSpanIterator_moveTo; - Java_sun_java2d_pipe_ShapeSpanIterator_lineTo; - Java_sun_java2d_pipe_ShapeSpanIterator_quadTo; - Java_sun_java2d_pipe_ShapeSpanIterator_curveTo; - Java_sun_java2d_pipe_ShapeSpanIterator_closePath; - Java_sun_java2d_pipe_ShapeSpanIterator_pathDone; - Java_sun_java2d_pipe_ShapeSpanIterator_getNativeConsumer; - Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly; - Java_sun_java2d_pipe_ShapeSpanIterator_dispose; - Java_sun_java2d_pipe_ShapeSpanIterator_getNativeIterator; - Java_sun_java2d_pipe_ShapeSpanIterator_getPathBox; - Java_sun_java2d_pipe_ShapeSpanIterator_initIDs; - Java_sun_java2d_pipe_ShapeSpanIterator_intersectClipBox; - Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan; - Java_sun_java2d_pipe_ShapeSpanIterator_setNormalize; - Java_sun_java2d_pipe_ShapeSpanIterator_setOutputAreaXYXY; - Java_sun_java2d_pipe_ShapeSpanIterator_setRule; - Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo; + Java_java_awt_CheckboxMenuItem_initIDs; + Java_java_awt_Color_initIDs; + Java_java_awt_FontMetrics_initIDs; + Java_java_awt_image_BufferedImage_initIDs; + Java_sun_awt_image_DataBufferNative_getElem; + Java_sun_awt_image_DataBufferNative_setElem; + Java_java_awt_image_ColorModel_initIDs; + Java_java_awt_image_IndexColorModel_initIDs; + Java_java_awt_image_Kernel_initIDs; + Java_java_awt_image_Raster_initIDs; + Java_java_awt_image_SampleModel_initIDs; + Java_java_awt_Label_initIDs; + Java_java_awt_MenuBar_initIDs; + Java_java_awt_ScrollPaneAdjustable_initIDs; + Java_java_awt_Toolkit_initIDs; + Java_sun_awt_DebugSettings_setCTracingOn__Z; + Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2; + Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2I; + Java_sun_awt_image_ByteComponentRaster_initIDs; + Java_sun_awt_image_GifImageDecoder_initIDs; + Java_sun_awt_image_GifImageDecoder_parseImage; + Java_sun_awt_image_ImageRepresentation_initIDs; + Java_sun_awt_image_ImageRepresentation_setDiffICM; + Java_sun_awt_image_ImageRepresentation_setICMpixels; + Java_sun_awt_image_ImagingLib_convolveBI; + Java_sun_awt_image_ImagingLib_convolveRaster; + Java_sun_awt_image_ImagingLib_init; + Java_sun_awt_image_ImagingLib_transformBI; + Java_sun_awt_image_ImagingLib_transformRaster; + Java_sun_awt_image_IntegerComponentRaster_initIDs; + Java_sun_awt_image_ShortComponentRaster_initIDs; + Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile; + Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans; + Java_sun_java2d_pipe_SpanClipRenderer_eraseTile; + Java_sun_java2d_pipe_SpanClipRenderer_fillTile; + Java_sun_java2d_pipe_ShapeSpanIterator_addSegment; + Java_sun_java2d_pipe_ShapeSpanIterator_moveTo; + Java_sun_java2d_pipe_ShapeSpanIterator_lineTo; + Java_sun_java2d_pipe_ShapeSpanIterator_quadTo; + Java_sun_java2d_pipe_ShapeSpanIterator_curveTo; + Java_sun_java2d_pipe_ShapeSpanIterator_closePath; + Java_sun_java2d_pipe_ShapeSpanIterator_pathDone; + Java_sun_java2d_pipe_ShapeSpanIterator_getNativeConsumer; + Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly; + Java_sun_java2d_pipe_ShapeSpanIterator_dispose; + Java_sun_java2d_pipe_ShapeSpanIterator_getNativeIterator; + Java_sun_java2d_pipe_ShapeSpanIterator_getPathBox; + Java_sun_java2d_pipe_ShapeSpanIterator_initIDs; + Java_sun_java2d_pipe_ShapeSpanIterator_intersectClipBox; + Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan; + Java_sun_java2d_pipe_ShapeSpanIterator_setNormalize; + Java_sun_java2d_pipe_ShapeSpanIterator_setOutputAreaXYXY; + Java_sun_java2d_pipe_ShapeSpanIterator_setRule; + Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo; - Java_java_awt_Choice_initIDs; - Java_java_awt_Dimension_initIDs; - Java_java_awt_event_MouseEvent_initIDs; - Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; - Java_java_awt_Rectangle_initIDs; - Java_sun_awt_image_BufImgSurfaceData_initIDs; - Java_sun_awt_image_BufImgSurfaceData_initRaster; - Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData; - Java_sun_awt_image_BytePackedRaster_initIDs; - Java_sun_awt_image_ImagingLib_lookupByteBI; - Java_sun_awt_image_ImagingLib_lookupByteRaster; - Java_sun_java2d_SurfaceData_initIDs; - Java_sun_java2d_SurfaceData_isOpaqueGray; - Java_sun_java2d_Disposer_initIDs; - Java_sun_java2d_DefaultDisposerRecord_invokeNativeDispose; - Java_sun_java2d_loops_BlitBg_BlitBg; - Java_sun_java2d_loops_Blit_Blit; - Java_sun_java2d_loops_ScaledBlit_Scale; - Java_sun_java2d_loops_DrawLine_DrawLine; - Java_sun_java2d_loops_DrawPolygons_DrawPolygons; - Java_sun_java2d_loops_DrawPath_DrawPath; - Java_sun_java2d_loops_FillPath_FillPath; + Java_java_awt_Choice_initIDs; + Java_java_awt_Dimension_initIDs; + Java_java_awt_event_MouseEvent_initIDs; + Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; + Java_java_awt_Rectangle_initIDs; + Java_sun_awt_image_BufImgSurfaceData_initIDs; + Java_sun_awt_image_BufImgSurfaceData_initRaster; + Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData; + Java_sun_awt_image_BytePackedRaster_initIDs; + Java_sun_awt_image_ImagingLib_lookupByteBI; + Java_sun_awt_image_ImagingLib_lookupByteRaster; + Java_sun_java2d_SurfaceData_initIDs; + Java_sun_java2d_SurfaceData_isOpaqueGray; + Java_sun_java2d_Disposer_initIDs; + Java_sun_java2d_DefaultDisposerRecord_invokeNativeDispose; + Java_sun_java2d_loops_BlitBg_BlitBg; + Java_sun_java2d_loops_Blit_Blit; + Java_sun_java2d_loops_ScaledBlit_Scale; + Java_sun_java2d_loops_DrawLine_DrawLine; + Java_sun_java2d_loops_DrawPolygons_DrawPolygons; + Java_sun_java2d_loops_DrawPath_DrawPath; + Java_sun_java2d_loops_FillPath_FillPath; - Java_sun_java2d_loops_DrawRect_DrawRect; - Java_sun_java2d_loops_FillRect_FillRect; - Java_sun_java2d_loops_FillSpans_FillSpans; - Java_sun_java2d_loops_FillParallelogram_FillParallelogram; - Java_sun_java2d_loops_DrawParallelogram_DrawParallelogram; - Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs; - Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops; - Java_sun_java2d_loops_MaskBlit_MaskBlit; - Java_sun_java2d_loops_MaskFill_MaskFill; - Java_sun_java2d_loops_MaskFill_FillAAPgram; - Java_sun_java2d_loops_MaskFill_DrawAAPgram; - Java_sun_java2d_loops_TransformHelper_Transform; - Java_sun_java2d_pipe_Region_initIDs; - Java_sun_java2d_pipe_SpanClipRenderer_initIDs; - sun_awt_image_GifImageDecoder_initIDs; + Java_sun_java2d_loops_DrawRect_DrawRect; + Java_sun_java2d_loops_FillRect_FillRect; + Java_sun_java2d_loops_FillSpans_FillSpans; + Java_sun_java2d_loops_FillParallelogram_FillParallelogram; + Java_sun_java2d_loops_DrawParallelogram_DrawParallelogram; + Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs; + Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops; + Java_sun_java2d_loops_MaskBlit_MaskBlit; + Java_sun_java2d_loops_MaskFill_MaskFill; + Java_sun_java2d_loops_MaskFill_FillAAPgram; + Java_sun_java2d_loops_MaskFill_DrawAAPgram; + Java_sun_java2d_loops_TransformHelper_Transform; + Java_sun_java2d_pipe_Region_initIDs; + Java_sun_java2d_pipe_SpanClipRenderer_initIDs; + sun_awt_image_GifImageDecoder_initIDs; - # libmawt entry points - SurfaceData_InitOps; - SurfaceData_ThrowInvalidPipeException; - SurfaceData_IntersectBlitBounds; - SurfaceData_IntersectBoundsXYXY; - Region_GetBounds; - Region_GetInfo; - Region_StartIteration; - Region_CountIterationRects; - Region_NextIteration; - Region_EndIteration; - RegionToYXBandedRectangles; - GrPrim_CompGetXorInfo; - GrPrim_CompGetAlphaInfo; - J2dTraceImpl; - J2dTraceInit; - img_makePalette; - initInverseGrayLut; - make_dither_arrays; - make_uns_ordered_dither_array; + # libmawt entry points + SurfaceData_InitOps; + SurfaceData_ThrowInvalidPipeException; + SurfaceData_IntersectBlitBounds; + SurfaceData_IntersectBoundsXYXY; + Region_GetBounds; + Region_GetInfo; + Region_StartIteration; + Region_CountIterationRects; + Region_NextIteration; + Region_EndIteration; + RegionToYXBandedRectangles; + GrPrim_CompGetXorInfo; + GrPrim_CompGetAlphaInfo; + J2dTraceImpl; + J2dTraceInit; + img_makePalette; + initInverseGrayLut; + make_dither_arrays; + make_uns_ordered_dither_array; - # variables exported to libmawt - std_img_oda_red; - std_img_oda_blue; - std_img_oda_green; - std_odas_computed; - g_CMpDataID; - colorValueID; - mul8table; - div8table; - jvm; + # variables exported to libmawt + std_img_oda_red; + std_img_oda_blue; + std_img_oda_green; + std_odas_computed; + g_CMpDataID; + colorValueID; + mul8table; + div8table; + jvm; - # ProcessPath entry points and data - doDrawPath; - doFillPath; - path2DNumTypesID; - path2DTypesID; - path2DWindingRuleID; - path2DFloatCoordsID; - sg2dStrokeHintID; - sunHints_INTVAL_STROKE_PURE; + # ProcessPath entry points and data + doDrawPath; + doFillPath; + path2DNumTypesID; + path2DTypesID; + path2DWindingRuleID; + path2DFloatCoordsID; + sg2dStrokeHintID; + sunHints_INTVAL_STROKE_PURE; - # CDE private entry points - # These are in awt_LoadLibrary.c and falls through to libmawt. - # Evidently CDE needs this for backward compatability. - Java_sun_awt_motif_XsessionWMcommand; - Java_sun_awt_motif_XsessionWMcommand_New; + # CDE private entry points + # These are in awt_LoadLibrary.c and falls through to libmawt. + # Evidently CDE needs this for backward compatability. + Java_sun_awt_motif_XsessionWMcommand; + Java_sun_awt_motif_XsessionWMcommand_New; - # libfontmanager entry points - AWTIsHeadless; - GrPrim_Sg2dGetCompInfo; - GrPrim_Sg2dGetClip; - GetNativePrim; - SurfaceData_IntersectBounds; - SurfaceData_GetOps; - Disposer_AddRecord; - GrPrim_Sg2dGetEaRGB; - GrPrim_Sg2dGetPixel; - GrPrim_Sg2dGetLCDTextContrast; + # libfontmanager entry points + AWTIsHeadless; + GrPrim_Sg2dGetCompInfo; + GrPrim_Sg2dGetClip; + GetNativePrim; + SurfaceData_IntersectBounds; + SurfaceData_GetOps; + Disposer_AddRecord; + GrPrim_Sg2dGetEaRGB; + GrPrim_Sg2dGetPixel; + GrPrim_Sg2dGetLCDTextContrast; - local: - *; + local: + *; }; diff --git a/jdk/make/mapfiles/libawt/mapfile-vers-linux b/jdk/make/mapfiles/libawt/mapfile-vers-linux index 5645cbd18d9..90e12f075b1 100644 --- a/jdk/make/mapfiles/libawt/mapfile-vers-linux +++ b/jdk/make/mapfiles/libawt/mapfile-vers-linux @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 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,277 +27,278 @@ # Linux port does not use mawt, all public symbols are in libawt.so SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_java_awt_CheckboxMenuItem_initIDs; - Java_java_awt_Color_initIDs; - Java_java_awt_FontMetrics_initIDs; - Java_java_awt_image_BufferedImage_initIDs; - Java_sun_awt_image_DataBufferNative_getElem; - Java_sun_awt_image_DataBufferNative_setElem; - Java_java_awt_image_ColorModel_initIDs; - Java_java_awt_image_IndexColorModel_initIDs; - Java_java_awt_image_Kernel_initIDs; - Java_java_awt_image_Raster_initIDs; - Java_java_awt_image_SampleModel_initIDs; - Java_java_awt_Label_initIDs; - Java_java_awt_MenuBar_initIDs; - Java_java_awt_ScrollPaneAdjustable_initIDs; - Java_java_awt_Toolkit_initIDs; - Java_java_awt_TrayIcon_initIDs; - Java_sun_awt_DebugSettings_setCTracingOn__Z; - Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2; - Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2I; - Java_sun_awt_image_ByteComponentRaster_initIDs; - Java_sun_awt_image_GifImageDecoder_initIDs; - Java_sun_awt_image_GifImageDecoder_parseImage; - Java_sun_awt_image_Image_initIDs; - Java_sun_awt_image_ImageRepresentation_initIDs; - Java_sun_awt_image_ImageRepresentation_setDiffICM; - Java_sun_awt_image_ImageRepresentation_setICMpixels; - Java_sun_awt_image_ImagingLib_convolveBI; - Java_sun_awt_image_ImagingLib_convolveRaster; - Java_sun_awt_image_ImagingLib_init; - Java_sun_awt_image_ImagingLib_transformBI; - Java_sun_awt_image_ImagingLib_transformRaster; - Java_sun_awt_image_IntegerComponentRaster_initIDs; - Java_sun_awt_image_ShortComponentRaster_initIDs; - Java_sun_java2d_pipe_SpanClipRenderer_eraseTile; - Java_sun_java2d_pipe_SpanClipRenderer_fillTile; - Java_sun_java2d_pipe_ShapeSpanIterator_addSegment; - Java_sun_java2d_pipe_ShapeSpanIterator_moveTo; - Java_sun_java2d_pipe_ShapeSpanIterator_lineTo; - Java_sun_java2d_pipe_ShapeSpanIterator_quadTo; - Java_sun_java2d_pipe_ShapeSpanIterator_curveTo; - Java_sun_java2d_pipe_ShapeSpanIterator_closePath; - Java_sun_java2d_pipe_ShapeSpanIterator_pathDone; - Java_sun_java2d_pipe_ShapeSpanIterator_getNativeConsumer; - Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly; - Java_sun_java2d_pipe_ShapeSpanIterator_dispose; - Java_sun_java2d_pipe_ShapeSpanIterator_getNativeIterator; - Java_sun_java2d_pipe_ShapeSpanIterator_getPathBox; - Java_sun_java2d_pipe_ShapeSpanIterator_initIDs; - Java_sun_java2d_pipe_ShapeSpanIterator_intersectClipBox; - Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan; - Java_sun_java2d_pipe_ShapeSpanIterator_setNormalize; - Java_sun_java2d_pipe_ShapeSpanIterator_setOutputAreaXYXY; - Java_sun_java2d_pipe_ShapeSpanIterator_setRule; - Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo; + Java_java_awt_CheckboxMenuItem_initIDs; + Java_java_awt_Color_initIDs; + Java_java_awt_FontMetrics_initIDs; + Java_java_awt_image_BufferedImage_initIDs; + Java_sun_awt_image_DataBufferNative_getElem; + Java_sun_awt_image_DataBufferNative_setElem; + Java_java_awt_image_ColorModel_initIDs; + Java_java_awt_image_IndexColorModel_initIDs; + Java_java_awt_image_Kernel_initIDs; + Java_java_awt_image_Raster_initIDs; + Java_java_awt_image_SampleModel_initIDs; + Java_java_awt_Label_initIDs; + Java_java_awt_MenuBar_initIDs; + Java_java_awt_ScrollPaneAdjustable_initIDs; + Java_java_awt_Toolkit_initIDs; + Java_java_awt_TrayIcon_initIDs; + Java_sun_awt_DebugSettings_setCTracingOn__Z; + Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2; + Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2I; + Java_sun_awt_image_ByteComponentRaster_initIDs; + Java_sun_awt_image_GifImageDecoder_initIDs; + Java_sun_awt_image_GifImageDecoder_parseImage; + Java_sun_awt_image_Image_initIDs; + Java_sun_awt_image_ImageRepresentation_initIDs; + Java_sun_awt_image_ImageRepresentation_setDiffICM; + Java_sun_awt_image_ImageRepresentation_setICMpixels; + Java_sun_awt_image_ImagingLib_convolveBI; + Java_sun_awt_image_ImagingLib_convolveRaster; + Java_sun_awt_image_ImagingLib_init; + Java_sun_awt_image_ImagingLib_transformBI; + Java_sun_awt_image_ImagingLib_transformRaster; + Java_sun_awt_image_IntegerComponentRaster_initIDs; + Java_sun_awt_image_ShortComponentRaster_initIDs; + Java_sun_java2d_pipe_SpanClipRenderer_eraseTile; + Java_sun_java2d_pipe_SpanClipRenderer_fillTile; + Java_sun_java2d_pipe_ShapeSpanIterator_addSegment; + Java_sun_java2d_pipe_ShapeSpanIterator_moveTo; + Java_sun_java2d_pipe_ShapeSpanIterator_lineTo; + Java_sun_java2d_pipe_ShapeSpanIterator_quadTo; + Java_sun_java2d_pipe_ShapeSpanIterator_curveTo; + Java_sun_java2d_pipe_ShapeSpanIterator_closePath; + Java_sun_java2d_pipe_ShapeSpanIterator_pathDone; + Java_sun_java2d_pipe_ShapeSpanIterator_getNativeConsumer; + Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly; + Java_sun_java2d_pipe_ShapeSpanIterator_dispose; + Java_sun_java2d_pipe_ShapeSpanIterator_getNativeIterator; + Java_sun_java2d_pipe_ShapeSpanIterator_getPathBox; + Java_sun_java2d_pipe_ShapeSpanIterator_initIDs; + Java_sun_java2d_pipe_ShapeSpanIterator_intersectClipBox; + Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan; + Java_sun_java2d_pipe_ShapeSpanIterator_setNormalize; + Java_sun_java2d_pipe_ShapeSpanIterator_setOutputAreaXYXY; + Java_sun_java2d_pipe_ShapeSpanIterator_setRule; + Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo; - Java_java_awt_Choice_initIDs; - Java_java_awt_Dimension_initIDs; - Java_java_awt_event_MouseEvent_initIDs; - Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; - Java_java_awt_Rectangle_initIDs; - Java_sun_awt_image_BufImgSurfaceData_getSurfaceData; - Java_sun_awt_image_BufImgSurfaceData_initIDs; - Java_sun_awt_image_BufImgSurfaceData_initRaster; - Java_sun_awt_image_BufImgSurfaceData_setSurfaceData; - Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData; - Java_sun_awt_image_BytePackedRaster_initIDs; - Java_sun_awt_image_ImagingLib_lookupByteBI; - Java_sun_awt_image_ImagingLib_lookupByteRaster; - Java_sun_java2d_SurfaceData_initIDs; - Java_sun_java2d_SurfaceData_isOpaqueGray; - Java_sun_java2d_Disposer_initIDs; - Java_sun_java2d_DefaultDisposerRecord_invokeNativeDispose; - Java_sun_java2d_loops_BlitBg_BlitBg; - Java_sun_java2d_loops_Blit_Blit; - Java_sun_java2d_loops_ScaledBlit_Scale; - Java_sun_java2d_loops_DrawLine_DrawLine; - Java_sun_java2d_loops_DrawPolygons_DrawPolygons; - Java_sun_java2d_loops_DrawRect_DrawRect; - Java_sun_java2d_loops_FillRect_FillRect; - Java_sun_java2d_loops_FillSpans_FillSpans; - Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs; - Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops; - Java_sun_java2d_loops_MaskBlit_MaskBlit; - Java_sun_java2d_loops_MaskFill_MaskFill; - Java_sun_java2d_loops_MaskFill_FillAAPgram; - Java_sun_java2d_loops_MaskFill_DrawAAPgram; - Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans; - Java_sun_java2d_pipe_SpanClipRenderer_initIDs; - sun_awt_image_GifImageDecoder_initIDs; + Java_java_awt_Choice_initIDs; + Java_java_awt_Dimension_initIDs; + Java_java_awt_event_MouseEvent_initIDs; + Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; + Java_java_awt_Rectangle_initIDs; + Java_sun_awt_image_BufImgSurfaceData_getSurfaceData; + Java_sun_awt_image_BufImgSurfaceData_initIDs; + Java_sun_awt_image_BufImgSurfaceData_initRaster; + Java_sun_awt_image_BufImgSurfaceData_setSurfaceData; + Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData; + Java_sun_awt_image_BytePackedRaster_initIDs; + Java_sun_awt_image_ImagingLib_lookupByteBI; + Java_sun_awt_image_ImagingLib_lookupByteRaster; + Java_sun_java2d_SurfaceData_initIDs; + Java_sun_java2d_SurfaceData_isOpaqueGray; + Java_sun_java2d_Disposer_initIDs; + Java_sun_java2d_DefaultDisposerRecord_invokeNativeDispose; + Java_sun_java2d_loops_BlitBg_BlitBg; + Java_sun_java2d_loops_Blit_Blit; + Java_sun_java2d_loops_ScaledBlit_Scale; + Java_sun_java2d_loops_DrawLine_DrawLine; + Java_sun_java2d_loops_DrawPolygons_DrawPolygons; + Java_sun_java2d_loops_DrawRect_DrawRect; + Java_sun_java2d_loops_FillRect_FillRect; + Java_sun_java2d_loops_FillSpans_FillSpans; + Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs; + Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops; + Java_sun_java2d_loops_MaskBlit_MaskBlit; + Java_sun_java2d_loops_MaskFill_MaskFill; + Java_sun_java2d_loops_MaskFill_FillAAPgram; + Java_sun_java2d_loops_MaskFill_DrawAAPgram; + Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans; + Java_sun_java2d_pipe_SpanClipRenderer_initIDs; + sun_awt_image_GifImageDecoder_initIDs; - # libmawt entry points - SurfaceData_InitOps; - SurfaceData_ThrowInvalidPipeException; - Region_GetBounds; - Region_GetInfo; - Region_StartIteration; - Region_CountIterationRects; - Region_NextIteration; - Region_EndIteration; - GrPrim_CompGetXorInfo; - GrPrim_CompGetAlphaInfo; - img_makePalette; - initInverseGrayLut; - make_dither_arrays; - make_uns_ordered_dither_array; + # libmawt entry points + SurfaceData_InitOps; + SurfaceData_ThrowInvalidPipeException; + Region_GetBounds; + Region_GetInfo; + Region_StartIteration; + Region_CountIterationRects; + Region_NextIteration; + Region_EndIteration; + GrPrim_CompGetXorInfo; + GrPrim_CompGetAlphaInfo; + img_makePalette; + initInverseGrayLut; + make_dither_arrays; + make_uns_ordered_dither_array; - # variables exported to libmawt - std_img_oda_red; - std_img_oda_blue; - std_img_oda_green; - std_odas_computed; - g_CMpDataID; - colorValueID; - jvm; + # variables exported to libmawt + std_img_oda_red; + std_img_oda_blue; + std_img_oda_green; + std_odas_computed; + g_CMpDataID; + colorValueID; + jvm; - # CDE private entry point - # This is in awt_LoadLibrary.c and falls through to libmawt. - # Evidently CDE needs this for backward compatability. - Java_sun_awt_motif_XsessionWMcommand; + # CDE private entry point + # This is in awt_LoadLibrary.c and falls through to libmawt. + # Evidently CDE needs this for backward compatability. + Java_sun_awt_motif_XsessionWMcommand; - # libfontmanager entry points - AWTIsHeadless; - GrPrim_Sg2dGetCompInfo; - GrPrim_Sg2dGetClip; - GetNativePrim; - SurfaceData_IntersectBounds; - SurfaceData_GetOps; - Disposer_AddRecord; - GrPrim_Sg2dGetEaRGB; - GrPrim_Sg2dGetPixel; - GrPrim_Sg2dGetLCDTextContrast; + # libfontmanager entry points + AWTIsHeadless; + GrPrim_Sg2dGetCompInfo; + GrPrim_Sg2dGetClip; + GetNativePrim; + SurfaceData_IntersectBounds; + SurfaceData_GetOps; + Disposer_AddRecord; + GrPrim_Sg2dGetEaRGB; + GrPrim_Sg2dGetPixel; + GrPrim_Sg2dGetLCDTextContrast; - Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; - Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; - Java_java_awt_AWTEvent_nativeSetSource; - Java_java_awt_Checkbox_initIDs; - Java_java_awt_Component_initIDs; - Java_java_awt_Dialog_initIDs; - Java_java_awt_Font_initIDs; - Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner; - Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner; - Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow; - Java_java_awt_KeyboardFocusManager_initIDs; - Java_java_awt_Menu_initIDs; - Java_java_awt_MenuComponent_initIDs; - Java_java_awt_MenuItem_initIDs; - Java_java_awt_Scrollbar_initIDs; - Java_java_awt_ScrollPane_initIDs; - Java_java_awt_TextArea_initIDs; - Java_sun_awt_FontDescriptor_initIDs; - Java_sun_awt_X11InputMethod_disposeXIC; - Java_sun_awt_X11InputMethod_isCompositionEnabledNative; - Java_sun_awt_X11InputMethod_resetXIC; - Java_sun_awt_X11InputMethod_setCompositionEnabledNative; - Java_sun_awt_X11InputMethod_turnoffStatusWindow; - Java_sun_awt_SunToolkit_closeSplashScreen; - Java_sun_awt_PlatformFont_initIDs; - Java_sun_awt_X11GraphicsConfig_init; - Java_sun_awt_X11GraphicsConfig_dispose; - Java_sun_awt_X11GraphicsConfig_pGetBounds; - Java_sun_awt_X11GraphicsConfig_getNumColors; - Java_sun_awt_X11GraphicsConfig_getXResolution; - Java_sun_awt_X11GraphicsConfig_getYResolution; - Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; - Java_sun_awt_X11GraphicsDevice_isDBESupported; - Java_sun_awt_X11GraphicsDevice_getDisplay; - Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; - Java_sun_awt_X11GraphicsDevice_getNumConfigs; - Java_sun_awt_X11GraphicsDevice_initIDs; - Java_sun_awt_X11GraphicsDevice_initXrandrExtension; - Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive; - Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive; - Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode; - Java_sun_awt_X11GraphicsDevice_enumDisplayModes; - Java_sun_awt_X11GraphicsDevice_configDisplayMode; - Java_sun_awt_X11GraphicsDevice_resetNativeData; - Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor; - Java_sun_awt_X11GraphicsEnvironment_checkShmExt; - Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; - Java_sun_awt_X11GraphicsEnvironment_getDisplayString; - Java_sun_awt_X11GraphicsEnvironment_getNumScreens; - Java_sun_awt_X11GraphicsEnvironment_initDisplay; - Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; - Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; - Java_sun_awt_X11GraphicsEnvironment_initXRender; + Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; + Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; + Java_java_awt_AWTEvent_nativeSetSource; + Java_java_awt_Checkbox_initIDs; + Java_java_awt_Component_initIDs; + Java_java_awt_Dialog_initIDs; + Java_java_awt_Font_initIDs; + Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner; + Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner; + Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow; + Java_java_awt_KeyboardFocusManager_initIDs; + Java_java_awt_Menu_initIDs; + Java_java_awt_MenuComponent_initIDs; + Java_java_awt_MenuItem_initIDs; + Java_java_awt_Scrollbar_initIDs; + Java_java_awt_ScrollPane_initIDs; + Java_java_awt_TextArea_initIDs; + Java_sun_awt_FontDescriptor_initIDs; + Java_sun_awt_X11InputMethod_disposeXIC; + Java_sun_awt_X11InputMethod_isCompositionEnabledNative; + Java_sun_awt_X11InputMethod_resetXIC; + Java_sun_awt_X11InputMethod_setCompositionEnabledNative; + Java_sun_awt_X11InputMethod_turnoffStatusWindow; + Java_sun_awt_SunToolkit_closeSplashScreen; + Java_sun_awt_PlatformFont_initIDs; + Java_sun_awt_X11GraphicsConfig_init; + Java_sun_awt_X11GraphicsConfig_dispose; + Java_sun_awt_X11GraphicsConfig_pGetBounds; + Java_sun_awt_X11GraphicsConfig_getNumColors; + Java_sun_awt_X11GraphicsConfig_getXResolution; + Java_sun_awt_X11GraphicsConfig_getYResolution; + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; + Java_sun_awt_X11GraphicsDevice_isDBESupported; + Java_sun_awt_X11GraphicsDevice_getDisplay; + Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; + Java_sun_awt_X11GraphicsDevice_getNumConfigs; + Java_sun_awt_X11GraphicsDevice_initIDs; + Java_sun_awt_X11GraphicsDevice_initXrandrExtension; + Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive; + Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive; + Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode; + Java_sun_awt_X11GraphicsDevice_enumDisplayModes; + Java_sun_awt_X11GraphicsDevice_configDisplayMode; + Java_sun_awt_X11GraphicsDevice_resetNativeData; + Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor; + Java_sun_awt_X11GraphicsEnvironment_checkShmExt; + Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; + Java_sun_awt_X11GraphicsEnvironment_getDisplayString; + Java_sun_awt_X11GraphicsEnvironment_getNumScreens; + Java_sun_awt_X11GraphicsEnvironment_initDisplay; + Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; + Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; + Java_sun_awt_X11GraphicsEnvironment_initXRender; + Java_java_awt_AWTEvent_initIDs; + Java_java_awt_Button_initIDs; + Java_java_awt_Container_initIDs; + Java_java_awt_Cursor_finalizeImpl; + Java_java_awt_Cursor_initIDs; + Java_java_awt_Event_initIDs; + Java_java_awt_event_InputEvent_initIDs; + Java_java_awt_event_KeyEvent_initIDs; + Java_java_awt_FileDialog_initIDs; + Java_java_awt_Frame_initIDs; + Java_java_awt_Insets_initIDs; + Java_java_awt_TextField_initIDs; + Java_java_awt_Window_initIDs; + Java_sun_awt_motif_X11OffScreenImage_updateBitmask; + Java_sun_awt_X11GraphicsConfig_init; + Java_sun_awt_X11GraphicsConfig_initIDs; + Java_sun_awt_X11GraphicsConfig_makeColorModel; + Java_sun_awt_X11GraphicsDevice_getConfigVisualId; + Java_sun_awt_X11PMBlitLoops_Blit; + Java_sun_awt_X11PMBlitBgLoops_nativeBlitBg; + Java_sun_awt_X11Renderer_devFillSpans; + Java_sun_awt_X11Renderer_doDrawArc; + Java_sun_awt_X11Renderer_doDrawLine; + Java_sun_awt_X11Renderer_doDrawOval; + Java_sun_awt_X11Renderer_doDrawPoly; + Java_sun_awt_X11Renderer_doDrawRect; + Java_sun_awt_X11Renderer_doDrawRoundRect; + Java_sun_awt_X11Renderer_doFillArc; + Java_sun_awt_X11Renderer_doFillOval; + Java_sun_awt_X11Renderer_doFillPoly; + Java_sun_awt_X11Renderer_doFillRect; + Java_sun_awt_X11Renderer_doFillRoundRect; + Java_sun_awt_X11Renderer_devCopyArea; + Java_sun_awt_X11SurfaceData_initIDs; + Java_sun_awt_X11SurfaceData_initOps; + Java_sun_awt_X11SurfaceData_initSurface; + Java_sun_awt_X11SurfaceData_isDgaAvailable; + Java_sun_awt_X11SurfaceData_setInvalid; + Java_sun_awt_X11SurfaceData_flushNativeSurface; + awt_display; + awt_lock; + awt_Lock; + awt_Unlock; + awt_GetDrawingSurface; + awt_FreeDrawingSurface; + awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; + X11SurfaceData_GetOps; + getDefaultConfig; + Java_sun_font_FontConfigManager_getFontConfig; + Java_sun_font_FontConfigManager_getFontConfigAASettings; + Java_sun_awt_FcFontManager_getFontPathNative; + Java_sun_font_SunFontManager_populateFontFileNameMap; - Java_java_awt_AWTEvent_initIDs; - Java_java_awt_Button_initIDs; - Java_java_awt_Container_initIDs; - Java_java_awt_Cursor_finalizeImpl; - Java_java_awt_Cursor_initIDs; - Java_java_awt_Event_initIDs; - Java_java_awt_event_InputEvent_initIDs; - Java_java_awt_event_KeyEvent_initIDs; - Java_java_awt_FileDialog_initIDs; - Java_java_awt_Frame_initIDs; - Java_java_awt_Insets_initIDs; - Java_java_awt_TextField_initIDs; - Java_java_awt_Window_initIDs; - Java_sun_awt_motif_X11OffScreenImage_updateBitmask; - Java_sun_awt_X11GraphicsConfig_init; - Java_sun_awt_X11GraphicsConfig_initIDs; - Java_sun_awt_X11GraphicsConfig_makeColorModel; - Java_sun_awt_X11GraphicsDevice_getConfigVisualId; - Java_sun_awt_X11PMBlitLoops_Blit; - Java_sun_awt_X11PMBlitBgLoops_nativeBlitBg; - Java_sun_awt_X11Renderer_devFillSpans; - Java_sun_awt_X11Renderer_doDrawArc; - Java_sun_awt_X11Renderer_doDrawLine; - Java_sun_awt_X11Renderer_doDrawOval; - Java_sun_awt_X11Renderer_doDrawPoly; - Java_sun_awt_X11Renderer_doDrawRect; - Java_sun_awt_X11Renderer_doDrawRoundRect; - Java_sun_awt_X11Renderer_doFillArc; - Java_sun_awt_X11Renderer_doFillOval; - Java_sun_awt_X11Renderer_doFillPoly; - Java_sun_awt_X11Renderer_doFillRect; - Java_sun_awt_X11Renderer_doFillRoundRect; - Java_sun_awt_X11Renderer_devCopyArea; - Java_sun_awt_X11SurfaceData_initIDs; - Java_sun_awt_X11SurfaceData_initOps; - Java_sun_awt_X11SurfaceData_initSurface; - Java_sun_awt_X11SurfaceData_isDgaAvailable; - Java_sun_awt_X11SurfaceData_setInvalid; - Java_sun_awt_X11SurfaceData_flushNativeSurface; - awt_display; - awt_lock; - awt_Lock; - awt_Unlock; - awt_GetDrawingSurface; - awt_FreeDrawingSurface; - awt_GetComponent; + # CDE private entry point + Java_sun_awt_motif_XsessionWMcommand; - X11SurfaceData_GetOps; - getDefaultConfig; - Java_sun_font_FontConfigManager_getFontConfig; - Java_sun_font_FontConfigManager_getFontConfigAASettings; - Java_sun_awt_FcFontManager_getFontPathNative; - Java_sun_font_SunFontManager_populateFontFileNameMap; + # libfontmanager entry points + AWTIsHeadless; + AWTCountFonts; + AWTLoadFont; + AWTFreeFont; + AWTFontMinByte1; + AWTFontMaxByte1; + AWTFontMinCharOrByte2; + AWTFontMaxCharOrByte2; + AWTFontDefaultChar; + AWTFontPerChar; + AWTFontMaxBounds; + AWTFontTextExtents16; + AWTFreeChar; + AWTFontGenerateImage; + AWTCharAdvance; + AWTCharLBearing; + AWTCharRBearing; + AWTCharAscent; + AWTCharDescent; + AWTDrawGlyphList; + AccelGlyphCache_RemoveAllCellInfos; - # CDE private entry point - Java_sun_awt_motif_XsessionWMcommand; - - # libfontmanager entry points - AWTIsHeadless; - AWTCountFonts; - AWTLoadFont; - AWTFreeFont; - AWTFontMinByte1; - AWTFontMaxByte1; - AWTFontMinCharOrByte2; - AWTFontMaxCharOrByte2; - AWTFontDefaultChar; - AWTFontPerChar; - AWTFontMaxBounds; - AWTFontTextExtents16; - AWTFreeChar; - AWTFontGenerateImage; - AWTCharAdvance; - AWTCharLBearing; - AWTCharRBearing; - AWTCharAscent; - AWTCharDescent; - AWTDrawGlyphList; - AccelGlyphCache_RemoveAllCellInfos; - - local: - *; + local: + *; }; diff --git a/jdk/make/mapfiles/libawt_headless/mapfile-vers b/jdk/make/mapfiles/libawt_headless/mapfile-vers index ac5101042a2..4ec723ffe0a 100644 --- a/jdk/make/mapfiles/libawt_headless/mapfile-vers +++ b/jdk/make/mapfiles/libawt_headless/mapfile-vers @@ -26,85 +26,84 @@ # Define public interface. SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; - Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; - Java_sun_java2d_x11_X11Renderer_XFillSpans; - Java_sun_java2d_x11_X11Renderer_XDrawArc; - Java_sun_java2d_x11_X11Renderer_XDrawLine; - Java_sun_java2d_x11_X11Renderer_XDrawOval; - Java_sun_java2d_x11_X11Renderer_XDrawPoly; - Java_sun_java2d_x11_X11Renderer_XDrawRect; - Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; - Java_sun_java2d_x11_X11Renderer_XDoPath; - Java_sun_java2d_x11_X11Renderer_XFillArc; - Java_sun_java2d_x11_X11Renderer_XFillOval; - Java_sun_java2d_x11_X11Renderer_XFillPoly; - Java_sun_java2d_x11_X11Renderer_XFillRect; - Java_sun_java2d_x11_X11Renderer_XFillRoundRect; - Java_sun_java2d_x11_X11Renderer_devCopyArea; - Java_sun_java2d_x11_X11SurfaceData_initIDs; - Java_sun_java2d_x11_X11SurfaceData_initSurface; - Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; - Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; - Java_sun_java2d_x11_X11SurfaceData_XSetForeground; + Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; + Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; + Java_sun_java2d_x11_X11Renderer_XFillSpans; + Java_sun_java2d_x11_X11Renderer_XDrawArc; + Java_sun_java2d_x11_X11Renderer_XDrawLine; + Java_sun_java2d_x11_X11Renderer_XDrawOval; + Java_sun_java2d_x11_X11Renderer_XDrawPoly; + Java_sun_java2d_x11_X11Renderer_XDrawRect; + Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; + Java_sun_java2d_x11_X11Renderer_XDoPath; + Java_sun_java2d_x11_X11Renderer_XFillArc; + Java_sun_java2d_x11_X11Renderer_XFillOval; + Java_sun_java2d_x11_X11Renderer_XFillPoly; + Java_sun_java2d_x11_X11Renderer_XFillRect; + Java_sun_java2d_x11_X11Renderer_XFillRoundRect; + Java_sun_java2d_x11_X11Renderer_devCopyArea; + Java_sun_java2d_x11_X11SurfaceData_initIDs; + Java_sun_java2d_x11_X11SurfaceData_initSurface; + Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; + Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; + Java_sun_java2d_x11_X11SurfaceData_XSetForeground; - Java_sun_java2d_x11_XSurfaceData_initOps; - Java_sun_java2d_x11_XSurfaceData_XCreateGC; - Java_sun_java2d_x11_XSurfaceData_XResetClip; - Java_sun_java2d_x11_XSurfaceData_XSetClip; - Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; - Java_sun_java2d_x11_XSurfaceData_isDrawableValid; - Java_sun_java2d_x11_XSurfaceData_setInvalid; - Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; + Java_sun_java2d_x11_XSurfaceData_initOps; + Java_sun_java2d_x11_XSurfaceData_XCreateGC; + Java_sun_java2d_x11_XSurfaceData_XResetClip; + Java_sun_java2d_x11_XSurfaceData_XSetClip; + Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; + Java_sun_java2d_x11_XSurfaceData_isDrawableValid; + Java_sun_java2d_x11_XSurfaceData_setInvalid; + Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; - X11SurfaceData_GetOps; - Java_java_awt_Font_initIDs; - Java_sun_font_FontConfigManager_getFontConfig; - Java_sun_font_FontConfigManager_getFontConfigAASettings; - Java_sun_font_FontConfigManager_getFontConfigVersion; - Java_sun_awt_FcFontManager_getFontPathNative; + X11SurfaceData_GetOps; + Java_java_awt_Font_initIDs; + Java_sun_font_FontConfigManager_getFontConfig; + Java_sun_font_FontConfigManager_getFontConfigAASettings; + Java_sun_font_FontConfigManager_getFontConfigVersion; + Java_sun_awt_FcFontManager_getFontPathNative; - Java_sun_awt_FontDescriptor_initIDs; - Java_sun_awt_PlatformFont_initIDs; + Java_sun_awt_FontDescriptor_initIDs; + Java_sun_awt_PlatformFont_initIDs; - Java_sun_print_CUPSPrinter_initIDs; - Java_sun_print_CUPSPrinter_getCupsServer; - Java_sun_print_CUPSPrinter_getCupsPort; - Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; - Java_sun_print_CUPSPrinter_canConnect; - Java_sun_print_CUPSPrinter_getMedia; - Java_sun_print_CUPSPrinter_getPageSizes; - Java_sun_print_CUPSPrinter_getResolutions; + Java_sun_print_CUPSPrinter_initIDs; + Java_sun_print_CUPSPrinter_getCupsServer; + Java_sun_print_CUPSPrinter_getCupsPort; + Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; + Java_sun_print_CUPSPrinter_canConnect; + Java_sun_print_CUPSPrinter_getMedia; + Java_sun_print_CUPSPrinter_getPageSizes; + Java_sun_print_CUPSPrinter_getResolutions; - # libfontmanager entry points - AWTIsHeadless; - AWTCountFonts; - AWTLoadFont; - AWTFreeFont; - AWTFontAscent; - AWTFontDescent; - AWTFontMinByte1; - AWTFontMaxByte1; - AWTFontMinCharOrByte2; - AWTFontMaxCharOrByte2; - AWTFontDefaultChar; - AWTFontPerChar; - AWTFontMaxBounds; - AWTFontTextExtents16; - AWTFreeChar; - AWTFontGenerateImage; - AWTCharAdvance; - AWTCharLBearing; - AWTCharRBearing; - AWTCharAscent; - AWTCharDescent; - AWTDrawGlyphList; - AccelGlyphCache_RemoveAllCellInfos; + # libfontmanager entry points + AWTIsHeadless; + AWTCountFonts; + AWTLoadFont; + AWTFreeFont; + AWTFontAscent; + AWTFontDescent; + AWTFontMinByte1; + AWTFontMaxByte1; + AWTFontMinCharOrByte2; + AWTFontMaxCharOrByte2; + AWTFontDefaultChar; + AWTFontPerChar; + AWTFontMaxBounds; + AWTFontTextExtents16; + AWTFreeChar; + AWTFontGenerateImage; + AWTCharAdvance; + AWTCharLBearing; + AWTCharRBearing; + AWTCharAscent; + AWTCharDescent; + AWTDrawGlyphList; + AccelGlyphCache_RemoveAllCellInfos; - - local: - *; + local: + *; }; diff --git a/jdk/make/mapfiles/libawt_xawt/mapfile-vers b/jdk/make/mapfiles/libawt_xawt/mapfile-vers index 461c1ba9f48..b56b47b8ce8 100644 --- a/jdk/make/mapfiles/libawt_xawt/mapfile-vers +++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers @@ -26,7 +26,7 @@ # Define public interface. SUNWprivate_1.1 { - global: + global: JNI_OnLoad; Java_sun_awt_X11_XlibWrapper_copyIntArray; Java_sun_awt_X11_XlibWrapper_copyLongArray; @@ -58,8 +58,8 @@ SUNWprivate_1.1 { Java_sun_awt_X11_XlibWrapper_XSetLocaleModifiers; Java_sun_awt_X11_XlibWrapper_XPeekEvent; Java_sun_awt_X11_XlibWrapper_DefaultScreen; - Java_sun_awt_X11_XlibWrapper_ScreenOfDisplay; - Java_sun_awt_X11_XlibWrapper_DoesBackingStore; + Java_sun_awt_X11_XlibWrapper_ScreenOfDisplay; + Java_sun_awt_X11_XlibWrapper_DoesBackingStore; Java_sun_awt_X11_XlibWrapper_RootWindow; Java_sun_awt_X11_XlibWrapper_DisplayHeight; Java_sun_awt_X11_XlibWrapper_DisplayWidthMM; @@ -172,7 +172,7 @@ SUNWprivate_1.1 { Java_java_awt_Scrollbar_initIDs; Java_java_awt_Window_initIDs; Java_java_awt_Frame_initIDs; - Java_sun_awt_SunToolkit_closeSplashScreen; + Java_sun_awt_SunToolkit_closeSplashScreen; Java_sun_awt_UNIXToolkit_check_1gtk; Java_sun_awt_UNIXToolkit_load_1gtk; Java_sun_awt_UNIXToolkit_unload_1gtk; @@ -196,17 +196,16 @@ SUNWprivate_1.1 { Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigVersion; - Java_sun_awt_FcFontManager_getFontPathNative; + Java_sun_awt_FcFontManager_getFontPathNative; Java_sun_awt_X11GraphicsEnvironment_initDisplay; Java_sun_awt_X11GraphicsEnvironment_initGLX; - Java_sun_awt_X11GraphicsEnvironment_initXRender; + Java_sun_awt_X11GraphicsEnvironment_initXRender; Java_sun_awt_X11GraphicsEnvironment_checkShmExt; Java_sun_awt_X11GraphicsEnvironment_getNumScreens; Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; Java_sun_awt_X11GraphicsEnvironment_getDisplayString; -# Java_sun_awt_X11GraphicsEnvironment_getNativeFonts; Java_sun_awt_X11GraphicsDevice_initIDs; Java_sun_awt_X11GraphicsDevice_getConfigVisualId; Java_sun_awt_X11GraphicsDevice_getConfigDepth; @@ -231,16 +230,16 @@ SUNWprivate_1.1 { Java_sun_awt_X11GraphicsConfig_makeColorModel; Java_sun_awt_X11GraphicsConfig_pGetBounds; Java_sun_awt_X11GraphicsConfig_createBackBuffer; - Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; - Java_sun_awt_X11GraphicsConfig_swapBuffers; - Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; + Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; + Java_sun_awt_X11GraphicsConfig_swapBuffers; + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout; Java_java_awt_Insets_initIDs; Java_java_awt_KeyboardFocusManager_initIDs; Java_java_awt_Font_initIDs; # libfontmanager entry points AWTIsHeadless; - AWTCountFonts; + AWTCountFonts; AWTLoadFont; AWTFreeFont; AWTFontAscent; @@ -303,7 +302,7 @@ SUNWprivate_1.1 { Java_sun_awt_X11_XlibWrapper_XGetIconSizes; Java_sun_awt_X11_XlibWrapper_XKeycodeToKeysym; Java_sun_awt_X11_XlibWrapper_XKeysymToKeycode; - Java_sun_awt_X11_XlibWrapper_XQueryKeymap; + Java_sun_awt_X11_XlibWrapper_XQueryKeymap; Java_sun_awt_X11_XlibWrapper_XkbGetEffectiveGroup; Java_sun_awt_X11_XlibWrapper_XkbSelectEvents; Java_sun_awt_X11_XlibWrapper_XkbSelectEventDetails; @@ -350,23 +349,23 @@ SUNWprivate_1.1 { Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask; - Java_sun_java2d_x11_X11Renderer_XFillSpans; - Java_sun_java2d_x11_X11Renderer_XDrawArc; - Java_sun_java2d_x11_X11Renderer_XDrawLine; - Java_sun_java2d_x11_X11Renderer_XDrawOval; - Java_sun_java2d_x11_X11Renderer_XDrawPoly; - Java_sun_java2d_x11_X11Renderer_XDrawRect; - Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; + Java_sun_java2d_x11_X11Renderer_XFillSpans; + Java_sun_java2d_x11_X11Renderer_XDrawArc; + Java_sun_java2d_x11_X11Renderer_XDrawLine; + Java_sun_java2d_x11_X11Renderer_XDrawOval; + Java_sun_java2d_x11_X11Renderer_XDrawPoly; + Java_sun_java2d_x11_X11Renderer_XDrawRect; + Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; Java_sun_java2d_x11_X11Renderer_XDoPath; - Java_sun_java2d_x11_X11Renderer_XFillArc; - Java_sun_java2d_x11_X11Renderer_XFillOval; - Java_sun_java2d_x11_X11Renderer_XFillPoly; - Java_sun_java2d_x11_X11Renderer_XFillRect; - Java_sun_java2d_x11_X11Renderer_XFillRoundRect; + Java_sun_java2d_x11_X11Renderer_XFillArc; + Java_sun_java2d_x11_X11Renderer_XFillOval; + Java_sun_java2d_x11_X11Renderer_XFillPoly; + Java_sun_java2d_x11_X11Renderer_XFillRect; + Java_sun_java2d_x11_X11Renderer_XFillRoundRect; Java_sun_java2d_x11_X11Renderer_devCopyArea; Java_sun_java2d_x11_X11SurfaceData_initIDs; Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; - Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; + Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; Java_sun_java2d_x11_X11SurfaceData_initSurface; Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; @@ -377,40 +376,40 @@ SUNWprivate_1.1 { Java_sun_java2d_x11_XSurfaceData_XResetClip; Java_sun_java2d_x11_XSurfaceData_XSetClip; Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; - Java_sun_java2d_x11_XSurfaceData_isDrawableValid; + Java_sun_java2d_x11_XSurfaceData_isDrawableValid; Java_sun_java2d_x11_XSurfaceData_setInvalid; Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; Java_sun_java2d_xr_XRSurfaceData_initXRPicture; Java_sun_java2d_xr_XRSurfaceData_initIDs; Java_sun_java2d_xr_XRSurfaceData_XRInitSurface; - Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; - Java_sun_java2d_xr_XRBackendNative_initIDs; - Java_sun_java2d_xr_XRBackendNative_freeGC; - Java_sun_java2d_xr_XRBackendNative_createGC; - Java_sun_java2d_xr_XRBackendNative_createPixmap; - Java_sun_java2d_xr_XRBackendNative_createPictureNative; - Java_sun_java2d_xr_XRBackendNative_freePicture; - Java_sun_java2d_xr_XRBackendNative_freePixmap; - Java_sun_java2d_xr_XRBackendNative_setPictureRepeat; - Java_sun_java2d_xr_XRBackendNative_setGCExposures; - Java_sun_java2d_xr_XRBackendNative_setGCForeground; - Java_sun_java2d_xr_XRBackendNative_copyArea; - Java_sun_java2d_xr_XRBackendNative_renderComposite; - Java_sun_java2d_xr_XRBackendNative_renderRectangle; - Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative; - Java_sun_java2d_xr_XRBackendNative_XRSetTransformNative; - Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative; - Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative; - Java_sun_java2d_xr_XRBackendNative_setFilter; - Java_sun_java2d_xr_XRBackendNative_XRSetClipNative; - Java_sun_java2d_xr_XRBackendNative_putMaskNative; - Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative; - Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative; - Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative; - Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; - Java_sun_java2d_xr_XRBackendNative_setGCMode; - Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; - Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; + Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; + Java_sun_java2d_xr_XRBackendNative_initIDs; + Java_sun_java2d_xr_XRBackendNative_freeGC; + Java_sun_java2d_xr_XRBackendNative_createGC; + Java_sun_java2d_xr_XRBackendNative_createPixmap; + Java_sun_java2d_xr_XRBackendNative_createPictureNative; + Java_sun_java2d_xr_XRBackendNative_freePicture; + Java_sun_java2d_xr_XRBackendNative_freePixmap; + Java_sun_java2d_xr_XRBackendNative_setPictureRepeat; + Java_sun_java2d_xr_XRBackendNative_setGCExposures; + Java_sun_java2d_xr_XRBackendNative_setGCForeground; + Java_sun_java2d_xr_XRBackendNative_copyArea; + Java_sun_java2d_xr_XRBackendNative_renderComposite; + Java_sun_java2d_xr_XRBackendNative_renderRectangle; + Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative; + Java_sun_java2d_xr_XRBackendNative_XRSetTransformNative; + Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative; + Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative; + Java_sun_java2d_xr_XRBackendNative_setFilter; + Java_sun_java2d_xr_XRBackendNative_XRSetClipNative; + Java_sun_java2d_xr_XRBackendNative_putMaskNative; + Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative; + Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative; + Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative; + Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; + Java_sun_java2d_xr_XRBackendNative_setGCMode; + Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; + Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow; Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box; @@ -444,25 +443,28 @@ SUNWprivate_1.1 { Java_sun_awt_X11_GtkFileDialogPeer_toFront; Java_sun_awt_X11_GtkFileDialogPeer_setBounds; - Java_sun_print_CUPSPrinter_initIDs; - Java_sun_print_CUPSPrinter_getCupsServer; - Java_sun_print_CUPSPrinter_getCupsPort; - Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; - Java_sun_print_CUPSPrinter_canConnect; - Java_sun_print_CUPSPrinter_getMedia; - Java_sun_print_CUPSPrinter_getPageSizes; - Java_sun_print_CUPSPrinter_getResolutions; + Java_sun_print_CUPSPrinter_initIDs; + Java_sun_print_CUPSPrinter_getCupsServer; + Java_sun_print_CUPSPrinter_getCupsPort; + Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; + Java_sun_print_CUPSPrinter_canConnect; + Java_sun_print_CUPSPrinter_getMedia; + Java_sun_print_CUPSPrinter_getPageSizes; + Java_sun_print_CUPSPrinter_getResolutions; awt_GetDrawingSurface; awt_FreeDrawingSurface; awt_Unlock; awt_Lock; awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; #XAWT entry point for CDE Java_sun_awt_motif_XsessionWMcommand; Java_sun_awt_motif_XsessionWMcommand_New; - local: - *; + local: + *; }; diff --git a/jdk/make/mapfiles/libjawt/mapfile-vers b/jdk/make/mapfiles/libjawt/mapfile-vers index 1a79df0c34d..ee0ef4202cc 100644 --- a/jdk/make/mapfiles/libjawt/mapfile-vers +++ b/jdk/make/mapfiles/libjawt/mapfile-vers @@ -26,8 +26,8 @@ # Define library interface. SUNWprivate_1.1 { - global: - JAWT_GetAWT; - local: - *; + global: + JAWT_GetAWT; + local: + *; }; diff --git a/jdk/make/mapfiles/libjpeg/mapfile-vers b/jdk/make/mapfiles/libjpeg/mapfile-vers index 4534fa0944b..b82e7574598 100644 --- a/jdk/make/mapfiles/libjpeg/mapfile-vers +++ b/jdk/make/mapfiles/libjpeg/mapfile-vers @@ -26,30 +26,30 @@ # Define public interface. SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_sun_awt_image_JPEGImageDecoder_initIDs; - Java_sun_awt_image_JPEGImageDecoder_readImage; + Java_sun_awt_image_JPEGImageDecoder_initIDs; + Java_sun_awt_image_JPEGImageDecoder_readImage; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setSource; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setOutColorSpace; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_abortRead; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetReader; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_disposeReader; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetLibraryState; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initWriterIDs; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initJPEGImageWriter; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_setDest; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_abortWrite; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_resetWriter; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_disposeWriter; - local: - *; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setSource; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setOutColorSpace; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_abortRead; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetReader; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_disposeReader; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetLibraryState; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initWriterIDs; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initJPEGImageWriter; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_setDest; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_abortWrite; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_resetWriter; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_disposeWriter; + local: + *; }; diff --git a/jdk/make/mapfiles/libjsound/mapfile-vers b/jdk/make/mapfiles/libjsound/mapfile-vers index b8ebf0d8af3..4cd03a758b1 100644 --- a/jdk/make/mapfiles/libjsound/mapfile-vers +++ b/jdk/make/mapfiles/libjsound/mapfile-vers @@ -26,60 +26,60 @@ # Define library interface. SUNWprivate_1.1 { - global: - Java_com_sun_media_sound_DirectAudioDevice_nAvailable; - Java_com_sun_media_sound_DirectAudioDevice_nClose; - Java_com_sun_media_sound_DirectAudioDevice_nFlush; - Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; - Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; - Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; - Java_com_sun_media_sound_DirectAudioDevice_nOpen; - Java_com_sun_media_sound_DirectAudioDevice_nRead; - Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; - Java_com_sun_media_sound_DirectAudioDevice_nService; - Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nStart; - Java_com_sun_media_sound_DirectAudioDevice_nStop; - Java_com_sun_media_sound_DirectAudioDevice_nWrite; - Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; - Java_com_sun_media_sound_MidiInDevice_nClose; - Java_com_sun_media_sound_MidiInDevice_nGetMessages; - Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiInDevice_nOpen; - Java_com_sun_media_sound_MidiInDevice_nStart; - Java_com_sun_media_sound_MidiInDevice_nStop; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; - Java_com_sun_media_sound_MidiOutDevice_nClose; - Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiOutDevice_nOpen; - Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; - Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; - Java_com_sun_media_sound_Platform_nGetExtraLibraries; - Java_com_sun_media_sound_Platform_nGetLibraryForFeature; - Java_com_sun_media_sound_Platform_nIsBigEndian; - Java_com_sun_media_sound_PortMixer_nClose; - Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlGetIntValue; - Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlSetIntValue; - Java_com_sun_media_sound_PortMixer_nGetControls; - Java_com_sun_media_sound_PortMixer_nGetPortCount; - Java_com_sun_media_sound_PortMixer_nGetPortName; - Java_com_sun_media_sound_PortMixer_nGetPortType; - Java_com_sun_media_sound_PortMixer_nOpen; - Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; - Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; - local: - *; + global: + Java_com_sun_media_sound_DirectAudioDevice_nAvailable; + Java_com_sun_media_sound_DirectAudioDevice_nClose; + Java_com_sun_media_sound_DirectAudioDevice_nFlush; + Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; + Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; + Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; + Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; + Java_com_sun_media_sound_DirectAudioDevice_nOpen; + Java_com_sun_media_sound_DirectAudioDevice_nRead; + Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; + Java_com_sun_media_sound_DirectAudioDevice_nService; + Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; + Java_com_sun_media_sound_DirectAudioDevice_nStart; + Java_com_sun_media_sound_DirectAudioDevice_nStop; + Java_com_sun_media_sound_DirectAudioDevice_nWrite; + Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; + Java_com_sun_media_sound_MidiInDevice_nClose; + Java_com_sun_media_sound_MidiInDevice_nGetMessages; + Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; + Java_com_sun_media_sound_MidiInDevice_nOpen; + Java_com_sun_media_sound_MidiInDevice_nStart; + Java_com_sun_media_sound_MidiInDevice_nStop; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; + Java_com_sun_media_sound_MidiOutDevice_nClose; + Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; + Java_com_sun_media_sound_MidiOutDevice_nOpen; + Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; + Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; + Java_com_sun_media_sound_Platform_nGetExtraLibraries; + Java_com_sun_media_sound_Platform_nGetLibraryForFeature; + Java_com_sun_media_sound_Platform_nIsBigEndian; + Java_com_sun_media_sound_PortMixer_nClose; + Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; + Java_com_sun_media_sound_PortMixer_nControlGetIntValue; + Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; + Java_com_sun_media_sound_PortMixer_nControlSetIntValue; + Java_com_sun_media_sound_PortMixer_nGetControls; + Java_com_sun_media_sound_PortMixer_nGetPortCount; + Java_com_sun_media_sound_PortMixer_nGetPortName; + Java_com_sun_media_sound_PortMixer_nGetPortType; + Java_com_sun_media_sound_PortMixer_nOpen; + Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; + Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; + local: + *; }; diff --git a/jdk/make/mapfiles/libjsoundalsa/mapfile-vers b/jdk/make/mapfiles/libjsoundalsa/mapfile-vers index 1b1c8f75be6..6228f8ad23e 100644 --- a/jdk/make/mapfiles/libjsoundalsa/mapfile-vers +++ b/jdk/make/mapfiles/libjsoundalsa/mapfile-vers @@ -26,57 +26,57 @@ # Define library interface. SUNWprivate_1.1 { - global: - Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; - Java_com_sun_media_sound_DirectAudioDevice_nAvailable; - Java_com_sun_media_sound_DirectAudioDevice_nClose; - Java_com_sun_media_sound_DirectAudioDevice_nFlush; - Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; - Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; - Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; - Java_com_sun_media_sound_DirectAudioDevice_nOpen; - Java_com_sun_media_sound_DirectAudioDevice_nRead; - Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; - Java_com_sun_media_sound_DirectAudioDevice_nService; - Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nStart; - Java_com_sun_media_sound_DirectAudioDevice_nStop; - Java_com_sun_media_sound_DirectAudioDevice_nWrite; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; - Java_com_sun_media_sound_MidiInDevice_nClose; - Java_com_sun_media_sound_MidiInDevice_nGetMessages; - Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiInDevice_nOpen; - Java_com_sun_media_sound_MidiInDevice_nStart; - Java_com_sun_media_sound_MidiInDevice_nStop; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; - Java_com_sun_media_sound_MidiOutDevice_nClose; - Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiOutDevice_nOpen; - Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; - Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; - Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; - Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; - Java_com_sun_media_sound_PortMixer_nClose; - Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlGetIntValue; - Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlSetIntValue; - Java_com_sun_media_sound_PortMixer_nGetControls; - Java_com_sun_media_sound_PortMixer_nGetPortCount; - Java_com_sun_media_sound_PortMixer_nGetPortName; - Java_com_sun_media_sound_PortMixer_nGetPortType; - Java_com_sun_media_sound_PortMixer_nOpen; - local: - *; + global: + Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; + Java_com_sun_media_sound_DirectAudioDevice_nAvailable; + Java_com_sun_media_sound_DirectAudioDevice_nClose; + Java_com_sun_media_sound_DirectAudioDevice_nFlush; + Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; + Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; + Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; + Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; + Java_com_sun_media_sound_DirectAudioDevice_nOpen; + Java_com_sun_media_sound_DirectAudioDevice_nRead; + Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; + Java_com_sun_media_sound_DirectAudioDevice_nService; + Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; + Java_com_sun_media_sound_DirectAudioDevice_nStart; + Java_com_sun_media_sound_DirectAudioDevice_nStop; + Java_com_sun_media_sound_DirectAudioDevice_nWrite; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; + Java_com_sun_media_sound_MidiInDevice_nClose; + Java_com_sun_media_sound_MidiInDevice_nGetMessages; + Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; + Java_com_sun_media_sound_MidiInDevice_nOpen; + Java_com_sun_media_sound_MidiInDevice_nStart; + Java_com_sun_media_sound_MidiInDevice_nStop; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; + Java_com_sun_media_sound_MidiOutDevice_nClose; + Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; + Java_com_sun_media_sound_MidiOutDevice_nOpen; + Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; + Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; + Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; + Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; + Java_com_sun_media_sound_PortMixer_nClose; + Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; + Java_com_sun_media_sound_PortMixer_nControlGetIntValue; + Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; + Java_com_sun_media_sound_PortMixer_nControlSetIntValue; + Java_com_sun_media_sound_PortMixer_nGetControls; + Java_com_sun_media_sound_PortMixer_nGetPortCount; + Java_com_sun_media_sound_PortMixer_nGetPortName; + Java_com_sun_media_sound_PortMixer_nGetPortType; + Java_com_sun_media_sound_PortMixer_nOpen; + local: + *; }; diff --git a/jdk/make/mapfiles/libsplashscreen/mapfile-vers b/jdk/make/mapfiles/libsplashscreen/mapfile-vers index fec7b037f0d..b948ef474a6 100644 --- a/jdk/make/mapfiles/libsplashscreen/mapfile-vers +++ b/jdk/make/mapfiles/libsplashscreen/mapfile-vers @@ -26,24 +26,24 @@ # Define public interface. SUNWprivate_1.1 { - global: - Java_java_awt_SplashScreen__1update; - Java_java_awt_SplashScreen__1isVisible; - Java_java_awt_SplashScreen__1getBounds; - Java_java_awt_SplashScreen__1getInstance; - Java_java_awt_SplashScreen__1close; - Java_java_awt_SplashScreen__1getImageFileName; - Java_java_awt_SplashScreen__1getImageJarName; - Java_java_awt_SplashScreen__1setImageData; - Java_java_awt_SplashScreen__1getScaleFactor; + global: + Java_java_awt_SplashScreen__1update; + Java_java_awt_SplashScreen__1isVisible; + Java_java_awt_SplashScreen__1getBounds; + Java_java_awt_SplashScreen__1getInstance; + Java_java_awt_SplashScreen__1close; + Java_java_awt_SplashScreen__1getImageFileName; + Java_java_awt_SplashScreen__1getImageJarName; + Java_java_awt_SplashScreen__1setImageData; + Java_java_awt_SplashScreen__1getScaleFactor; - SplashLoadMemory; - SplashLoadFile; - SplashInit; - SplashClose; - SplashSetFileJarName; - SplashSetScaleFactor; - SplashGetScaledImageName; - local: - *; + SplashLoadMemory; + SplashLoadFile; + SplashInit; + SplashClose; + SplashSetFileJarName; + SplashSetScaleFactor; + SplashGetScaledImageName; + local: + *; }; diff --git a/jdk/src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c b/jdk/src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c index 8fd84347da1..059d9a7badb 100644 --- a/jdk/src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c +++ b/jdk/src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 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 @@ -123,7 +123,6 @@ Java_sun_nio_ch_KQueueArrayWrapper_register0(JNIEnv *env, jobject this, kevent(kq, changes, 2, errors, 2, &dontBlock); } - JNIEXPORT jint JNICALL Java_sun_nio_ch_KQueueArrayWrapper_kevent0(JNIEnv *env, jobject this, jint kq, jlong kevAddr, jint kevCount, @@ -138,6 +137,15 @@ Java_sun_nio_ch_KQueueArrayWrapper_kevent0(JNIEnv *env, jobject this, jint kq, // Java timeout == -1 : wait forever : timespec timeout of NULL // Java timeout == 0 : return immediately : timespec timeout of zero if (timeout >= 0) { + // For some indeterminate reason kevent(2) has been found to fail with + // an EINVAL error for timeout values greater than or equal to + // 100000001000L. To avoid this problem, clamp the timeout arbitrarily + // to the maximum value of a 32-bit signed integer which is + // approximately 25 days in milliseconds. + const jlong timeoutMax = 0x7fffffff; // java.lang.Integer.MAX_VALUE + if (timeout > timeoutMax) { + timeout = timeoutMax; + } ts.tv_sec = timeout / 1000; ts.tv_nsec = (timeout % 1000) * 1000000; //nanosec = 1 million millisec tsp = &ts; diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index a02e2f18b23..cec799ec1a3 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -1207,11 +1207,16 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method * the following conditions: *
    *
  • if the field is declared {@code final}, then the write, atomic - * update, and numeric atomic update access modes are unsupported. + * update, numeric atomic update, and bitwise atomic update access + * modes are unsupported. *
  • if the field type is anything other than {@code byte}, - * {@code short}, {@code char}, {@code int} or {@code long}, + * {@code short}, {@code char}, {@code int}, {@code long}, * {@code float}, or {@code double} then numeric atomic update * access modes are unsupported. + *
  • if the field type is anything other than {@code boolean}, + * {@code byte}, {@code short}, {@code char}, {@code int} or + * {@code long} then bitwise atomic update access modes are + * unsupported. *
*

* If the field is declared {@code volatile} then the returned VarHandle @@ -1326,11 +1331,16 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method * the following conditions: *

    *
  • if the field is declared {@code final}, then the write, atomic - * update, and numeric atomic update access modes are unsupported. + * update, numeric atomic update, and bitwise atomic update access + * modes are unsupported. *
  • if the field type is anything other than {@code byte}, - * {@code short}, {@code char}, {@code int} or {@code long}, + * {@code short}, {@code char}, {@code int}, {@code long}, * {@code float}, or {@code double}, then numeric atomic update * access modes are unsupported. + *
  • if the field type is anything other than {@code boolean}, + * {@code byte}, {@code short}, {@code char}, {@code int} or + * {@code long} then bitwise atomic update access modes are + * unsupported. *
*

* If the field is declared {@code volatile} then the returned VarHandle @@ -1631,11 +1641,16 @@ return mh1; * the following conditions: *

    *
  • if the field is declared {@code final}, then the write, atomic - * update, and numeric atomic update access modes are unsupported. + * update, numeric atomic update, and bitwise atomic update access + * modes are unsupported. *
  • if the field type is anything other than {@code byte}, - * {@code short}, {@code char}, {@code int} or {@code long}, + * {@code short}, {@code char}, {@code int}, {@code long}, * {@code float}, or {@code double} then numeric atomic update * access modes are unsupported. + *
  • if the field type is anything other than {@code boolean}, + * {@code byte}, {@code short}, {@code char}, {@code int} or + * {@code long} then bitwise atomic update access modes are + * unsupported. *
*

* If the field is declared {@code volatile} then the returned VarHandle @@ -2353,9 +2368,13 @@ return mh1; * the following conditions: *

    *
  • if the component type is anything other than {@code byte}, - * {@code short}, {@code char}, {@code int} or {@code long}, + * {@code short}, {@code char}, {@code int}, {@code long}, * {@code float}, or {@code double} then numeric atomic update access * modes are unsupported. + *
  • if the field type is anything other than {@code boolean}, + * {@code byte}, {@code short}, {@code char}, {@code int} or + * {@code long} then bitwise atomic update access modes are + * unsupported. *
*

* If the component type is {@code float} or {@code double} then numeric @@ -2426,7 +2445,9 @@ return mh1; * If access is aligned then following access modes are supported and are * guaranteed to support atomic access: *

    - *
  • read write access modes for all {@code T}; + *
  • read write access modes for all {@code T}, with the exception of + * access modes {@code get} and {@code set} for {@code long} and + * {@code double} on 32-bit platforms. *
  • atomic update access modes for {@code int}, {@code long}, * {@code float} or {@code double}. * (Future major platform releases of the JDK may support additional @@ -2434,6 +2455,9 @@ return mh1; *
  • numeric atomic update access modes for {@code int} and {@code long}. * (Future major platform releases of the JDK may support additional * numeric types for certain currently unsupported access modes.) + *
  • bitwise atomic update access modes for {@code int} and {@code long}. + * (Future major platform releases of the JDK may support additional + * numeric types for certain currently unsupported access modes.) *
*

* Misaligned access, and therefore atomicity guarantees, may be determined @@ -2508,7 +2532,9 @@ return mh1; * If access is aligned then following access modes are supported and are * guaranteed to support atomic access: *

    - *
  • read write access modes for all {@code T}; + *
  • read write access modes for all {@code T}, with the exception of + * access modes {@code get} and {@code set} for {@code long} and + * {@code double} on 32-bit platforms. *
  • atomic update access modes for {@code int}, {@code long}, * {@code float} or {@code double}. * (Future major platform releases of the JDK may support additional @@ -2516,6 +2542,9 @@ return mh1; *
  • numeric atomic update access modes for {@code int} and {@code long}. * (Future major platform releases of the JDK may support additional * numeric types for certain currently unsupported access modes.) + *
  • bitwise atomic update access modes for {@code int} and {@code long}. + * (Future major platform releases of the JDK may support additional + * numeric types for certain currently unsupported access modes.) *
*

* Misaligned access, and therefore atomicity guarantees, may be determined diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java index 5e71204b6d0..50e81913c16 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java @@ -134,21 +134,39 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * The set of corresponding access mode methods belonging to this group * consists of the methods * {@link #compareAndSet compareAndSet}, + * {@link #weakCompareAndSetPlain weakCompareAndSetPlain}, * {@link #weakCompareAndSet weakCompareAndSet}, - * {@link #weakCompareAndSetVolatile weakCompareAndSetVolatile}, * {@link #weakCompareAndSetAcquire weakCompareAndSetAcquire}, * {@link #weakCompareAndSetRelease weakCompareAndSetRelease}, * {@link #compareAndExchangeAcquire compareAndExchangeAcquire}, * {@link #compareAndExchange compareAndExchange}, * {@link #compareAndExchangeRelease compareAndExchangeRelease}, - * {@link #getAndSet getAndSet}. + * {@link #getAndSet getAndSet}, + * {@link #getAndSetAcquire getAndSetAcquire}, + * {@link #getAndSetRelease getAndSetRelease}. *

  • numeric atomic update access modes that, for example, atomically get and * set with addition the value of a variable under specified memory ordering * effects. * The set of corresponding access mode methods belonging to this group * consists of the methods * {@link #getAndAdd getAndAdd}, + * {@link #getAndAddAcquire getAndAddAcquire}, + * {@link #getAndAddRelease getAndAddRelease}, * {@link #addAndGet addAndGet}. + *
  • bitwise atomic update access modes that, for example, atomically get and + * bitwise OR the value of a variable under specified memory ordering + * effects. + * The set of corresponding access mode methods belonging to this group + * consists of the methods + * {@link #getAndBitwiseOr getAndBitwiseOr}, + * {@link #getAndBitwiseOrAcquire getAndBitwiseOrAcquire}, + * {@link #getAndBitwiseOrRelease getAndBitwiseOrRelease}, + * {@link #getAndBitwiseAnd getAndBitwiseAnd}, + * {@link #getAndBitwiseAndAcquire getAndBitwiseAndAcquire}, + * {@link #getAndBitwiseAndRelease getAndBitwiseAndRelease}, + * {@link #getAndBitwiseXor getAndBitwiseXor}, + * {@link #getAndBitwiseXorAcquire getAndBitwiseXorAcquire}, + * {@link #getAndBitwiseXorRelease getAndBitwiseXorRelease}. * * *

    Factory methods that produce or {@link java.lang.invoke.MethodHandles.Lookup @@ -163,8 +181,8 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError; * VarHandle instances and the corresponding method never throws * {@code UnsupportedOperationException}. * If a VarHandle references a read-only variable (for example a {@code final} - * field) then write, atomic update and numeric atomic update access modes are - * not supported and corresponding methods throw + * field) then write, atomic update, numeric atomic update, and bitwise atomic + * update access modes are not supported and corresponding methods throw * {@code UnsupportedOperationException}. * Read/write access modes (if supported), with the exception of * {@code get} and {@code set}, provide atomic access for @@ -816,8 +834,8 @@ public abstract class VarHandle { *

    The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. * *

    The symbolic type descriptor at the call site of {@code - * weakCompareAndSet} must match the access mode type that is the result of - * calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)} + * weakCompareAndSetPlain} must match the access mode type that is the result of + * calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)} * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form @@ -838,7 +856,7 @@ public abstract class VarHandle { public final native @MethodHandle.PolymorphicSignature @HotSpotIntrinsicCandidate - boolean weakCompareAndSet(Object... args); + boolean weakCompareAndSetPlain(Object... args); /** * Possibly atomically sets the value of a variable to the {@code newValue} @@ -853,8 +871,8 @@ public abstract class VarHandle { *

    The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. * *

    The symbolic type descriptor at the call site of {@code - * weakCompareAndSetVolatile} must match the access mode type that is the - * result of calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)} + * weakCompareAndSet} must match the access mode type that is the + * result of calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)} * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form @@ -875,7 +893,7 @@ public abstract class VarHandle { public final native @MethodHandle.PolymorphicSignature @HotSpotIntrinsicCandidate - boolean weakCompareAndSetVolatile(Object... args); + boolean weakCompareAndSet(Object... args); /** * Possibly atomically sets the value of a variable to the {@code newValue} @@ -986,6 +1004,71 @@ public abstract class VarHandle { @HotSpotIntrinsicCandidate Object getAndSet(Object... args); + /** + * Atomically sets the value of a variable to the {@code newValue} with the + * memory semantics of {@link #set} and returns the variable's + * previous value, as accessed with the memory semantics of + * {@link #getAcquire}. + * + *

    The method signature is of the form {@code (CT, T newValue)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndSetAcquire} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T newValue)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndSetAcquire(Object... args); + + /** + * Atomically sets the value of a variable to the {@code newValue} with the + * memory semantics of {@link #setRelease} and returns the variable's + * previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    The method signature is of the form {@code (CT, T newValue)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndSetRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_SET_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T newValue)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndSetRelease(Object... args); // Primitive adders // Throw UnsupportedOperationException for refs @@ -1025,21 +1108,21 @@ public abstract class VarHandle { /** * Atomically adds the {@code value} to the current value of a variable with - * the memory semantics of {@link #setVolatile}, and returns the variable's - * current (updated) value, as accessed with the memory semantics of - * {@link #getVolatile}. + * the memory semantics of {@link #set}, and returns the variable's + * previous value, as accessed with the memory semantics of + * {@link #getAcquire}. * *

    The method signature is of the form {@code (CT, T value)T}. * - *

    The symbolic type descriptor at the call site of {@code addAndGet} + *

    The symbolic type descriptor at the call site of {@code getAndAddAcquire} * must match the access mode type that is the result of calling - * {@code accessModeType(VarHandle.AccessMode.ADD_AND_GET)} on this + * {@code accessModeType(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)} on this * VarHandle. * * @param args the signature-polymorphic parameter list of the form * {@code (CT, T value)} * , statically represented using varargs. - * @return the signature-polymorphic result that is the current value of + * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported @@ -1054,7 +1137,378 @@ public abstract class VarHandle { public final native @MethodHandle.PolymorphicSignature @HotSpotIntrinsicCandidate - Object addAndGet(Object... args); + Object getAndAddAcquire(Object... args); + + /** + * Atomically adds the {@code value} to the current value of a variable with + * the memory semantics of {@link #setRelease}, and returns the variable's + * previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    The method signature is of the form {@code (CT, T value)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndAddRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_ADD_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T value)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndAddRelease(Object... args); + + + // Bitwise operations + // Throw UnsupportedOperationException for refs + + /** + * Atomically sets the value of a variable to the result of + * bitwise OR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setVolatile} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getVolatile}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical OR is performed instead of a bitwise OR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseOr} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseOr(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise OR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #set} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getAcquire}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical OR is performed instead of a bitwise OR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseOrAcquire} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #set(Object...) + * @see #getAcquire(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseOrAcquire(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise OR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setRelease} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical OR is performed instead of a bitwise OR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseOrRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setRelease(Object...) + * @see #get(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseOrRelease(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise AND between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setVolatile} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getVolatile}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical AND is performed instead of a bitwise AND. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseAnd} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseAnd(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise AND between the variable's current value and the {@code mask} + * with the memory semantics of {@link #set} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getAcquire}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical AND is performed instead of a bitwise AND. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseAndAcquire} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #set(Object...) + * @see #getAcquire(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseAndAcquire(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise AND between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setRelease} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical AND is performed instead of a bitwise AND. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseAndRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setRelease(Object...) + * @see #get(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseAndRelease(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise XOR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setVolatile} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getVolatile}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical XOR is performed instead of a bitwise XOR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseXor} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseXor(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise XOR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #set} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getAcquire}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical XOR is performed instead of a bitwise XOR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseXorAcquire} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #set(Object...) + * @see #getAcquire(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseXorAcquire(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise XOR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setRelease} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical XOR is performed instead of a bitwise XOR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseXorRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setRelease(Object...) + * @see #get(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseXorRelease(Object... args); + enum AccessType { GET(Object.class), @@ -1204,15 +1658,15 @@ public abstract class VarHandle { /** * The access mode whose access is specified by the corresponding * method - * {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet} + * {@link VarHandle#weakCompareAndSetPlain VarHandle.weakCompareAndSetPlain} */ - WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP), + WEAK_COMPARE_AND_SET_PLAIN("weakCompareAndSetPlain", AccessType.COMPARE_AND_SWAP), /** * The access mode whose access is specified by the corresponding * method - * {@link VarHandle#weakCompareAndSetVolatile VarHandle.weakCompareAndSetVolatile} + * {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet} */ - WEAK_COMPARE_AND_SET_VOLATILE("weakCompareAndSetVolatile", AccessType.COMPARE_AND_SWAP), + WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP), /** * The access mode whose access is specified by the corresponding * method @@ -1231,6 +1685,18 @@ public abstract class VarHandle { * {@link VarHandle#getAndSet VarHandle.getAndSet} */ GET_AND_SET("getAndSet", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndSetAcquire VarHandle.getAndSetAcquire} + */ + GET_AND_SET_ACQUIRE("getAndSetAcquire", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndSetRelease VarHandle.getAndSetRelease} + */ + GET_AND_SET_RELEASE("getAndSetRelease", AccessType.GET_AND_UPDATE), /** * The access mode whose access is specified by the corresponding * method @@ -1240,9 +1706,69 @@ public abstract class VarHandle { /** * The access mode whose access is specified by the corresponding * method - * {@link VarHandle#addAndGet VarHandle.addAndGet} + * {@link VarHandle#getAndAddAcquire VarHandle.getAndAddAcquire} */ - ADD_AND_GET("addAndGet", AccessType.GET_AND_UPDATE), + GET_AND_ADD_ACQUIRE("getAndAddAcquire", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndAddRelease VarHandle.getAndAddRelease} + */ + GET_AND_ADD_RELEASE("getAndAddRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseOr VarHandle.getAndBitwiseOr} + */ + GET_AND_BITWISE_OR("getAndBitwiseOr", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseOrRelease VarHandle.getAndBitwiseOrRelease} + */ + GET_AND_BITWISE_OR_RELEASE("getAndBitwiseOrRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseOrAcquire VarHandle.getAndBitwiseOrAcquire} + */ + GET_AND_BITWISE_OR_ACQUIRE("getAndBitwiseOrAcquire", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseAnd VarHandle.getAndBitwiseAnd} + */ + GET_AND_BITWISE_AND("getAndBitwiseAnd", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseAndRelease VarHandle.getAndBitwiseAndRelease} + */ + GET_AND_BITWISE_AND_RELEASE("getAndBitwiseAndRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseAndAcquire VarHandle.getAndBitwiseAndAcquire} + */ + GET_AND_BITWISE_AND_ACQUIRE("getAndBitwiseAndAcquire", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseXor VarHandle.getAndBitwiseXor} + */ + GET_AND_BITWISE_XOR("getAndBitwiseXor", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseXorRelease VarHandle.getAndBitwiseXorRelease} + */ + GET_AND_BITWISE_XOR_RELEASE("getAndBitwiseXorRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseXorAcquire VarHandle.getAndBitwiseXorAcquire} + */ + GET_AND_BITWISE_XOR_ACQUIRE("getAndBitwiseXorAcquire", AccessType.GET_AND_UPDATE), ; static final Map methodNameToAccessMode; diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template index d6f5aaa380c..634d64d8327 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template +++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template @@ -156,7 +156,7 @@ final class VarHandle$Type$s { } @ForceInline - static boolean weakCompareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { return UNSAFE.weakCompareAndSwap$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, @@ -164,7 +164,7 @@ final class VarHandle$Type$s { } @ForceInline - static boolean weakCompareAndSetVolatile(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { return UNSAFE.weakCompareAndSwap$Type$Volatile(Objects.requireNonNull(handle.receiverType.cast(holder)), handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, @@ -193,6 +193,20 @@ final class VarHandle$Type$s { handle.fieldOffset, {#if[Object]?handle.fieldType.cast(value):value}); } + + @ForceInline + static $type$ getAndSetAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndSet$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + {#if[Object]?handle.fieldType.cast(value):value}); + } + + @ForceInline + static $type$ getAndSetRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndSet$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + {#if[Object]?handle.fieldType.cast(value):value}); + } #end[CAS] #if[AtomicAdd] @@ -204,12 +218,85 @@ final class VarHandle$Type$s { } @ForceInline - static $type$ addAndGet(FieldInstanceReadWrite handle, Object holder, $type$ value) { - return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + static $type$ getAndAddAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndAdd$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), handle.fieldOffset, - value) + value); + value); } + + @ForceInline + static $type$ getAndAddRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndAdd$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + #end[AtomicAdd] +#if[Bitwise] + + @ForceInline + static $type$ getAndBitwiseOr(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAnd(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXor(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } +#end[Bitwise] static final VarForm FORM = new VarForm(FieldInstanceReadWrite.class, Object.class, $type$.class); } @@ -337,7 +424,7 @@ final class VarHandle$Type$s { } @ForceInline - static boolean weakCompareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(FieldStaticReadWrite handle, $type$ expected, $type$ value) { return UNSAFE.weakCompareAndSwap$Type$(handle.base, handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, @@ -345,7 +432,7 @@ final class VarHandle$Type$s { } @ForceInline - static boolean weakCompareAndSetVolatile(FieldStaticReadWrite handle, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) { return UNSAFE.weakCompareAndSwap$Type$Volatile(handle.base, handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, @@ -374,6 +461,20 @@ final class VarHandle$Type$s { handle.fieldOffset, {#if[Object]?handle.fieldType.cast(value):value}); } + + @ForceInline + static $type$ getAndSetAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndSet$Type$Acquire(handle.base, + handle.fieldOffset, + {#if[Object]?handle.fieldType.cast(value):value}); + } + + @ForceInline + static $type$ getAndSetRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndSet$Type$Release(handle.base, + handle.fieldOffset, + {#if[Object]?handle.fieldType.cast(value):value}); + } #end[CAS] #if[AtomicAdd] @@ -385,12 +486,84 @@ final class VarHandle$Type$s { } @ForceInline - static $type$ addAndGet(FieldStaticReadWrite handle, $type$ value) { - return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(handle.base, + static $type$ getAndAddAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndAdd$Type$Acquire(handle.base, handle.fieldOffset, - value) + value); + value); + } + + @ForceInline + static $type$ getAndAddRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndAdd$Type$Release(handle.base, + handle.fieldOffset, + value); } #end[AtomicAdd] +#if[Bitwise] + + @ForceInline + static $type$ getAndBitwiseOr(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$Release(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$Acquire(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAnd(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$Release(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$Acquire(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXor(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$Release(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$Acquire(handle.base, + handle.fieldOffset, + value); + } +#end[Bitwise] static final VarForm FORM = new VarForm(FieldStaticReadWrite.class, null, $type$.class); } @@ -562,7 +735,7 @@ final class VarHandle$Type$s { } @ForceInline - static boolean weakCompareAndSet(Array handle, Object oarray, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(Array handle, Object oarray, int index, $type$ expected, $type$ value) { #if[Object] Object[] array = (Object[]) handle.arrayType.cast(oarray); #else[Object] @@ -575,7 +748,7 @@ final class VarHandle$Type$s { } @ForceInline - static boolean weakCompareAndSetVolatile(Array handle, Object oarray, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(Array handle, Object oarray, int index, $type$ expected, $type$ value) { #if[Object] Object[] array = (Object[]) handle.arrayType.cast(oarray); #else[Object] @@ -624,33 +797,131 @@ final class VarHandle$Type$s { (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(value):value}); } -#end[CAS] -#if[AtomicAdd] @ForceInline - static $type$ getAndAdd(Array handle, Object oarray, int index, $type$ value) { + static $type$ getAndSetAcquire(Array handle, Object oarray, int index, $type$ value) { #if[Object] Object[] array = (Object[]) handle.arrayType.cast(oarray); #else[Object] $type$[] array = ($type$[]) oarray; #end[Object] + return UNSAFE.getAndSet$Type$Acquire(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + {#if[Object]?handle.componentType.cast(value):value}); + } + + @ForceInline + static $type$ getAndSetRelease(Array handle, Object oarray, int index, $type$ value) { +#if[Object] + Object[] array = (Object[]) handle.arrayType.cast(oarray); +#else[Object] + $type$[] array = ($type$[]) oarray; +#end[Object] + return UNSAFE.getAndSet$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + {#if[Object]?handle.componentType.cast(value):value}); + } +#end[CAS] +#if[AtomicAdd] + + @ForceInline + static $type$ getAndAdd(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; return UNSAFE.getAndAdd$Type$(array, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, value); } @ForceInline - static $type$ addAndGet(Array handle, Object oarray, int index, $type$ value) { -#if[Object] - Object[] array = (Object[]) handle.arrayType.cast(oarray); -#else[Object] + static $type$ getAndAddAcquire(Array handle, Object oarray, int index, $type$ value) { $type$[] array = ($type$[]) oarray; -#end[Object] - return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(array, + return UNSAFE.getAndAdd$Type$Acquire(array, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, - value) + value); + value); + } + + @ForceInline + static $type$ getAndAddRelease(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndAdd$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); } #end[AtomicAdd] +#if[Bitwise] + + @ForceInline + static $type$ getAndBitwiseOr(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseOr$Type$(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrRelease(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseOr$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseOr$Type$Acquire(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseAnd(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseAnd$Type$(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndRelease(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseAnd$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseAnd$Type$Acquire(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseXor(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseXor$Type$(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseXor$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseXor$Type$Acquire(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } +#end[Bitwise] static final VarForm FORM = new VarForm(Array.class, {#if[Object]?Object[].class:$type$[].class}, {#if[Object]?Object.class:$type$.class}, int.class); } diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template index bb2f7f0ae10..da57311e39d 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template +++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template @@ -223,7 +223,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { } @ForceInline - static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { byte[] ba = (byte[]) oba; return UNSAFE.weakCompareAndSwap$RawType$( ba, @@ -232,7 +232,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { } @ForceInline - static boolean weakCompareAndSetVolatile(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { byte[] ba = (byte[]) oba; return UNSAFE.weakCompareAndSwap$RawType$Volatile( ba, @@ -267,6 +267,26 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { address(ba, index(ba, index)), convEndian(handle.be, value))); } + + @ForceInline + static $type$ getAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + return convEndian(handle.be, + UNSAFE.getAndSet$RawType$Acquire( + ba, + address(ba, index(ba, index)), + convEndian(handle.be, value))); + } + + @ForceInline + static $type$ getAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + return convEndian(handle.be, + UNSAFE.getAndSet$RawType$Release( + ba, + address(ba, index(ba, index)), + convEndian(handle.be, value))); + } #end[CAS] #if[AtomicAdd] @@ -283,6 +303,32 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { } } + @ForceInline + static $type$ getAndAddAcquire(ArrayHandle handle, Object oba, int index, $type$ delta) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$Acquire( + ba, + address(ba, index(ba, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(ba, index, delta); + } + } + + @ForceInline + static $type$ getAndAddRelease(ArrayHandle handle, Object oba, int index, $type$ delta) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$Release( + ba, + address(ba, index(ba, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(ba, index, delta); + } + } + @ForceInline static $type$ getAndAddConvEndianWithCAS(byte[] ba, int index, $type$ delta) { $type$ nativeExpectedValue, expectedValue; @@ -294,12 +340,162 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); return expectedValue; } +#end[AtomicAdd] +#if[Bitwise] @ForceInline - static $type$ addAndGet(ArrayHandle handle, Object oba, int index, $type$ delta) { - return getAndAdd(handle, oba, index, delta) + delta; + static $type$ getAndBitwiseOr(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(ba, index, value); + } } -#end[AtomicAdd] + + @ForceInline + static $type$ getAndBitwiseOrRelease(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$Release( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$Acquire( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrConvEndianWithCAS(byte[] ba, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + long offset = address(ba, index(ba, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value))); + return expectedValue; + } + + @ForceInline + static $type$ getAndBitwiseAnd(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndRelease(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$Release( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$Acquire( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndConvEndianWithCAS(byte[] ba, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + long offset = address(ba, index(ba, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value))); + return expectedValue; + } + + @ForceInline + static $type$ getAndBitwiseXor(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$Release( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$Acquire( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorConvEndianWithCAS(byte[] ba, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + long offset = address(ba, index(ba, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value))); + return expectedValue; + } +#end[Bitwise] static final VarForm FORM = new VarForm(ArrayHandle.class, byte[].class, $type$.class, int.class); } @@ -466,7 +662,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { } @ForceInline - static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { ByteBuffer bb = (ByteBuffer) obb; return UNSAFE.weakCompareAndSwap$RawType$( UNSAFE.getObject(bb, BYTE_BUFFER_HB), @@ -475,7 +671,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { } @ForceInline - static boolean weakCompareAndSetVolatile(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { ByteBuffer bb = (ByteBuffer) obb; return UNSAFE.weakCompareAndSwap$RawType$Volatile( UNSAFE.getObject(bb, BYTE_BUFFER_HB), @@ -510,6 +706,26 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { address(bb, indexRO(bb, index)), convEndian(handle.be, value))); } + + @ForceInline + static $type$ getAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + return convEndian(handle.be, + UNSAFE.getAndSet$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + convEndian(handle.be, value))); + } + + @ForceInline + static $type$ getAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + return convEndian(handle.be, + UNSAFE.getAndSet$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + convEndian(handle.be, value))); + } #end[CAS] #if[AtomicAdd] @@ -526,6 +742,32 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { } } + @ForceInline + static $type$ getAndAddAcquire(ByteBufferHandle handle, Object obb, int index, $type$ delta) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(bb, index, delta); + } + } + + @ForceInline + static $type$ getAndAddRelease(ByteBufferHandle handle, Object obb, int index, $type$ delta) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(bb, index, delta); + } + } + @ForceInline static $type$ getAndAddConvEndianWithCAS(ByteBuffer bb, int index, $type$ delta) { $type$ nativeExpectedValue, expectedValue; @@ -538,12 +780,166 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); return expectedValue; } +#end[AtomicAdd] +#if[Bitwise] @ForceInline - static $type$ addAndGet(ByteBufferHandle handle, Object obb, int index, $type$ delta) { - return getAndAdd(handle, obb, index, delta) + delta; + static $type$ getAndBitwiseOr(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(bb, index, value); + } } -#end[AtomicAdd] + + @ForceInline + static $type$ getAndBitwiseOrRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); + long offset = address(bb, indexRO(bb, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value))); + return expectedValue; + } + + @ForceInline + static $type$ getAndBitwiseAnd(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); + long offset = address(bb, indexRO(bb, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value))); + return expectedValue; + } + + + @ForceInline + static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); + long offset = address(bb, indexRO(bb, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value))); + return expectedValue; + } +#end[Bitwise] static final VarForm FORM = new VarForm(ByteBufferHandle.class, ByteBuffer.class, $type$.class, int.class); } diff --git a/jdk/src/java.base/share/classes/java/net/ServerSocket.java b/jdk/src/java.base/share/classes/java/net/ServerSocket.java index a86fca6af3c..256c9a6e2ee 100644 --- a/jdk/src/java.base/share/classes/java/net/ServerSocket.java +++ b/jdk/src/java.base/share/classes/java/net/ServerSocket.java @@ -25,8 +25,13 @@ package java.net; +import jdk.internal.misc.JavaNetSocketAccess; +import jdk.internal.misc.SharedSecrets; + import java.io.FileDescriptor; import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.nio.channels.ServerSocketChannel; import java.security.AccessController; import java.security.PrivilegedExceptionAction; @@ -1011,4 +1016,27 @@ class ServerSocket implements java.io.Closeable { return options; } } + + static { + SharedSecrets.setJavaNetSocketAccess( + new JavaNetSocketAccess() { + @Override + public ServerSocket newServerSocket(SocketImpl impl) { + return new ServerSocket(impl); + } + + @Override + public SocketImpl newSocketImpl(Class implClass) { + try { + Constructor ctor = + implClass.getDeclaredConstructor(); + return ctor.newInstance(); + } catch (NoSuchMethodException | InstantiationException | + IllegalAccessException | InvocationTargetException e) { + throw new AssertionError(e); + } + } + } + ); + } } diff --git a/jdk/src/java.base/share/classes/java/util/Base64.java b/jdk/src/java.base/share/classes/java/util/Base64.java index 9a34f279ab3..99f5dc0d993 100644 --- a/jdk/src/java.base/share/classes/java/util/Base64.java +++ b/jdk/src/java.base/share/classes/java/util/Base64.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -788,7 +788,7 @@ public class Base64 { public void write(byte[] b, int off, int len) throws IOException { if (closed) throw new IOException("Stream is closed"); - if (off < 0 || len < 0 || off + len > b.length) + if (off < 0 || len < 0 || len > b.length - off) throw new ArrayIndexOutOfBoundsException(); if (len == 0) return; diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java index fd116b5343a..ea2ab9c4d24 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java @@ -521,7 +521,7 @@ public class CompletableFuture implements Future, CompletionStage { else break; } - else if (STACK.weakCompareAndSetVolatile(this, p, (p = p.next))) + else if (STACK.weakCompareAndSet(this, p, (p = p.next))) unlinked = true; else p = stack; @@ -532,7 +532,7 @@ public class CompletableFuture implements Future, CompletionStage { if (q.isLive()) { p = q; q = s; - } else if (NEXT.weakCompareAndSetVolatile(p, q, s)) + } else if (NEXT.weakCompareAndSet(p, q, s)) break; else q = p.next; diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java index e8193a00256..5c1c7069da7 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java @@ -330,7 +330,7 @@ public class ConcurrentLinkedDeque // for e to become an element of this deque, // and for newNode to become "live". if (p != h) // hop two nodes at a time; failure is OK - HEAD.weakCompareAndSetVolatile(this, h, newNode); + HEAD.weakCompareAndSet(this, h, newNode); return; } // Lost CAS race to another thread; re-read prev @@ -362,7 +362,7 @@ public class ConcurrentLinkedDeque // for e to become an element of this deque, // and for newNode to become "live". if (p != t) // hop two nodes at a time; failure is OK - TAIL.weakCompareAndSetVolatile(this, t, newNode); + TAIL.weakCompareAndSet(this, t, newNode); return; } // Lost CAS race to another thread; re-read next @@ -1153,12 +1153,12 @@ public class ConcurrentLinkedDeque if (NEXT.compareAndSet(p, null, beginningOfTheEnd)) { // Successful CAS is the linearization point // for all elements to be added to this deque. - if (!TAIL.weakCompareAndSetVolatile(this, t, last)) { + if (!TAIL.weakCompareAndSet(this, t, last)) { // Try a little harder to update tail, // since we may be adding many elements. t = tail; if (last.next == null) - TAIL.weakCompareAndSetVolatile(this, t, last); + TAIL.weakCompareAndSet(this, t, last); } return true; } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java index 1e3f1aad4f6..56ccb3317fa 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java @@ -308,7 +308,7 @@ public class ConcurrentLinkedQueue extends AbstractQueue // for e to become an element of this queue, // and for newNode to become "live". if (p != t) // hop two nodes at a time; failure is OK - TAIL.weakCompareAndSetVolatile(this, t, newNode); + TAIL.weakCompareAndSet(this, t, newNode); return true; } // Lost CAS race to another thread; re-read next @@ -477,7 +477,7 @@ public class ConcurrentLinkedQueue extends AbstractQueue next = succ(p); if (pred != null && next != null) // unlink - NEXT.weakCompareAndSetVolatile(pred, p, next); + NEXT.weakCompareAndSet(pred, p, next); if (removed) return true; } @@ -524,12 +524,12 @@ public class ConcurrentLinkedQueue extends AbstractQueue if (NEXT.compareAndSet(p, null, beginningOfTheEnd)) { // Successful CAS is the linearization point // for all elements to be added to this queue. - if (!TAIL.weakCompareAndSetVolatile(this, t, last)) { + if (!TAIL.weakCompareAndSet(this, t, last)) { // Try a little harder to update tail, // since we may be adding many elements. t = tail; if (last.next == null) - TAIL.weakCompareAndSetVolatile(this, t, last); + TAIL.weakCompareAndSet(this, t, last); } return true; } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java b/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java index a61762b5669..1218c75de68 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java @@ -551,7 +551,7 @@ public abstract class CountedCompleter extends ForkJoinTask { public final int decrementPendingCountUnlessZero() { int c; do {} while ((c = pending) != 0 && - !PENDING.weakCompareAndSetVolatile(this, c, c - 1)); + !PENDING.weakCompareAndSet(this, c, c - 1)); return c; } @@ -584,7 +584,7 @@ public abstract class CountedCompleter extends ForkJoinTask { return; } } - else if (PENDING.weakCompareAndSetVolatile(a, c, c - 1)) + else if (PENDING.weakCompareAndSet(a, c, c - 1)) return; } } @@ -607,7 +607,7 @@ public abstract class CountedCompleter extends ForkJoinTask { return; } } - else if (PENDING.weakCompareAndSetVolatile(a, c, c - 1)) + else if (PENDING.weakCompareAndSet(a, c, c - 1)) return; } } @@ -652,7 +652,7 @@ public abstract class CountedCompleter extends ForkJoinTask { for (int c;;) { if ((c = pending) == 0) return this; - else if (PENDING.weakCompareAndSetVolatile(this, c, c - 1)) + else if (PENDING.weakCompareAndSet(this, c, c - 1)) return null; } } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java index 9cc3aef305b..4169ec323e5 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java @@ -42,15 +42,10 @@ import java.security.AccessControlContext; import java.security.Permissions; import java.security.ProtectionDomain; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.function.Predicate; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.CountedCompleter; -import java.util.concurrent.ForkJoinTask; -import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.locks.LockSupport; /** @@ -1413,7 +1408,7 @@ public class ForkJoinPool extends AbstractExecutorService { } if (phase != QUIET) { // else pre-adjusted long c; // decrement counts - do {} while (!CTL.weakCompareAndSetVolatile + do {} while (!CTL.weakCompareAndSet (this, c = ctl, ((RC_MASK & (c - RC_UNIT)) | (TC_MASK & (c - TC_UNIT)) | (SP_MASK & c)))); @@ -1608,7 +1603,7 @@ public class ForkJoinPool extends AbstractExecutorService { do { w.stackPred = (int)(c = ctl); nc = ((c - RC_UNIT) & UC_MASK) | (SP_MASK & np); - } while (!CTL.weakCompareAndSetVolatile(this, c, nc)); + } while (!CTL.weakCompareAndSet(this, c, nc)); } else { // already queued int pred = w.stackPred; diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/FutureTask.java b/jdk/src/java.base/share/classes/java/util/concurrent/FutureTask.java index 82e773c7630..ec90f2334c9 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/FutureTask.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/FutureTask.java @@ -361,7 +361,7 @@ public class FutureTask implements RunnableFuture { private void finishCompletion() { // assert state > COMPLETING; for (WaitNode q; (q = waiters) != null;) { - if (WAITERS.weakCompareAndSetVolatile(this, q, null)) { + if (WAITERS.weakCompareAndSet(this, q, null)) { for (;;) { Thread t = q.thread; if (t != null) { @@ -423,7 +423,7 @@ public class FutureTask implements RunnableFuture { q = new WaitNode(); } else if (!queued) - queued = WAITERS.weakCompareAndSetVolatile(this, q.next = waiters, q); + queued = WAITERS.weakCompareAndSet(this, q.next = waiters, q); else if (timed) { final long parkNanos; if (startTime == 0L) { // first time diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java b/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java index c0e6fbadb01..043c0b2b2c8 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java @@ -456,7 +456,7 @@ public class Phaser { // finish registration whenever parent registration // succeeded, even when racing with termination, // since these are part of the same "transaction". - while (!STATE.weakCompareAndSetVolatile + while (!STATE.weakCompareAndSet (this, s, ((long)phase << PHASE_SHIFT) | adjust)) { s = state; @@ -488,7 +488,7 @@ public class Phaser { // CAS to root phase with current parties, tripping unarrived while ((phase = (int)(root.state >>> PHASE_SHIFT)) != (int)(s >>> PHASE_SHIFT) && - !STATE.weakCompareAndSetVolatile + !STATE.weakCompareAndSet (this, s, s = (((long)phase << PHASE_SHIFT) | ((phase < 0) ? (s & COUNTS_MASK) : diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java b/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java index 8ba78b3aeb8..b59887d415c 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java @@ -1203,7 +1203,7 @@ public class SubmissionPublisher implements Flow.Publisher, } catch (RuntimeException | Error ex) { // back out do {} while (((c = ctl) & DISABLED) == 0 && (c & ACTIVE) != 0 && - !CTL.weakCompareAndSetVolatile + !CTL.weakCompareAndSet (this, c, c & ~ACTIVE)); throw ex; } diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java index 44b9e5aea68..9410db99bc4 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java @@ -106,16 +106,16 @@ public class AtomicBoolean implements java.io.Serializable { /** * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param expectedValue the expected value * @param newValue the new value * @return {@code true} if successful */ public boolean weakCompareAndSet(boolean expectedValue, boolean newValue) { - return VALUE.weakCompareAndSet(this, - (expectedValue ? 1 : 0), - (newValue ? 1 : 0)); + return VALUE.weakCompareAndSetPlain(this, + (expectedValue ? 1 : 0), + (newValue ? 1 : 0)); } /** @@ -285,7 +285,7 @@ public class AtomicBoolean implements java.io.Serializable { * Possibly atomically sets the value to {@code newValue} if the current * value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param expectedValue the expected value * @param newValue the new value @@ -293,9 +293,9 @@ public class AtomicBoolean implements java.io.Serializable { * @since 9 */ public final boolean weakCompareAndSetVolatile(boolean expectedValue, boolean newValue) { - return VALUE.weakCompareAndSetVolatile(this, - (expectedValue ? 1 : 0), - (newValue ? 1 : 0)); + return VALUE.weakCompareAndSet(this, + (expectedValue ? 1 : 0), + (newValue ? 1 : 0)); } /** diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java index fa7af454788..c7fa1c66e52 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java @@ -146,7 +146,7 @@ public class AtomicInteger extends Number implements java.io.Serializable { /** * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param expectedValue the expected value * @param newValue the new value @@ -217,7 +217,7 @@ public class AtomicInteger extends Number implements java.io.Serializable { /** * Atomically adds the given value to the current value, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * * @param delta the value to add * @return the updated value @@ -490,7 +490,7 @@ public class AtomicInteger extends Number implements java.io.Serializable { * Possibly atomically sets the value to {@code newValue} if * the current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param expectedValue the expected value * @param newValue the new value diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java index 301aa4a5844..8bce29b6f95 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java @@ -149,7 +149,7 @@ public class AtomicIntegerArray implements java.io.Serializable { /** * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param i the index * @param expectedValue the expected value @@ -157,7 +157,7 @@ public class AtomicIntegerArray implements java.io.Serializable { * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, int expectedValue, int newValue) { - return AA.weakCompareAndSet(array, i, expectedValue, newValue); + return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue); } /** @@ -200,7 +200,7 @@ public class AtomicIntegerArray implements java.io.Serializable { /** * Atomically increments the value of the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(i, 1)}. * @@ -208,12 +208,12 @@ public class AtomicIntegerArray implements java.io.Serializable { * @return the updated value */ public final int incrementAndGet(int i) { - return (int)AA.addAndGet(array, i, 1); + return (int)AA.getAndAdd(array, i, 1) + 1; } /** * Atomically decrements the value of the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(i, -1)}. * @@ -221,19 +221,19 @@ public class AtomicIntegerArray implements java.io.Serializable { * @return the updated value */ public final int decrementAndGet(int i) { - return (int)AA.addAndGet(array, i, -1); + return (int)AA.getAndAdd(array, i, -1) - 1; } /** * Atomically adds the given value to the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * * @param i the index * @param delta the value to add * @return the updated value */ public final int addAndGet(int i, int delta) { - return (int)AA.addAndGet(array, i, delta); + return (int)AA.getAndAdd(array, i, delta) + delta; } /** @@ -489,7 +489,7 @@ public class AtomicIntegerArray implements java.io.Serializable { * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param i the index * @param expectedValue the expected value @@ -498,7 +498,7 @@ public class AtomicIntegerArray implements java.io.Serializable { * @since 9 */ public final boolean weakCompareAndSetVolatile(int i, int expectedValue, int newValue) { - return AA.weakCompareAndSetVolatile(array, i, expectedValue, newValue); + return AA.weakCompareAndSet(array, i, expectedValue, newValue); } /** diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java index 726e7a3b7e3..5ee7104fdb8 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java @@ -162,7 +162,7 @@ public class AtomicLong extends Number implements java.io.Serializable { /** * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param expectedValue the expected value * @param newValue the new value @@ -209,7 +209,7 @@ public class AtomicLong extends Number implements java.io.Serializable { /** * Atomically increments the current value, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(1)}. * @@ -221,7 +221,7 @@ public class AtomicLong extends Number implements java.io.Serializable { /** * Atomically decrements the current value, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(-1)}. * @@ -233,7 +233,7 @@ public class AtomicLong extends Number implements java.io.Serializable { /** * Atomically adds the given value to the current value, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * * @param delta the value to add * @return the updated value @@ -504,7 +504,7 @@ public class AtomicLong extends Number implements java.io.Serializable { * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param expectedValue the expected value * @param newValue the new value diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java index 3d584cf44e0..84182c44f74 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java @@ -149,7 +149,7 @@ public class AtomicLongArray implements java.io.Serializable { /** * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param i the index * @param expectedValue the expected value @@ -157,7 +157,7 @@ public class AtomicLongArray implements java.io.Serializable { * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, long expectedValue, long newValue) { - return AA.weakCompareAndSet(array, i, expectedValue, newValue); + return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue); } /** @@ -200,7 +200,7 @@ public class AtomicLongArray implements java.io.Serializable { /** * Atomically increments the value of the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(i, 1)}. * @@ -208,12 +208,12 @@ public class AtomicLongArray implements java.io.Serializable { * @return the updated value */ public final long incrementAndGet(int i) { - return (long)AA.addAndGet(array, i, 1L); + return (long)AA.getAndAdd(array, i, 1L) + 1L; } /** * Atomically decrements the value of the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(i, -1)}. * @@ -221,19 +221,19 @@ public class AtomicLongArray implements java.io.Serializable { * @return the updated value */ public final long decrementAndGet(int i) { - return (long)AA.addAndGet(array, i, -1L); + return (long)AA.getAndAdd(array, i, -1L) - 1L; } /** * Atomically adds the given value to the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * * @param i the index * @param delta the value to add * @return the updated value */ public long addAndGet(int i, long delta) { - return (long)AA.addAndGet(array, i, delta); + return (long)AA.getAndAdd(array, i, delta) + delta; } /** @@ -489,7 +489,7 @@ public class AtomicLongArray implements java.io.Serializable { * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param i the index * @param expectedValue the expected value @@ -498,7 +498,7 @@ public class AtomicLongArray implements java.io.Serializable { * @since 9 */ public final boolean weakCompareAndSetVolatile(int i, long expectedValue, long newValue) { - return AA.weakCompareAndSetVolatile(array, i, expectedValue, newValue); + return AA.weakCompareAndSet(array, i, expectedValue, newValue); } /** diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java index d8bd6e4a7bc..0098d31bf2e 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java @@ -125,14 +125,14 @@ public class AtomicReference implements java.io.Serializable { /** * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param expectedValue the expected value * @param newValue the new value * @return {@code true} if successful */ public final boolean weakCompareAndSet(V expectedValue, V newValue) { - return VALUE.weakCompareAndSet(this, expectedValue, newValue); + return VALUE.weakCompareAndSetPlain(this, expectedValue, newValue); } /** @@ -370,7 +370,7 @@ public class AtomicReference implements java.io.Serializable { * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param expectedValue the expected value * @param newValue the new value @@ -378,7 +378,7 @@ public class AtomicReference implements java.io.Serializable { * @since 9 */ public final boolean weakCompareAndSetVolatile(V expectedValue, V newValue) { - return VALUE.weakCompareAndSetVolatile(this, expectedValue, newValue); + return VALUE.weakCompareAndSet(this, expectedValue, newValue); } /** diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java index 34bb0f135da..998f167d5cc 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java @@ -155,7 +155,7 @@ public class AtomicReferenceArray implements java.io.Serializable { /** * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param i the index * @param expectedValue the expected value @@ -163,7 +163,7 @@ public class AtomicReferenceArray implements java.io.Serializable { * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, E expectedValue, E newValue) { - return AA.weakCompareAndSet(array, i, expectedValue, newValue); + return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue); } /** @@ -451,7 +451,7 @@ public class AtomicReferenceArray implements java.io.Serializable { * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param i the index * @param expectedValue the expected value @@ -460,7 +460,7 @@ public class AtomicReferenceArray implements java.io.Serializable { * @since 9 */ public final boolean weakCompareAndSetVolatile(int i, E expectedValue, E newValue) { - return AA.weakCompareAndSetVolatile(array, i, expectedValue, newValue); + return AA.weakCompareAndSet(array, i, expectedValue, newValue); } /** diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java b/jdk/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java index 24be8fbe580..8b9d401ee10 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java @@ -1123,14 +1123,14 @@ public class StampedLock implements java.io.Serializable { } else if ((p = wtail) == null) { // initialize queue WNode hd = new WNode(WMODE, null); - if (WHEAD.weakCompareAndSetVolatile(this, null, hd)) + if (WHEAD.weakCompareAndSet(this, null, hd)) wtail = hd; } else if (node == null) node = new WNode(WMODE, p); else if (node.prev != p) node.prev = p; - else if (WTAIL.weakCompareAndSetVolatile(this, p, node)) { + else if (WTAIL.weakCompareAndSet(this, p, node)) { p.next = node; break; } @@ -1162,7 +1162,7 @@ public class StampedLock implements java.io.Serializable { else if (h != null) { // help release stale waiters WNode c; Thread w; while ((c = h.cowait) != null) { - if (WCOWAIT.weakCompareAndSetVolatile(h, c, c.cowait) && + if (WCOWAIT.weakCompareAndSet(h, c, c.cowait) && (w = c.thread) != null) LockSupport.unpark(w); } @@ -1247,7 +1247,7 @@ public class StampedLock implements java.io.Serializable { } if (p == null) { // initialize queue WNode hd = new WNode(WMODE, null); - if (WHEAD.weakCompareAndSetVolatile(this, null, hd)) + if (WHEAD.weakCompareAndSet(this, null, hd)) wtail = hd; } else if (node == null) @@ -1255,7 +1255,7 @@ public class StampedLock implements java.io.Serializable { else if (h == p || p.mode != RMODE) { if (node.prev != p) node.prev = p; - else if (WTAIL.weakCompareAndSetVolatile(this, p, node)) { + else if (WTAIL.weakCompareAndSet(this, p, node)) { p.next = node; break; } diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaNetSocketAccess.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaNetSocketAccess.java new file mode 100644 index 00000000000..39dd153731e --- /dev/null +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaNetSocketAccess.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.misc; + +import java.net.ServerSocket; +import java.net.SocketImpl; + +public interface JavaNetSocketAccess { + /** + * Creates a ServerSocket associated with the given SocketImpl. + */ + ServerSocket newServerSocket(SocketImpl impl); + + /* + * Constructs a SocketImpl instance of the given class. + */ + SocketImpl newSocketImpl(Class implClass); +} diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java index fed1b694548..052d1119f09 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java @@ -55,6 +55,7 @@ public class SharedSecrets { private static JavaNetAccess javaNetAccess; private static JavaNetInetAddressAccess javaNetInetAddressAccess; private static JavaNetHttpCookieAccess javaNetHttpCookieAccess; + private static JavaNetSocketAccess javaNetSocketAccess; private static JavaNioAccess javaNioAccess; private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess; @@ -161,6 +162,16 @@ public class SharedSecrets { return javaNetHttpCookieAccess; } + public static void setJavaNetSocketAccess(JavaNetSocketAccess jnsa) { + javaNetSocketAccess = jnsa; + } + + public static JavaNetSocketAccess getJavaNetSocketAccess() { + if (javaNetSocketAccess == null) + unsafe.ensureClassInitialized(java.net.ServerSocket.class); + return javaNetSocketAccess; + } + public static void setJavaNioAccess(JavaNioAccess jna) { javaNioAccess = jna; } diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java index d37b3e7de5b..f86f5ab69d3 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java @@ -2278,6 +2278,24 @@ public final class Unsafe { return v; } + @ForceInline + public final int getAndAddIntRelease(Object o, long offset, int delta) { + int v; + do { + v = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, v, v + delta)); + return v; + } + + @ForceInline + public final int getAndAddIntAcquire(Object o, long offset, int delta) { + int v; + do { + v = getIntAcquire(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, v, v + delta)); + return v; + } + /** * Atomically adds the given value to the current value of a field * or array element within the given object {@code o} @@ -2298,6 +2316,24 @@ public final class Unsafe { return v; } + @ForceInline + public final long getAndAddLongRelease(Object o, long offset, long delta) { + long v; + do { + v = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, v, v + delta)); + return v; + } + + @ForceInline + public final long getAndAddLongAcquire(Object o, long offset, long delta) { + long v; + do { + v = getLongAcquire(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, v, v + delta)); + return v; + } + @HotSpotIntrinsicCandidate public final byte getAndAddByte(Object o, long offset, byte delta) { byte v; @@ -2307,6 +2343,24 @@ public final class Unsafe { return v; } + @ForceInline + public final byte getAndAddByteRelease(Object o, long offset, byte delta) { + byte v; + do { + v = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, v, (byte) (v + delta))); + return v; + } + + @ForceInline + public final byte getAndAddByteAcquire(Object o, long offset, byte delta) { + byte v; + do { + v = getByteAcquire(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, v, (byte) (v + delta))); + return v; + } + @HotSpotIntrinsicCandidate public final short getAndAddShort(Object o, long offset, short delta) { short v; @@ -2316,11 +2370,39 @@ public final class Unsafe { return v; } + @ForceInline + public final short getAndAddShortRelease(Object o, long offset, short delta) { + short v; + do { + v = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, v, (short) (v + delta))); + return v; + } + + @ForceInline + public final short getAndAddShortAcquire(Object o, long offset, short delta) { + short v; + do { + v = getShortAcquire(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, v, (short) (v + delta))); + return v; + } + @ForceInline public final char getAndAddChar(Object o, long offset, char delta) { return (char) getAndAddShort(o, offset, (short) delta); } + @ForceInline + public final char getAndAddCharRelease(Object o, long offset, char delta) { + return (char) getAndAddShortRelease(o, offset, (short) delta); + } + + @ForceInline + public final char getAndAddCharAcquire(Object o, long offset, char delta) { + return (char) getAndAddShortAcquire(o, offset, (short) delta); + } + @ForceInline public final float getAndAddFloat(Object o, long offset, float delta) { int expectedBits; @@ -2336,6 +2418,36 @@ public final class Unsafe { return v; } + @ForceInline + public final float getAndAddFloatRelease(Object o, long offset, float delta) { + int expectedBits; + float v; + do { + // Load and CAS with the raw bits to avoid issues with NaNs and + // possible bit conversion from signaling NaNs to quiet NaNs that + // may result in the loop not terminating. + expectedBits = getInt(o, offset); + v = Float.intBitsToFloat(expectedBits); + } while (!weakCompareAndSwapIntRelease(o, offset, + expectedBits, Float.floatToRawIntBits(v + delta))); + return v; + } + + @ForceInline + public final float getAndAddFloatAcquire(Object o, long offset, float delta) { + int expectedBits; + float v; + do { + // Load and CAS with the raw bits to avoid issues with NaNs and + // possible bit conversion from signaling NaNs to quiet NaNs that + // may result in the loop not terminating. + expectedBits = getIntAcquire(o, offset); + v = Float.intBitsToFloat(expectedBits); + } while (!weakCompareAndSwapIntAcquire(o, offset, + expectedBits, Float.floatToRawIntBits(v + delta))); + return v; + } + @ForceInline public final double getAndAddDouble(Object o, long offset, double delta) { long expectedBits; @@ -2351,6 +2463,36 @@ public final class Unsafe { return v; } + @ForceInline + public final double getAndAddDoubleRelease(Object o, long offset, double delta) { + long expectedBits; + double v; + do { + // Load and CAS with the raw bits to avoid issues with NaNs and + // possible bit conversion from signaling NaNs to quiet NaNs that + // may result in the loop not terminating. + expectedBits = getLong(o, offset); + v = Double.longBitsToDouble(expectedBits); + } while (!weakCompareAndSwapLongRelease(o, offset, + expectedBits, Double.doubleToRawLongBits(v + delta))); + return v; + } + + @ForceInline + public final double getAndAddDoubleAcquire(Object o, long offset, double delta) { + long expectedBits; + double v; + do { + // Load and CAS with the raw bits to avoid issues with NaNs and + // possible bit conversion from signaling NaNs to quiet NaNs that + // may result in the loop not terminating. + expectedBits = getLongAcquire(o, offset); + v = Double.longBitsToDouble(expectedBits); + } while (!weakCompareAndSwapLongAcquire(o, offset, + expectedBits, Double.doubleToRawLongBits(v + delta))); + return v; + } + /** * Atomically exchanges the given value with the current value of * a field or array element within the given object {@code o} @@ -2371,6 +2513,24 @@ public final class Unsafe { return v; } + @ForceInline + public final int getAndSetIntRelease(Object o, long offset, int newValue) { + int v; + do { + v = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final int getAndSetIntAcquire(Object o, long offset, int newValue) { + int v; + do { + v = getIntAcquire(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, v, newValue)); + return v; + } + /** * Atomically exchanges the given value with the current value of * a field or array element within the given object {@code o} @@ -2391,6 +2551,24 @@ public final class Unsafe { return v; } + @ForceInline + public final long getAndSetLongRelease(Object o, long offset, long newValue) { + long v; + do { + v = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final long getAndSetLongAcquire(Object o, long offset, long newValue) { + long v; + do { + v = getLongAcquire(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, v, newValue)); + return v; + } + /** * Atomically exchanges the given reference value with the current * reference value of a field or array element within the given @@ -2411,6 +2589,24 @@ public final class Unsafe { return v; } + @ForceInline + public final Object getAndSetObjectRelease(Object o, long offset, Object newValue) { + Object v; + do { + v = getObject(o, offset); + } while (!weakCompareAndSwapObjectRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final Object getAndSetObjectAcquire(Object o, long offset, Object newValue) { + Object v; + do { + v = getObjectAcquire(o, offset); + } while (!weakCompareAndSwapObjectAcquire(o, offset, v, newValue)); + return v; + } + @HotSpotIntrinsicCandidate public final byte getAndSetByte(Object o, long offset, byte newValue) { byte v; @@ -2420,11 +2616,39 @@ public final class Unsafe { return v; } + @ForceInline + public final byte getAndSetByteRelease(Object o, long offset, byte newValue) { + byte v; + do { + v = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final byte getAndSetByteAcquire(Object o, long offset, byte newValue) { + byte v; + do { + v = getByteAcquire(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, v, newValue)); + return v; + } + @ForceInline public final boolean getAndSetBoolean(Object o, long offset, boolean newValue) { return byte2bool(getAndSetByte(o, offset, bool2byte(newValue))); } + @ForceInline + public final boolean getAndSetBooleanRelease(Object o, long offset, boolean newValue) { + return byte2bool(getAndSetByteRelease(o, offset, bool2byte(newValue))); + } + + @ForceInline + public final boolean getAndSetBooleanAcquire(Object o, long offset, boolean newValue) { + return byte2bool(getAndSetByteAcquire(o, offset, bool2byte(newValue))); + } + @HotSpotIntrinsicCandidate public final short getAndSetShort(Object o, long offset, short newValue) { short v; @@ -2434,23 +2658,559 @@ public final class Unsafe { return v; } + @ForceInline + public final short getAndSetShortRelease(Object o, long offset, short newValue) { + short v; + do { + v = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final short getAndSetShortAcquire(Object o, long offset, short newValue) { + short v; + do { + v = getShortAcquire(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, v, newValue)); + return v; + } + @ForceInline public final char getAndSetChar(Object o, long offset, char newValue) { return s2c(getAndSetShort(o, offset, c2s(newValue))); } + @ForceInline + public final char getAndSetCharRelease(Object o, long offset, char newValue) { + return s2c(getAndSetShortRelease(o, offset, c2s(newValue))); + } + + @ForceInline + public final char getAndSetCharAcquire(Object o, long offset, char newValue) { + return s2c(getAndSetShortAcquire(o, offset, c2s(newValue))); + } + @ForceInline public final float getAndSetFloat(Object o, long offset, float newValue) { int v = getAndSetInt(o, offset, Float.floatToRawIntBits(newValue)); return Float.intBitsToFloat(v); } + @ForceInline + public final float getAndSetFloatRelease(Object o, long offset, float newValue) { + int v = getAndSetIntRelease(o, offset, Float.floatToRawIntBits(newValue)); + return Float.intBitsToFloat(v); + } + + @ForceInline + public final float getAndSetFloatAcquire(Object o, long offset, float newValue) { + int v = getAndSetIntAcquire(o, offset, Float.floatToRawIntBits(newValue)); + return Float.intBitsToFloat(v); + } + @ForceInline public final double getAndSetDouble(Object o, long offset, double newValue) { long v = getAndSetLong(o, offset, Double.doubleToRawLongBits(newValue)); return Double.longBitsToDouble(v); } + @ForceInline + public final double getAndSetDoubleRelease(Object o, long offset, double newValue) { + long v = getAndSetLongRelease(o, offset, Double.doubleToRawLongBits(newValue)); + return Double.longBitsToDouble(v); + } + + @ForceInline + public final double getAndSetDoubleAcquire(Object o, long offset, double newValue) { + long v = getAndSetLongAcquire(o, offset, Double.doubleToRawLongBits(newValue)); + return Double.longBitsToDouble(v); + } + + + // The following contain CAS-based Java implementations used on + // platforms not supporting native instructions + + @ForceInline + public final boolean getAndBitwiseOrBoolean(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseOrByte(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseOrBooleanRelease(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseOrByteRelease(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseOrBooleanAcquire(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseOrByteAcquire(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseAndBoolean(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseAndByte(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseAndBooleanRelease(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseAndByteRelease(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseAndBooleanAcquire(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseAndByteAcquire(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseXorBoolean(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseXorByte(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseXorBooleanRelease(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseXorByteRelease(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseXorBooleanAcquire(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseXorByteAcquire(o, offset, bool2byte(mask))); + } + + + @ForceInline + public final byte getAndBitwiseOrByte(Object o, long offset, byte mask) { + byte current; + do { + current = getByteVolatile(o, offset); + } while (!weakCompareAndSwapByteVolatile(o, offset, + current, (byte) (current | mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseOrByteRelease(Object o, long offset, byte mask) { + byte current; + do { + current = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, + current, (byte) (current | mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseOrByteAcquire(Object o, long offset, byte mask) { + byte current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getByte(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, + current, (byte) (current | mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseAndByte(Object o, long offset, byte mask) { + byte current; + do { + current = getByteVolatile(o, offset); + } while (!weakCompareAndSwapByteVolatile(o, offset, + current, (byte) (current & mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseAndByteRelease(Object o, long offset, byte mask) { + byte current; + do { + current = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, + current, (byte) (current & mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseAndByteAcquire(Object o, long offset, byte mask) { + byte current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getByte(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, + current, (byte) (current & mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseXorByte(Object o, long offset, byte mask) { + byte current; + do { + current = getByteVolatile(o, offset); + } while (!weakCompareAndSwapByteVolatile(o, offset, + current, (byte) (current ^ mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseXorByteRelease(Object o, long offset, byte mask) { + byte current; + do { + current = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, + current, (byte) (current ^ mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseXorByteAcquire(Object o, long offset, byte mask) { + byte current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getByte(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, + current, (byte) (current ^ mask))); + return current; + } + + + @ForceInline + public final char getAndBitwiseOrChar(Object o, long offset, char mask) { + return s2c(getAndBitwiseOrShort(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseOrCharRelease(Object o, long offset, char mask) { + return s2c(getAndBitwiseOrShortRelease(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseOrCharAcquire(Object o, long offset, char mask) { + return s2c(getAndBitwiseOrShortAcquire(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseAndChar(Object o, long offset, char mask) { + return s2c(getAndBitwiseAndShort(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseAndCharRelease(Object o, long offset, char mask) { + return s2c(getAndBitwiseAndShortRelease(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseAndCharAcquire(Object o, long offset, char mask) { + return s2c(getAndBitwiseAndShortAcquire(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseXorChar(Object o, long offset, char mask) { + return s2c(getAndBitwiseXorShort(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseXorCharRelease(Object o, long offset, char mask) { + return s2c(getAndBitwiseXorShortRelease(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseXorCharAcquire(Object o, long offset, char mask) { + return s2c(getAndBitwiseXorShortAcquire(o, offset, c2s(mask))); + } + + + @ForceInline + public final short getAndBitwiseOrShort(Object o, long offset, short mask) { + short current; + do { + current = getShortVolatile(o, offset); + } while (!weakCompareAndSwapShortVolatile(o, offset, + current, (short) (current | mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseOrShortRelease(Object o, long offset, short mask) { + short current; + do { + current = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, + current, (short) (current | mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseOrShortAcquire(Object o, long offset, short mask) { + short current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getShort(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, + current, (short) (current | mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseAndShort(Object o, long offset, short mask) { + short current; + do { + current = getShortVolatile(o, offset); + } while (!weakCompareAndSwapShortVolatile(o, offset, + current, (short) (current & mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseAndShortRelease(Object o, long offset, short mask) { + short current; + do { + current = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, + current, (short) (current & mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseAndShortAcquire(Object o, long offset, short mask) { + short current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getShort(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, + current, (short) (current & mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseXorShort(Object o, long offset, short mask) { + short current; + do { + current = getShortVolatile(o, offset); + } while (!weakCompareAndSwapShortVolatile(o, offset, + current, (short) (current ^ mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseXorShortRelease(Object o, long offset, short mask) { + short current; + do { + current = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, + current, (short) (current ^ mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseXorShortAcquire(Object o, long offset, short mask) { + short current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getShort(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, + current, (short) (current ^ mask))); + return current; + } + + + @ForceInline + public final int getAndBitwiseOrInt(Object o, long offset, int mask) { + int current; + do { + current = getIntVolatile(o, offset); + } while (!weakCompareAndSwapIntVolatile(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseOrIntRelease(Object o, long offset, int mask) { + int current; + do { + current = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseOrIntAcquire(Object o, long offset, int mask) { + int current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getInt(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, + current, current | mask)); + return current; + } + + /** + * Atomically replaces the current value of a field or array element within + * the given object with the result of bitwise AND between the current value + * and mask. + * + * @param o object/array to update the field/element in + * @param offset field/element offset + * @param mask the mask value + * @return the previous value + * @since 1.9 + */ + @ForceInline + public final int getAndBitwiseAndInt(Object o, long offset, int mask) { + int current; + do { + current = getIntVolatile(o, offset); + } while (!weakCompareAndSwapIntVolatile(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseAndIntRelease(Object o, long offset, int mask) { + int current; + do { + current = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseAndIntAcquire(Object o, long offset, int mask) { + int current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getInt(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseXorInt(Object o, long offset, int mask) { + int current; + do { + current = getIntVolatile(o, offset); + } while (!weakCompareAndSwapIntVolatile(o, offset, + current, current ^ mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseXorIntRelease(Object o, long offset, int mask) { + int current; + do { + current = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, + current, current ^ mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseXorIntAcquire(Object o, long offset, int mask) { + int current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getInt(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, + current, current ^ mask)); + return current; + } + + + @ForceInline + public final long getAndBitwiseOrLong(Object o, long offset, long mask) { + long current; + do { + current = getLongVolatile(o, offset); + } while (!weakCompareAndSwapLongVolatile(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseOrLongRelease(Object o, long offset, long mask) { + long current; + do { + current = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseOrLongAcquire(Object o, long offset, long mask) { + long current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getLong(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseAndLong(Object o, long offset, long mask) { + long current; + do { + current = getLongVolatile(o, offset); + } while (!weakCompareAndSwapLongVolatile(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseAndLongRelease(Object o, long offset, long mask) { + long current; + do { + current = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseAndLongAcquire(Object o, long offset, long mask) { + long current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getLong(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseXorLong(Object o, long offset, long mask) { + long current; + do { + current = getLongVolatile(o, offset); + } while (!weakCompareAndSwapLongVolatile(o, offset, + current, current ^ mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseXorLongRelease(Object o, long offset, long mask) { + long current; + do { + current = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, + current, current ^ mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseXorLongAcquire(Object o, long offset, long mask) { + long current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getLong(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, + current, current ^ mask)); + return current; + } + + + /** * Ensures that loads before the fence will not be reordered with loads and * stores after the fence; a "LoadLoad plus LoadStore barrier". diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index 923fbe4d66c..35a3fa5da66 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -1074,7 +1074,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { * 1) if (instProxy != null) * connect to instProxy; raise exception if failed * 2) else use system default ProxySelector - * 3) is 2) fails, make direct connection + * 3) else make a direct connection if ProxySelector is not present */ if (instProxy == null) { // no instance Proxy is set @@ -1117,10 +1117,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { if (p != Proxy.NO_PROXY) { sel.connectFailed(uri, p.address(), ioex); if (!it.hasNext()) { - // fallback to direct connection - http = getNewHttpClient(url, null, connectTimeout, false); - http.setReadTimeout(readTimeout); - break; + throw ioex; } } else { throw ioex; diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java b/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java index 764f04cd545..86727b91997 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java @@ -1496,7 +1496,7 @@ final class AbstractTrustManagerWrapper extends X509ExtendedTrustManager } } catch (CertPathValidatorException cpve) { throw new CertificateException( - "Certificates does not conform to algorithm constraints"); + "Certificates do not conform to algorithm constraints", cpve); } } } diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c index 12ca2b2c656..6dc9674a6ed 100644 --- a/jdk/src/java.base/share/native/libjli/java.c +++ b/jdk/src/java.base/share/native/libjli/java.c @@ -556,20 +556,6 @@ IsLauncherOption(const char* name) { JLI_StrCmp(name, "--list-modules") == 0; } -#ifndef OLD_MODULE_OPTIONS -/* - * Old module options for transition - */ -static jboolean -IsOldModuleOption(const char* name) { - return JLI_StrCmp(name, "-modulepath") == 0 || - JLI_StrCmp(name, "-mp") == 0 || - JLI_StrCmp(name, "-upgrademodulepath") == 0 || - JLI_StrCmp(name, "-addmods") == 0 || - JLI_StrCmp(name, "-limitmods") == 0; -} -#endif - /* * Test if the given name is a module-system white-space option that * will be passed to the VM with its corresponding long-form option @@ -584,8 +570,7 @@ IsModuleOption(const char* name) { JLI_StrCmp(name, "--limit-modules") == 0 || JLI_StrCmp(name, "--add-exports") == 0 || JLI_StrCmp(name, "--add-reads") == 0 || - JLI_StrCmp(name, "--patch-module") == 0 || - IsOldModuleOption(name); + JLI_StrCmp(name, "--patch-module") == 0; } /* @@ -1224,32 +1209,6 @@ GetOpt(int *pargc, char ***pargv, char **poption, char **pvalue) { } } -#ifndef OLD_MODULE_OPTIONS - // for transition to support both old and new syntax - if (JLI_StrCmp(arg, "-modulepath") == 0 || - JLI_StrCmp(arg, "-mp") == 0) { - option = "--module-path"; - } else if (JLI_StrCmp(arg, "-upgrademodulepath") == 0) { - option = "--upgrade-module-path"; - } else if (JLI_StrCmp(arg, "-addmods") == 0) { - option = "--add-modules"; - } else if (JLI_StrCmp(arg, "-limitmods") == 0) { - option = "--limit-modules"; - } else if (JLI_StrCCmp(arg, "-XaddExports:") == 0) { - option = "--add-exports"; - value = arg + 13; - kind = VM_LONG_OPTION_WITH_ARGUMENT; - } else if (JLI_StrCCmp(arg, "-XaddReads:") == 0) { - option = "--add-reads"; - value = arg + 11; - kind = VM_LONG_OPTION_WITH_ARGUMENT; - } else if (JLI_StrCCmp(arg, "-Xpatch:") == 0) { - option = "--patch-module"; - value = arg + 8; - kind = VM_LONG_OPTION_WITH_ARGUMENT; - } -#endif - *pargc = argc; *pargv = argv; *poption = option; @@ -1340,16 +1299,6 @@ ParseArguments(int *pargc, char ***pargv, JLI_StrCmp(arg, "--patch-module") == 0) { REPORT_ERROR (has_arg, ARG_ERROR6, arg); } -#ifndef OLD_MODULE_OPTIONS - else if (JLI_StrCmp(arg, "-modulepath") == 0 || - JLI_StrCmp(arg, "-mp") == 0 || - JLI_StrCmp(arg, "-upgrademodulepath") == 0) { - REPORT_ERROR (has_arg, ARG_ERROR4, arg); - } else if (JLI_StrCmp(arg, "-addmods") == 0 || - JLI_StrCmp(arg, "-limitmods") == 0) { - REPORT_ERROR (has_arg, ARG_ERROR6, arg); - } -#endif /* * The following cases will cause the argument parsing to stop */ @@ -1548,6 +1497,7 @@ NewPlatformStringArray(JNIEnv *env, char **strv, int strc) NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0)); + CHECK_EXCEPTION_RETURN_VALUE(0); for (i = 0; i < strc; i++) { jstring str = NewPlatformString(env, *strv++); NULL_CHECK0(str); diff --git a/jdk/src/java.base/share/native/libjli/java.h b/jdk/src/java.base/share/native/libjli/java.h index c18c66e5b51..41a232714c8 100644 --- a/jdk/src/java.base/share/native/libjli/java.h +++ b/jdk/src/java.base/share/native/libjli/java.h @@ -253,6 +253,13 @@ typedef struct { #define NULL_CHECK(NC_check_pointer) \ NULL_CHECK_RETURN_VALUE(NC_check_pointer, ) +#define CHECK_EXCEPTION_RETURN_VALUE(CER_value) \ + do { \ + if ((*env)->ExceptionOccurred(env)) { \ + return CER_value; \ + } \ + } while (JNI_FALSE) + #define CHECK_EXCEPTION_RETURN() \ do { \ if ((*env)->ExceptionOccurred(env)) { \ diff --git a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java index 4b4441a7700..f26b0108fed 100644 --- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java +++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java @@ -630,6 +630,19 @@ final class ProcessImpl extends Process { return !hasExited; } + /** + * The {@code toString} method returns a string consisting of + * the native process ID of the process and the exit value of the process. + * + * @return a string representation of the object. + */ + @Override + public String toString() { + return new StringBuilder("Process[pid=").append(pid) + .append(", exitValue=").append(hasExited ? exitcode : "\"not exited\"") + .append("]").toString(); + } + private static native void init(); static { diff --git a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c index 3408bdd9762..27230858253 100644 --- a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c +++ b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c @@ -349,6 +349,8 @@ static int copystrings(char *buf, int offset, const char * const *arg) { __attribute_noinline__ #endif +/* vfork(2) is deprecated on Solaris */ +#ifndef __solaris__ static pid_t vforkChild(ChildStuff *c) { volatile pid_t resultPid; @@ -367,6 +369,7 @@ vforkChild(ChildStuff *c) { assert(resultPid != 0); /* childProcess never returns */ return resultPid; } +#endif static pid_t forkChild(ChildStuff *c) { @@ -479,8 +482,11 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) static pid_t startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) { switch (c->mode) { +/* vfork(2) is deprecated on Solaris */ +#ifndef __solaris__ case MODE_VFORK: return vforkChild(c); +#endif case MODE_FORK: return forkChild(c); #if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX) diff --git a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c index 3efde95813a..d5b1824b314 100644 --- a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c +++ b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c @@ -80,6 +80,12 @@ #define DEV_PREFIX "/dev/" #endif +#ifdef LIFNAMSIZ + #define IFNAMESIZE LIFNAMSIZ +#else + #define IFNAMESIZE IFNAMSIZ +#endif + #define CHECKED_MALLOC3(_pointer, _type, _size) \ do { \ _pointer = (_type)malloc(_size); \ @@ -158,7 +164,7 @@ static short translateIPv6AddressToPrefix(struct sockaddr_in6 *addr); static int getIndex(int sock, const char *ifname); static int getFlags(int sock, const char *ifname, int *flags); -static int getMacAddress(JNIEnv *env, int sock, const char *ifname, +static int getMacAddress(JNIEnv *env, const char *ifname, const struct in_addr *addr, unsigned char *buf); static int getMTU(JNIEnv *env, int sock, const char *ifname); @@ -237,20 +243,25 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0 const char* name_utf; jobject obj = NULL; + if (name != NULL) { + name_utf = (*env)->GetStringUTFChars(env, name, &isCopy); + } else { + JNU_ThrowNullPointerException(env, "network interface name is NULL"); + return NULL; + } + + if (name_utf == NULL) { + if (!(*env)->ExceptionCheck(env)) + JNU_ThrowOutOfMemoryError(env, NULL); + return NULL; + } + ifs = enumInterfaces(env); if (ifs == NULL) { return NULL; } - name_utf = (*env)->GetStringUTFChars(env, name, &isCopy); - if (name_utf == NULL) { - if (!(*env)->ExceptionCheck(env)) - JNU_ThrowOutOfMemoryError(env, NULL); - freeif(ifs); - return NULL; - } - - // Search the list of interface based on name + // search the list of interfaces based on name curr = ifs; while (curr != NULL) { if (strcmp(name_utf, curr->name) == 0) { @@ -285,12 +296,13 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0 if (index <= 0) { return NULL; } + ifs = enumInterfaces(env); if (ifs == NULL) { return NULL; } - // Search the list of interface based on index + // search the list of interfaces based on index curr = ifs; while (curr != NULL) { if (index == curr->index) { @@ -304,7 +316,9 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByIndex0 obj = createNetworkInterface(env, curr); } + // release the interface list freeif(ifs); + return obj; } @@ -317,13 +331,11 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 (JNIEnv *env, jclass cls, jobject iaObj) { netif *ifs, *curr; - #if defined(AF_INET6) int family = (getInetAddress_family(env, iaObj) == IPv4) ? AF_INET : AF_INET6; #else int family = AF_INET; #endif - jobject obj = NULL; jboolean match = JNI_FALSE; @@ -342,7 +354,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 if (family == addrP->family) { if (family == AF_INET) { int address1 = htonl( - ((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr); + ((struct sockaddr_in *)addrP->addr)->sin_addr.s_addr); int address2 = getInetAddress_addr(env, iaObj); if (address1 == address2) { @@ -350,7 +362,6 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 break; } } - #if defined(AF_INET6) if (family == AF_INET6) { jbyte *bytes = (jbyte *)&( @@ -390,7 +401,9 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 obj = createNetworkInterface(env, curr); } + // release the interface list freeif(ifs); + return obj; } @@ -411,7 +424,7 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll return NULL; } - // count the interface + // count the interfaces ifCount = 0; curr = ifs; while (curr != NULL) { @@ -426,8 +439,8 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll return NULL; } - // Iterate through the interfaces, create a NetworkInterface instance - // for each array element and populate the object. + // iterate through the interfaces, create a NetworkInterface instance + // for each array element and populate the object curr = ifs; arr_index = 0; while (curr != NULL) { @@ -445,7 +458,9 @@ JNIEXPORT jobjectArray JNICALL Java_java_net_NetworkInterface_getAll curr = curr->next; } + // release the interface list freeif(ifs); + return netIFArr; } @@ -511,46 +526,45 @@ JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0 jbyteArray ret = NULL; unsigned char mac[16]; int len; - int sock; jboolean isCopy; - const char* name_utf; + const char *name_utf; - name_utf = (*env)->GetStringUTFChars(env, name, &isCopy); - if (name_utf == NULL) { - if (!(*env)->ExceptionCheck(env)) - JNU_ThrowOutOfMemoryError(env, NULL); - return NULL; + if (name != NULL) { + name_utf = (*env)->GetStringUTFChars(env, name, &isCopy); + } else { + JNU_ThrowNullPointerException(env, "network interface name is NULL"); + return NULL; } - if ((sock = openSocketWithFallback(env, name_utf)) < 0) { - (*env)->ReleaseStringUTFChars(env, name, name_utf); - return NULL; + + if (name_utf == NULL) { + if (!(*env)->ExceptionCheck(env)) + JNU_ThrowOutOfMemoryError(env, NULL); + return NULL; } if (!IS_NULL(addrArray)) { - (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr); - addr = ((caddr[0]<<24) & 0xff000000); - addr |= ((caddr[1] <<16) & 0xff0000); - addr |= ((caddr[2] <<8) & 0xff00); - addr |= (caddr[3] & 0xff); - iaddr.s_addr = htonl(addr); - len = getMacAddress(env, sock, name_utf, &iaddr, mac); + (*env)->GetByteArrayRegion(env, addrArray, 0, 4, caddr); + addr = ((caddr[0]<<24) & 0xff000000); + addr |= ((caddr[1] <<16) & 0xff0000); + addr |= ((caddr[2] <<8) & 0xff00); + addr |= (caddr[3] & 0xff); + iaddr.s_addr = htonl(addr); + len = getMacAddress(env, name_utf, &iaddr, mac); } else { - len = getMacAddress(env, sock, name_utf, NULL, mac); + len = getMacAddress(env, name_utf, NULL, mac); } - if (len > 0) { - ret = (*env)->NewByteArray(env, len); - if (IS_NULL(ret)) { - /* we may have memory to free at the end of this */ - goto fexit; - } - (*env)->SetByteArrayRegion(env, ret, 0, len, (jbyte *)(mac)); - } - fexit: - // release the UTF string and interface list - (*env)->ReleaseStringUTFChars(env, name, name_utf); - close(sock); - return ret; + if (len > 0) { + ret = (*env)->NewByteArray(env, len); + if (!IS_NULL(ret)) { + (*env)->SetByteArrayRegion(env, ret, 0, len, (jbyte *)(mac)); + } + } + + // release the UTF string and interface list + (*env)->ReleaseStringUTFChars(env, name, name_utf); + + return ret; } /* @@ -562,8 +576,7 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0 (JNIEnv *env, jclass cls, jstring name, jint index) { jboolean isCopy; - int ret = -1; - int sock; + int sock, ret = -1; const char* name_utf = NULL; if (name != NULL) { @@ -572,15 +585,16 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0 JNU_ThrowNullPointerException(env, "network interface name is NULL"); return ret; } + if (name_utf == NULL) { - if (!(*env)->ExceptionCheck(env)) - JNU_ThrowOutOfMemoryError(env, NULL); - return ret; + if (!(*env)->ExceptionCheck(env)) + JNU_ThrowOutOfMemoryError(env, NULL); + return ret; } if ((sock = openSocketWithFallback(env, name_utf)) < 0) { - (*env)->ReleaseStringUTFChars(env, name, name_utf); - return JNI_FALSE; + (*env)->ReleaseStringUTFChars(env, name, name_utf); + return JNI_FALSE; } ret = getMTU(env, sock, name_utf); @@ -595,9 +609,8 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0 static int getFlags0(JNIEnv *env, jstring name) { jboolean isCopy; - int ret, sock; - const char* name_utf; - int flags = 0; + int ret, sock, flags = 0; + const char *name_utf; if (name != NULL) { name_utf = (*env)->GetStringUTFChars(env, name, &isCopy); @@ -607,9 +620,9 @@ static int getFlags0(JNIEnv *env, jstring name) { } if (name_utf == NULL) { - if (!(*env)->ExceptionCheck(env)) - JNU_ThrowOutOfMemoryError(env, NULL); - return -1; + if (!(*env)->ExceptionCheck(env)) + JNU_ThrowOutOfMemoryError(env, NULL); + return -1; } if ((sock = openSocketWithFallback(env, name_utf)) < 0) { (*env)->ReleaseStringUTFChars(env, name, name_utf); @@ -648,7 +661,7 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) { netif *childP; jobject tmp; - // Create a NetworkInterface object and populate it + // create a NetworkInterface object and populate it netifObj = (*env)->NewObject(env, ni_class, ni_ctrID); CHECK_NULL_RETURN(netifObj, NULL); name = (*env)->NewStringUTF(env, ifs->name); @@ -659,7 +672,7 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) { (*env)->SetBooleanField(env, netifObj, ni_virutalID, ifs->virtual ? JNI_TRUE : JNI_FALSE); - //Count the number of address on this interface + // count the number of addresses on this interface addr_count = 0; addrP = ifs->addr; while (addrP != NULL) { @@ -667,7 +680,7 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) { addrP = addrP->next; } - // Create the array of InetAddresses + // create the array of InetAddresses addrArr = (*env)->NewObjectArray(env, addr_count, ia_class, NULL); if (addrArr == NULL) { return NULL; @@ -687,32 +700,31 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) { if (addrP->family == AF_INET) { iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID); if (iaObj) { - setInetAddress_addr(env, iaObj, htonl( - ((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr)); + setInetAddress_addr(env, iaObj, htonl( + ((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr)); } else { return NULL; } ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj) { - (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj); - if (addrP->brdcast) { + (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj); + if (addrP->brdcast) { jobject ia2Obj = NULL; ia2Obj = (*env)->NewObject(env, ia4_class, ia4_ctrID); if (ia2Obj) { - setInetAddress_addr(env, ia2Obj, htonl( - ((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr)); - (*env)->SetObjectField(env, ibObj, ni_ib4broadcastID, ia2Obj); + setInetAddress_addr(env, ia2Obj, htonl( + ((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr)); + (*env)->SetObjectField(env, ibObj, ni_ib4broadcastID, ia2Obj); } else { return NULL; } - } - (*env)->SetShortField(env, ibObj, ni_ib4maskID, addrP->mask); - (*env)->SetObjectArrayElement(env, bindArr, bind_index++, ibObj); + } + (*env)->SetShortField(env, ibObj, ni_ib4maskID, addrP->mask); + (*env)->SetObjectArrayElement(env, bindArr, bind_index++, ibObj); } else { return NULL; } } - #if defined(AF_INET6) if (addrP->family == AF_INET6) { int scope=0; @@ -748,7 +760,7 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) { addrP = addrP->next; } - // See if there is any virtual interface attached to this one. + // see if there is any virtual interface attached to this one. child_count = 0; childP = ifs->childs; while (childP) { @@ -761,17 +773,17 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) { return NULL; } - // Create the NetworkInterface instances for the sub-interfaces as well. + // create the NetworkInterface instances for the sub-interfaces as well child_index = 0; childP = ifs->childs; while(childP) { - tmp = createNetworkInterface(env, childP); - if (tmp == NULL) { - return NULL; - } - (*env)->SetObjectField(env, tmp, ni_parentID, netifObj); - (*env)->SetObjectArrayElement(env, childArr, child_index++, tmp); - childP = childP->next; + tmp = createNetworkInterface(env, childP); + if (tmp == NULL) { + return NULL; + } + (*env)->SetObjectField(env, tmp, ni_parentID, netifObj); + (*env)->SetObjectArrayElement(env, childArr, child_index++, tmp); + childP = childP->next; } (*env)->SetObjectField(env, netifObj, ni_addrsID, addrArr); (*env)->SetObjectField(env, netifObj, ni_bindsID, bindArr); @@ -785,46 +797,42 @@ static jobject createNetworkInterface(JNIEnv *env, netif *ifs) { * Enumerates all interfaces */ static netif *enumInterfaces(JNIEnv *env) { - netif *ifs; + netif *ifs = NULL; int sock; - // Enumerate IPv4 addresses sock = openSocket(env, AF_INET); if (sock < 0 && (*env)->ExceptionOccurred(env)) { return NULL; } + // enumerate IPv4 addresses ifs = enumIPv4Interfaces(env, sock, NULL); close(sock); + // return partial list if an exception occurs in the middle of process ??? if (ifs == NULL && (*env)->ExceptionOccurred(env)) { return NULL; } - // return partial list if an exception occurs in the middle of process ??? - // If IPv6 is available then enumerate IPv6 addresses. #if defined(AF_INET6) - // User can disable ipv6 explicitly by -Djava.net.preferIPv4Stack=true, // so we have to call ipv6_available() if (ipv6_available()) { + sock = openSocket(env, AF_INET6); + if (sock < 0 && (*env)->ExceptionOccurred(env)) { + freeif(ifs); + return NULL; + } - sock = openSocket(env, AF_INET6); - if (sock < 0 && (*env)->ExceptionOccurred(env)) { - freeif(ifs); - return NULL; - } + ifs = enumIPv6Interfaces(env, sock, ifs); + close(sock); - ifs = enumIPv6Interfaces(env, sock, ifs); - close(sock); - - if ((*env)->ExceptionOccurred(env)) { - freeif(ifs); - return NULL; - } - - } + if ((*env)->ExceptionOccurred(env)) { + freeif(ifs); + return NULL; + } + } #endif return ifs; @@ -845,7 +853,7 @@ static void freeif(netif *ifs) { addrP = next; } - // Don't forget to free the sub-interfaces. + // don't forget to free the sub-interfaces if (currif->childs != NULL) { freeif(currif->childs); } @@ -863,26 +871,17 @@ static netif *addif(JNIEnv *env, int sock, const char *if_name, netif *ifs, { netif *currif = ifs, *parent; netaddr *addrP; - -#ifdef LIFNAMSIZ - int ifnam_size = LIFNAMSIZ; - char name[LIFNAMSIZ], vname[LIFNAMSIZ]; -#else - int ifnam_size = IFNAMSIZ; - char name[IFNAMSIZ], vname[IFNAMSIZ]; -#endif - + char name[IFNAMESIZE], vname[IFNAMESIZE]; char *name_colonP; int isVirtual = 0; int addr_size; - int flags = 0; // If the interface name is a logical interface then we remove the unit // number so that we have the physical interface (eg: hme0:1 -> hme0). // NetworkInterface currently doesn't have any concept of physical vs. // logical interfaces. - strncpy(name, if_name, ifnam_size); - name[ifnam_size - 1] = '\0'; + strncpy(name, if_name, IFNAMESIZE); + name[IFNAMESIZE - 1] = '\0'; *vname = 0; // Create and populate the netaddr node. If allocation fails @@ -917,20 +916,21 @@ static netif *addif(JNIEnv *env, int sock, const char *if_name, netif *ifs, // Deal with virtual interface with colon notation e.g. eth0:1 name_colonP = strchr(name, ':'); if (name_colonP != NULL) { + int flags = 0; // This is a virtual interface. If we are able to access the parent // we need to create a new entry if it doesn't exist yet *and* update // the 'parent' interface with the new records. *name_colonP = 0; if (getFlags(sock, name, &flags) < 0 || flags < 0) { - // failed to access parent interface do not create parent. - // We are a virtual interface with no parent. - isVirtual = 1; - *name_colonP = ':'; + // failed to access parent interface do not create parent. + // We are a virtual interface with no parent. + isVirtual = 1; + *name_colonP = ':'; } else { - // Got access to parent, so create it if necessary. - // Save original name to vname and truncate name by ':' - memcpy(vname, name, sizeof(vname) ); - vname[name_colonP - name] = ':'; + // Got access to parent, so create it if necessary. + // Save original name to vname and truncate name by ':' + memcpy(vname, name, sizeof(vname)); + vname[name_colonP - name] = ':'; } } @@ -943,12 +943,12 @@ static netif *addif(JNIEnv *env, int sock, const char *if_name, netif *ifs, currif = currif->next; } - // If "new" then create an netif structure and insert it into the list. + // If "new" then create a netif structure and insert it into the list. if (currif == NULL) { - CHECKED_MALLOC3(currif, netif *, sizeof(netif) + ifnam_size); + CHECKED_MALLOC3(currif, netif *, sizeof(netif) + IFNAMESIZE); currif->name = (char *)currif + sizeof(netif); - strncpy(currif->name, name, ifnam_size); - currif->name[ifnam_size - 1] = '\0'; + strncpy(currif->name, name, IFNAMESIZE); + currif->name[IFNAMESIZE - 1] = '\0'; currif->index = getIndex(sock, name); currif->addr = NULL; currif->childs = NULL; @@ -977,13 +977,12 @@ static netif *addif(JNIEnv *env, int sock, const char *if_name, netif *ifs, } if (currif == NULL) { - CHECKED_MALLOC3(currif, netif *, sizeof(netif) + ifnam_size); + CHECKED_MALLOC3(currif, netif *, sizeof(netif) + IFNAMESIZE); currif->name = (char *)currif + sizeof(netif); - strncpy(currif->name, vname, ifnam_size); - currif->name[ifnam_size - 1] = '\0'; + strncpy(currif->name, vname, IFNAMESIZE); + currif->name[IFNAMESIZE - 1] = '\0'; currif->index = getIndex(sock, vname); - currif->addr = NULL; - // Need to duplicate the addr entry? + currif->addr = NULL; // Need to duplicate the addr entry? currif->virtual = 1; currif->childs = NULL; currif->next = parent->childs; @@ -1150,7 +1149,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { struct sockaddr addr, broadaddr, *broadaddrP = NULL; short prefix = 0; - // ignore non IPv4 interfaces + // ignore non IPv4 addresses if (ifreqP->ifr_addr.sa_family != AF_INET) { continue; } @@ -1264,19 +1263,26 @@ static int getIndex(int sock, const char *name) { * MAC address. Returns -1 if there is no hardware address on that interface. */ static int getMacAddress - (JNIEnv *env, int sock, const char *ifname, const struct in_addr *addr, + (JNIEnv *env, const char *ifname, const struct in_addr *addr, unsigned char *buf) { static struct ifreq ifr; - int i; + int i, sock; + + if ((sock = openSocketWithFallback(env, ifname)) < 0) { + return -1; + } + memset((char *)&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); if (ioctl(sock, SIOCGIFHWADDR, &ifr) < 0) { JNU_ThrowByNameWithMessageAndLastError (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFHWADDR) failed"); + close(sock); return -1; } + close(sock); memcpy(buf, &ifr.ifr_hwaddr.sa_data, IFHWADDRLEN); // all bytes to 0 means no hardware address @@ -1388,7 +1394,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { struct sockaddr addr, broadaddr, *broadaddrP = NULL; short prefix = 0; - // ignore non IPv4 interfaces + // ignore non IPv4 addresses if (ifreqP->ifr_addr.sa_family != AF_INET) { continue; } @@ -1444,7 +1450,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { struct ifconf ifc; struct ifreq *ifreqP; - char *buf; + char *buf, *cp, *cplimit; // call SIOCGSIZIFCONF to get size for SIOCGIFCONF buffer if (ioctl(sock, SIOCGSIZIFCONF, &(ifc.ifc_len)) < 0) { @@ -1464,8 +1470,9 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { } // iterate through each interface - char *cp = (char *)ifc.ifc_req; - char *cplimit = cp + ifc.ifc_len; + ifreqP = ifc.ifc_req; + cp = (char *)ifc.ifc_req; + cplimit = cp + ifc.ifc_len; for (; cp < cplimit; cp += (sizeof(ifreqP->ifr_name) + @@ -1474,7 +1481,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { ifreqP = (struct ifreq *)cp; short prefix = 0; - // ignore non IPv6 interfaces + // ignore non IPv6 addresses if (ifreqP->ifr_addr.sa_family != AF_INET6) { continue; } @@ -1527,7 +1534,7 @@ static int getIndex(int sock, const char *name) { * MAC address. Returns -1 if there is no hardware address on that interface. */ static int getMacAddress - (JNIEnv *env, int sock, const char *ifname, const struct in_addr *addr, + (JNIEnv *env, const char *ifname, const struct in_addr *addr, unsigned char *buf) { int size; @@ -1586,20 +1593,20 @@ static int getMTU(JNIEnv *env, int sock, const char *ifname) { } static int getFlags(int sock, const char *ifname, int *flags) { - struct ifreq if2; - memset((char *)&if2, 0, sizeof(if2)); - strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1); + struct ifreq if2; + memset((char *)&if2, 0, sizeof(if2)); + strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1); - if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) { - return -1; - } + if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) { + return -1; + } - if (sizeof(if2.ifr_flags) == sizeof(short)) { - *flags = (if2.ifr_flags & 0xffff); - } else { - *flags = if2.ifr_flags; - } - return 0; + if (sizeof(if2.ifr_flags) == sizeof(short)) { + *flags = (if2.ifr_flags & 0xffff); + } else { + *flags = if2.ifr_flags; + } + return 0; } #endif /* _AIX */ @@ -1668,7 +1675,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { char *buf = NULL; unsigned i; - // call SIOCGLIFNUM to get the size of SIOCGIFCONF buffer + // call SIOCGLIFNUM to get the interface count numifs.lifn_family = AF_INET; numifs.lifn_flags = 0; if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) { @@ -1695,7 +1702,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { for (i = 0; i < numifs.lifn_count; i++, ifreqP++) { struct sockaddr addr, *broadaddrP = NULL; - // ignore non IPv4 interfaces + // ignore non IPv4 addresses if (ifreqP->lifr_addr.ss_family != AF_INET) { continue; } @@ -1744,7 +1751,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { char *buf = NULL; unsigned i; - // call SIOCGLIFNUM to get the size of SIOCGLIFCONF buffer + // call SIOCGLIFNUM to get the interface count numifs.lifn_family = AF_INET6; numifs.lifn_flags = 0; if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) { @@ -1770,7 +1777,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { ifreqP = ifc.lifc_req; for (i = 0; i < numifs.lifn_count; i++, ifreqP++) { - // ignore non IPv6 interfaces + // ignore non IPv6 addresses if (ifreqP->lifr_addr.ss_family != AF_INET6) { continue; } @@ -1789,7 +1796,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { free(buf); return ifs; } - } + } // free buffer free(buf); @@ -1834,9 +1841,9 @@ static int getMacFromDevice strcpy(style1dev, DEV_PREFIX); strcat(style1dev, ifname); if ((fd = open(style1dev, O_RDWR)) < 0) { - // Can't open it. We probably are missing the privilege. - // We'll have to try something else - return 0; + // Can't open it. We probably are missing the privilege. + // We'll have to try something else + return 0; } dlpareq.dl_primitive = DL_PHYS_ADDR_REQ; @@ -1878,11 +1885,15 @@ static int getMacFromDevice * MAC address. Returns -1 if there is no hardware address on that interface. */ static int getMacAddress - (JNIEnv *env, int sock, const char *ifname, const struct in_addr *addr, + (JNIEnv *env, const char *ifname, const struct in_addr *addr, unsigned char *buf) { struct lifreq if2; - int len, i; + int len, i, sock; + + if ((sock = openSocketWithFallback(env, ifname)) < 0) { + return -1; + } // First, try the new (S11) SIOCGLIFHWADDR ioctl(). If that fails // try the old way. @@ -1893,40 +1904,36 @@ static int getMacAddress struct sockaddr_dl *sp; sp = (struct sockaddr_dl *)&if2.lifr_addr; memcpy(buf, &sp->sdl_data[0], sp->sdl_alen); + close(sock); return sp->sdl_alen; } // On Solaris we have to use DLPI, but it will only work if we have // privileged access (i.e. root). If that fails, we try a lookup // in the ARP table, which requires an IPv4 address. - if ((len = getMacFromDevice(env, ifname, buf)) == 0) { - // DLPI failed - trying to do arp lookup - + if (((len = getMacFromDevice(env, ifname, buf)) == 0) && (addr != NULL)) { struct arpreq arpreq; struct sockaddr_in *sin; struct sockaddr_in ipAddr; - if (addr == NULL) { - // No IPv4 address for that interface, so can't do an ARP lookup. - return -1; - } + len = 6; //??? - len = 6; //??? + sin = (struct sockaddr_in *)&arpreq.arp_pa; + memset((char *)&arpreq, 0, sizeof(struct arpreq)); + ipAddr.sin_port = 0; + ipAddr.sin_family = AF_INET; + memcpy(&ipAddr.sin_addr, addr, sizeof(struct in_addr)); + memcpy(&arpreq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); + arpreq.arp_flags= ATF_PUBL; - sin = (struct sockaddr_in *)&arpreq.arp_pa; - memset((char *)&arpreq, 0, sizeof(struct arpreq)); - ipAddr.sin_port = 0; - ipAddr.sin_family = AF_INET; - memcpy(&ipAddr.sin_addr, addr, sizeof(struct in_addr)); - memcpy(&arpreq.arp_pa, &ipAddr, sizeof(struct sockaddr_in)); - arpreq.arp_flags= ATF_PUBL; + if (ioctl(sock, SIOCGARP, &arpreq) < 0) { + close(sock); + return -1; + } - if (ioctl(sock, SIOCGARP, &arpreq) < 0) { - return -1; - } - - memcpy(buf, &arpreq.arp_ha.sa_data[0], len); + memcpy(buf, &arpreq.arp_ha.sa_data[0], len); } + close(sock); // all bytes to 0 means no hardware address for (i = 0; i < len; i++) { @@ -2014,7 +2021,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) { for (ifa = origifa; ifa != NULL; ifa = ifa->ifa_next) { struct sockaddr *broadaddrP = NULL; - // ignore non IPv4 interfaces + // ignore non IPv4 addresses if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET) continue; @@ -2058,7 +2065,7 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) { } for (ifa = origifa; ifa != NULL; ifa = ifa->ifa_next) { - // ignore non IPv6 interfaces + // ignore non IPv6 addresses if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -2113,22 +2120,22 @@ static int getIndex(int sock, const char *name) { * MAC address. Returns -1 if there is no hardware address on that interface. */ static int getMacAddress - (JNIEnv *env, int sock, const char *ifname, const struct in_addr *addr, + (JNIEnv *env, const char *ifname, const struct in_addr *addr, unsigned char *buf) { struct ifaddrs *ifa0, *ifa; struct sockaddr *saddr; int i; - // Grab the interface list + // grab the interface list if (!getifaddrs(&ifa0)) { - // Cycle through the interfaces + // cycle through the interfaces for (i = 0, ifa = ifa0; ifa != NULL; ifa = ifa->ifa_next, i++) { saddr = ifa->ifa_addr; - // Link layer contains the MAC address + // link layer contains the MAC address if (saddr->sa_family == AF_LINK && !strcmp(ifname, ifa->ifa_name)) { struct sockaddr_dl *sadl = (struct sockaddr_dl *) saddr; - // Check the address is the correct length + // check the address has the correct length if (sadl->sdl_alen == ETHER_ADDR_LEN) { memcpy(buf, (sadl->sdl_data + sadl->sdl_nlen), ETHER_ADDR_LEN); freeifaddrs(ifa0); diff --git a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java index a59eba9dd3d..988234daf51 100644 --- a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java +++ b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java @@ -563,6 +563,20 @@ final class ProcessImpl extends Process { private static native boolean isProcessAlive(long handle); + /** + * The {@code toString} method returns a string consisting of + * the native process ID of the process and the exit value of the process. + * + * @return a string representation of the object. + */ + @Override + public String toString() { + int exitCode = getExitCodeProcess(handle); + return new StringBuilder("Process[pid=").append(getPid()) + .append(", exitValue=").append(exitCode == STILL_ACTIVE ? "\"not exited\"" : exitCode) + .append("]").toString(); + } + /** * Create a process using the win32 function CreateProcess. * The method is synchronized due to MS kb315939 problem. diff --git a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java index 272b1f1f25b..8e105132eaa 100644 --- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java +++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java @@ -25,7 +25,6 @@ package apple.laf; -import java.lang.reflect.Field; import java.nio.ByteBuffer; import java.lang.annotation.Native; @@ -70,6 +69,21 @@ public final class JRSUIConstants { throw new RuntimeException("Constant not implemented in native: " + this); } + private String getConstantName(Key hit) { + if (hit == VALUE) { + return "VALUE"; + } else if (hit == THUMB_PROPORTION) { + return "THUMB_PROPORTION"; + } else if (hit == THUMB_START) { + return "THUMB_START"; + } else if (hit == WINDOW_TITLE_BAR_HEIGHT) { + return "WINDOW_TITLE_BAR_HEIGHT"; + } else if (hit == THUMB_START) { + return "ANIMATION_FRAME"; + } + return getClass().getSimpleName(); + } + public String toString() { return getConstantName(this) + (ptr == 0 ? "(unlinked)" : ""); } @@ -138,7 +152,7 @@ public final class JRSUIConstants { } public String toString() { - return getConstantName(this); + return getClass().getSimpleName(); } } @@ -779,6 +793,17 @@ public final class JRSUIConstants { return hit > 0; } + private String getConstantName(Hit hit) { + if (hit == UNKNOWN) { + return "UNKNOWN"; + } else if (hit == NONE) { + return "NONE"; + } else if (hit == HIT) { + return "HIT"; + } + return getClass().getSimpleName(); + } + public String toString() { return getConstantName(this); } @@ -829,16 +854,4 @@ public final class JRSUIConstants { } return Hit.UNKNOWN; } - - static String getConstantName(final Object object) { - final Class clazz = object.getClass(); - try { - for (final Field field : clazz.getFields()) { - if (field.get(null) == object) { - return field.getName(); - } - } - } catch (final Exception e) {} - return clazz.getSimpleName(); - } } diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java index eab1efb3447..c9c0c9bcf4d 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java @@ -72,7 +72,7 @@ class _AppDockIconHandler { public void setDockIconImage(final Image image) { try { - final CImage cImage = getCImageCreator().createFromImage(image); + final CImage cImage = CImage.createFromImage(image); final long nsImagePtr = getNSImagePtrFrom(cImage); nativeSetDockIconImage(nsImagePtr); } catch (final Throwable e) { @@ -84,7 +84,11 @@ class _AppDockIconHandler { try { final long dockNSImage = nativeGetDockIconImage(); if (dockNSImage == 0) return null; - return getCImageCreator().createImageUsingNativeSize(dockNSImage); + final Method getCreatorMethod = CImage.class.getDeclaredMethod( + "getCreator", new Class[]{}); + getCreatorMethod.setAccessible(true); + Creator imageCreator = (Creator) getCreatorMethod.invoke(null, new Object[]{}); + return imageCreator.createImageUsingNativeSize(dockNSImage); } catch (final Throwable e) { throw new RuntimeException(e); } @@ -98,16 +102,6 @@ class _AppDockIconHandler { nativeSetDockIconProgress(value); } - static Creator getCImageCreator() { - try { - final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); - getCreatorMethod.setAccessible(true); - return (Creator)getCreatorMethod.invoke(null, new Object[] {}); - } catch (final Throwable e) { - throw new RuntimeException(e); - } - } - static long getNSImagePtrFrom(final CImage cImage) { if (cImage == null) return 0; diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java index a417f692ab8..e64e9b158b5 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java @@ -171,7 +171,8 @@ class _AppEventHandler { currentQuitResponse = null; try { - if (defaultQuitAction == QuitStrategy.NORMAL_EXIT) System.exit(0); + if (defaultQuitAction == QuitStrategy.NORMAL_EXIT + || _AppMiscHandlers.isSuddenTerminationEnbaled()) System.exit(0); if (defaultQuitAction != QuitStrategy.CLOSE_ALL_WINDOWS) { throw new RuntimeException("Unknown quit action"); @@ -422,6 +423,10 @@ class _AppEventHandler { } void performUsing(final QuitHandler handler, final _NativeEvent event) { + if (_AppMiscHandlers.isSuddenTerminationEnbaled()) { + performDefaultAction(event); + return; + } final MacQuitResponse response = obtainQuitResponse(); // obtains the "current" quit response handler.handleQuitRequestWith(new QuitEvent(), response); } diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMiscHandlers.java b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMiscHandlers.java index 6f892caaa91..1851e2aa90c 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMiscHandlers.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMiscHandlers.java @@ -26,6 +26,8 @@ package com.apple.eawt; class _AppMiscHandlers { + private static boolean isSuddenTerminationEnabled; + private static native void nativeOpenHelpViewer(); private static native void nativeRequestActivation(final boolean allWindows); @@ -47,10 +49,16 @@ class _AppMiscHandlers { } static void enableSuddenTermination() { + isSuddenTerminationEnabled = true; nativeEnableSuddenTermination(); } static void disableSuddenTermination() { + isSuddenTerminationEnabled = false; nativeDisableSuddenTermination(); } + + public static boolean isSuddenTerminationEnbaled() { + return isSuddenTerminationEnabled; + } } diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java index b4bc1e69d58..936fe567c66 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java @@ -37,6 +37,7 @@ import apple.laf.*; import com.apple.laf.AquaUtilControlSize.*; import com.apple.laf.AquaUtils.RecyclableSingleton; +import sun.lwawt.macosx.CImage; public class AquaIcon { interface InvertableIcon extends Icon { @@ -226,7 +227,7 @@ public class AquaIcon { } Image createImage() { - return AquaUtils.getCImageCreator().createImageOfFile(file.getAbsolutePath(), getIconWidth(), getIconHeight()); + return CImage.createImageOfFile(file.getAbsolutePath(), getIconWidth(), getIconHeight()); } } @@ -299,7 +300,7 @@ public class AquaIcon { } Image createImage() { - return AquaUtils.getCImageCreator().createSystemImageFromSelector( + return CImage.createSystemImageFromSelector( selector, getIconWidth(), getIconHeight()); } } diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java index c26bcae3d06..5d43a41e502 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java @@ -46,8 +46,8 @@ import com.apple.laf.AquaIcon.JRSUIControlSpec; import com.apple.laf.AquaIcon.SystemIcon; import com.apple.laf.AquaUtils.RecyclableObject; import com.apple.laf.AquaUtils.RecyclableSingleton; -import java.awt.image.MultiResolutionImage; import sun.awt.image.MultiResolutionCachedImage; +import sun.lwawt.macosx.CImage; public class AquaImageFactory { public static IconUIResource getConfirmImageIcon() { @@ -73,7 +73,7 @@ public class AquaImageFactory { public static IconUIResource getLockImageIcon() { // public, because UIDefaults.ProxyLazyValue uses reflection to get this value if (JRSUIUtils.Images.shouldUseLegacySecurityUIPath()) { - final Image lockIcon = AquaUtils.getCImageCreator().createImageFromFile("/System/Library/CoreServices/SecurityAgent.app/Contents/Resources/Security.icns", kAlertIconSize, kAlertIconSize); + final Image lockIcon = CImage.createImageFromFile("/System/Library/CoreServices/SecurityAgent.app/Contents/Resources/Security.icns", kAlertIconSize, kAlertIconSize); return getAppIconCompositedOn(lockIcon); } diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java index 67520fcc30b..5e7d160943c 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java @@ -41,8 +41,6 @@ import jdk.internal.loader.ClassLoaders; import sun.awt.AppContext; -import sun.lwawt.macosx.CImage; -import sun.lwawt.macosx.CImage.Creator; import sun.lwawt.macosx.CPlatformWindow; import sun.reflect.misc.ReflectUtil; import sun.security.action.GetPropertyAction; @@ -50,6 +48,7 @@ import sun.swing.SwingUtilities2; import com.apple.laf.AquaImageFactory.SlicedImageControl; import sun.awt.image.MultiResolutionCachedImage; +import sun.swing.SwingAccessor; final class AquaUtils { @@ -78,65 +77,45 @@ final class AquaUtils { } } - private static Creator getCImageCreatorInternal() { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Creator run() { - try { - final Method getCreatorMethod = CImage.class.getDeclaredMethod( - "getCreator", new Class[] {}); - getCreatorMethod.setAccessible(true); - return (Creator)getCreatorMethod.invoke(null, new Object[] {}); - } catch (final Exception ignored) { - return null; - } - } - }); - } - - private static final RecyclableSingleton cImageCreator = new RecyclableSingleton() { - @Override - protected Creator getInstance() { - return getCImageCreatorInternal(); - } - }; - static Creator getCImageCreator() { - return cImageCreator.get(); - } - static Image generateSelectedDarkImage(final Image image) { - final ImageProducer prod = new FilteredImageSource(image.getSource(), new IconImageFilter() { + final ImageFilter filter = new IconImageFilter() { @Override int getGreyFor(final int gray) { return gray * 75 / 100; } - }); - return Toolkit.getDefaultToolkit().createImage(prod); + }; + return map(image, filter); } static Image generateDisabledImage(final Image image) { - final ImageProducer prod = new FilteredImageSource(image.getSource(), new IconImageFilter() { + final ImageFilter filter = new IconImageFilter() { @Override int getGreyFor(final int gray) { return 255 - ((255 - gray) * 65 / 100); } - }); - return Toolkit.getDefaultToolkit().createImage(prod); + }; + return map(image, filter); } static Image generateLightenedImage(final Image image, final int percent) { final GrayFilter filter = new GrayFilter(true, percent); - return (image instanceof MultiResolutionCachedImage) - ? ((MultiResolutionCachedImage) image).map( - rv -> generateLightenedImage(rv, filter)) - : generateLightenedImage(image, filter); + return map(image, filter); } - static Image generateLightenedImage(Image image, ImageFilter filter) { + static Image generateFilteredImage(Image image, ImageFilter filter) { final ImageProducer prod = new FilteredImageSource(image.getSource(), filter); return Toolkit.getDefaultToolkit().createImage(prod); } + private static Image map(Image image, ImageFilter filter) { + if (image instanceof MultiResolutionImage) { + return MultiResolutionCachedImage + .map((MultiResolutionImage) image, + (img) -> generateFilteredImage(img, filter)); + } + return generateFilteredImage(image, filter); + } + private abstract static class IconImageFilter extends RGBImageFilter { IconImageFilter() { super(); @@ -399,15 +378,9 @@ final class AquaUtils { } }; - private static final Integer OPAQUE_SET_FLAG = 24; // private int JComponent.OPAQUE_SET + private static final int OPAQUE_SET_FLAG = 24; // private int JComponent.OPAQUE_SET static boolean hasOpaqueBeenExplicitlySet(final JComponent c) { - final Method method = getJComponentGetFlagMethod.get(); - if (method == null) return false; - try { - return Boolean.TRUE.equals(method.invoke(c, OPAQUE_SET_FLAG)); - } catch (final Throwable ignored) { - return false; - } + return SwingAccessor.getJComponentAccessor().getFlag(c, OPAQUE_SET_FLAG); } private static boolean isWindowTextured(final Component c) { diff --git a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java index dcc4b5793eb..049dbb58619 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java +++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java @@ -278,6 +278,18 @@ public final class CFont extends PhysicalFont implements FontSubstitution { return getStrike(font, DEFAULT_FRC); } + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + + return ((Font2D)o).getStyle() == this.getStyle(); + } + + public int hashCode() { + return super.hashCode() ^ this.getStyle(); + } + public String toString() { return "CFont { fullName: " + fullName + ", familyName: " + familyName + ", style: " + style + diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java index 00cb5274be2..3307e5b0e86 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java @@ -37,6 +37,7 @@ import sun.awt.AWTAccessor; import javax.accessibility.*; import javax.swing.*; +import sun.awt.AWTAccessor; class CAccessibility implements PropertyChangeListener { private static Set ignoredRoles; @@ -205,33 +206,12 @@ class CAccessibility implements PropertyChangeListener { }, c); } - static Field getAccessibleBundleKeyFieldWithReflection() { - try { - final Field fieldKey = AccessibleBundle.class.getDeclaredField("key"); - fieldKey.setAccessible(true); - return fieldKey; - } catch (final SecurityException e) { - e.printStackTrace(); - } catch (final NoSuchFieldException e) { - e.printStackTrace(); - } - return null; - } - private static final Field FIELD_KEY = getAccessibleBundleKeyFieldWithReflection(); - static String getAccessibleRoleFor(final Accessible a) { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return null; final AccessibleRole role = ac.getAccessibleRole(); - try { - return (String)FIELD_KEY.get(role); - } catch (final IllegalArgumentException e) { - e.printStackTrace(); - } catch (final IllegalAccessException e) { - e.printStackTrace(); - } - return null; + return AWTAccessor.getAccessibleBundleAccessor().getKey(role); } public static String getAccessibleRole(final Accessible a, final Component c) { diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java index 6ac0a07ca0f..d3d3dca9538 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java @@ -28,7 +28,6 @@ package sun.lwawt.macosx; import java.awt.Component; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.lang.reflect.Field; import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; @@ -41,36 +40,23 @@ import static javax.accessibility.AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT import static javax.accessibility.AccessibleContext.ACCESSIBLE_CARET_PROPERTY; import static javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY; import static javax.accessibility.AccessibleContext.ACCESSIBLE_TEXT_PROPERTY; +import sun.awt.AWTAccessor; class CAccessible extends CFRetainedResource implements Accessible { - static Field getNativeAXResourceField() { - try { - final Field field = AccessibleContext.class.getDeclaredField("nativeAXResource"); - field.setAccessible(true); - return field; - } catch (final Exception e) { - e.printStackTrace(); - return null; - } - } - - private static Field nativeAXResourceField = getNativeAXResourceField(); public static CAccessible getCAccessible(final Accessible a) { if (a == null) return null; AccessibleContext context = a.getAccessibleContext(); - try { - final CAccessible cachedCAX = (CAccessible) nativeAXResourceField.get(context); - if (cachedCAX != null) return cachedCAX; - - final CAccessible newCAX = new CAccessible(a); - nativeAXResourceField.set(context, newCAX); - return newCAX; - } catch (final Exception e) { - e.printStackTrace(); - return null; + AWTAccessor.AccessibleContextAccessor accessor + = AWTAccessor.getAccessibleContextAccessor(); + final CAccessible cachedCAX = (CAccessible) accessor.getNativeAXResource(context); + if (cachedCAX != null) { + return cachedCAX; } + final CAccessible newCAX = new CAccessible(a); + accessor.setNativeAXResource(context, newCAX); + return newCAX; } private static native void unregisterFromCocoaAXSystem(long ptr); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java index 3f05185c091..150c6e92ad1 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java @@ -36,7 +36,7 @@ import java.nio.charset.Charset; import java.text.Normalizer; import java.text.Normalizer.Form; import java.util.*; - +import java.util.regex.*; import java.awt.datatransfer.*; import sun.awt.datatransfer.*; @@ -129,12 +129,21 @@ public class CDataTransferer extends DataTransferer { long format, Transferable transferable) throws IOException { if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass())) { - String[] strings = dragQueryFile(bytes); - if(strings == null || strings.length == 0) { - return null; + String charset = Charset.defaultCharset().name(); + if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) { + try { + charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), "UTF-8"); + } catch (UnsupportedFlavorException cannotHappen) { + } } - return new URL(strings[0]); - } else if(isUriListFlavor(flavor)) { + + String xml = new String(bytes, charset); + // macosx pasteboard returns a property list that consists of one URL + // let's extract it. + return new URL(extractURL(xml)); + } + + if(isUriListFlavor(flavor) && format == CF_FILE) { // dragQueryFile works fine with files and url, // it parses and extracts values from property list. // maxosx always returns property list for @@ -156,6 +165,16 @@ public class CDataTransferer extends DataTransferer { return super.translateBytes(bytes, flavor, format, transferable); } + private String extractURL(String xml) { + Pattern urlExtractorPattern = Pattern.compile("(.*)"); + Matcher matcher = urlExtractorPattern.matcher(xml); + if (matcher.find()) { + return matcher.group(1); + } else { + return null; + } + } + @Override protected synchronized Long getFormatForNativeAsLong(String str) { Long format = predefinedClipboardNameMap.get(str); diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java index a5504cbee25..61f41a2c70f 100644 --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java @@ -56,6 +56,25 @@ public class CImage extends CFRetainedResource { return creator; } + // This is used to create a CImage that represents the icon of the given file. + public static Image createImageOfFile(String file, int width, int height) { + return getCreator().createImageOfFile(file, width, height); + } + + public static Image createSystemImageFromSelector(String iconSelector, + int width, int height) { + return getCreator().createSystemImageFromSelector(iconSelector, width, height); + } + + public static Image createImageFromFile(String file, double width, double height) { + return getCreator().createImageFromFile(file, width, height); + } + + // This is used to create a CImage from a Image + public static CImage createFromImage(final Image image) { + return getCreator().createFromImage(image); + } + public static class Creator { Creator() { } diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m index f444bc9b693..fb2cb86a617 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 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 @@ -27,6 +27,8 @@ #import "AWTSurfaceLayers.h" +#import "jni_util.h" + JNIEXPORT JAWT_DrawingSurfaceInfo* JNICALL awt_DrawingSurface_GetDrawingSurfaceInfo (JAWT_DrawingSurface* ds) { @@ -130,3 +132,47 @@ JNIEXPORT jobject JNICALL awt_GetComponent // TODO: implement return NULL; } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/lwawt/macosx/CViewEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = (*env)->GetMethodID(env, cls, "", "(J)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return (*env)->NewObject(env, cls, mid, platformInfo); +} + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, doActivate); +} diff --git a/jdk/src/java.desktop/macosx/native/libjawt/jawt.m b/jdk/src/java.desktop/macosx/native/libjawt/jawt.m index cd9f52a8e5e..773c6482caa 100644 --- a/jdk/src/java.desktop/macosx/native/libjawt/jawt.m +++ b/jdk/src/java.desktop/macosx/native/libjawt/jawt.m @@ -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 @@ -46,8 +46,9 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT return JNI_FALSE; } - if (awt->version != (JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER) && - awt->version != JAWT_VERSION_1_7) + if (awt->version != (JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER) + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -58,6 +59,11 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT awt->Lock = awt_Lock; awt->Unlock = awt_Unlock; awt->GetComponent = awt_GetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE; diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java index 028efffbd12..ead39be2867 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -200,11 +200,13 @@ public final class ModelByteBuffer { public void writeTo(OutputStream out) throws IOException { if (root.file != null && root.buffer == null) { - InputStream is = getInputStream(); - byte[] buff = new byte[1024]; - int ret; - while ((ret = is.read(buff)) != -1) - out.write(buff, 0, ret); + try (InputStream is = getInputStream()) { + byte[] buff = new byte[1024]; + int ret; + while ((ret = is.read(buff)) != -1) { + out.write(buff, 0, ret); + } + } } else out.write(array(), (int) arrayOffset(), (int) capacity()); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java b/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java index 1c723aeb133..9250597ac81 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java @@ -284,35 +284,6 @@ public abstract class AWTEvent extends EventObject { }); } - private static synchronized Field get_InputEvent_CanAccessSystemClipboard() { - if (inputEvent_CanAccessSystemClipboard_Field == null) { - inputEvent_CanAccessSystemClipboard_Field = - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Field run() { - Field field = null; - try { - field = InputEvent.class. - getDeclaredField("canAccessSystemClipboard"); - field.setAccessible(true); - return field; - } catch (SecurityException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("AWTEvent.get_InputEvent_CanAccessSystemClipboard() got SecurityException ", e); - } - } catch (NoSuchFieldException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("AWTEvent.get_InputEvent_CanAccessSystemClipboard() got NoSuchFieldException ", e); - } - } - return null; - } - }); - } - - return inputEvent_CanAccessSystemClipboard_Field; - } - /** * Initialize JNI field and method IDs for fields that may be * accessed from C. @@ -593,33 +564,20 @@ public abstract class AWTEvent extends EventObject { that.bdata = this.bdata; // Copy canAccessSystemClipboard value from this into that. if (this instanceof InputEvent && that instanceof InputEvent) { - Field field = get_InputEvent_CanAccessSystemClipboard(); - if (field != null) { - try { - boolean b = field.getBoolean(this); - field.setBoolean(that, b); - } catch(IllegalAccessException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("AWTEvent.copyPrivateDataInto() got IllegalAccessException ", e); - } - } - } + + AWTAccessor.InputEventAccessor accessor + = AWTAccessor.getInputEventAccessor(); + + boolean b = accessor.canAccessSystemClipboard((InputEvent) this); + accessor.setCanAccessSystemClipboard((InputEvent) that, b); } that.isSystemGenerated = this.isSystemGenerated; } void dispatched() { if (this instanceof InputEvent) { - Field field = get_InputEvent_CanAccessSystemClipboard(); - if (field != null) { - try { - field.setBoolean(this, false); - } catch(IllegalAccessException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("AWTEvent.dispatched() got IllegalAccessException ", e); - } - } - } + AWTAccessor.getInputEventAccessor(). + setCanAccessSystemClipboard((InputEvent) this, false); } } } // class AWTEvent diff --git a/jdk/src/java.desktop/share/classes/java/awt/Component.java b/jdk/src/java.desktop/share/classes/java/awt/Component.java index c2a021fd595..25c6ee2b1aa 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Component.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java @@ -53,13 +53,11 @@ import java.beans.Transient; import java.awt.im.InputContext; import java.awt.im.InputMethodRequests; import java.awt.dnd.DropTarget; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.security.AccessController; -import java.security.PrivilegedAction; import java.security.AccessControlContext; import javax.accessibility.*; import java.applet.Applet; +import javax.swing.JComponent; import sun.awt.ComponentFactory; import sun.security.action.GetPropertyAction; @@ -81,6 +79,7 @@ import sun.java2d.pipe.hw.ExtendedBufferCapabilities; import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*; import sun.awt.RequestFocusController; import sun.java2d.SunGraphicsEnvironment; +import sun.swing.SwingAccessor; import sun.util.logging.PlatformLogger; /** @@ -8695,6 +8694,9 @@ public abstract class Component implements ImageObserver, MenuContainer, * the Swing package private method {@code compWriteObjectNotify}. */ private void doSwingSerialization() { + if (!(this instanceof JComponent)) { + return; + } @SuppressWarnings("deprecation") Package swingPackage = Package.getPackage("javax.swing"); // For Swing serialization to correctly work Swing needs to @@ -8707,36 +8709,10 @@ public abstract class Component implements ImageObserver, MenuContainer, klass = klass.getSuperclass()) { if (klass.getPackage() == swingPackage && klass.getClassLoader() == null) { - final Class swingClass = klass; - // Find the first override of the compWriteObjectNotify method - Method[] methods = AccessController.doPrivileged( - new PrivilegedAction() { - public Method[] run() { - return swingClass.getDeclaredMethods(); - } - }); - for (int counter = methods.length - 1; counter >= 0; - counter--) { - final Method method = methods[counter]; - if (method.getName().equals("compWriteObjectNotify")){ - // We found it, use doPrivileged to make it accessible - // to use. - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - method.setAccessible(true); - return null; - } - }); - // Invoke the method - try { - method.invoke(this, (Object[]) null); - } catch (IllegalAccessException iae) { - } catch (InvocationTargetException ite) { - } - // We're done, bail. - return; - } - } + + SwingAccessor.getJComponentAccessor() + .compWriteObjectNotify((JComponent) this); + return; } } } diff --git a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java index aa9d64367a4..1e9e2f4bfd0 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java @@ -40,8 +40,6 @@ import java.beans.VetoableChangeSupport; import java.lang.ref.WeakReference; -import java.lang.reflect.Field; - import java.security.AccessController; import java.security.PrivilegedAction; @@ -140,6 +138,10 @@ public abstract class KeyboardFocusManager public void removeLastFocusRequest(Component heavyweight) { KeyboardFocusManager.removeLastFocusRequest(heavyweight); } + @Override + public Component getMostRecentFocusOwner(Window window) { + return KeyboardFocusManager.getMostRecentFocusOwner(window); + } public void setMostRecentFocusOwner(Window window, Component component) { KeyboardFocusManager.setMostRecentFocusOwner(window, component); } @@ -3053,32 +3055,9 @@ public abstract class KeyboardFocusManager } } - static Field proxyActive; // Accessor to private field isProxyActive of KeyEvent private static boolean isProxyActiveImpl(KeyEvent e) { - if (proxyActive == null) { - proxyActive = AccessController.doPrivileged(new PrivilegedAction() { - public Field run() { - Field field = null; - try { - field = KeyEvent.class.getDeclaredField("isProxyActive"); - if (field != null) { - field.setAccessible(true); - } - } catch (NoSuchFieldException nsf) { - assert(false); - } - return field; - } - }); - } - - try { - return proxyActive.getBoolean(e); - } catch (IllegalAccessException iae) { - assert(false); - } - return false; + return AWTAccessor.getKeyEventAccessor().isProxyActive(e); } // Returns the value of this KeyEvent's field isProxyActive diff --git a/jdk/src/java.desktop/share/classes/java/awt/SequencedEvent.java b/jdk/src/java.desktop/share/classes/java/awt/SequencedEvent.java index 678067ab143..394686a7ba3 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/SequencedEvent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/SequencedEvent.java @@ -63,6 +63,10 @@ class SequencedEvent extends AWTEvent implements ActiveEvent { public boolean isSequencedEvent(AWTEvent event) { return event instanceof SequencedEvent; } + + public AWTEvent create(AWTEvent event) { + return new SequencedEvent(event); + } }); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java b/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java index d332d2d2735..ec9bd0be0a1 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java @@ -302,6 +302,12 @@ public abstract class InputEvent extends ComponentEvent { public boolean canAccessSystemClipboard(InputEvent event) { return event.canAccessSystemClipboard; } + + @Override + public void setCanAccessSystemClipboard(InputEvent event, + boolean canAccessSystemClipboard) { + event.canAccessSystemClipboard = canAccessSystemClipboard; + } }); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java b/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java index f103d525271..0ca378d556b 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java +++ b/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java @@ -1091,6 +1091,11 @@ public class KeyEvent extends InputEvent { public Component getOriginalSource( KeyEvent ev ) { return ev.originalSource; } + + @Override + public boolean isProxyActive(KeyEvent ev) { + return ev.isProxyActive; + } }); } diff --git a/jdk/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java b/jdk/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java index cd4c9fdf224..738cd6c9dc9 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java +++ b/jdk/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 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 @@ -25,7 +25,6 @@ package java.awt.font; -import java.lang.reflect.Field; import jdk.internal.misc.JavaAWTFontAccess; class JavaAWTFontAccessImpl implements JavaAWTFontAccess { @@ -33,19 +32,17 @@ class JavaAWTFontAccessImpl implements JavaAWTFontAccess { // java.awt.font.TextAttribute constants public Object getTextAttributeConstant(String name) { switch (name) { - case "RUN_DIRECTION": - case "NUMERIC_SHAPING": - case "BIDI_EMBEDDING": - case "RUN_DIRECTION_LTR": - try { - Field f = TextAttribute.class.getField(name); - return f.get(null); - } catch (NoSuchFieldException | IllegalAccessException x) { - throw new AssertionError(x); - } + case "RUN_DIRECTION": + return TextAttribute.RUN_DIRECTION; + case "NUMERIC_SHAPING": + return TextAttribute.NUMERIC_SHAPING; + case "BIDI_EMBEDDING": + return TextAttribute.BIDI_EMBEDDING; + case "RUN_DIRECTION_LTR": + return TextAttribute.RUN_DIRECTION_LTR; + default: + throw new AssertionError("Constant name is not recognized"); } - - throw new AssertionError("Constant name is not recognized"); } // java.awt.font.NumericShaper diff --git a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java index 936322af467..5e2d97b43e5 100644 --- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java +++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java @@ -31,6 +31,7 @@ import java.util.Vector; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; +import sun.awt.AWTAccessor; /** *

    Base class used to maintain a strongly typed enumeration. This is @@ -53,6 +54,17 @@ public abstract class AccessibleBundle { private final String defaultResourceBundleName = "com.sun.accessibility.internal.resources.accessibility"; + static { + AWTAccessor.setAccessibleBundleAccessor( + new AWTAccessor.AccessibleBundleAccessor() { + + @Override + public String getKey(AccessibleBundle accessibleBundle) { + return accessibleBundle.key; + } + }); + } + /** * Construct an {@code AccessibleBundle}. */ diff --git a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java index 65a163fa4ca..c3a30f3a5ae 100644 --- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java +++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java @@ -99,6 +99,16 @@ public abstract class AccessibleContext { public AppContext getAppContext(AccessibleContext accessibleContext) { return accessibleContext.targetAppContext; } + + @Override + public Object getNativeAXResource(AccessibleContext accessibleContext) { + return accessibleContext.nativeAXResource; + } + + @Override + public void setNativeAXResource(AccessibleContext accessibleContext, Object value) { + accessibleContext.nativeAXResource = value; + } }); } diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/ImageIO.java b/jdk/src/java.desktop/share/classes/javax/imageio/ImageIO.java index 7af7b77be77..523a857dbc1 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/ImageIO.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/ImageIO.java @@ -462,10 +462,13 @@ public final class ImageIO { return new String[0]; } - HashSet s = new HashSet(); + HashSet s = new HashSet<>(); while (iter.hasNext()) { ImageReaderWriterSpi spi = iter.next(); - Collections.addAll(s, spiInfo.info(spi)); + String[] info = spiInfo.info(spi); + if (info != null) { + Collections.addAll(s, info); + } } return s.toArray(new String[s.size()]); diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java index edcb086cb45..da9ade0d8f7 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java @@ -412,7 +412,7 @@ public class TIFFField implements Cloneable { /** * Creates a {@code TIFFField} from a TIFF native image - * metadata node. If the value of the "number" attribute + * metadata node. If the value of the {@code "number"} attribute * of the node is not found in {@code tagSet} then a new * {@code TIFFTag} with name {@code TIFFTag.UNKNOWN_TAG_NAME} * will be created and assigned to the field. @@ -420,20 +420,22 @@ public class TIFFField implements Cloneable { * @param tagSet The {@code TIFFTagSet} to which the * {@code TIFFTag} of the field belongs. * @param node A native TIFF image metadata {@code TIFFField} node. - * @throws NullPointerException if {@code node} is - * {@code null}. - * @throws IllegalArgumentException if the name of the node is not - * {@code "TIFFField"}. - * @throws NullPointerException if the node does not contain any data. - * @throws IllegalArgumentException if the combination of node attributes - * and data is not legal per the {@link #TIFFField(TIFFTag,int,int,Object)} - * constructor specification. + * @throws IllegalArgumentException If the {@code Node} parameter content + * does not adhere to the {@code TIFFField} element structure defined by + * the + * TIFF native image metadata format specification, or if the + * combination of node attributes and data is not legal per the + * {@link #TIFFField(TIFFTag,int,int,Object)} constructor specification. + * Note that a cause might be set on such an exception. * @return A new {@code TIFFField}. */ public static TIFFField createFromMetadataNode(TIFFTagSet tagSet, Node node) { if (node == null) { - throw new NullPointerException("node == null!"); + // This method is specified to throw only IllegalArgumentExceptions + // so we create an IAE with a NullPointerException as its cause. + throw new IllegalArgumentException(new NullPointerException + ("node == null!")); } String name = node.getNodeName(); if (!name.equals("TIFFField")) { @@ -487,7 +489,17 @@ public class TIFFField implements Cloneable { tag = new TIFFTag(TIFFTag.UNKNOWN_TAG_NAME, tagNumber, 1 << type); } - return new TIFFField(tag, type, count, data); + TIFFField field; + try { + field = new TIFFField(tag, type, count, data); + } catch (NullPointerException npe) { + // This method is specified to throw only IllegalArgumentExceptions + // so we catch the NullPointerException and set it as the cause of + // the IAE which is thrown. + throw new IllegalArgumentException(npe); + } + + return field; } /** diff --git a/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java b/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java index 82566e9f804..615de409bdf 100644 --- a/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java +++ b/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java @@ -40,6 +40,7 @@ import javax.print.attribute.AttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.standard.Destination; import javax.print.attribute.standard.Fidelity; +import sun.print.DialogOwner; import sun.print.ServiceDialog; import sun.print.SunAlternateMedia; @@ -187,9 +188,8 @@ public class ServiceUI { defaultIndex = 0; } - // For now we set owner to null. In the future, it may be passed - // as an argument. - Window owner = null; + DialogOwner dlgOwner = (DialogOwner)attributes.get(DialogOwner.class); + Window owner = (dlgOwner != null) ? dlgOwner.getOwner() : null; Rectangle gcBounds = (gc == null) ? GraphicsEnvironment. getLocalGraphicsEnvironment().getDefaultScreenDevice(). diff --git a/jdk/src/java.desktop/share/classes/javax/swing/GrayFilter.java b/jdk/src/java.desktop/share/classes/javax/swing/GrayFilter.java index af5947e5eec..65fddf32df9 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/GrayFilter.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/GrayFilter.java @@ -26,6 +26,7 @@ package javax.swing; import java.awt.*; import java.awt.image.*; +import sun.awt.image.MultiResolutionCachedImage; /** * An image filter that "disables" an image by turning @@ -48,7 +49,16 @@ public class GrayFilter extends RGBImageFilter { * @param i an {@code Image} to be created as disabled * @return the new grayscale image created from {@code i} */ - public static Image createDisabledImage (Image i) { + public static Image createDisabledImage(Image i) { + if (i instanceof MultiResolutionImage) { + return MultiResolutionCachedImage + .map((MultiResolutionImage) i, + (img) -> createDisabledImageImpl(img)); + } + return createDisabledImageImpl(i); + } + + private static Image createDisabledImageImpl(Image i) { GrayFilter filter = new GrayFilter(true, 50); ImageProducer prod = new FilteredImageSource(i.getSource(), filter); Image grayImage = Toolkit.getDefaultToolkit().createImage(prod); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java b/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java index 8a63fe74cab..e12241f5771 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java @@ -40,8 +40,8 @@ import java.util.Locale; import javax.accessibility.*; import sun.awt.AppContext; -import java.lang.reflect.Field; import java.security.*; +import sun.awt.AWTAccessor; /** * An implementation of the Icon interface that paints Icons @@ -106,11 +106,8 @@ public class ImageIcon implements Icon, Serializable, Accessible { final Component component = createNoPermsComponent(); // 6482575 - clear the appContext field so as not to leak it - Field appContextField = - - Component.class.getDeclaredField("appContext"); - appContextField.setAccessible(true); - appContextField.set(component, null); + AWTAccessor.getComponentAccessor(). + setAppContext(component, null); return component; } catch (Throwable e) { diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java index 3d6025407d9..74abca7dc54 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java @@ -55,6 +55,7 @@ import javax.accessibility.*; import sun.awt.AWTAccessor; import sun.awt.SunToolkit; +import sun.swing.SwingAccessor; import sun.swing.SwingUtilities2; /** @@ -376,6 +377,21 @@ public abstract class JComponent extends Container implements Serializable, private transient Object aaHint; private transient Object lcdRenderingHint; + static { + SwingAccessor.setJComponentAccessor(new SwingAccessor.JComponentAccessor() { + + @Override + public boolean getFlag(JComponent comp, int aFlag) { + return comp.getFlag(aFlag); + } + + @Override + public void compWriteObjectNotify(JComponent comp) { + comp.compWriteObjectNotify(); + } + }); + } + static Graphics safelyGetGraphics(Component c) { return safelyGetGraphics(c, SwingUtilities.getRoot(c)); } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java index 2698c90bc6e..894f3fabe18 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java @@ -261,23 +261,7 @@ public class GlyphView extends View implements TabableView, Cloneable { if (painter == null) { if (defaultPainter == null) { // the classname should probably come from a property file. - String classname = "javax.swing.text.GlyphPainter1"; - try { - Class c; - ClassLoader loader = getClass().getClassLoader(); - if (loader != null) { - c = loader.loadClass(classname); - } else { - c = Class.forName(classname); - } - Object o = c.newInstance(); - if (o instanceof GlyphPainter) { - defaultPainter = (GlyphPainter) o; - } - } catch (Throwable e) { - throw new StateInvariantError("GlyphView: Can't load glyph painter: " - + classname); - } + defaultPainter = new GlyphPainter1(); } setGlyphPainter(defaultPainter.getPainter(this, getStartOffset(), getEndOffset())); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java b/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java index 154db5cf7ef..fc96021ccc3 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java @@ -61,20 +61,8 @@ public class ParagraphView extends FlowView implements TabExpander { Object i18nFlag = doc.getProperty(AbstractDocument.I18NProperty); if ((i18nFlag != null) && i18nFlag.equals(Boolean.TRUE)) { try { - if (i18nStrategy == null) { - // the classname should probably come from a property file. - String classname = "javax.swing.text.TextLayoutStrategy"; - ClassLoader loader = getClass().getClassLoader(); - if (loader != null) { - i18nStrategy = loader.loadClass(classname); - } else { - i18nStrategy = Class.forName(classname); - } - } - Object o = i18nStrategy.newInstance(); - if (o instanceof FlowStrategy) { - strategy = (FlowStrategy) o; - } + // the classname should probably come from a property file. + strategy = new TextLayoutStrategy(); } catch (Throwable e) { throw new StateInvariantError("ParagraphView: Can't create i18n strategy: " + e.getMessage()); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java index 78157460653..57beae1ddb9 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java @@ -40,6 +40,7 @@ import javax.accessibility.*; import java.lang.ref.*; import java.security.AccessController; import java.security.PrivilegedAction; +import javax.swing.text.html.parser.ParserDelegator; /** * The Swing JEditorPane text component supports different kinds @@ -610,11 +611,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { */ protected Parser getParser() { if (defaultParser == null) { - try { - Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); - defaultParser = (Parser) c.newInstance(); - } catch (Throwable e) { - } + defaultParser = new ParserDelegator(); } return defaultParser; } diff --git a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java index 404131827fe..d03e5be0527 100644 --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java @@ -616,34 +616,8 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * calls KeyboardFocusManager directly. */ private Component getMostRecentFocusOwnerForWindow(Window w) { - Method meth = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Method run() { - Method meth = null; - try { - meth = KeyboardFocusManager.class.getDeclaredMethod( - "getMostRecentFocusOwner", - new Class[]{Window.class}); - meth.setAccessible(true); - } catch (Exception e) { - // Must never happen - e.printStackTrace(); - } - return meth; - } - }); - if (meth != null) { - // Meth refers static method - try { - return (Component)meth.invoke(null, new Object[] {w}); - } catch (Exception e) { - // Must never happen - e.printStackTrace(); - } - } - // Will get here if exception was thrown or meth is null - return w.getMostRecentFocusOwner(); + return AWTAccessor.getKeyboardFocusManagerAccessor() + .getMostRecentFocusOwner(w); } /* diff --git a/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java b/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java index 796b7ab5d79..f59f064c111 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java @@ -34,6 +34,7 @@ import java.awt.dnd.DragSourceContext; import java.awt.dnd.DropTargetContext; import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.dnd.peer.DropTargetContextPeer; +import java.awt.event.AWTEventListener; import java.awt.event.InputEvent; import java.awt.event.InvocationEvent; import java.awt.event.KeyEvent; @@ -48,6 +49,7 @@ import java.security.AccessControlContext; import java.io.File; import java.util.ResourceBundle; import java.util.Vector; +import javax.accessibility.AccessibleBundle; /** * The AWTAccessor utility class. @@ -406,6 +408,8 @@ public final class AWTAccessor { * Accessor for InputEvent.canAccessSystemClipboard field */ boolean canAccessSystemClipboard(InputEvent event); + void setCanAccessSystemClipboard(InputEvent event, + boolean canAccessSystemClipboard); } /* @@ -454,6 +458,11 @@ public final class AWTAccessor { */ void removeLastFocusRequest(Component heavyweight); + /** + * Gets the most recent focus owner in the window. + */ + Component getMostRecentFocusOwner(Window window); + /** * Sets the most recent focus owner in the window. */ @@ -708,6 +717,11 @@ public final class AWTAccessor { * Gets original source for KeyEvent */ Component getOriginalSource(KeyEvent ev); + + /** + * Gets isProxyActive field for KeyEvent + */ + boolean isProxyActive(KeyEvent ev); } /** @@ -758,6 +772,11 @@ public final class AWTAccessor { * Returns true if the event is an instances of SequencedEvent. */ boolean isSequencedEvent(AWTEvent event); + + /* + * Creates SequencedEvent with the given nested event + */ + AWTEvent create(AWTEvent event); } /* @@ -787,6 +806,15 @@ public final class AWTAccessor { public interface AccessibleContextAccessor { void setAppContext(AccessibleContext accessibleContext, AppContext appContext); AppContext getAppContext(AccessibleContext accessibleContext); + Object getNativeAXResource(AccessibleContext accessibleContext); + void setNativeAXResource(AccessibleContext accessibleContext, Object value); + } + + /* + * An accessor object for the AccessibleContext class + */ + public interface AccessibleBundleAccessor { + String getKey(AccessibleBundle accessibleBundle); } /* @@ -845,6 +873,7 @@ public final class AWTAccessor { private static InvocationEventAccessor invocationEventAccessor; private static SystemColorAccessor systemColorAccessor; private static AccessibleContextAccessor accessibleContextAccessor; + private static AccessibleBundleAccessor accessibleBundleAccessor; private static DragSourceContextAccessor dragSourceContextAccessor; private static DropTargetContextAccessor dropTargetContextAccessor; @@ -1235,9 +1264,13 @@ public final class AWTAccessor { * Get the accessor object for the java.awt.SequencedEvent class. */ public static SequencedEventAccessor getSequencedEventAccessor() { - // The class is not public. So we can't ensure it's initialized. - // Null returned value means it's not initialized - // (so not a single instance of the event has been created). + if (sequencedEventAccessor == null) { + try { + unsafe.ensureClassInitialized( + Class.forName("java.awt.SequencedEvent")); + } catch (ClassNotFoundException ignore) { + } + } return sequencedEventAccessor; } @@ -1301,6 +1334,23 @@ public final class AWTAccessor { return accessibleContextAccessor; } + /* + * Set the accessor object for the javax.accessibility.AccessibleBundle class. + */ + public static void setAccessibleBundleAccessor(AccessibleBundleAccessor accessor) { + AWTAccessor.accessibleBundleAccessor = accessor; + } + + /* + * Get the accessor object for the javax.accessibility.AccessibleBundle class. + */ + public static AccessibleBundleAccessor getAccessibleBundleAccessor() { + if (accessibleBundleAccessor == null) { + unsafe.ensureClassInitialized(AccessibleBundle.class); + } + return accessibleBundleAccessor; + } + /* * Set the accessor object for the javax.accessibility.AccessibleContext class. */ @@ -1342,4 +1392,4 @@ public final class AWTAccessor { AWTAccessor.dropTargetContextAccessor = accessor; } -} +} \ No newline at end of file diff --git a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java index 8461974375f..c017454ec0f 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java @@ -372,26 +372,6 @@ public abstract class SunToolkit extends Toolkit cont.setFocusTraversalPolicy(defaultPolicy); } - private static FocusTraversalPolicy createLayoutPolicy() { - FocusTraversalPolicy policy = null; - try { - Class layoutPolicyClass = - Class.forName("javax.swing.LayoutFocusTraversalPolicy"); - policy = (FocusTraversalPolicy)layoutPolicyClass.newInstance(); - } - catch (ClassNotFoundException e) { - assert false; - } - catch (InstantiationException e) { - assert false; - } - catch (IllegalAccessException e) { - assert false; - } - - return policy; - } - /* * Insert a mapping from target to AppContext, for later retrieval * via targetToAppContext() above. diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java index 8d8acdcf0a3..76bbfcff0f5 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.function.Function; import java.util.function.BiFunction; import java.util.stream.Collectors; +import java.awt.image.MultiResolutionImage; import java.awt.image.AbstractMultiResolutionImage; public class MultiResolutionCachedImage extends AbstractMultiResolutionImage { @@ -44,17 +45,30 @@ public class MultiResolutionCachedImage extends AbstractMultiResolutionImage { private int availableInfo; public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight, - BiFunction mapper) { - this(baseImageWidth, baseImageHeight, new Dimension[]{new Dimension( - baseImageWidth, baseImageHeight) + BiFunction mapper) + { + this(baseImageWidth, baseImageHeight, + new Dimension[]{new Dimension( baseImageWidth, baseImageHeight) }, mapper); } public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight, - Dimension2D[] sizes, BiFunction mapper) { + Dimension2D[] sizes, + BiFunction mapper) + { + this(baseImageWidth, baseImageHeight, sizes, mapper, true); + } + + private MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight, + Dimension2D[] sizes, + BiFunction mapper, + boolean copySizes) + { this.baseImageWidth = baseImageWidth; this.baseImageHeight = baseImageHeight; - this.sizes = (sizes == null) ? null : Arrays.copyOf(sizes, sizes.length); + this.sizes = (copySizes && sizes != null) + ? Arrays.copyOf(sizes, sizes.length) + : sizes; this.mapper = mapper; } @@ -99,6 +113,35 @@ public class MultiResolutionCachedImage extends AbstractMultiResolutionImage { mapper.apply(getResolutionVariant(width, height))); } + public static Image map(MultiResolutionImage mrImage, + Function mapper) { + + if (mrImage instanceof MultiResolutionToolkitImage) { + MultiResolutionToolkitImage mrtImage = + (MultiResolutionToolkitImage) mrImage; + return MultiResolutionToolkitImage.map(mrtImage, mapper); + } + + BiFunction sizeMapper + = (w, h) -> mapper.apply(mrImage.getResolutionVariant(w, h)); + + if (mrImage instanceof MultiResolutionCachedImage) { + MultiResolutionCachedImage mrcImage + = (MultiResolutionCachedImage) mrImage; + + return new MultiResolutionCachedImage(mrcImage.baseImageWidth, + mrcImage.baseImageHeight, + mrcImage.sizes, + sizeMapper, + false); + } + + Image image = (Image) mrImage; + int width = image.getWidth(null); + int height = image.getHeight(null); + return new MultiResolutionCachedImage(width, height, sizeMapper); + } + @Override public int getWidth(ImageObserver observer) { updateInfo(observer, ImageObserver.WIDTH); diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java index 26a86916824..dfe08735a15 100644 --- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java @@ -29,6 +29,7 @@ import java.awt.image.ImageObserver; import java.awt.image.MultiResolutionImage; import java.util.Arrays; import java.util.List; +import java.util.function.Function; import sun.awt.SoftCache; public class MultiResolutionToolkitImage extends ToolkitImage implements MultiResolutionImage { @@ -47,6 +48,13 @@ public class MultiResolutionToolkitImage extends ToolkitImage implements MultiRe ? this : resolutionVariant; } + public static Image map(MultiResolutionToolkitImage mrImage, + Function mapper) { + Image baseImage = mapper.apply(mrImage); + Image rvImage = mapper.apply(mrImage.resolutionVariant); + return new MultiResolutionToolkitImage(baseImage, rvImage); + } + private static void checkSize(double width, double height) { if (width <= 0 || height <= 0) { throw new IllegalArgumentException(String.format( diff --git a/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java b/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java index abe8bd9ab7a..f80e10c9778 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java +++ b/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java @@ -33,11 +33,8 @@ import java.awt.GraphicsEnvironment; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.HeadlessException; -import java.awt.Rectangle; import java.awt.Shape; -import java.awt.image.BufferedImage; - import java.awt.font.FontRenderContext; import java.awt.geom.AffineTransform; @@ -46,7 +43,6 @@ import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; -import java.awt.peer.FontPeer; import java.awt.print.Pageable; import java.awt.print.PageFormat; import java.awt.print.Paper; @@ -55,14 +51,12 @@ import java.awt.print.PrinterException; import java.awt.print.PrinterIOException; import java.awt.print.PrinterJob; -import javax.print.DocFlavor; import javax.print.PrintService; import javax.print.StreamPrintService; import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.PrintServiceAttributeSet; import javax.print.attribute.standard.PrinterName; -import javax.print.attribute.standard.Chromaticity; import javax.print.attribute.standard.Copies; import javax.print.attribute.standard.Destination; import javax.print.attribute.standard.DialogTypeSelection; @@ -72,7 +66,6 @@ import javax.print.attribute.standard.Sides; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; -import java.io.CharConversionException; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; @@ -85,17 +78,14 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; -import java.util.Enumeration; import java.util.Locale; import java.util.Properties; import sun.awt.CharsetString; import sun.awt.FontConfiguration; -import sun.awt.FontDescriptor; import sun.awt.PlatformFont; import sun.awt.SunToolkit; import sun.font.FontAccess; -import sun.font.FontManagerFactory; import sun.font.FontUtilities; import java.nio.charset.*; @@ -105,7 +95,9 @@ import java.nio.file.Files; //REMIND: Remove use of this class when IPPPrintService is moved to share directory. import java.lang.reflect.Method; +import javax.print.attribute.Attribute; import javax.print.attribute.standard.JobSheets; +import javax.print.attribute.standard.Media; /** * A class which initiates and executes a PostScript printer job. @@ -489,6 +481,23 @@ public class PSPrinterJob extends RasterPrinterJob { return doPrint; } + @Override + protected void setAttributes(PrintRequestAttributeSet attributes) + throws PrinterException { + super.setAttributes(attributes); + if (attributes == null) { + return; // now always use attributes, so this shouldn't happen. + } + Attribute attr = attributes.get(Media.class); + if (attr instanceof CustomMediaTray) { + CustomMediaTray customTray = (CustomMediaTray)attr; + String choice = customTray.getChoiceName(); + if (choice != null) { + mOptions = " InputSlot="+ choice; + } + } + } + /** * Invoked by the RasterPrinterJob super class * this method is called to mark the start of a @@ -1629,7 +1638,7 @@ public class PSPrinterJob extends RasterPrinterJob { execCmd[n++] = "-o job-sheets=standard"; } if ((pFlags & OPTIONS) != 0) { - execCmd[n++] = new String(options); + execCmd[n++] = "-o" + options; } } else { ncomps+=1; //add 1 arg for lp diff --git a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java index 59797508b2e..5dd2b4de046 100644 --- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java +++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java @@ -944,6 +944,10 @@ public class ServiceDialog extends JDialog implements ActionListener { } catch (MalformedURLException ex) { dstSupported = true; } + } else { + if (psCurrent.isAttributeCategorySupported(dstCategory)) { + dstSupported = true; + } } cbPrintToFile.setEnabled(dstSupported && dstAllowed); cbPrintToFile.setSelected(dstSelected && dstAllowed diff --git a/jdk/src/java.desktop/share/classes/sun/swing/SwingAccessor.java b/jdk/src/java.desktop/share/classes/sun/swing/SwingAccessor.java index 66d20f2458b..76a9f63ec1b 100644 --- a/jdk/src/java.desktop/share/classes/sun/swing/SwingAccessor.java +++ b/jdk/src/java.desktop/share/classes/sun/swing/SwingAccessor.java @@ -50,6 +50,16 @@ public final class SwingAccessor { private SwingAccessor() { } + /** + * An accessor for the JComponent class. + */ + public interface JComponentAccessor { + + boolean getFlag(JComponent comp, int aFlag); + + void compWriteObjectNotify(JComponent comp); + } + /** * An accessor for the JTextComponent class. * Note that we intentionally introduce the JTextComponentAccessor, @@ -105,6 +115,29 @@ public final class SwingAccessor { KeyStroke create(); } + /** + * The javax.swing.JComponent class accessor object. + */ + private static JComponentAccessor jComponentAccessor; + + /** + * Set an accessor object for the javax.swing.JComponent class. + */ + public static void setJComponentAccessor(JComponentAccessor jCompAccessor) { + jComponentAccessor = jCompAccessor; + } + + /** + * Retrieve the accessor object for the javax.swing.JComponent class. + */ + public static JComponentAccessor getJComponentAccessor() { + if (jComponentAccessor == null) { + unsafe.ensureClassInitialized(JComponent.class); + } + + return jComponentAccessor; + } + /** * The javax.swing.text.JTextComponent class accessor object. */ diff --git a/jdk/src/java.desktop/share/native/include/jawt.h b/jdk/src/java.desktop/share/native/include/jawt.h index e0f682f4305..8cb2cb8564d 100644 --- a/jdk/src/java.desktop/share/native/include/jawt.h +++ b/jdk/src/java.desktop/share/native/include/jawt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #endif /* - * AWT native interface (new in JDK 1.3) + * AWT native interface. * * The AWT native interface allows a native C or C++ application a means * by which to access native structures in AWT. This is to facilitate moving @@ -279,6 +279,50 @@ typedef struct jawt { */ jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); + /** + * Since 9 + * Creates a java.awt.Frame placed in a native container. Container is + * referenced by the native platform handle. For example on Windows this + * corresponds to an HWND. For other platforms, see the appropriate + * machine-dependent header file for a description. The reference returned + * by this function is a local reference that is only valid in this + * environment. This function returns a NULL reference if no frame could be + * created with matching platform information. + */ + jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo); + + /** + * Since 9 + * Moves and resizes the embedded frame. The new location of the top-left + * corner is specified by x and y parameters relative to the native parent + * component. The new size is specified by width and height. + * + * The embedded frame should be created by CreateEmbeddedFrame() method, or + * this function will not have any effect. + * + * java.awt.Component.setLocation() and java.awt.Component.setBounds() for + * EmbeddedFrame really don't move it within the native parent. These + * methods always locate the embedded frame at (0, 0) for backward + * compatibility. To allow moving embedded frames this method was + * introduced, and it works just the same way as setLocation() and + * setBounds() for usual, non-embedded components. + * + * Using usual get/setLocation() and get/setBounds() together with this new + * method is not recommended. + */ + void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame, + jint x, jint y, jint w, jint h); + /** + * Since 9 + * Synthesize a native message to activate or deactivate an EmbeddedFrame + * window depending on the value of parameter doActivate, if "true" + * activates the window; otherwise, deactivates the window. + * + * The embedded frame should be created by CreateEmbeddedFrame() method, or + * this function will not have any effect. + */ + void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env, + jobject embeddedFrame, jboolean doActivate); } JAWT; /* @@ -291,6 +335,7 @@ jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt); #define JAWT_VERSION_1_3 0x00010003 #define JAWT_VERSION_1_4 0x00010004 #define JAWT_VERSION_1_7 0x00010007 +#define JAWT_VERSION_9 0x00090000 #ifdef __cplusplus } /* extern "C" */ diff --git a/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c b/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c index 472b5eed491..15c705a5fec 100644 --- a/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c +++ b/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -772,6 +772,7 @@ Java_sun_awt_image_ImagingLib_transformBI(JNIEnv *env, jobject this, mlib_image *src; mlib_image *dst; int i; + int j = 0; int retStatus = 1; mlib_status status; double *matrix; @@ -824,6 +825,15 @@ Java_sun_awt_image_ImagingLib_transformBI(JNIEnv *env, jobject this, return 0; } + /* Check for invalid double value in transformation matrix */ + for (j = 0; j < 6; j++) { + + if (!(IS_FINITE(matrix[j]))) { + (*env)->ReleasePrimitiveArrayCritical(env, jmatrix, matrix, JNI_ABORT); + return 0; + } + } + if (s_printIt) { printf("matrix is %g %g %g %g %g %g\n", matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); @@ -980,6 +990,7 @@ Java_sun_awt_image_ImagingLib_transformRaster(JNIEnv *env, jobject this, mlib_image *src; mlib_image *dst; int i; + int j = 0; int retStatus = 1; mlib_status status; double *matrix; @@ -1044,6 +1055,18 @@ Java_sun_awt_image_ImagingLib_transformRaster(JNIEnv *env, jobject this, return 0; } + /* Check for invalid double value in transformation matrix */ + for (j = 0; j < 6; j++) { + + if (!(IS_FINITE(matrix[j]))) { + (*env)->ReleasePrimitiveArrayCritical(env, jmatrix, matrix, JNI_ABORT); + free(srcRasterP); + free(dstRasterP); + + return 0; + } + } + if (s_printIt) { printf("matrix is %g %g %g %g %g %g\n", matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); diff --git a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c index 485c42a7b96..d8de3e36d92 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c +++ b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c @@ -72,12 +72,13 @@ static int init_JNI_IDs(JNIEnv *env) { int storeGVData(JNIEnv* env, jobject gvdata, jint slot, jint baseIndex, jobject startPt, int glyphCount, hb_glyph_info_t *glyphInfo, - hb_glyph_position_t *glyphPos, hb_direction_t direction) { + hb_glyph_position_t *glyphPos, hb_direction_t direction, + float devScale) { int i; float x=0, y=0; float startX, startY; - float scale = 1.0f/64.0f; + float scale = 1.0f/64.0f/devScale; unsigned int* glyphs; float* positions; int initialCount, glyphArrayLen, posArrayLen, maxGlyphs, storeadv; @@ -216,7 +217,11 @@ JDKFontInfo* fi->ptSize = ptSize; fi->xPtSize = euclidianDistance(fi->matrix[0], fi->matrix[1]); fi->yPtSize = euclidianDistance(fi->matrix[2], fi->matrix[3]); - + if (!aat && (getenv("HB_NODEVTX") != NULL)) { + fi->devScale = fi->xPtSize / fi->ptSize; + } else { + fi->devScale = 1.0f; + } return fi; } @@ -309,7 +314,8 @@ JNIEXPORT jboolean JNICALL Java_sun_font_SunLayoutEngine_shape // by calling code. storeGVData(env, gvdata, slot, baseIndex, startPt, - glyphCount, glyphInfo, glyphPos, direction); + glyphCount, glyphInfo, glyphPos, direction, + jdkFontInfo->devScale); hb_buffer_destroy (buffer); hb_font_destroy(hbfont); diff --git a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc index 1727bb80ea3..93ac190b4d1 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc +++ b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc @@ -81,6 +81,7 @@ hb_jdk_get_glyph_h_advance (hb_font_t *font HB_UNUSED, return 0; } fadv = env->GetFloatField(pt, sunFontIDs.xFID); + fadv *= jdkFontInfo->devScale; env->DeleteLocalRef(pt); return FloatToF26Dot6(fadv); // should this round ? @@ -324,8 +325,8 @@ static hb_font_t* _hb_jdk_font_create(JDKFontInfo *jdkFontInfo, _hb_jdk_get_font_funcs (), jdkFontInfo, (hb_destroy_func_t) _do_nothing); hb_font_set_scale (font, - FloatToF26Dot6(jdkFontInfo->xPtSize), - FloatToF26Dot6(jdkFontInfo->yPtSize)); + FloatToF26Dot6(jdkFontInfo->ptSize*jdkFontInfo->devScale), + FloatToF26Dot6(jdkFontInfo->ptSize*jdkFontInfo->devScale)); return font; } diff --git a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h index c17ea12ebbc..1cd8d5ba241 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h +++ b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h @@ -43,6 +43,7 @@ typedef struct JDKFontInfo_Struct { float ptSize; float xPtSize; float yPtSize; + float devScale; // How much applying the full glyph tx scales x distance. jboolean aat; } JDKFontInfo; diff --git a/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c b/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c index 34c2171274e..e151de73cc9 100644 --- a/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c +++ b/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ #include "mlib_image.h" #include "mlib_SysMath.h" #include "mlib_ImageAffine.h" +#include "safe_math.h" + /***************************************************************/ mlib_status mlib_AffineEdges(mlib_affine_param *param, @@ -83,6 +85,12 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, dstYStride = mlib_ImageGetStride(dst); paddings = mlib_ImageGetPaddings(src); + /* All the transformation matrix parameters should be finite. if not, return failure */ + if (!(IS_FINITE(a) && IS_FINITE(b) && IS_FINITE(c) && IS_FINITE(d) && + IS_FINITE(tx) && IS_FINITE(ty))) { + return MLIB_FAILURE; + } + if (srcWidth >= (1 << 15) || srcHeight >= (1 << 15)) { return MLIB_FAILURE; } @@ -288,6 +296,10 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if (dY1 == dY2) continue; + if (!(IS_FINITE(slope))) { + continue; + } + if (dY1 < 0.0) y1 = 0; else { @@ -328,6 +340,10 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, if (dY1 == dY2) continue; + if (!(IS_FINITE(slope))) { + continue; + } + if (dY1 < 0.0) y1 = 0; else { diff --git a/jdk/src/java.desktop/share/native/libmlib_image/safe_math.h b/jdk/src/java.desktop/share/native/libmlib_image/safe_math.h index 34c1fc56e9a..a87eba11723 100644 --- a/jdk/src/java.desktop/share/native/libmlib_image/safe_math.h +++ b/jdk/src/java.desktop/share/native/libmlib_image/safe_math.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,15 @@ #ifndef __SAFE_MATH_H__ #define __SAFE_MATH_H__ +#include "mlib_types.h" + #define SAFE_TO_MULT(a, b) \ (((a) > 0) && ((b) >= 0) && ((0x7fffffff / (a)) > (b))) #define SAFE_TO_ADD(a, b) \ (((a) >= 0) && ((b) >= 0) && ((0x7fffffff - (a)) > (b))) +#define IS_FINITE(a) \ + (((a) >= MLIB_D64_MIN) && ((a) <= MLIB_D64_MAX)) + #endif // __SAFE_MATH_H__ diff --git a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c index 2d3d88225e9..1c1b217654e 100644 --- a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c +++ b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c @@ -114,7 +114,7 @@ DGifOpenFileHandle(int FileHandle, int *Error) GifFile->SavedImages = NULL; GifFile->SColorMap = NULL; - Private = (GifFilePrivateType *)malloc(sizeof(GifFilePrivateType)); + Private = (GifFilePrivateType *)calloc(1, sizeof(GifFilePrivateType)); if (Private == NULL) { if (Error != NULL) *Error = D_GIF_ERR_NOT_ENOUGH_MEM; @@ -122,6 +122,9 @@ DGifOpenFileHandle(int FileHandle, int *Error) free((char *)GifFile); return NULL; } + + /*@i1@*/memset(Private, '\0', sizeof(GifFilePrivateType)); + #ifdef _WIN32 _setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */ #endif /* _WIN32 */ @@ -197,13 +200,14 @@ DGifOpen(void *userData, InputFunc readFunc, int *Error) GifFile->SavedImages = NULL; GifFile->SColorMap = NULL; - Private = (GifFilePrivateType *)malloc(sizeof(GifFilePrivateType)); + Private = (GifFilePrivateType *)calloc(1, sizeof(GifFilePrivateType)); if (!Private) { if (Error != NULL) *Error = D_GIF_ERR_NOT_ENOUGH_MEM; free((char *)GifFile); return NULL; } + /*@i1@*/memset(Private, '\0', sizeof(GifFilePrivateType)); GifFile->Private = (void *)Private; Private->FileHandle = 0; @@ -417,8 +421,8 @@ DGifGetImageDesc(GifFileType *GifFile) if (GifFile->SavedImages) { SavedImage* new_saved_images = - (SavedImage *)realloc(GifFile->SavedImages, - sizeof(SavedImage) * (GifFile->ImageCount + 1)); + (SavedImage *)reallocarray(GifFile->SavedImages, + (GifFile->ImageCount + 1), sizeof(SavedImage)); if (new_saved_images == NULL) { GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM; return GIF_ERROR; @@ -788,6 +792,12 @@ DGifSetupDecompress(GifFileType *GifFile) } BitsPerPixel = CodeSize; + /* this can only happen on a severely malformed GIF */ + if (BitsPerPixel > 8) { + GifFile->Error = D_GIF_ERR_READ_FAILED; /* somewhat bogus error code */ + return GIF_ERROR; /* Failed to read Code size. */ + } + Private->Buf[0] = 0; /* Input Buffer empty. */ Private->BitsPerPixel = BitsPerPixel; Private->ClearCode = (1 << BitsPerPixel); @@ -1123,7 +1133,7 @@ DGifSlurp(GifFileType *GifFile) if (ImageSize > (SIZE_MAX / sizeof(GifPixelType))) { return GIF_ERROR; } - sp->RasterBits = (unsigned char *)malloc(ImageSize * + sp->RasterBits = (unsigned char *)reallocarray(NULL, ImageSize, sizeof(GifPixelType)); if (sp->RasterBits == NULL) { diff --git a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h index aa356362bf6..e8d7090bd10 100644 --- a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h +++ b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h @@ -37,7 +37,7 @@ extern "C" { #define GIFLIB_MAJOR 5 #define GIFLIB_MINOR 1 -#define GIFLIB_RELEASE 1 +#define GIFLIB_RELEASE 4 #define GIF_ERROR 0 #define GIF_OK 1 @@ -274,6 +274,9 @@ extern ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, GifPixelType ColorTransIn2[]); extern int GifBitSize(int n); +extern void * reallocarray(void *optr, size_t nmemb, size_t size); + + /****************************************************************************** Support for the in-core structures allocation (slurp mode). ******************************************************************************/ diff --git a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c index f7a6a3d8f28..cc784d19bd8 100644 --- a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c +++ b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c @@ -212,8 +212,8 @@ GifUnionColorMap(const ColorMapObject *ColorIn1, /* perhaps we can shrink the map? */ if (RoundUpTo < ColorUnion->ColorCount) { - GifColorType *new_map = (GifColorType *)realloc(Map, - sizeof(GifColorType) * RoundUpTo); + GifColorType *new_map = (GifColorType *)reallocarray(Map, + RoundUpTo, sizeof(GifColorType)); if( new_map == NULL ) { GifFreeMapObject(ColorUnion); return ((ColorMapObject *) NULL); @@ -256,9 +256,9 @@ GifAddExtensionBlock(int *ExtensionBlockCount, if (*ExtensionBlocks == NULL) *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock)); else { - ExtensionBlock* ep_new = (ExtensionBlock *)realloc(*ExtensionBlocks, - sizeof(ExtensionBlock) * - (*ExtensionBlockCount + 1)); + ExtensionBlock* ep_new = (ExtensionBlock *)reallocarray + (*ExtensionBlocks, (*ExtensionBlockCount + 1), + sizeof(ExtensionBlock)); if( ep_new == NULL ) return (GIF_ERROR); *ExtensionBlocks = ep_new; @@ -349,8 +349,8 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom) if (GifFile->SavedImages == NULL) GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage)); else - GifFile->SavedImages = (SavedImage *)realloc(GifFile->SavedImages, - sizeof(SavedImage) * (GifFile->ImageCount + 1)); + GifFile->SavedImages = (SavedImage *)reallocarray(GifFile->SavedImages, + (GifFile->ImageCount + 1), sizeof(SavedImage)); if (GifFile->SavedImages == NULL) return ((SavedImage *)NULL); @@ -379,9 +379,10 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom) } /* next, the raster */ - sp->RasterBits = (unsigned char *)malloc(sizeof(GifPixelType) * - CopyFrom->ImageDesc.Height * - CopyFrom->ImageDesc.Width); + sp->RasterBits = (unsigned char *)reallocarray(NULL, + (CopyFrom->ImageDesc.Height * + CopyFrom->ImageDesc.Width), + sizeof(GifPixelType)); if (sp->RasterBits == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); @@ -392,9 +393,9 @@ GifMakeSavedImage(GifFileType *GifFile, const SavedImage *CopyFrom) /* finally, the extension blocks */ if (sp->ExtensionBlocks != NULL) { - sp->ExtensionBlocks = (ExtensionBlock *)malloc( - sizeof(ExtensionBlock) * - CopyFrom->ExtensionBlockCount); + sp->ExtensionBlocks = (ExtensionBlock *)reallocarray(NULL, + CopyFrom->ExtensionBlockCount, + sizeof(ExtensionBlock)); if (sp->ExtensionBlocks == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); diff --git a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c new file mode 100644 index 00000000000..1087671c27b --- /dev/null +++ b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c @@ -0,0 +1,106 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* $OpenBSD: reallocarray.c,v 1.1 2014/05/08 21:43:49 deraadt Exp $ */ +/* + * Copyright (c) 2008 Otto Moerbeek + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) + +void * +reallocarray(void *optr, size_t nmemb, size_t size) +{ + if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && SIZE_MAX / nmemb < size) { + errno = ENOMEM; + return NULL; + } + /* + * Head off variations in realloc behavior on different + * platforms (reported by MarkR ) + * + * The behaviour of reallocarray is implementation-defined if + * nmemb or size is zero. It can return NULL or non-NULL + * depending on the platform. + * https://www.securecoding.cert.org/confluence/display/c/MEM04-C.Beware+of+zero-lengthallocations + * + * Here are some extracts from realloc man pages on different platforms. + * + * void realloc( void memblock, size_t size ); + * + * Windows: + * + * If there is not enough available memory to expand the block + * to the given size, the original block is left unchanged, + * and NULL is returned. If size is zero, then the block + * pointed to by memblock is freed; the return value is NULL, + * and memblock is left pointing at a freed block. + * + * OpenBSD: + * + * If size or nmemb is equal to 0, a unique pointer to an + * access protected, zero sized object is returned. Access via + * this pointer will generate a SIGSEGV exception. + * + * Linux: + * + * If size was equal to 0, either NULL or a pointer suitable + * to be passed to free() is returned. + * + * OS X: + * + * If size is zero and ptr is not NULL, a new, minimum sized + * object is allocated and the original object is freed. + * + * It looks like images with zero width or height can trigger + * this, and fuzzing behaviour will differ by platform, so + * fuzzing on one platform may not detect zero-size allocation + * problems on other platforms. + */ + if (size == 0 || nmemb == 0) + return NULL; + return realloc(optr, size * nmemb); +} diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java index c65a7c79f96..846e06bb864 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java @@ -57,8 +57,6 @@ import java.awt.image.ImageProducer; import java.awt.image.VolatileImage; import java.awt.peer.ComponentPeer; import java.awt.peer.ContainerPeer; -import java.lang.reflect.*; -import java.security.*; import java.util.Collection; import java.util.Objects; import java.util.Set; @@ -241,46 +239,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget return false; } - private static Class seClass; - private static Constructor seCtor; - static final AWTEvent wrapInSequenced(AWTEvent event) { - try { - if (seClass == null) { - seClass = Class.forName("java.awt.SequencedEvent"); - } - - if (seCtor == null) { - seCtor = AccessController.doPrivileged(new - PrivilegedExceptionAction>() { - public Constructor run() throws Exception { - Constructor ctor = seClass.getConstructor( - new Class[] { AWTEvent.class }); - ctor.setAccessible(true); - return ctor; - } - }); - } - - return (AWTEvent) seCtor.newInstance(new Object[] { event }); - } - catch (ClassNotFoundException e) { - throw new NoClassDefFoundError("java.awt.SequencedEvent."); - } - catch (PrivilegedActionException ex) { - throw new NoClassDefFoundError("java.awt.SequencedEvent."); - } - catch (InstantiationException e) { - assert false; - } - catch (IllegalAccessException e) { - assert false; - } - catch (InvocationTargetException e) { - assert false; - } - - return null; + return AWTAccessor.getSequencedEventAccessor().create(event); } // TODO: consider moving it to KeyboardFocusManagerPeerImpl diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java index 4422e7a8b35..e457c43e91e 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java @@ -36,10 +36,6 @@ import java.awt.dnd.DragGestureListener; import java.awt.event.InputEvent; import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; - -import java.lang.reflect.*; import sun.awt.dnd.SunDragSourceContextPeer; diff --git a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java index 907446ad81c..0c5cc361c76 100644 --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java @@ -32,8 +32,6 @@ import java.awt.image.ColorModel; import java.lang.ref.WeakReference; -import java.lang.reflect.Method; - import sun.awt.AWTAccessor.ComponentAccessor; import sun.util.logging.PlatformLogger; @@ -395,7 +393,6 @@ class XWindow extends XBaseWindow implements X11ComponentPeer { return false; } - static Method m_sendMessage; static void sendEvent(final AWTEvent e) { // The uses of this method imply that the incoming event is system-generated SunToolkit.setSystemGenerated(e); diff --git a/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java b/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java index 7d79243d393..06b086e59a2 100644 --- a/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java +++ b/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java @@ -41,14 +41,12 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.Reader; import java.io.StringWriter; -import java.io.UnsupportedEncodingException; import java.nio.file.Files; import java.util.Vector; import javax.print.CancelablePrintJob; import javax.print.Doc; import javax.print.DocFlavor; -import javax.print.DocPrintJob; import javax.print.PrintService; import javax.print.PrintException; import javax.print.event.PrintJobEvent; @@ -56,7 +54,6 @@ import javax.print.event.PrintJobListener; import javax.print.event.PrintJobAttributeListener; import javax.print.attribute.Attribute; -import javax.print.attribute.AttributeSet; import javax.print.attribute.AttributeSetUtilities; import javax.print.attribute.DocAttributeSet; import javax.print.attribute.HashPrintJobAttributeSet; @@ -65,7 +62,6 @@ import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintJobAttributeSet; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintRequestAttributeSet; -import javax.print.attribute.PrintServiceAttributeSet; import javax.print.attribute.standard.Copies; import javax.print.attribute.standard.Destination; import javax.print.attribute.standard.DocumentName; @@ -77,13 +73,17 @@ import javax.print.attribute.standard.Media; import javax.print.attribute.standard.MediaSize; import javax.print.attribute.standard.MediaSizeName; import javax.print.attribute.standard.OrientationRequested; -import javax.print.attribute.standard.PrinterName; import javax.print.attribute.standard.RequestingUserName; import javax.print.attribute.standard.NumberUp; import javax.print.attribute.standard.Sides; import javax.print.attribute.standard.PrinterIsAcceptingJobs; -import java.awt.print.*; +import java.awt.print.PageFormat; +import java.awt.print.PrinterJob; +import java.awt.print.Pageable; +import java.awt.print.Paper; +import java.awt.print.Printable; +import java.awt.print.PrinterException; @@ -370,7 +370,7 @@ public class UnixPrintJob implements CancelablePrintJob { customTray instanceof CustomMediaTray) { String choice = customTray.getChoiceName(); if (choice != null) { - mOptions += " media="+choice; + mOptions += " InputSlot="+choice; } } diff --git a/jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h b/jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h index bb59b4658c7..bdc9830b07b 100644 --- a/jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h +++ b/jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ #include #include -#include _JNI_IMPORT_OR_EXPORT_ JAWT_DrawingSurface* JNICALL awt_GetDrawingSurface(JNIEnv* env, jobject target); @@ -45,4 +44,14 @@ _JNI_IMPORT_OR_EXPORT_ void JNICALL _JNI_IMPORT_OR_EXPORT_ jobject JNICALL awt_GetComponent(JNIEnv* env, void* platformInfo); +_JNI_IMPORT_OR_EXPORT_ jobject JNICALL + awt_CreateEmbeddedFrame(JNIEnv* env, void* platformInfo); + +_JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SetBounds(JNIEnv *env, jobject embeddedFrame, jint x, jint y, + jint w, jint h); + +_JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SynthesizeWindowActivation(JNIEnv *env, jobject embeddedFrame, + jboolean doActivate); #endif /* !_AWT_DRAWING_SURFACE_H_ */ diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c index de7e8488985..1cc09c9acac 100644 --- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c +++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -383,3 +383,48 @@ JNIEXPORT jobject JNICALL return target; } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/awt/X11/XEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = (*env)->GetMethodID(env, cls, "", "(JZ)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return (*env)->NewObject(env, cls, mid, platformInfo, JNI_TRUE); +} + + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, doActivate); +} diff --git a/jdk/src/java.desktop/unix/native/libjawt/jawt.c b/jdk/src/java.desktop/unix/native/libjawt/jawt.c index b6a5240a7c1..59e9a55cff2 100644 --- a/jdk/src/java.desktop/unix/native/libjawt/jawt.c +++ b/jdk/src/java.desktop/unix/native/libjawt/jawt.c @@ -45,7 +45,8 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt) if (awt->version != JAWT_VERSION_1_3 && awt->version != JAWT_VERSION_1_4 - && awt->version != JAWT_VERSION_1_7) { + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -55,6 +56,11 @@ JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt) awt->Lock = awt_Lock; awt->Unlock = awt_Unlock; awt->GetComponent = awt_GetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE; diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp index 05549673564..019295ac2b5 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -272,3 +272,47 @@ extern "C" JNIEXPORT void JNICALL DSUnlockAWT(JNIEnv* env) { // Do nothing on Windows } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/awt/windows/WEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = env->FindClass(embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = env->GetMethodID(cls, "", "(J)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return env->NewObject(cls, mid, platformInfo); +} + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = env->FindClass(embeddedClassName); + CHECK_NULL(cls); + mid = env->GetMethodID(cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + env->CallVoidMethod(embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = env->FindClass(embeddedClassName); + CHECK_NULL(cls); + mid = env->GetMethodID(cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + env->CallVoidMethod(embeddedFrame, mid, doActivate); +} diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h index cd135b947e2..a2a510797e9 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -162,6 +162,16 @@ extern "C" { jobject JNICALL DSGetComponent( JNIEnv* env, void* platformInfo); + _JNI_IMPORT_OR_EXPORT_ jobject JNICALL + awt_CreateEmbeddedFrame(JNIEnv* env, void* platformInfo); + + _JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SetBounds(JNIEnv *env, jobject embeddedFrame, jint x, + jint y, jint w, jint h); + + _JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SynthesizeWindowActivation(JNIEnv *env, jobject embeddedFrame, + jboolean doActivate); #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp index 6c36d177fb2..6f75291d62f 100644 --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp @@ -1132,7 +1132,7 @@ BOOL AwtPrintControl::getDevmode( HANDLE hPrinter, if (dwRet != IDOK) { /* if failure, cleanup and return failure */ - GlobalFree(pDevMode); + GlobalFree(*pDevMode); *pDevMode = NULL; return FALSE; } diff --git a/jdk/src/java.desktop/windows/native/libjawt/jawt.cpp b/jdk/src/java.desktop/windows/native/libjawt/jawt.cpp index 218b7dd0864..1393dfcf8f6 100644 --- a/jdk/src/java.desktop/windows/native/libjawt/jawt.cpp +++ b/jdk/src/java.desktop/windows/native/libjawt/jawt.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,9 @@ extern "C" JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt) } if (awt->version != JAWT_VERSION_1_3 - && awt->version != JAWT_VERSION_1_4) { + && awt->version != JAWT_VERSION_1_4 + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -56,6 +58,11 @@ extern "C" JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt) awt->Lock = DSLockAWT; awt->Unlock = DSUnlockAWT; awt->GetComponent = DSGetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE; diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java index cbf32ee5834..93a5c7cbdd1 100644 --- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java +++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -64,6 +64,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.WeakHashMap; import java.util.stream.Collectors; @@ -1851,8 +1852,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable private static final class ObjectInputStreamWithLoader extends ObjectInputStream { ObjectInputStreamWithLoader(InputStream in, ClassLoader cl) - throws IOException { + throws IOException, IllegalArgumentException { super(in); + if (cl == null ) { + throw new IllegalArgumentException("class loader is null"); + } this.loader = cl; } @@ -1861,7 +1865,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable throws IOException, ClassNotFoundException { String name = classDesc.getName(); ReflectUtil.checkPackageAccess(name); - return Class.forName(name, false, loader); + return Class.forName(name, false, Objects.requireNonNull(loader)); } private final ClassLoader loader; diff --git a/jdk/src/java.management/share/classes/module-info.java b/jdk/src/java.management/share/classes/module-info.java index 6772da9d8ee..54ccb16107a 100644 --- a/jdk/src/java.management/share/classes/module-info.java +++ b/jdk/src/java.management/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 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 @@ -50,6 +50,7 @@ module java.management { uses javax.management.remote.JMXConnectorProvider; uses javax.management.remote.JMXConnectorServerProvider; uses sun.management.spi.PlatformMBeanProvider; + uses sun.management.spi.AgentProvider; provides javax.security.auth.spi.LoginModule with com.sun.jmx.remote.security.FileLoginModule; diff --git a/jdk/src/java.management/share/classes/sun/management/Agent.java b/jdk/src/java.management/share/classes/sun/management/Agent.java index be68601ce0e..fbc80433793 100644 --- a/jdk/src/java.management/share/classes/sun/management/Agent.java +++ b/jdk/src/java.management/share/classes/sun/management/Agent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,17 +31,19 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.lang.management.ManagementFactory; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.InetAddress; import java.net.MalformedURLException; import java.net.UnknownHostException; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; import java.util.MissingResourceException; import java.util.Properties; import java.util.ResourceBundle; +import java.util.ServiceLoader; import java.util.function.Function; import java.util.function.Predicate; @@ -53,6 +55,7 @@ import sun.management.jmxremote.ConnectorBootstrap; import sun.management.jdp.JdpController; import sun.management.jdp.JdpException; import jdk.internal.vm.VMSupport; +import sun.management.spi.AgentProvider; /** * This Agent is started by the VM when -Dcom.sun.management.snmp or @@ -248,8 +251,8 @@ public class Agent { "com.sun.management.enableThreadContentionMonitoring"; private static final String LOCAL_CONNECTOR_ADDRESS_PROP = "com.sun.management.jmxremote.localConnectorAddress"; - private static final String SNMP_ADAPTOR_BOOTSTRAP_CLASS_NAME = - "sun.management.snmp.AdaptorBootstrap"; + private static final String SNMP_AGENT_NAME = + "SnmpAgent"; private static final String JDP_DEFAULT_ADDRESS = "224.0.23.178"; private static final int JDP_DEFAULT_PORT = 7095; @@ -429,7 +432,7 @@ public class Agent { try { if (snmpPort != null) { - loadSnmpAgent(snmpPort, props); + loadSnmpAgent(props); } /* @@ -554,28 +557,24 @@ public class Agent { return mgmtProps; } - private static void loadSnmpAgent(String snmpPort, Properties props) { - try { - // invoke the following through reflection: - // AdaptorBootstrap.initialize(snmpPort, props); - final Class adaptorClass = - Class.forName(SNMP_ADAPTOR_BOOTSTRAP_CLASS_NAME, true, null); - final Method initializeMethod = - adaptorClass.getMethod("initialize", - String.class, Properties.class); - initializeMethod.invoke(null, snmpPort, props); - } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException x) { - // snmp runtime doesn't exist - initialization fails - throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT, x); - } catch (InvocationTargetException x) { - final Throwable cause = x.getCause(); - if (cause instanceof RuntimeException) { - throw (RuntimeException) cause; - } else if (cause instanceof Error) { - throw (Error) cause; - } - // should not happen... - throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT, cause); + private static void loadSnmpAgent(Properties props) { + /* + * Load the jdk.snmp service + */ + AgentProvider provider = AccessController.doPrivileged( + (PrivilegedAction) () -> { + for(AgentProvider aProvider : ServiceLoader.loadInstalled(AgentProvider.class)) { + if(aProvider.getName().equals(SNMP_AGENT_NAME)) + return aProvider; + } + return null; + }, null + ); + + if (provider != null) { + provider.startAgent(props); + } else { // snmp runtime doesn't exist - initialization fails + throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT); } } diff --git a/jdk/src/java.management/share/classes/sun/management/spi/AgentProvider.java b/jdk/src/java.management/share/classes/sun/management/spi/AgentProvider.java new file mode 100644 index 00000000000..f68343acacb --- /dev/null +++ b/jdk/src/java.management/share/classes/sun/management/spi/AgentProvider.java @@ -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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package sun.management.spi; + +import java.util.Properties; + +/** + * Service interface for management agent + */ +public abstract class AgentProvider { + + /** + * Instantiates a new AgentProvider. + * + * @throws SecurityException if the subclass (and calling code) does not + * have + * {@code RuntimePermission("sun.management.spi.AgentProvider.subclass")} + */ + protected AgentProvider() { + this(checkSubclassPermission()); + } + + private AgentProvider(Void unused) { + } + + private static Void checkSubclassPermission() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new RuntimePermission(AgentProvider.class.getName() + ".subclass")); + } + return null; + } + + /** + * Gets the name of the agent provider. + * + * @return name of agent provider + */ + public abstract String getName(); + + /** + * Initializes and starts the agent. + * + * @throws IllegalStateException if this agent has already been started. + */ + public abstract void startAgent(); + + /** + * Initializes and starts the agent at given port and with given properties + * + * @param props environment variables for agent + * + * @throws IllegalStateException if this agent has already been started. + */ + public abstract void startAgent(Properties props); + + /** + * Checks if agent is started and not terminated. + * + * @return true if agent is running, false otherwise. + */ + public abstract boolean isActive(); + + /** + * Stops this agent. + * + * @throws IllegalStateException if this agent is not started. + */ + public abstract void stopAgent(); +} diff --git a/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java b/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java index de1410f3ef1..604fac30cc4 100644 --- a/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java +++ b/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -75,10 +75,10 @@ final class TerminalImpl extends CardTerminal { } } try { - card = new CardImpl(this, protocol); + card = new CardImpl(this, protocol); return card; } catch (PCSCException e) { - if (e.code == SCARD_W_REMOVED_CARD) { + if (e.code == SCARD_W_REMOVED_CARD || e.code == SCARD_E_NO_SMARTCARD) { throw new CardNotPresentException("No card present", e); } else { throw new CardException("connect() failed", e); diff --git a/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java index 0981b9cfaf5..8054ca86adc 100644 --- a/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java @@ -76,20 +76,29 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { sendQuitTo(pid); // give the target VM time to start the attach mechanism - int i = 0; - long delay = 200; - int retries = (int)(attachTimeout() / delay); + final int delay_step = 100; + final long timeout = attachTimeout(); + long time_spend = 0; + long delay = 0; do { + // Increase timeout on each attempt to reduce polling + delay += delay_step; try { Thread.sleep(delay); } catch (InterruptedException x) { } path = findSocketFile(pid); - i++; - } while (i <= retries && path == null); + + time_spend += delay; + if (time_spend > timeout/2 && path == null) { + // Send QUIT again to give target VM the last chance to react + sendQuitTo(pid); + } + } while (time_spend <= timeout && path == null); if (path == null) { throw new AttachNotSupportedException( - "Unable to open socket file: target process not responding " + - "or HotSpot VM not loaded"); + String.format("Unable to open socket file %s: " + + "target process %d doesn't respond within %dms " + + "or HotSpot VM not loaded", f.getPath(), pid, time_spend)); } } finally { f.delete(); diff --git a/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java index 2bf3e74a8bd..5cc81e9a2d0 100644 --- a/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java @@ -44,9 +44,6 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { // Any changes to this needs to be synchronized with HotSpot. private static final String tmpdir = "/tmp"; - // Indicates if this machine uses the old LinuxThreads - static boolean isLinuxThreads; - // The patch to the socket file created by the target VM String path; @@ -73,44 +70,37 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { if (path == null) { File f = createAttachFile(pid); try { - // On LinuxThreads each thread is a process and we don't have the - // pid of the VMThread which has SIGQUIT unblocked. To workaround - // this we get the pid of the "manager thread" that is created - // by the first call to pthread_create. This is parent of all - // threads (except the initial thread). - if (isLinuxThreads) { - int mpid; - try { - mpid = getLinuxThreadsManager(pid); - } catch (IOException x) { - throw new AttachNotSupportedException(x.getMessage()); - } - assert(mpid >= 1); - sendQuitToChildrenOf(mpid); - } else { - sendQuitTo(pid); - } + sendQuitTo(pid); // give the target VM time to start the attach mechanism - int i = 0; - long delay = 200; - int retries = (int)(attachTimeout() / delay); + final int delay_step = 100; + final long timeout = attachTimeout(); + long time_spend = 0; + long delay = 0; do { + // Increase timeout on each attempt to reduce polling + delay += delay_step; try { Thread.sleep(delay); } catch (InterruptedException x) { } path = findSocketFile(pid); - i++; - } while (i <= retries && path == null); + + time_spend += delay; + if (time_spend > timeout/2 && path == null) { + // Send QUIT again to give target VM the last chance to react + sendQuitTo(pid); + } + } while (time_spend <= timeout && path == null); if (path == null) { throw new AttachNotSupportedException( - "Unable to open socket file: target process not responding " + - "or HotSpot VM not loaded"); + String.format("Unable to open socket file %s: " + + "target process %d doesn't respond within %dms " + + "or HotSpot VM not loaded", f.getPath(), pid, time_spend)); } } finally { f.delete(); } - } + } // Check that the file owner/permission to avoid attaching to // bogus process @@ -340,6 +330,5 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { static { System.loadLibrary("attach"); - isLinuxThreads = isLinuxThreads(); } } diff --git a/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java index 0e304d0347d..9ed16330922 100644 --- a/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java @@ -70,26 +70,34 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { // Then we attempt to find the socket file again. path = findSocketFile(pid); if (path == null) { - File f = new File(tmpdir, ".attach_pid" + pid); - createAttachFile(f.getPath()); + File f = createAttachFile(pid); try { sendQuitTo(pid); // give the target VM time to start the attach mechanism - int i = 0; - long delay = 200; - int retries = (int)(attachTimeout() / delay); + final int delay_step = 100; + final long timeout = attachTimeout(); + long time_spend = 0; + long delay = 0; do { + // Increase timeout on each attempt to reduce polling + delay += delay_step; try { Thread.sleep(delay); } catch (InterruptedException x) { } path = findSocketFile(pid); - i++; - } while (i <= retries && path == null); + + time_spend += delay; + if (time_spend > timeout/2 && path == null) { + // Send QUIT again to give target VM the last chance to react + sendQuitTo(pid); + } + } while (time_spend <= timeout && path == null); if (path == null) { throw new AttachNotSupportedException( - "Unable to open socket file: target process not responding " + - "or HotSpot VM not loaded"); + String.format("Unable to open socket file %s: " + + "target process %d doesn't respond within %dms " + + "or HotSpot VM not loaded", f.getPath(), pid, time_spend)); } } finally { f.delete(); @@ -282,6 +290,12 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { write(fd, b, 0, 1); } + private File createAttachFile(int pid) throws IOException { + String fn = ".attach_pid" + pid; + File f = new File(tmpdir, fn); + createAttachFile0(f.getPath()); + return f; + } //-- native methods @@ -299,7 +313,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { static native void write(int fd, byte buf[], int off, int bufLen) throws IOException; - static native void createAttachFile(String path); + static native void createAttachFile0(String path); static native String getTempDir(); diff --git a/jdk/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c b/jdk/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c index 0f75dfe4e3d..42c4a256601 100644 --- a/jdk/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c +++ b/jdk/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c @@ -270,7 +270,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_write * Method: createAttachFile * Signature: (Ljava.lang.String;)V */ -JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_createAttachFile(JNIEnv *env, jclass cls, jstring path) +JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_createAttachFile0(JNIEnv *env, jclass cls, jstring path) { const char* _path; jboolean isCopy; diff --git a/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java b/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java index a5e965e5ec3..98d0ddc7e44 100644 --- a/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java +++ b/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java @@ -319,7 +319,7 @@ public abstract class HotSpotVirtualMachine extends VirtualMachine { // -- attach timeout support - private static long defaultAttachTimeout = 5000; + private static long defaultAttachTimeout = 10000; private volatile long attachTimeout; /* diff --git a/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java b/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java index b93f745475e..4d0a3bc3dec 100644 --- a/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java @@ -71,27 +71,36 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { } catch (FileNotFoundException fnf1) { File f = createAttachFile(pid); try { - // kill -QUIT will tickle target VM to check for the - // attach file. sigquit(pid); // give the target VM time to start the attach mechanism - int i = 0; - long delay = 200; - int retries = (int)(attachTimeout() / delay); + final int delay_step = 100; + final long timeout = attachTimeout(); + long time_spend = 0; + long delay = 0; do { + // Increase timeout on each attempt to reduce polling + delay += delay_step; try { Thread.sleep(delay); } catch (InterruptedException x) { } try { fd = openDoor(pid); - } catch (FileNotFoundException fnf2) { } - i++; - } while (i <= retries && fd == -1); - if (fd == -1) { + } catch (FileNotFoundException fnf2) { + // pass + } + + time_spend += delay; + if (time_spend > timeout/2 && fd == -1) { + // Send QUIT again to give target VM the last chance to react + sigquit(pid); + } + } while (time_spend <= timeout && fd == -1); + if (fd == -1) { throw new AttachNotSupportedException( - "Unable to open door: target process not responding or " + - "HotSpot VM not loaded"); + String.format("Unable to open door %s: " + + "target process %d doesn't respond within %dms " + + "or HotSpot VM not loaded", f.getPath(), pid, time_spend)); } } finally { f.delete(); diff --git a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java index 9b7edac4d33..84341e1e181 100644 --- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java +++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java @@ -39,6 +39,7 @@ import java.util.ListIterator; //import java.util.Map; import java.util.ResourceBundle; import java.util.Stack; +import java.util.regex.Matcher; import java.util.regex.Pattern; import jdk.internal.jline.Terminal; @@ -2336,6 +2337,33 @@ public class ConsoleReader out.flush(); } + Stack pushBackChar = new Stack(); + + if (terminal.isAnsiSupported()) { + //detect the prompt length by reading the cursor position from the terminal + //the real prompt length could differ from the simple prompt length due to + //use of escape sequences: + out.write("\033[6n"); + out.flush(); + StringBuilder input = new StringBuilder(); + while (true) { + int read; + while ((read = in.read()) != 'R') { + input.appendCodePoint(read); + } + input.appendCodePoint(read); + Matcher m = CURSOR_COLUMN_PATTERN.matcher(input); + if (m.matches()) { + promptLen = Integer.parseInt(m.group("column")) - 1; + String prefix = m.group("prefix"); + for (int i = prefix.length() - 1; i >= 0; i--) { + pushBackChar.push(prefix.charAt(i)); + } + break; + } + } + } + // if the terminal is unsupported, just use plain-java reading if (!terminal.isSupported()) { return readLineSimple(); @@ -2352,7 +2380,6 @@ public class ConsoleReader boolean success = true; StringBuilder sb = new StringBuilder(); - Stack pushBackChar = new Stack(); while (true) { int c = pushBackChar.isEmpty() ? readCharacter() : pushBackChar.pop (); if (c == -1) { @@ -3193,6 +3220,9 @@ public class ConsoleReader } } } + //where: + private Pattern CURSOR_COLUMN_PATTERN = + Pattern.compile("(?.*)\033\\[[0-9]+;(?[0-9]+)R"); /** * Read a line for unsupported terminals. diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java index df824856282..549b6abfd54 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java @@ -99,9 +99,13 @@ public final class ExcludeVMPlugin implements Plugin { * e.g.: /java.base/native/amd64/server/libjvm.so * /java.base/native/server/libjvm.dylib */ - private List getVMs(ResourcePoolModule javaBase, String jvmlib) { + private List getVMs(ResourcePoolModule javaBase, String[] jvmlibs) { List ret = javaBase.entries().filter((t) -> { - return t.path().endsWith("/" + jvmlib); + String path = t.path(); + for (String jvmlib : jvmlibs) { + return t.path().endsWith("/" + jvmlib); + } + return false; }).collect(Collectors.toList()); return ret; } @@ -109,18 +113,21 @@ public final class ExcludeVMPlugin implements Plugin { @Override public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) { ResourcePoolModule javaBase = in.moduleView().findModule("java.base").get(); - String jvmlib = jvmlib(javaBase.descriptor().osName().get()); + String[] jvmlibs = jvmlibs(javaBase.descriptor().osName().get()); TreeSet existing = new TreeSet<>(new JvmComparator()); TreeSet removed = new TreeSet<>(new JvmComparator()); if (!keepAll) { // First retrieve all available VM names and removed VM - List jvms = getVMs(javaBase, jvmlib); + List jvms = getVMs(javaBase, jvmlibs); for (Jvm jvm : Jvm.values()) { for (ResourcePoolEntry md : jvms) { - if (md.path().endsWith("/" + jvm.getName() + "/" + jvmlib)) { - existing.add(jvm); - if (isRemoved(md)) { - removed.add(jvm); + String mdPath = md.path(); + for (String jvmlib : jvmlibs) { + if (mdPath.endsWith("/" + jvm.getName() + "/" + jvmlib)) { + existing.add(jvm); + if (isRemoved(md)) { + removed.add(jvm); + } } } } @@ -248,14 +255,14 @@ public final class ExcludeVMPlugin implements Plugin { return orig.copyWithContent(content); } - private static String jvmlib(String osName) { - String lib = "libjvm.so"; + private static String[] jvmlibs(String osName) { if (isWindows(osName)) { - lib = "jvm.dll"; + return new String[] { "jvm.dll" }; } else if (isMac(osName)) { - lib = "libjvm.dylib"; + return new String[] { "libjvm.dylib", "libjvm.a" }; + } else { + return new String[] { "libjvm.so", "libjvm.a" }; } - return lib; } private static boolean isWindows(String osName) { diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java index a60a1e934b5..115020953f3 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java @@ -29,12 +29,12 @@ import java.io.IOException; import java.lang.invoke.MethodType; import java.nio.file.Files; import java.util.ArrayList; -import java.util.Arrays; import java.util.EnumSet; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.internal.misc.SharedSecrets; @@ -69,11 +69,11 @@ public final class GenerateJLIClassesPlugin implements Plugin { private static final JavaLangInvokeAccess JLIA = SharedSecrets.getJavaLangInvokeAccess(); - List speciesTypes; + Set speciesTypes; - List invokerTypes; + Set invokerTypes; - Map> dmhMethods; + Map> dmhMethods; public GenerateJLIClassesPlugin() { } @@ -110,8 +110,8 @@ public final class GenerateJLIClassesPlugin implements Plugin { * A better long-term solution is to define and run a set of quick * generators and extracting this list as a step in the build process. */ - public static List defaultSpecies() { - return List.of("LL", "L3", "L4", "L5", "L6", "L7", "L7I", + public static Set defaultSpecies() { + return Set.of("LL", "L3", "L4", "L5", "L6", "L7", "L7I", "L7II", "L7IIL", "L8", "L9", "L10", "L10I", "L10II", "L10IIL", "L11", "L12", "L13", "LI", "D", "L3I", "LIL", "LLI", "LLIL", "LILL", "I", "LLILL"); @@ -120,23 +120,23 @@ public final class GenerateJLIClassesPlugin implements Plugin { /** * @return the default invoker forms to generate. */ - private static List defaultInvokers() { - return List.of("LL_L", "LL_I", "LILL_I", "L6_L"); + private static Set defaultInvokers() { + return Set.of("LL_L", "LL_I", "LILL_I", "L6_L"); } /** * @return the list of default DirectMethodHandle methods to generate. */ - private static Map> defaultDMHMethods() { + private static Map> defaultDMHMethods() { return Map.of( - DMH_INVOKE_VIRTUAL, List.of("L_L", "LL_L", "LLI_I", "L3_V"), - DMH_INVOKE_SPECIAL, List.of("LL_I", "LL_L", "LLF_L", "LLD_L", "L3_L", + DMH_INVOKE_VIRTUAL, Set.of("L_L", "LL_L", "LLI_I", "L3_V"), + DMH_INVOKE_SPECIAL, Set.of("LL_I", "LL_L", "LLF_L", "LLD_L", "L3_L", "L4_L", "L5_L", "L6_L", "L7_L", "L8_L", "LLI_I", "LLI_L", "LLIL_I", "LLII_I", "LLII_L", "L3I_L", "L3I_I", "LLILI_I", "LLIIL_L", "LLIILL_L", "LLIILL_I", "LLIIL_I", "LLILIL_I", "LLILILL_I", "LLILII_I", "LLI3_I", "LLI3L_I", "LLI3LL_I", "LLI3_L", "LLI4_I"), - DMH_INVOKE_STATIC, List.of("LII_I", "LIL_I", "LILIL_I", "LILII_I", + DMH_INVOKE_STATIC, Set.of("LII_I", "LIL_I", "LILIL_I", "LILII_I", "L_I", "L_L", "L_V", "LD_L", "LF_L", "LI_I", "LII_L", "LLI_L", "LL_V", "LL_L", "L3_L", "L4_L", "L5_L", "L6_L", "L7_L", "L8_L", "L9_L", "L10_L", "L10I_L", "L10II_L", "L10IIL_L", @@ -159,15 +159,48 @@ public final class GenerateJLIClassesPlugin implements Plugin { public void configure(Map config) { String mainArgument = config.get(NAME); - if (mainArgument != null && mainArgument.startsWith("@")) { + if ("none".equals(mainArgument)) { + speciesTypes = Set.of(); + invokerTypes = Set.of(); + dmhMethods = Map.of(); + return; + } + + // Start with the default configuration + Set defaultBMHSpecies = defaultSpecies(); + // Expand BMH species signatures + defaultBMHSpecies = defaultBMHSpecies.stream() + .map(type -> expandSignature(type)) + .collect(Collectors.toSet()); + + Set defaultInvokerTypes = defaultInvokers(); + validateMethodTypes(defaultInvokerTypes); + + Map> defaultDmhMethods = defaultDMHMethods(); + for (Set dmhMethodTypes : defaultDmhMethods.values()) { + validateMethodTypes(dmhMethodTypes); + } + + // Extend the default configuration with the contents in the supplied + // input file + if (mainArgument == null || !mainArgument.startsWith("@")) { + speciesTypes = defaultBMHSpecies; + invokerTypes = defaultInvokerTypes; + dmhMethods = defaultDmhMethods; + } else { File file = new File(mainArgument.substring(1)); if (file.exists()) { - speciesTypes = new ArrayList<>(); - invokerTypes = new ArrayList<>(); - dmhMethods = new HashMap<>(); - Stream lines = fileLines(file); - - lines.map(line -> line.split(" ")) + // Use TreeSet/TreeMap to keep things sorted in a deterministic + // order to avoid scrambling the layout on small changes and to + // ease finding methods in the generated code + speciesTypes = new TreeSet<>(defaultBMHSpecies); + invokerTypes = new TreeSet<>(defaultInvokerTypes); + dmhMethods = new TreeMap<>(); + for (Map.Entry> entry : defaultDmhMethods.entrySet()) { + dmhMethods.put(entry.getKey(), new TreeSet<>(entry.getValue())); + } + fileLines(file) + .map(line -> line.split(" ")) .forEach(parts -> { switch (parts[0]) { case "[BMH_RESOLVE]": @@ -191,28 +224,14 @@ public final class GenerateJLIClassesPlugin implements Plugin { } }); } - } else { - List bmhSpecies = defaultSpecies(); - // Expand BMH species signatures - speciesTypes = bmhSpecies.stream() - .map(type -> expandSignature(type)) - .collect(Collectors.toList()); - - invokerTypes = defaultInvokers(); - validateMethodTypes(invokerTypes); - - dmhMethods = defaultDMHMethods(); - for (List dmhMethodTypes : dmhMethods.values()) { - validateMethodTypes(dmhMethodTypes); - } } } private void addDMHMethodType(String dmh, String methodType) { validateMethodType(methodType); - List methodTypes = dmhMethods.get(dmh); + Set methodTypes = dmhMethods.get(dmh); if (methodTypes == null) { - methodTypes = new ArrayList<>(); + methodTypes = new TreeSet<>(); dmhMethods.put(dmh, methodTypes); } methodTypes.add(methodType); @@ -226,7 +245,7 @@ public final class GenerateJLIClassesPlugin implements Plugin { } } - private void validateMethodTypes(List dmhMethodTypes) { + private void validateMethodTypes(Set dmhMethodTypes) { for (String type : dmhMethodTypes) { validateMethodType(type); } @@ -291,13 +310,13 @@ public final class GenerateJLIClassesPlugin implements Plugin { private void generateHolderClasses(ResourcePoolBuilder out) { int count = 0; - for (List entry : dmhMethods.values()) { + for (Set entry : dmhMethods.values()) { count += entry.size(); } MethodType[] directMethodTypes = new MethodType[count]; int[] dmhTypes = new int[count]; int index = 0; - for (Map.Entry> entry : dmhMethods.entrySet()) { + for (Map.Entry> entry : dmhMethods.entrySet()) { String dmhType = entry.getKey(); for (String type : entry.getValue()) { // The DMH type to actually ask for is retrieved by removing @@ -314,10 +333,11 @@ public final class GenerateJLIClassesPlugin implements Plugin { } } MethodType[] invokerMethodTypes = new MethodType[this.invokerTypes.size()]; - for (int i = 0; i < invokerTypes.size(); i++) { + int i = 0; + for (String invokerType : invokerTypes) { // The invoker type to ask for is retrieved by removing the first // and the last argument, which needs to be of Object.class - MethodType mt = asMethodType(invokerTypes.get(i)); + MethodType mt = asMethodType(invokerType); final int lastParam = mt.parameterCount() - 1; if (mt.parameterCount() < 2 || mt.parameterType(0) != Object.class || @@ -327,6 +347,7 @@ public final class GenerateJLIClassesPlugin implements Plugin { } mt = mt.dropParameterTypes(lastParam, lastParam + 1); invokerMethodTypes[i] = mt.dropParameterTypes(0, 1); + i++; } try { byte[] bytes = JLIA.generateDirectMethodHandleHolderClassBytes( diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties index 67c40903eb9..1303d5745c5 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties @@ -68,12 +68,12 @@ exclude-resources.argument= resources to exclude exclude-resources.description=\ Specify resources to exclude. e.g.: **.jcov,glob:**/META-INF/** -generate-jli-classes.argument=<@filename> +generate-jli-classes.argument= generate-jli-classes.description=\ Takes a file hinting to jlink what java.lang.invoke classes to pre-generate. If\n\ -this flag is not specified a default set of classes will be generated, so to \n\ -disable pre-generation supply the name of an empty or non-existing file +this flag is not specified a default set of classes will be generated. To \n\ +disable pre-generation specify none as the argument installed-modules.description=Fast loading of module descriptors (always enabled) @@ -139,7 +139,8 @@ plugin.opt.plugin-module-path=\ \ --plugin-module-path Custom plugin module path plugin.opt.c=\ -\ -c, --compress=2 Enable compression of resources (level 2) +\ -c, --compress=<0|1|2> Enable compression of resources\ +\n More details in --list-plugins option plugin.opt.G=\ \ -G, --strip-debug Strip debug information diff --git a/jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c b/jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c index 8fb337b8ecd..b457950e0d9 100644 --- a/jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c @@ -87,9 +87,32 @@ JNIEXPORT void JNICALL Java_com_sun_management_internal_GcInfoBuilder_fillGcAttr for (i = 0; i < num_attributes; i++) { nativeTypes[i] = ext_att_info[i].type; attName = (*env)->NewStringUTF(env, ext_att_info[i].name); - desc = (*env)->NewStringUTF(env, ext_att_info[i].description); + if ((*env)->ExceptionCheck(env)) { + free(ext_att_info); + free(nativeTypes); + return; + } + (*env)->SetObjectArrayElement(env, attributeNames, i, attName); + if ((*env)->ExceptionCheck(env)) { + free(ext_att_info); + free(nativeTypes); + return; + } + + desc = (*env)->NewStringUTF(env, ext_att_info[i].description); + if ((*env)->ExceptionCheck(env)) { + free(ext_att_info); + free(nativeTypes); + return; + } + (*env)->SetObjectArrayElement(env, descriptions, i, desc); + if ((*env)->ExceptionCheck(env)) { + free(ext_att_info); + free(nativeTypes); + return; + } } (*env)->SetCharArrayRegion(env, types, 0, num_attributes, nativeTypes); diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index 2165bef4aba..38f2392ea0f 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -213,8 +213,6 @@ java/rmi/transport/dgcDeadLock/DGCDeadLock.java 8029360 macosx-a sun/security/pkcs11/ec/TestKeyFactory.java 8026976 generic-all -sun/security/krb5/auto/Unreachable.java 7164518 macosx-all - sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java 8026393 generic-all diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups index be1540695df..d24280a517b 100644 --- a/jdk/test/TEST.groups +++ b/jdk/test/TEST.groups @@ -189,7 +189,6 @@ jdk_security3 = \ -sun/security/krb5 \ -sun/security/jgss \ javax/net \ - sun/net/www/protocol/https \ com/sun/net/ssl \ lib/security diff --git a/jdk/test/com/sun/jdi/SunBootClassPathEmptyTest.java b/jdk/test/com/sun/jdi/SunBootClassPathEmptyTest.java index e062996ee6a..b1eacad1e90 100644 --- a/jdk/test/com/sun/jdi/SunBootClassPathEmptyTest.java +++ b/jdk/test/com/sun/jdi/SunBootClassPathEmptyTest.java @@ -32,7 +32,7 @@ import jdk.test.lib.Asserts; * @summary Verifies that PathSearchingVirtualMachine.bootClassPath() * returns an empty list in case no bootclass path specified * regardless of sun.boot.class.path option, which is now obsolete - * @library /test/lib/share/classes + * @library /test/lib * @compile TestClass.java * @compile SunBootClassPathEmptyTest.java * @run main/othervm SunBootClassPathEmptyTest diff --git a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java index 8a2c224f461..ac8e4f9c2a9 100644 --- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java +++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ import com.sun.management.HotSpotDiagnosticMXBean; * @bug 6455258 * @summary Sanity test for com.sun.management.HotSpotDiagnosticMXBean.dumpHeap method * @library /lib/testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @build jdk.testlibrary.* * @build jdk.test.lib.hprof.* * @build jdk.test.lib.hprof.model.* diff --git a/jdk/test/java/awt/PrintJob/TestPrintJobFrameAssociation.java b/jdk/test/java/awt/PrintJob/TestPrintJobFrameAssociation.java new file mode 100644 index 00000000000..1dd861cf325 --- /dev/null +++ b/jdk/test/java/awt/PrintJob/TestPrintJobFrameAssociation.java @@ -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. + */ +/* + * @test + * @bug 8154218 + * @summary Verifies if owner Frame is associated with print dialog + * @run main/manual TestPrintJobFrameAssociation + */ +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Panel; +import java.awt.JobAttributes; +import java.awt.PrintJob; +import java.awt.Toolkit; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +public class TestPrintJobFrameAssociation { + private static Thread mainThread; + private static boolean testPassed; + private static boolean testGeneratedInterrupt; + private static Button print; + private static Label dialogName; + private static Frame frame; + private static boolean start; + private static Thread t; + + public static void main(String args[]) throws Exception { + SwingUtilities.invokeAndWait(() -> { + doTest(TestPrintJobFrameAssociation::frameTest); + }); + mainThread = Thread.currentThread(); + try { + Thread.sleep(60000); + } catch (InterruptedException e) { + if (!testPassed && testGeneratedInterrupt) { + throw new RuntimeException("Print dialog not disposed." + + " Print dialog is not associated with owner Frame`"); + } + } + if (!testGeneratedInterrupt) { + throw new RuntimeException("user has not executed the test"); + } + } + + private static void frameTest() { + Panel panel =new Panel(); + + print = new Button("Print"); + print.setActionCommand("Print"); + print.addActionListener((e) -> { + JobAttributes ja = new JobAttributes(); + ja.setDialog(JobAttributes.DialogType.COMMON); + + t.start(); + start = true; + PrintJob pjob = Toolkit.getDefaultToolkit().getPrintJob(frame, + "Printing Test", + ja,null); + }); + + panel.add(print); + + frame = new Frame("Test Frame"); + frame.setLayout (new BorderLayout ()); + frame.add(panel,"South"); + frame.pack(); + frame.setVisible(true); + + t = new Thread (() -> { + if (start) { + try { + Thread.sleep(5000); + } catch (InterruptedException ex) {} + frame.dispose(); + } + }); + } + + public static synchronized void pass() { + testPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + public static synchronized void fail() { + testPassed = false; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + private static void doTest(Runnable action) { + String description + = " A Frame with Print Button is shown. Press Print.\n" + + " A cross-platform print dialog will be shown. After 5 secs\n" + + " the frame along with this print dialog will be disposed.\n" + + " If the print dialog is not disposed, press FAIL else press PASS"; + + final JDialog dialog = new JDialog(); + dialog.setTitle("printSelectionTest"); + JTextArea textArea = new JTextArea(description); + textArea.setEditable(false); + final JButton testButton = new JButton("Start Test"); + final JButton passButton = new JButton("PASS"); + passButton.setEnabled(false); + passButton.addActionListener((e) -> { + dialog.dispose(); + pass(); + }); + final JButton failButton = new JButton("FAIL"); + failButton.setEnabled(false); + failButton.addActionListener((e) -> { + dialog.dispose(); + fail(); + }); + testButton.addActionListener((e) -> { + testButton.setEnabled(false); + action.run(); + passButton.setEnabled(true); + failButton.setEnabled(true); + }); + JPanel mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(textArea, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(testButton); + buttonPanel.add(passButton); + buttonPanel.add(failButton); + mainPanel.add(buttonPanel, BorderLayout.SOUTH); + dialog.add(mainPanel); + dialog.pack(); + dialog.setVisible(true); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + System.out.println("main dialog closing"); + testGeneratedInterrupt = false; + mainThread.interrupt(); + } + }); + + } +} diff --git a/jdk/test/java/awt/Window/8159168/SetShapeTest.java b/jdk/test/java/awt/Window/8159168/SetShapeTest.java index 19670a5f46e..9baaea1d084 100644 --- a/jdk/test/java/awt/Window/8159168/SetShapeTest.java +++ b/jdk/test/java/awt/Window/8159168/SetShapeTest.java @@ -1,29 +1,30 @@ /* -* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* This code is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License version 2 only, as -* published by the Free Software Foundation. -* -* This code is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -* version 2 for more details (a copy is included in the LICENSE file that -* accompanied this code). -* -* You should have received a copy of the GNU General Public License version -* 2 along with this work; if not, write to the Free Software Foundation, -* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -* -* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -* or visit www.oracle.com if you need additional information or have any -* questions. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ /** * @test - * @bug 8159168 + * @key headful + * @bug 8159168 8161913 * @summary [hidpi] Window.setShape() works incorrectly on HiDPI * @run main/othervm -Dsun.java2d.uiScale=2 SetShapeTest */ @@ -50,6 +51,7 @@ public class SetShapeTest { Rectangle rect = window.getBounds(); rect.x += rect.width - 10; rect.y += rect.height - 10; + robot.delay(1000); Color c = robot.getPixelColor(rect.x, rect.y); try { if (!c.equals(Color.RED)) { diff --git a/jdk/test/java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java b/jdk/test/java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java index 0b6da116ede..81fdd4b049b 100644 --- a/jdk/test/java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java +++ b/jdk/test/java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java @@ -27,16 +27,14 @@ @bug 6758673 @summary Tests that windows are removed from owner's child windows list @author art: area=awt.toplevel - @run main OwnedWindowsLeak + @run main/othervm -mx128m OwnedWindowsLeak */ -import java.awt.*; -import java.awt.event.*; - -import java.lang.ref.*; -import java.lang.reflect.*; - -import java.util.*; +import java.awt.Frame; +import java.awt.Window; +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.util.Vector; public class OwnedWindowsLeak { diff --git a/jdk/test/java/awt/dnd/URLDragTest/DragLinkFromBrowser.java b/jdk/test/java/awt/dnd/URLDragTest/DragLinkFromBrowser.java new file mode 100644 index 00000000000..6eacad3a7a3 --- /dev/null +++ b/jdk/test/java/awt/dnd/URLDragTest/DragLinkFromBrowser.java @@ -0,0 +1,232 @@ +/* + * 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 8156099 + @summary Drag and drop of link from web browser, DataFlavor types + application/x-java-url and text/uri-list, getTransferData returns null + @run main/manual DragLinkFromBrowser + */ + +import java.awt.Frame; +import java.awt.Button; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.TransferHandler; +import javax.swing.SwingUtilities; +import javax.swing.JOptionPane; + +public class DragLinkFromBrowser implements ActionListener { + + private static GridBagLayout layout; + private static Panel mainControlPanel; + private static Panel resultButtonPanel; + private static TextArea instructionTextArea; + private static Button passButton; + private static Button failButton; + private static Frame mainFrame; + private static Thread mainThread = null; + private static volatile boolean testPassed = false; + private static volatile boolean isInterrupted = false; + private static volatile String failMessage; + private static final int testTimeOut = 300000; + private static JFrame urlFrame; + private static JPanel urlPanel; + + public static void dragLinkFromWebBrowser() { + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + urlFrame = new JFrame(); + urlPanel = new JPanel(); + failMessage = "Dragging link from web browser Failed. " + + "getTransferData returns null"; + urlFrame.getContentPane().add(urlPanel); + urlPanel.setTransferHandler(new TransferHandler() { + @Override + public boolean canImport(final TransferSupport support) { + return true; + } + + @Override + public boolean importData(final TransferSupport support) { + final Transferable transferable = + support.getTransferable(); + final DataFlavor[] flavors + = transferable.getTransferDataFlavors(); + + for (final DataFlavor flavor : flavors) { + try { + final Object transferData + = transferable.getTransferData(flavor); + + if (transferData == null) { + JOptionPane.showMessageDialog(urlPanel, + failMessage); + break; + } else { + String flavorMessage = flavor.toString(); + String transferDataMessage = + transferData.toString(); + if (flavorMessage.contains("error") + || transferDataMessage.contains("null")) { + JOptionPane.showMessageDialog(urlPanel, + failMessage); + break; + } + } + } catch (UnsupportedFlavorException e) { + testFailed("UnsupportedFlavorException - " + + "test Failed"); + } catch (IOException e) { + testFailed("IOException - test Failed"); + } + } + + return true; + } + }); + + urlFrame.setBounds(500, 10, 200, 200); + urlFrame.setVisible(true); + } + }); + } + + private void createInstructionUI() { + mainFrame = new Frame("Drag and drop link from web browser"); + layout = new GridBagLayout(); + mainControlPanel = new Panel(layout); + resultButtonPanel = new Panel(layout); + + GridBagConstraints gbc = new GridBagConstraints(); + String instructions + = "INSTRUCTIONS:" + + "\n 1. Open any browser." + + "\n 2. Select and drag URL from the browser page and " + + "drop it on the panel" + + "\n 3. If test fails, then a popup message will be displayed," + + " click Ok and \n click Fail button." + + "\n 5. Otherwise test passed. Click Pass button."; + + instructionTextArea = new TextArea(); + instructionTextArea.setText(instructions); + instructionTextArea.setEnabled(false); + instructionTextArea.setBackground(Color.white); + + gbc.gridx = 0; + gbc.gridy = 0; + gbc.fill = GridBagConstraints.HORIZONTAL; + mainControlPanel.add(instructionTextArea, gbc); + + passButton = new Button("Pass"); + passButton.setName("Pass"); + passButton.addActionListener(this); + + failButton = new Button("Fail"); + failButton.setName("Fail"); + failButton.addActionListener(this); + + gbc.gridx = 0; + gbc.gridy = 0; + resultButtonPanel.add(passButton, gbc); + gbc.gridx = 1; + gbc.gridy = 0; + resultButtonPanel.add(failButton, gbc); + gbc.gridx = 0; + gbc.gridy = 1; + mainControlPanel.add(resultButtonPanel, gbc); + + mainFrame.add(mainControlPanel); + mainFrame.pack(); + mainFrame.setVisible(true); + } + + @Override + public void actionPerformed(ActionEvent ae) { + if (ae.getSource() instanceof Button) { + Button btn = (Button) ae.getSource(); + switch (btn.getName()) { + case "Pass": + testPassed = true; + isInterrupted = true; + mainThread.interrupt(); + break; + + case "Fail": + testFailed("Dragging link from web browser Failed"); + break; + } + } + } + + public static void cleanUp() { + urlFrame.dispose(); + mainFrame.dispose(); + } + + public static void testFailed(String message) { + testPassed = false; + isInterrupted = true; + failMessage = message; + mainThread.interrupt(); + } + + public static void main(final String[] args) throws Exception { + + DragLinkFromBrowser linkFromBrowser = new DragLinkFromBrowser(); + linkFromBrowser.createInstructionUI(); + linkFromBrowser.dragLinkFromWebBrowser(); + + mainThread = Thread.currentThread(); + try { + mainThread.sleep(testTimeOut); + } catch (InterruptedException ex) { + if (!testPassed) { + throw new RuntimeException(failMessage); + } + } finally { + cleanUp(); + } + + if (!isInterrupted) { + throw new RuntimeException("Test Timed out after " + + testTimeOut / 1000 + " seconds"); + } + } +} + diff --git a/jdk/test/java/awt/font/TextLayout/StyledFontLayoutTest.java b/jdk/test/java/awt/font/TextLayout/StyledFontLayoutTest.java new file mode 100644 index 00000000000..806381451df --- /dev/null +++ b/jdk/test/java/awt/font/TextLayout/StyledFontLayoutTest.java @@ -0,0 +1,118 @@ +/* + * 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 8139176 + * @summary Test layout uses correct styled font. + * @run main StyledFontLayoutTest + */ + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; + +public class StyledFontLayoutTest extends JPanel { + + static final int W=600, H=400; + static boolean interactive; + static BufferedImage im; + public static void main(String[] args) { + + interactive = args.length > 0; + + runTest(); + + if (!interactive) { + return; + } + SwingUtilities.invokeLater(() -> { + JFrame frame = new JFrame("Styled Font Layout Test"); + frame.add(new StyledFontLayoutTest()); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.setSize(W, H); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + } + + @Override + protected void paintComponent(Graphics g) { + g.drawImage(im, 0, 0, null); + } + + private static void runTest() { + im = new BufferedImage(W, H, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = im.createGraphics(); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, W, H); + g2d.setColor(Color.black); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + char[] chs = "Sample Text.".toCharArray(); + int len = chs.length; + + int x = 50, y = 100; + + FontRenderContext frc = g2d.getFontRenderContext(); + Font plain = new Font("Serif", Font.PLAIN, 48); + GlyphVector pgv = plain.layoutGlyphVector(frc, chs, 0, len, 0); + g2d.setFont(plain); + g2d.drawChars(chs, 0, len, x, y); y +=50; + + g2d.drawGlyphVector(pgv, x, y); y += 50; + Rectangle2D plainStrBounds = plain.getStringBounds(chs, 0, len, frc); + Rectangle2D plainGVBounds = pgv.getLogicalBounds(); + Font bold = new Font("Serif", Font.BOLD, 48); + GlyphVector bgv = bold.layoutGlyphVector(frc, chs, 0, len, 0); + Rectangle2D boldStrBounds = bold.getStringBounds(chs, 0, len, frc); + Rectangle2D boldGVBounds = bgv.getLogicalBounds(); + g2d.setFont(bold); + g2d.drawChars(chs, 0, len, x, y); y +=50; + g2d.drawGlyphVector(bgv, x, y); + System.out.println("Plain String Bounds = " + plainStrBounds); + System.out.println("Bold String Bounds = " + boldStrBounds); + System.out.println("Plain GlyphVector Bounds = " + plainGVBounds); + System.out.println("Bold GlyphVector Bounds = " + boldGVBounds); + if (!plainStrBounds.equals(boldStrBounds) && + plainGVBounds.equals(boldGVBounds)) + { + System.out.println("Test failed: Plain GV bounds same as Bold"); + if (!interactive) { + throw new RuntimeException("Plain GV bounds same as Bold"); + } + } + + }; +} diff --git a/jdk/test/java/awt/geom/AffineTransform/InvalidTransformParameterTest.java b/jdk/test/java/awt/geom/AffineTransform/InvalidTransformParameterTest.java new file mode 100644 index 00000000000..f8c36ec21e7 --- /dev/null +++ b/jdk/test/java/awt/geom/AffineTransform/InvalidTransformParameterTest.java @@ -0,0 +1,138 @@ +/* + * 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 8158356 + * @summary Test AffineTransform transformations do not result in SIGSEGV + * if NaN or infinity parameter is passed as argument. + * @run main InvalidTransformParameterTest + */ + +import java.awt.geom.AffineTransform; +import java.awt.image.AffineTransformOp; +import java.awt.image.BufferedImage; +import java.awt.image.ImagingOpException; +import java.awt.Point; +import java.awt.image.DataBuffer; +import java.awt.image.DataBufferByte; +import java.awt.image.PixelInterleavedSampleModel; +import java.awt.image.Raster; +import java.awt.image.WritableRaster; +import java.awt.image.RasterOp; +import java.awt.image.SampleModel; + +public class InvalidTransformParameterTest { + + public static void main(String[] args) { + int count = 0; + final int testScenarios = 12; + double NaNArg = 0.0 / 0.0; + double positiveInfArg = 1.0 / 0.0; + double negativeInfArg = -1.0 / 0.0; + + BufferedImage img = new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB); + + AffineTransform[] inputTransforms = new AffineTransform[testScenarios]; + + for (int i = 0; i < inputTransforms.length; i++) { + inputTransforms[i] = new AffineTransform(); + } + + inputTransforms[0].rotate(NaNArg, img.getWidth()/2, img.getHeight()/2); + inputTransforms[1].translate(NaNArg, NaNArg); + inputTransforms[2].scale(NaNArg, NaNArg); + inputTransforms[3].shear(NaNArg, NaNArg); + + inputTransforms[4].rotate(positiveInfArg, img.getWidth()/2, img.getHeight()/2); + inputTransforms[5].translate(positiveInfArg, positiveInfArg); + inputTransforms[6].scale(positiveInfArg, positiveInfArg); + inputTransforms[7].shear(positiveInfArg, positiveInfArg); + + inputTransforms[8].rotate(negativeInfArg, img.getWidth()/2, img.getHeight()/2); + inputTransforms[9].translate(negativeInfArg, negativeInfArg); + inputTransforms[10].scale(negativeInfArg, negativeInfArg); + inputTransforms[11].shear(negativeInfArg, negativeInfArg); + + // Test BufferedImage AffineTransform --------------------------------- + + for (int i = 0; i < inputTransforms.length; i++) { + try { + testImageTransform(img, inputTransforms[i]); + } catch (ImagingOpException ex) { + count++; + } + } + + if (count != testScenarios) { + throw new RuntimeException("Test failed. All test scenarios did not" + + " result in exception as expected."); + } + + // Test Raster AffineTransform --------------------------------- + + count = 0; + int[] bandOffsets = {0}; + Point location = new Point(0, 0); + DataBuffer db = new DataBufferByte(10 * 10); + SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, + 10, 10, 1, 10, + bandOffsets); + + Raster src = Raster.createRaster(sm, db, location); + WritableRaster dst = Raster.createWritableRaster(sm, db, location); + + for (int i = 0; i < inputTransforms.length; i++) { + try { + testRasterTransform(src, dst, inputTransforms[i]); + } catch (ImagingOpException ex) { + count++; + } + } + + if (count != testScenarios) { + throw new RuntimeException("Test failed. All test scenarios did not" + + " result in exception as expected."); + } + } + + public static BufferedImage testImageTransform(BufferedImage image, + AffineTransform transform) { + AffineTransformOp op = + new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR); + + BufferedImage transformedImage = new BufferedImage(image.getWidth(), + image.getHeight(), + image.getType()); + + return op.filter(image, transformedImage); + } + + public static Raster testRasterTransform(Raster src, WritableRaster dst, + AffineTransform transform) { + AffineTransformOp op = + new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR); + + return op.filter(src, dst); + } +} + diff --git a/jdk/test/java/awt/image/MultiResolutionImage/MultiResolutionDisabledImageTest.java b/jdk/test/java/awt/image/MultiResolutionImage/MultiResolutionDisabledImageTest.java new file mode 100644 index 00000000000..ce5c44d0d8a --- /dev/null +++ b/jdk/test/java/awt/image/MultiResolutionImage/MultiResolutionDisabledImageTest.java @@ -0,0 +1,119 @@ +/* + * 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.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Toolkit; +import java.awt.image.BaseMultiResolutionImage; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; +import javax.swing.GrayFilter; +import java.awt.image.MultiResolutionImage; +import javax.swing.JLabel; + +/** + * @test + * @bug 8156182 + * @summary [macosx] HiDPI/Retina icons do not work for disabled + * JButton/JMenuItem etc. + * @run main/othervm -Dsun.java2d.uiScale=2 MultiResolutionDisabledImageTest + */ +public class MultiResolutionDisabledImageTest { + + private static final String IMAGE_NAME_1X = "image.png"; + private static final String IMAGE_NAME_2X = "image@2x.png"; + private static final int IMAGE_SIZE = 100; + private static final Color COLOR_1X = Color.GREEN; + private static final Color COLOR_2X = Color.BLUE; + + public static void main(String[] args) throws Exception { + + Image baseMRImage = new BaseMultiResolutionImage(createImage(1), + createImage(2)); + testMRDisabledImage(baseMRImage); + + saveImages(); + Image toolkitMRImage = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X); + + if (toolkitMRImage instanceof MultiResolutionImage) { + testMRDisabledImage(toolkitMRImage); + } + } + + private static void testMRDisabledImage(Image image) throws Exception { + + Image disabledImage = GrayFilter.createDisabledImage(image); + MediaTracker mediaTracker = new MediaTracker(new JLabel()); + mediaTracker.addImage(disabledImage, 0); + mediaTracker.waitForID(0); + + BufferedImage buffImage = new BufferedImage(IMAGE_SIZE, + IMAGE_SIZE, + BufferedImage.TYPE_INT_RGB); + + int x = IMAGE_SIZE / 2; + int y = IMAGE_SIZE / 2; + + Graphics2D g = buffImage.createGraphics(); + + g.scale(1, 1); + g.drawImage(disabledImage, 0, 0, null); + int rgb1x = buffImage.getRGB(x, y); + + g.scale(2, 2); + g.drawImage(disabledImage, 0, 0, null); + int rgb2x = buffImage.getRGB(x, y); + + g.dispose(); + + if (rgb1x == rgb2x) { + throw new RuntimeException("Disabled image is the same for the base" + + "image and the resolution variant"); + } + + } + + private static BufferedImage createImage(int scale) throws Exception { + BufferedImage image = new BufferedImage(scale * 200, scale * 300, + BufferedImage.TYPE_INT_RGB); + Graphics g = image.createGraphics(); + g.setColor(scale == 1 ? COLOR_1X : COLOR_2X); + g.fillRect(0, 0, scale * 200, scale * 300); + g.dispose(); + return image; + } + + private static void saveImages() throws Exception { + saveImage(createImage(1), IMAGE_NAME_1X); + saveImage(createImage(2), IMAGE_NAME_2X); + } + + private static void saveImage(BufferedImage image, String name) throws Exception { + ImageIO.write(image, "png", new File(name)); + } +} diff --git a/jdk/test/java/awt/image/VolatileImage/TransparentVImage.java b/jdk/test/java/awt/image/VolatileImage/TransparentVImage.java new file mode 100644 index 00000000000..525099e24ff --- /dev/null +++ b/jdk/test/java/awt/image/VolatileImage/TransparentVImage.java @@ -0,0 +1,260 @@ +/* + * 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 4881082 4916294 5002129 8158524 + * @summary The test verifies whether the rendering operations on transparent + * and translucent VolatileImage objects generate identical output + * as generated with transparent and translucent BufferedImages. + * @key headful + * @run main/othervm -Dsun.java2d.uiScale=1 TransparentVImage + * @run main/othervm -Dsun.java2d.uiScale=1 -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false TransparentVImage + * @run main/othervm -Dsun.java2d.uiScale=1 -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true TransparentVImage + */ +import java.awt.GraphicsConfiguration; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Transparency; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; +import java.awt.Color; +import javax.swing.JFrame; +import javax.swing.JComponent; +import javax.swing.ImageIcon; +import javax.swing.SwingUtilities; + +/* + * This test draws the same contents to 4 images: 2 BufferedImages that are + * transparent and translucent and 2 VolatileImages that are transparent and + * translucent. It compares the results pixel-by-pixel and fails if the + * results are not the same. + */ +public class TransparentVImage + extends JComponent { + + BufferedImage cImgTransparent, cImgTranslucent; + VolatileImage vImgTransparent, vImgTranslucent; + Image sprite; + static final int IMAGE_SIZE = 250; + static final int WINDOW_SIZE = 600; + static boolean doneComparing = false; + static JFrame testFrame = null; + + @Override + public void paint(Graphics g) { + if (cImgTransparent == null) { + GraphicsConfiguration gc = getGraphicsConfiguration(); + // doesn't exist yet: create it (and the other images) + cImgTransparent = (BufferedImage) + gc.createCompatibleImage(IMAGE_SIZE, IMAGE_SIZE, + Transparency.BITMASK); + cImgTranslucent = (BufferedImage) + gc.createCompatibleImage(IMAGE_SIZE, IMAGE_SIZE, + Transparency.TRANSLUCENT); + vImgTransparent = gc.createCompatibleVolatileImage(IMAGE_SIZE, + IMAGE_SIZE, Transparency.BITMASK); + vImgTranslucent = gc.createCompatibleVolatileImage(IMAGE_SIZE, + IMAGE_SIZE, Transparency.TRANSLUCENT); + + String fileName = "duke.gif"; + String separator = System.getProperty("file.separator"); + String dirPath = System.getProperty("test.src", "."); + String filePath = dirPath + separator + fileName; + sprite = new ImageIcon(filePath).getImage(); + + // Now they exist; render to them + Graphics gImg[] = new Graphics[4]; + gImg[0] = cImgTransparent.getGraphics(); + gImg[1] = cImgTranslucent.getGraphics(); + gImg[2] = vImgTransparent.getGraphics(); + gImg[3] = vImgTranslucent.getGraphics(); + + for (int i = 0; i < gImg.length; ++i) { + /* + * VolatileImage utilizes the power of accelerated rendering + * using GPU. The GPU drivers for D3d and OpenGL are supplied + * by OEM vendors and are external to graphics subsystem. Thus + * one cannot guarentee that the drivers will render the + * primitives using exactly the same algorithms as those used + * by BufferedImage. This could result in minor differences in + * pixel values between BufferedImage and VolatileImage. + * + * The pipelines for D3d and OpenGL adjust the rendering with + * fudge factors to align output of GPU rendering with that of + * CPU rendering. Some of the draw calls in this paint method + * are commented indicating a need to fine tune the fudge + * factors in the future. Once they are found to work on all + * hardware, the draw calls will be enabled. + */ + // rectangular fill + gImg[i].setColor(Color.blue); + gImg[i].fillRect(0, 0, IMAGE_SIZE, IMAGE_SIZE); + + /* + * Image copy. Copy it 3 times to get any image management + * acceleration going + */ + int spriteW = sprite.getWidth(null); + gImg[i].drawImage(sprite, 0, 0, null); + gImg[i].drawImage(sprite, spriteW, 0, null); + gImg[i].drawImage(sprite, 2 * spriteW, 0, null); + + // horizontal/vertical/diagonal lines + gImg[i].setColor(Color.red); + gImg[i].drawLine(0, 0, + IMAGE_SIZE - 1, IMAGE_SIZE - 1); + gImg[i].drawLine(IMAGE_SIZE / 2, 0, + IMAGE_SIZE / 2, IMAGE_SIZE - 1); + //gImg[i].drawLine(IMAGE_SIZE, 0, + // 0, IMAGE_SIZE - 1); + gImg[i].drawLine(0, IMAGE_SIZE / 2, + IMAGE_SIZE - 1, IMAGE_SIZE / 2); + + // filled circle + //gImg[i].setColor(Color.yellow); + //gImg[i].fillOval(IMAGE_SIZE / 2 - 20, IMAGE_SIZE / 2 - 20, + // 40, 40); + } + + /* + * Now everything is drawn: let's compare pixels + * First, grab the pixel arrays + */ + int cRgbTransparent[] = new int[IMAGE_SIZE * IMAGE_SIZE]; + int cRgbTranslucent[] = new int[IMAGE_SIZE * IMAGE_SIZE]; + int vRgbTransparent[] = new int[IMAGE_SIZE * IMAGE_SIZE]; + int vRgbTranslucent[] = new int[IMAGE_SIZE * IMAGE_SIZE]; + cImgTransparent.getRGB(0, 0, IMAGE_SIZE, IMAGE_SIZE, + cRgbTransparent, 0, IMAGE_SIZE); + cImgTranslucent.getRGB(0, 0, IMAGE_SIZE, IMAGE_SIZE, + cRgbTranslucent, 0, IMAGE_SIZE); + BufferedImage bImgTransparent = vImgTransparent.getSnapshot(); + bImgTransparent.getRGB(0, 0, IMAGE_SIZE, IMAGE_SIZE, + vRgbTransparent, 0, IMAGE_SIZE); + BufferedImage bImgTranslucent = vImgTranslucent.getSnapshot(); + bImgTranslucent.getRGB(0, 0, IMAGE_SIZE, IMAGE_SIZE, + vRgbTranslucent, 0, IMAGE_SIZE); + + boolean failed = false; + for (int pixel = 0; pixel < cRgbTransparent.length; ++pixel) { + if (cRgbTransparent[pixel] != vRgbTransparent[pixel]) { + failed = true; + System.out.println("Error in transparent image: " + + "BI[" + pixel + "] = " + + Integer.toHexString(cRgbTransparent[pixel]) + + "VI[" + pixel + "] = " + + Integer.toHexString(vRgbTransparent[pixel])); + break; + } + if (cRgbTranslucent[pixel] != vRgbTranslucent[pixel]) { + failed = true; + System.out.println("Error in translucent image: " + + "BI[" + pixel + "] = " + + Integer.toHexString(cRgbTranslucent[pixel]) + + "VI[" + pixel + "] = " + + Integer.toHexString(vRgbTranslucent[pixel])); + break; + } + } + if (failed) { + throw new RuntimeException("Failed: Pixel mis-match observed"); + } + else { + System.out.println("Passed"); + } + doneComparing = true; + } + + g.drawImage(cImgTransparent, 0, 0, null); + g.drawImage(cImgTranslucent, getWidth() - IMAGE_SIZE, 0, null); + g.drawImage(vImgTransparent, 0, getHeight() - IMAGE_SIZE, null); + g.drawImage(vImgTranslucent, getWidth() - IMAGE_SIZE, + getHeight() - IMAGE_SIZE, null); + } + + private static void constructTestUI() { + testFrame = new JFrame(); + testFrame.setSize(600, 600); + testFrame.setResizable(false); + testFrame.getContentPane().add(new TransparentVImage()); + + testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + testFrame.setLocationRelativeTo(null); + testFrame.setVisible(true); + } + + private static void destroyTestUI() { + testFrame.dispose(); + } + + public static void main(String args[]) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + try { + // Construct the test interface + constructTestUI(); + } catch (Exception ex) { + // Throw an exception indicating error while creating UI + throw new RuntimeException("Test Failed: Error while" + + " creating the test interface."); + } + } + }); + + /* + * Wait until the image comparison between VolatileImage and + * BufferedImage is complete. + */ + while (!doneComparing) { + try { + Thread.sleep(100); + } + catch (Exception e) {} + } + + /* + * Now sleep just a little longer to let the user see the resulting + * images in the frame + */ + try { + Thread.sleep(5000); + } + catch (Exception e) {} + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + try { + // Destroy the test interface + destroyTestUI(); + } catch (Exception ex) { + // Throw an exception indicating error while deleting UI + throw new RuntimeException("Test Failed: Error while" + + " deleting the test interface."); + } + } + }); + } +} diff --git a/jdk/test/java/awt/image/VolatileImage/duke.gif b/jdk/test/java/awt/image/VolatileImage/duke.gif new file mode 100644 index 00000000000..ed32e0ff79b Binary files /dev/null and b/jdk/test/java/awt/image/VolatileImage/duke.gif differ diff --git a/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java b/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java index 985041f6a1c..6083366e925 100644 --- a/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java +++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java @@ -23,10 +23,10 @@ /** * @test - * @bug 8147648 + * @bug 8147648 8163160 * @summary [hidpi] multiresolution image: wrong resolution variant is used as * icon in the Unity panel - * @run main/othervm -Dsun.java2d.uiScale=2 IconTest + * @run main/manual/othervm -Dsun.java2d.uiScale=2 IconTest */ import java.awt.Color; import java.awt.Graphics; @@ -67,7 +67,7 @@ public class IconTest { if (g != null) { g.setColor(c); g.fillRect(0, 0, x, x); - g.setColor(Color.YELLOW); + g.setColor(Color.GREEN); g.drawRect(0, 0, x-1, x-1); } } finally { @@ -91,7 +91,8 @@ public class IconTest { GridBagConstraints gbc = new GridBagConstraints(); String instructions = "INSTRUCTIONS:
    " - + "Check if test button and unity icons are both blue with yellow border.

    " + + "Check if test button icon and unity icon are both " + + "blue with green border.

    " + "If Icon color is blue press pass" + " else press fail.

    "; diff --git a/jdk/test/java/awt/print/PrinterJob/TestMediaTraySelection.java b/jdk/test/java/awt/print/PrinterJob/TestMediaTraySelection.java new file mode 100644 index 00000000000..374928a56c5 --- /dev/null +++ b/jdk/test/java/awt/print/PrinterJob/TestMediaTraySelection.java @@ -0,0 +1,185 @@ +/* + * 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 6357887 + * @summary Verifies if selected printertray is used + * @requires (os.family == "linux" | os.family == "solaris") + * @run main/manual TestMediaTraySelection + */ + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import javax.print.DocFlavor; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.standard.Media; +import javax.print.attribute.standard.MediaTray; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +public class TestMediaTraySelection implements Printable { + + private static Thread mainThread; + private static boolean testPassed; + private static boolean testGeneratedInterrupt; + private static PrintService prservices; + + public static void main(String[] args) throws Exception { + prservices = PrintServiceLookup.lookupDefaultPrintService(); + if (prservices == null) { + System.out.println("No print service found"); + return; + } + System.out.println(" Print service " + prservices); + SwingUtilities.invokeAndWait(() -> { + doTest(TestMediaTraySelection::printTest); + }); + mainThread = Thread.currentThread(); + try { + Thread.sleep(90000); + } catch (InterruptedException e) { + if (!testPassed && testGeneratedInterrupt) { + throw new RuntimeException("Banner page did not print"); + } + } + if (!testGeneratedInterrupt) { + throw new RuntimeException("user has not executed the test"); + } + } + + private static void printTest() { + + MediaTray tray = null; + //tray = getMediaTray( prservices, "Bypass Tray" ); + tray = getMediaTray( prservices, "Tray 4" ); + PrintRequestAttributeSet atrset = new HashPrintRequestAttributeSet(); + //atrset.add( MediaSizeName.ISO_A4 ); + atrset.add(tray); + PrinterJob pjob = PrinterJob.getPrinterJob(); + pjob.setPrintable(new TestMediaTraySelection()); + try { + pjob.print(atrset); + } catch (PrinterException e) { + e.printStackTrace(); + fail(); + } + } + + static MediaTray getMediaTray( PrintService ps, String name) { + Media[] media = (Media[])ps.getSupportedAttributeValues( Media.class, + DocFlavor.SERVICE_FORMATTED.PAGEABLE, null); + + for (Media m : media) { + if ( m instanceof MediaTray) { + System.out.println("MediaTray=" + m.toString() ); + if ( m.toString().trim().indexOf( name ) > -1 ) { + return (MediaTray)m; + } + } + } + return null; + } + + public static synchronized void pass() { + testPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + public static synchronized void fail() { + testPassed = false; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + private static void doTest(Runnable action) { + String description + = " Please verify the \"Tray 4\" of printer is used for printout\n" + + " and not standard/auto tray. If yes, press PASS else press FAIL"; + + final JDialog dialog = new JDialog(); + dialog.setTitle("printBannerTest"); + JTextArea textArea = new JTextArea(description); + textArea.setEditable(false); + final JButton testButton = new JButton("Start Test"); + final JButton passButton = new JButton("PASS"); + passButton.setEnabled(false); + passButton.addActionListener((e) -> { + dialog.dispose(); + pass(); + }); + final JButton failButton = new JButton("FAIL"); + failButton.setEnabled(false); + failButton.addActionListener((e) -> { + dialog.dispose(); + fail(); + }); + testButton.addActionListener((e) -> { + testButton.setEnabled(false); + action.run(); + passButton.setEnabled(true); + failButton.setEnabled(true); + }); + JPanel mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(textArea, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(testButton); + buttonPanel.add(passButton); + buttonPanel.add(failButton); + mainPanel.add(buttonPanel, BorderLayout.SOUTH); + dialog.add(mainPanel); + dialog.pack(); + dialog.setVisible(true); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + System.out.println("main dialog closing"); + testGeneratedInterrupt = false; + mainThread.interrupt(); + } + }); + } + + @Override + public int print(Graphics g, PageFormat pf, int pi) { + System.out.println("pi = " + pi); + if (pi > 0) { + return NO_SUCH_PAGE; + } + g.drawString("Testing : " , 200, 200); + return PAGE_EXISTS; + } +} diff --git a/jdk/test/java/beans/Introspector/Test8027905.java b/jdk/test/java/beans/Introspector/Test8027905.java index 6c91694b4df..60318f34555 100644 --- a/jdk/test/java/beans/Introspector/Test8027905.java +++ b/jdk/test/java/beans/Introspector/Test8027905.java @@ -28,6 +28,7 @@ import java.beans.PropertyDescriptor; * @bug 8027905 * @summary Tests that GC does not affect a property type * @author Sergey Malenkov + * @run main/othervm -mx16m Test8027905 */ public class Test8027905 { diff --git a/jdk/test/java/lang/Class/GetModuleTest.java b/jdk/test/java/lang/Class/GetModuleTest.java index 918e4dd9dd1..359f7ca2ff7 100644 --- a/jdk/test/java/lang/Class/GetModuleTest.java +++ b/jdk/test/java/lang/Class/GetModuleTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/jdk/test/java/lang/Class/GetPackageTest.java b/jdk/test/java/lang/Class/GetPackageTest.java index f9cb5fb31ff..5f6c96f0d44 100644 --- a/jdk/test/java/lang/Class/GetPackageTest.java +++ b/jdk/test/java/lang/Class/GetPackageTest.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/jdk/test/java/lang/ClassLoader/GetSystemPackage.java b/jdk/test/java/lang/ClassLoader/GetSystemPackage.java index fba5648f5f4..56152b5907f 100644 --- a/jdk/test/java/lang/ClassLoader/GetSystemPackage.java +++ b/jdk/test/java/lang/ClassLoader/GetSystemPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java b/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java index 26fbe3dd586..691c509e2e9 100644 --- a/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java +++ b/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java index 9a1d97647f7..e17e28865e4 100644 --- a/jdk/test/java/lang/ProcessBuilder/Basic.java +++ b/jdk/test/java/lang/ProcessBuilder/Basic.java @@ -2226,6 +2226,33 @@ public class Basic { reader.join(); } } + + //---------------------------------------------------------------- + // Check the Process toString() method + //---------------------------------------------------------------- + { + List childArgs = new ArrayList(javaChildArgs); + childArgs.add("testIO"); + ProcessBuilder pb = new ProcessBuilder(childArgs); + pb.redirectInput(Redirect.PIPE); + pb.redirectOutput(DISCARD); + pb.redirectError(DISCARD); + final Process p = pb.start(); + // Child process waits until it gets input + String s = p.toString(); + check(s.contains("not exited")); + check(s.contains("pid=" + p.getPid() + ",")); + + new PrintStream(p.getOutputStream()).print("standard input"); + p.getOutputStream().close(); + + // Check the toString after it exits + int exitValue = p.waitFor(); + s = p.toString(); + check(s.contains("pid=" + p.getPid() + ",")); + check(s.contains("exitValue=" + exitValue) && + !s.contains("not exited")); + } } catch (Throwable t) { unexpected(t); } //---------------------------------------------------------------- diff --git a/jdk/test/java/lang/ProcessBuilder/CloseRace.java b/jdk/test/java/lang/ProcessBuilder/CloseRace.java index a9afbd2ba91..1fa6d8d5e15 100644 --- a/jdk/test/java/lang/ProcessBuilder/CloseRace.java +++ b/jdk/test/java/lang/ProcessBuilder/CloseRace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/jdk/test/java/lang/ProcessBuilder/PipelineTest.java b/jdk/test/java/lang/ProcessBuilder/PipelineTest.java index 9f6ec99fb70..90b277ad9eb 100644 --- a/jdk/test/java/lang/ProcessBuilder/PipelineTest.java +++ b/jdk/test/java/lang/ProcessBuilder/PipelineTest.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ import java.io.File; diff --git a/jdk/test/java/lang/ProcessBuilder/Zombies.java b/jdk/test/java/lang/ProcessBuilder/Zombies.java index 30f296cc513..10c804ee1d4 100644 --- a/jdk/test/java/lang/ProcessBuilder/Zombies.java +++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java @@ -25,7 +25,6 @@ * @test * @run main/othervm Zombies * @bug 6474073 6180151 - * @key intermittent * @summary Make sure zombies don't get created on Unix * @author Martin Buchholz */ diff --git a/jdk/test/java/lang/ProcessHandle/Basic.java b/jdk/test/java/lang/ProcessHandle/Basic.java index b759e9c7c39..c34bcab098b 100644 --- a/jdk/test/java/lang/ProcessHandle/Basic.java +++ b/jdk/test/java/lang/ProcessHandle/Basic.java @@ -36,7 +36,7 @@ import org.testng.annotations.Test; /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.management * @run testng Basic diff --git a/jdk/test/java/lang/ProcessHandle/InfoTest.java b/jdk/test/java/lang/ProcessHandle/InfoTest.java index 7d8867d67da..fbd855db91d 100644 --- a/jdk/test/java/lang/ProcessHandle/InfoTest.java +++ b/jdk/test/java/lang/ProcessHandle/InfoTest.java @@ -48,7 +48,7 @@ import org.testng.annotations.Test; /* * @test * @bug 8077350 8081566 8081567 8098852 8136597 - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.management * @build jdk.test.lib.Platform jdk.test.lib.Utils diff --git a/jdk/test/java/lang/ProcessHandle/OnExitTest.java b/jdk/test/java/lang/ProcessHandle/OnExitTest.java index c797f4a705b..ff9f4c2607c 100644 --- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java +++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java @@ -38,7 +38,7 @@ import org.testng.TestNG; /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.management * @build jdk.test.lib.Platform jdk.test.lib.Utils diff --git a/jdk/test/java/lang/ProcessHandle/TreeTest.java b/jdk/test/java/lang/ProcessHandle/TreeTest.java index bb62d06353c..a1493b65882 100644 --- a/jdk/test/java/lang/ProcessHandle/TreeTest.java +++ b/jdk/test/java/lang/ProcessHandle/TreeTest.java @@ -44,7 +44,7 @@ import org.testng.annotations.Test; /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.management * @build jdk.test.lib.Utils diff --git a/jdk/test/java/lang/StackWalker/CountLocalSlots.java b/jdk/test/java/lang/StackWalker/CountLocalSlots.java index c78a4cb7bf4..066055b0a1d 100644 --- a/jdk/test/java/lang/StackWalker/CountLocalSlots.java +++ b/jdk/test/java/lang/StackWalker/CountLocalSlots.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/StackWalker/LocalsAndOperands.java b/jdk/test/java/lang/StackWalker/LocalsAndOperands.java index b253ab27e81..f4f646549ec 100644 --- a/jdk/test/java/lang/StackWalker/LocalsAndOperands.java +++ b/jdk/test/java/lang/StackWalker/LocalsAndOperands.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/StackWalker/LocalsCrash.java b/jdk/test/java/lang/StackWalker/LocalsCrash.java index b50dd263f00..87415e4df0c 100644 --- a/jdk/test/java/lang/StackWalker/LocalsCrash.java +++ b/jdk/test/java/lang/StackWalker/LocalsCrash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/String/concat/CompactStringsInitialCoder.java b/jdk/test/java/lang/String/concat/CompactStringsInitialCoder.java index 6f566c33eb9..5669bce2fd8 100644 --- a/jdk/test/java/lang/String/concat/CompactStringsInitialCoder.java +++ b/jdk/test/java/lang/String/concat/CompactStringsInitialCoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/String/concat/StringConcatFactoryEmptyMethods.java b/jdk/test/java/lang/String/concat/StringConcatFactoryEmptyMethods.java index 31b29cd30fd..7ee0d988529 100644 --- a/jdk/test/java/lang/String/concat/StringConcatFactoryEmptyMethods.java +++ b/jdk/test/java/lang/String/concat/StringConcatFactoryEmptyMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/String/concat/WithSecurityManager.java b/jdk/test/java/lang/String/concat/WithSecurityManager.java index 9359d29fbb1..2835a3813f4 100644 --- a/jdk/test/java/lang/String/concat/WithSecurityManager.java +++ b/jdk/test/java/lang/String/concat/WithSecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/Thread/ThreadStateController.java b/jdk/test/java/lang/Thread/ThreadStateController.java index 728a115c271..c426d1b34b4 100644 --- a/jdk/test/java/lang/Thread/ThreadStateController.java +++ b/jdk/test/java/lang/Thread/ThreadStateController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedReceiverType.java b/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedReceiverType.java index e9608089763..084ed563809 100644 --- a/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedReceiverType.java +++ b/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedReceiverType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/jdk/test/java/lang/instrument/NMTHelper.java b/jdk/test/java/lang/instrument/NMTHelper.java index 09e60e4a623..07ee25be38d 100644 --- a/jdk/test/java/lang/instrument/NMTHelper.java +++ b/jdk/test/java/lang/instrument/NMTHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java b/jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java index 4522d8b1055..47090167051 100644 --- a/jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java +++ b/jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java @@ -24,6 +24,7 @@ /** * @test * @bug 6263319 + * @requires ((vm.opt.StartFlightRecording == null) | (vm.opt.StartFlightRecording == false)) & ((vm.opt.FlightRecorder == null) | (vm.opt.FlightRecorder == false)) * @summary test setNativeMethodPrefix * @author Robert Field, Sun Microsystems * diff --git a/jdk/test/java/lang/instrument/RedefineBigClass.sh b/jdk/test/java/lang/instrument/RedefineBigClass.sh index 60fb081055a..4f625a7501c 100644 --- a/jdk/test/java/lang/instrument/RedefineBigClass.sh +++ b/jdk/test/java/lang/instrument/RedefineBigClass.sh @@ -70,7 +70,7 @@ else fi "${JAVA}" ${TESTVMOPTS} \ - -XX:TraceRedefineClasses=3 ${NMT} \ + -Xlog:redefine+class+load=debug,redefine+class+load+exceptions=info ${NMT} \ -javaagent:RedefineBigClassAgent.jar=BigClass.class \ -classpath "${TESTCLASSES}" RedefineBigClassApp \ > output.log 2>&1 diff --git a/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh index 357e24417f9..e583c9df469 100644 --- a/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh +++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh @@ -87,23 +87,8 @@ mv RedefineSubclassWithTwoInterfacesImpl.class \ echo "INFO: launching RedefineSubclassWithTwoInterfacesApp" -# TraceRedefineClasses options: -# -# 0x00000001 | 1 - name each target class before loading, after -# loading and after redefinition is completed -# 0x00000002 | 2 - print info if parsing, linking or -# verification throws an exception -# 0x00000004 | 4 - print timer info for the VM operation -# 0x00001000 | 4096 - detect calls to obsolete methods -# 0x00002000 | 8192 - fail a guarantee() in addition to detection -# 0x00004000 | 16384 - detect old/obsolete methods in metadata -# 0x00100000 | 1048576 - impl details: vtable updates -# 0x00200000 | 2097152 - impl details: itable updates -# -# 1+2+4+4096+8192+16384+1048576+2097152 == 3174407 - "${JAVA}" ${TESTVMOPTS} \ - -XX:TraceRedefineClasses=3174407 \ + -Xlog:redefine+class+load=trace,redefine+class+load+exceptions=trace,redefine+class+timer=trace,redefine+class+obsolete=trace,redefine+class+obsolete+metadata=trace,redefine+class+constantpool=trace \ -javaagent:RedefineSubclassWithTwoInterfacesAgent.jar \ -classpath "${TESTCLASSES}" \ RedefineSubclassWithTwoInterfacesApp > output.log 2>&1 diff --git a/jdk/test/java/lang/instrument/RetransformBigClass.sh b/jdk/test/java/lang/instrument/RetransformBigClass.sh index 7144689722b..455f42a3247 100644 --- a/jdk/test/java/lang/instrument/RetransformBigClass.sh +++ b/jdk/test/java/lang/instrument/RetransformBigClass.sh @@ -70,7 +70,7 @@ else fi "${JAVA}" ${TESTVMOPTS} \ - -XX:TraceRedefineClasses=3 ${NMT} \ + -Xlog:redefine+class+load=debug,redefine+class+load+exceptions=info ${NMT} \ -javaagent:RetransformBigClassAgent.jar=BigClass.class \ -classpath "${TESTCLASSES}" RetransformBigClassApp \ > output.log 2>&1 diff --git a/jdk/test/java/lang/invoke/6987555/Test6987555.java b/jdk/test/java/lang/invoke/6987555/Test6987555.java index 7a2f45c6efe..eb939007326 100644 --- a/jdk/test/java/lang/invoke/6987555/Test6987555.java +++ b/jdk/test/java/lang/invoke/6987555/Test6987555.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/6991596/Test6991596.java b/jdk/test/java/lang/invoke/6991596/Test6991596.java index a7083bd8114..193009deafd 100644 --- a/jdk/test/java/lang/invoke/6991596/Test6991596.java +++ b/jdk/test/java/lang/invoke/6991596/Test6991596.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/6998541/Test6998541.java b/jdk/test/java/lang/invoke/6998541/Test6998541.java index 1edf14f9dc6..983c23b3640 100644 --- a/jdk/test/java/lang/invoke/6998541/Test6998541.java +++ b/jdk/test/java/lang/invoke/6998541/Test6998541.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/7087570/Test7087570.java b/jdk/test/java/lang/invoke/7087570/Test7087570.java index 732467b8c62..165968c6069 100644 --- a/jdk/test/java/lang/invoke/7087570/Test7087570.java +++ b/jdk/test/java/lang/invoke/7087570/Test7087570.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /* @test diff --git a/jdk/test/java/lang/invoke/7157574/Test7157574.java b/jdk/test/java/lang/invoke/7157574/Test7157574.java index acf9ef48a04..d2a91d92626 100644 --- a/jdk/test/java/lang/invoke/7157574/Test7157574.java +++ b/jdk/test/java/lang/invoke/7157574/Test7157574.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /* diff --git a/jdk/test/java/lang/invoke/7196190/ClassForNameTest.java b/jdk/test/java/lang/invoke/7196190/ClassForNameTest.java index 4730efafb6c..e0797f0f741 100644 --- a/jdk/test/java/lang/invoke/7196190/ClassForNameTest.java +++ b/jdk/test/java/lang/invoke/7196190/ClassForNameTest.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java b/jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java index 24a9512ffaf..57a06d16b05 100644 --- a/jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java +++ b/jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/8009222/Test8009222.java b/jdk/test/java/lang/invoke/8009222/Test8009222.java index 711969387ed..62ee09c066a 100644 --- a/jdk/test/java/lang/invoke/8009222/Test8009222.java +++ b/jdk/test/java/lang/invoke/8009222/Test8009222.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/8022701/BogoLoader.java b/jdk/test/java/lang/invoke/8022701/BogoLoader.java index e77be6f44ff..e8c579a27c8 100644 --- a/jdk/test/java/lang/invoke/8022701/BogoLoader.java +++ b/jdk/test/java/lang/invoke/8022701/BogoLoader.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ import java.io.BufferedInputStream; diff --git a/jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java b/jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java index 5c1f64bf9b0..011ae7f43a5 100644 --- a/jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java +++ b/jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ import java.lang.reflect.InvocationTargetException; diff --git a/jdk/test/java/lang/invoke/8022701/Invoker.java b/jdk/test/java/lang/invoke/8022701/Invoker.java index a97159e9e29..62015fae371 100644 --- a/jdk/test/java/lang/invoke/8022701/Invoker.java +++ b/jdk/test/java/lang/invoke/8022701/Invoker.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ public class Invoker { diff --git a/jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java b/jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java index badc1a817f3..18d4a4c6752 100644 --- a/jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java +++ b/jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/8022701/MethodSupplier.java b/jdk/test/java/lang/invoke/8022701/MethodSupplier.java index 4699a52aaff..5ef4d20f1ac 100644 --- a/jdk/test/java/lang/invoke/8022701/MethodSupplier.java +++ b/jdk/test/java/lang/invoke/8022701/MethodSupplier.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /* diff --git a/jdk/test/java/lang/invoke/CallSiteTest.java b/jdk/test/java/lang/invoke/CallSiteTest.java index 48b0d7b6d9a..bf0fe2e4dc7 100644 --- a/jdk/test/java/lang/invoke/CallSiteTest.java +++ b/jdk/test/java/lang/invoke/CallSiteTest.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/CallStaticInitOrder.java b/jdk/test/java/lang/invoke/CallStaticInitOrder.java index 83808f8fb9f..4090e8fff2d 100644 --- a/jdk/test/java/lang/invoke/CallStaticInitOrder.java +++ b/jdk/test/java/lang/invoke/CallStaticInitOrder.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java index edfe52af8a7..7356b290768 100644 --- a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java +++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java index 154109c883a..771e87f67aa 100644 --- a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java +++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java @@ -19,8 +19,8 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ + package p1; import p2.T3; diff --git a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java index 9f4d7cee9bc..0deba761a74 100644 --- a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java +++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java @@ -19,8 +19,8 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ + package p2; import p1.T2; diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java index ed3160b9979..aa66b2fd726 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java @@ -132,7 +132,8 @@ abstract class VarHandleBaseTest { COMPARE_AND_SET, COMPARE_AND_EXCHANGE, GET_AND_SET, - GET_AND_ADD; + GET_AND_ADD, + GET_AND_BITWISE; } enum TestAccessMode { @@ -148,13 +149,26 @@ abstract class VarHandleBaseTest { COMPARE_AND_EXCHANGE(TestAccessType.COMPARE_AND_EXCHANGE), COMPARE_AND_EXCHANGE_ACQUIRE(TestAccessType.COMPARE_AND_EXCHANGE), COMPARE_AND_EXCHANGE_RELEASE(TestAccessType.COMPARE_AND_EXCHANGE), + WEAK_COMPARE_AND_SET_PLAIN(TestAccessType.COMPARE_AND_SET), WEAK_COMPARE_AND_SET(TestAccessType.COMPARE_AND_SET), - WEAK_COMPARE_AND_SET_VOLATILE(TestAccessType.COMPARE_AND_SET), WEAK_COMPARE_AND_SET_ACQUIRE(TestAccessType.COMPARE_AND_SET), WEAK_COMPARE_AND_SET_RELEASE(TestAccessType.COMPARE_AND_SET), GET_AND_SET(TestAccessType.GET_AND_SET), + GET_AND_SET_ACQUIRE(TestAccessType.GET_AND_SET), + GET_AND_SET_RELEASE(TestAccessType.GET_AND_SET), GET_AND_ADD(TestAccessType.GET_AND_ADD), - ADD_AND_GET(TestAccessType.GET_AND_ADD),; + GET_AND_ADD_ACQUIRE(TestAccessType.GET_AND_ADD), + GET_AND_ADD_RELEASE(TestAccessType.GET_AND_ADD), + GET_AND_BITWISE_OR(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_OR_ACQUIRE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_OR_RELEASE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_AND(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_AND_ACQUIRE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_AND_RELEASE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_XOR(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_XOR_ACQUIRE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_XOR_RELEASE(TestAccessType.GET_AND_BITWISE), + ; final TestAccessType at; final boolean isPolyMorphicInReturnType; diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java index ae23346c689..a4d54635d95 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -266,8 +279,13 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(recv, true); + boolean o = (boolean) vh.getAndAddAcquire(recv, true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(recv, true); + }); + } @@ -321,8 +339,13 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(true); + boolean o = (boolean) vh.getAndAddAcquire(true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(true); + }); + } @@ -418,11 +441,11 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, true, false); + success = vh.weakCompareAndSetPlain(recv, true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(recv); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -448,21 +471,125 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, false, true); + success = vh.weakCompareAndSet(recv, false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) vh.get(recv); - assertEquals(x, true, "weakCompareAndSetVolatile boolean value"); + assertEquals(x, true, "weakCompareAndSet boolean value"); } // Compare set and get { + vh.set(recv, true); + boolean o = (boolean) vh.getAndSet(recv, false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) vh.get(recv); assertEquals(x, false, "getAndSet boolean value"); } + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndSetAcquire(recv, false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndSetRelease(recv, false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseOr(recv, false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseOrAcquire(recv, false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseOrRelease(recv, false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseAnd(recv, false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseAndAcquire(recv, false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseAndRelease(recv, false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseXor(recv, false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseXorAcquire(recv, false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseXorRelease(recv, false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } static void testInstanceFieldUnsupported(VarHandleTestAccessBoolean recv, VarHandle vh) { @@ -472,8 +599,13 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(recv, true); + boolean o = (boolean) vh.getAndAddAcquire(recv, true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(recv, true); + }); + } @@ -569,11 +701,11 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(true, false); + success = vh.weakCompareAndSetPlain(true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -599,21 +731,125 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(false, true); + success = vh.weakCompareAndSet(false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) vh.get(); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get { + vh.set(true); + boolean o = (boolean) vh.getAndSet(false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) vh.get(); assertEquals(x, false, "getAndSet boolean value"); } + { + vh.set(true); + + boolean o = (boolean) vh.getAndSetAcquire(false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndSetRelease(false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseOr(false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseOrAcquire(false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseOrRelease(false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseAnd(false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseAndAcquire(false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseAndRelease(false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseXor(false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseXorAcquire(false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseXorRelease(false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } static void testStaticFieldUnsupported(VarHandle vh) { @@ -623,8 +859,13 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(true); + boolean o = (boolean) vh.getAndAddAcquire(true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(true); + }); + } @@ -723,11 +964,11 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, true, false); + success = vh.weakCompareAndSetPlain(array, i, true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(array, i); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -753,21 +994,125 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, false, true); + success = vh.weakCompareAndSet(array, i, false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) vh.get(array, i); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get { + vh.set(array, i, true); + boolean o = (boolean) vh.getAndSet(array, i, false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) vh.get(array, i); assertEquals(x, false, "getAndSet boolean value"); } + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndSetAcquire(array, i, false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndSetRelease(array, i, false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseOr(array, i, false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseOrAcquire(array, i, false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseOrRelease(array, i, false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseAnd(array, i, false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseAndAcquire(array, i, false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseAndRelease(array, i, false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseXor(array, i, false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseXorAcquire(array, i, false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseXorRelease(array, i, false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } } @@ -781,8 +1126,13 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(array, i, true); + boolean o = (boolean) vh.getAndAddAcquire(array, i, true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(array, i, true); + }); + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -840,11 +1190,11 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, true, false); + boolean r = vh.weakCompareAndSetPlain(array, ci, true, false); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, true, false); + boolean r = vh.weakCompareAndSet(array, ci, true, false); }); checkIOOBE(() -> { @@ -859,6 +1209,50 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { boolean o = (boolean) vh.getAndSet(array, ci, true); }); + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndSetAcquire(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndSetRelease(array, ci, true); + }); + + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseOr(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseOrAcquire(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseOrRelease(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseAnd(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseAndAcquire(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseAndRelease(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseXor(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseXorAcquire(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseXorRelease(array, ci, true); + }); } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java index 754f4908a8a..be79776202b 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { }); + } @@ -309,6 +323,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { }); + } @@ -404,11 +419,11 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, (byte)0x01, (byte)0x23); + success = vh.weakCompareAndSetPlain(recv, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) vh.get(recv); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -434,34 +449,157 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, (byte)0x23, (byte)0x01); + success = vh.weakCompareAndSet(recv, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) vh.get(recv); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte value"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte value"); } // Compare set and get { + vh.set(recv, (byte)0x01); + byte o = (byte) vh.getAndSet(recv, (byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) vh.get(recv); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - vh.set(recv, (byte)0x01); + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndSetAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndSetRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) vh.getAndAdd(recv, (byte)0x45); + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndAdd(recv, (byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) vh.addAndGet(recv, (byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndAddAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndAddRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddReleasebyte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOr(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAnd(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXor(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessByte recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet((byte)0x01, (byte)0x23); + success = vh.weakCompareAndSetPlain((byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) vh.get(); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -587,34 +725,157 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease((byte)0x23, (byte)0x01); + success = vh.weakCompareAndSet((byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) vh.get(); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get { + vh.set((byte)0x01); + byte o = (byte) vh.getAndSet((byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) vh.get(); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - vh.set((byte)0x01); + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndSetAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndSetRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) vh.getAndAdd( (byte)0x45); + vh.set((byte)0x01); + + byte o = (byte) vh.getAndAdd((byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) vh.addAndGet((byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndAddAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndAddRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddReleasebyte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseOr((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseAnd((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseXor((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, (byte)0x01, (byte)0x23); + success = vh.weakCompareAndSetPlain(array, i, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) vh.get(array, i); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -743,29 +1004,151 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, (byte)0x23, (byte)0x01); + success = vh.weakCompareAndSet(array, i, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) vh.get(array, i); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get { + vh.set(array, i, (byte)0x01); + byte o = (byte) vh.getAndSet(array, i, (byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) vh.get(array, i); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - vh.set(array, i, (byte)0x01); + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndSetAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndSetRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) vh.getAndAdd(array, i, (byte)0x45); + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndAdd(array, i, (byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) vh.addAndGet(array, i, (byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndAddAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndAddRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddReleasebyte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOr(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAnd(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXor(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } } @@ -775,6 +1158,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, (byte)0x01, (byte)0x23); + boolean r = vh.weakCompareAndSetPlain(array, ci, (byte)0x01, (byte)0x23); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, (byte)0x01, (byte)0x23); + boolean r = vh.weakCompareAndSet(array, ci, (byte)0x01, (byte)0x23); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { }); checkIOOBE(() -> { - byte o = (byte) vh.getAndAdd(array, ci, (byte)0x45); + byte o = (byte) vh.getAndSetAcquire(array, ci, (byte)0x01); }); checkIOOBE(() -> { - byte o = (byte) vh.addAndGet(array, ci, (byte)0x45); + byte o = (byte) vh.getAndSetRelease(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndAdd(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndAddAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndAddRelease(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseOr(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseOrAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseOrRelease(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseAnd(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseAndAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseAndRelease(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseXor(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseXorAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseXorRelease(array, ci, (byte)0x01); }); } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java index 9a0af41e930..6e2f42cee14 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { }); + } @@ -309,6 +323,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { }); + } @@ -404,11 +419,11 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, '\u0123', '\u4567'); + success = vh.weakCompareAndSetPlain(recv, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) vh.get(recv); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -434,34 +449,157 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, '\u4567', '\u0123'); + success = vh.weakCompareAndSet(recv, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) vh.get(recv); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char value"); + assertEquals(x, '\u0123', "weakCompareAndSet char value"); } // Compare set and get { + vh.set(recv, '\u0123'); + char o = (char) vh.getAndSet(recv, '\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) vh.get(recv); assertEquals(x, '\u4567', "getAndSet char value"); } - vh.set(recv, '\u0123'); + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndSetAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndSetRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) vh.get(recv); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) vh.getAndAdd(recv, '\u89AB'); + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndAdd(recv, '\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) vh.addAndGet(recv, '\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndAddAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndAddRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndAddReleasechar"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseOr(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseOrAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseOrRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseAnd(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseAndAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseAndRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseXor(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseXorAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseXorRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessChar recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet('\u0123', '\u4567'); + success = vh.weakCompareAndSetPlain('\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) vh.get(); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -587,34 +725,157 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease('\u4567', '\u0123'); + success = vh.weakCompareAndSet('\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) vh.get(); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get { + vh.set('\u0123'); + char o = (char) vh.getAndSet('\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) vh.get(); assertEquals(x, '\u4567', "getAndSet char value"); } - vh.set('\u0123'); + { + vh.set('\u0123'); + + char o = (char) vh.getAndSetAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) vh.get(); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndSetRelease('\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) vh.get(); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) vh.getAndAdd( '\u89AB'); + vh.set('\u0123'); + + char o = (char) vh.getAndAdd('\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) vh.addAndGet('\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndAddAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndAddRelease('\u4567'); + assertEquals(o, '\u0123', "getAndAddReleasechar"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseOr('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseOrAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseOrRelease('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseAnd('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseAndAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseAndRelease('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseXor('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseXorAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseXorRelease('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, '\u0123', '\u4567'); + success = vh.weakCompareAndSetPlain(array, i, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) vh.get(array, i); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -743,29 +1004,151 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, '\u4567', '\u0123'); + success = vh.weakCompareAndSet(array, i, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) vh.get(array, i); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get { + vh.set(array, i, '\u0123'); + char o = (char) vh.getAndSet(array, i, '\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) vh.get(array, i); assertEquals(x, '\u4567', "getAndSet char value"); } - vh.set(array, i, '\u0123'); + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndSetAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndSetRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) vh.get(array, i); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) vh.getAndAdd(array, i, '\u89AB'); + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndAdd(array, i, '\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) vh.addAndGet(array, i, '\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndAddAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndAddRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndAddReleasechar"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseOr(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseOrAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseOrRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseAnd(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseAndAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseAndRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseXor(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseXorAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseXorRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } } @@ -775,6 +1158,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, '\u0123', '\u4567'); + boolean r = vh.weakCompareAndSetPlain(array, ci, '\u0123', '\u4567'); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, '\u0123', '\u4567'); + boolean r = vh.weakCompareAndSet(array, ci, '\u0123', '\u4567'); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { }); checkIOOBE(() -> { - char o = (char) vh.getAndAdd(array, ci, '\u89AB'); + char o = (char) vh.getAndSetAcquire(array, ci, '\u0123'); }); checkIOOBE(() -> { - char o = (char) vh.addAndGet(array, ci, '\u89AB'); + char o = (char) vh.getAndSetRelease(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndAdd(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndAddAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndAddRelease(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseOr(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseOrAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseOrRelease(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseAnd(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseAndAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseAndRelease(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseXor(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseXorAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseXorRelease(array, ci, '\u0123'); }); } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java index 710aae87fc1..e0564d5d002 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,42 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(recv, 1.0d); + }); } @@ -309,6 +358,42 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(1.0d); + }); } @@ -404,11 +489,11 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, 1.0d, 2.0d); + success = vh.weakCompareAndSetPlain(recv, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(recv); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -434,34 +519,109 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, 2.0d, 1.0d); + success = vh.weakCompareAndSet(recv, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(recv); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double value"); + assertEquals(x, 1.0d, "weakCompareAndSet double value"); } // Compare set and get { + vh.set(recv, 1.0d); + double o = (double) vh.getAndSet(recv, 2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) vh.get(recv); assertEquals(x, 2.0d, "getAndSet double value"); } - vh.set(recv, 1.0d); + { + vh.set(recv, 1.0d); + + double o = (double) vh.getAndSetAcquire(recv, 2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) vh.get(recv); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + { + vh.set(recv, 1.0d); + + double o = (double) vh.getAndSetRelease(recv, 2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) vh.get(recv); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) vh.getAndAdd(recv, 3.0d); + vh.set(recv, 1.0d); + + double o = (double) vh.getAndAdd(recv, 2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) vh.addAndGet(recv, 3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) vh.get(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + vh.set(recv, 1.0d); + + double o = (double) vh.getAndAddAcquire(recv, 2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) vh.get(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + vh.set(recv, 1.0d); + + double o = (double) vh.getAndAddRelease(recv, 2.0d); + assertEquals(o, 1.0d, "getAndAddReleasedouble"); + double x = (double) vh.get(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } static void testInstanceFieldUnsupported(VarHandleTestAccessDouble recv, VarHandle vh) { + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(recv, 1.0d); + }); } @@ -557,11 +717,11 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(1.0d, 2.0d); + success = vh.weakCompareAndSetPlain(1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -587,34 +747,109 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(2.0d, 1.0d); + success = vh.weakCompareAndSet(2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get { + vh.set(1.0d); + double o = (double) vh.getAndSet(2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) vh.get(); assertEquals(x, 2.0d, "getAndSet double value"); } - vh.set(1.0d); + { + vh.set(1.0d); + + double o = (double) vh.getAndSetAcquire(2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) vh.get(); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + { + vh.set(1.0d); + + double o = (double) vh.getAndSetRelease(2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) vh.get(); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) vh.getAndAdd( 3.0d); + vh.set(1.0d); + + double o = (double) vh.getAndAdd(2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) vh.addAndGet(3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) vh.get(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + vh.set(1.0d); + + double o = (double) vh.getAndAddAcquire(2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) vh.get(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + vh.set(1.0d); + + double o = (double) vh.getAndAddRelease(2.0d); + assertEquals(o, 1.0d, "getAndAddReleasedouble"); + double x = (double) vh.get(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } static void testStaticFieldUnsupported(VarHandle vh) { + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(1.0d); + }); } @@ -713,11 +948,11 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, 1.0d, 2.0d); + success = vh.weakCompareAndSetPlain(array, i, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -743,30 +978,69 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, 2.0d, 1.0d); + success = vh.weakCompareAndSet(array, i, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(array, i); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get { + vh.set(array, i, 1.0d); + double o = (double) vh.getAndSet(array, i, 2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) vh.get(array, i); assertEquals(x, 2.0d, "getAndSet double value"); } - vh.set(array, i, 1.0d); + { + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndSetAcquire(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) vh.get(array, i); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + { + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndSetRelease(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) vh.get(array, i); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) vh.getAndAdd(array, i, 3.0d); + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndAdd(array, i, 2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) vh.addAndGet(array, i, 3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) vh.get(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndAddAcquire(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) vh.get(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndAddRelease(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndAddReleasedouble"); + double x = (double) vh.get(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } } @@ -775,6 +1049,42 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { int i = 0; + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(array, i, 1.0d); + }); } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1142,11 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, 1.0d, 2.0d); + boolean r = vh.weakCompareAndSetPlain(array, ci, 1.0d, 2.0d); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, 1.0d, 2.0d); + boolean r = vh.weakCompareAndSet(array, ci, 1.0d, 2.0d); }); checkIOOBE(() -> { @@ -852,12 +1162,25 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { }); checkIOOBE(() -> { - double o = (double) vh.getAndAdd(array, ci, 3.0d); + double o = (double) vh.getAndSetAcquire(array, ci, 1.0d); }); checkIOOBE(() -> { - double o = (double) vh.addAndGet(array, ci, 3.0d); + double o = (double) vh.getAndSetRelease(array, ci, 1.0d); }); + + checkIOOBE(() -> { + double o = (double) vh.getAndAdd(array, ci, 1.0d); + }); + + checkIOOBE(() -> { + double o = (double) vh.getAndAddAcquire(array, ci, 1.0d); + }); + + checkIOOBE(() -> { + double o = (double) vh.getAndAddRelease(array, ci, 1.0d); + }); + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java index 4a2306bcab6..4fa6b41fd3c 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,42 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(recv, 1.0f); + }); } @@ -309,6 +358,42 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(1.0f); + }); } @@ -404,11 +489,11 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, 1.0f, 2.0f); + success = vh.weakCompareAndSetPlain(recv, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(recv); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -434,34 +519,109 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, 2.0f, 1.0f); + success = vh.weakCompareAndSet(recv, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(recv); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float value"); + assertEquals(x, 1.0f, "weakCompareAndSet float value"); } // Compare set and get { + vh.set(recv, 1.0f); + float o = (float) vh.getAndSet(recv, 2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) vh.get(recv); assertEquals(x, 2.0f, "getAndSet float value"); } - vh.set(recv, 1.0f); + { + vh.set(recv, 1.0f); + + float o = (float) vh.getAndSetAcquire(recv, 2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) vh.get(recv); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + { + vh.set(recv, 1.0f); + + float o = (float) vh.getAndSetRelease(recv, 2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) vh.get(recv); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) vh.getAndAdd(recv, 3.0f); + vh.set(recv, 1.0f); + + float o = (float) vh.getAndAdd(recv, 2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) vh.addAndGet(recv, 3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) vh.get(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + vh.set(recv, 1.0f); + + float o = (float) vh.getAndAddAcquire(recv, 2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) vh.get(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + vh.set(recv, 1.0f); + + float o = (float) vh.getAndAddRelease(recv, 2.0f); + assertEquals(o, 1.0f, "getAndAddReleasefloat"); + float x = (float) vh.get(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } static void testInstanceFieldUnsupported(VarHandleTestAccessFloat recv, VarHandle vh) { + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(recv, 1.0f); + }); } @@ -557,11 +717,11 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(1.0f, 2.0f); + success = vh.weakCompareAndSetPlain(1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -587,34 +747,109 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(2.0f, 1.0f); + success = vh.weakCompareAndSet(2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get { + vh.set(1.0f); + float o = (float) vh.getAndSet(2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) vh.get(); assertEquals(x, 2.0f, "getAndSet float value"); } - vh.set(1.0f); + { + vh.set(1.0f); + + float o = (float) vh.getAndSetAcquire(2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) vh.get(); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + { + vh.set(1.0f); + + float o = (float) vh.getAndSetRelease(2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) vh.get(); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) vh.getAndAdd( 3.0f); + vh.set(1.0f); + + float o = (float) vh.getAndAdd(2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) vh.addAndGet(3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) vh.get(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + vh.set(1.0f); + + float o = (float) vh.getAndAddAcquire(2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) vh.get(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + vh.set(1.0f); + + float o = (float) vh.getAndAddRelease(2.0f); + assertEquals(o, 1.0f, "getAndAddReleasefloat"); + float x = (float) vh.get(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } static void testStaticFieldUnsupported(VarHandle vh) { + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(1.0f); + }); } @@ -713,11 +948,11 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, 1.0f, 2.0f); + success = vh.weakCompareAndSetPlain(array, i, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -743,30 +978,69 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, 2.0f, 1.0f); + success = vh.weakCompareAndSet(array, i, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(array, i); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get { + vh.set(array, i, 1.0f); + float o = (float) vh.getAndSet(array, i, 2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) vh.get(array, i); assertEquals(x, 2.0f, "getAndSet float value"); } - vh.set(array, i, 1.0f); + { + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndSetAcquire(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) vh.get(array, i); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + { + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndSetRelease(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) vh.get(array, i); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) vh.getAndAdd(array, i, 3.0f); + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndAdd(array, i, 2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) vh.addAndGet(array, i, 3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) vh.get(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndAddAcquire(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) vh.get(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndAddRelease(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndAddReleasefloat"); + float x = (float) vh.get(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } } @@ -775,6 +1049,42 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { int i = 0; + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(array, i, 1.0f); + }); } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1142,11 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, 1.0f, 2.0f); + boolean r = vh.weakCompareAndSetPlain(array, ci, 1.0f, 2.0f); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, 1.0f, 2.0f); + boolean r = vh.weakCompareAndSet(array, ci, 1.0f, 2.0f); }); checkIOOBE(() -> { @@ -852,12 +1162,25 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { }); checkIOOBE(() -> { - float o = (float) vh.getAndAdd(array, ci, 3.0f); + float o = (float) vh.getAndSetAcquire(array, ci, 1.0f); }); checkIOOBE(() -> { - float o = (float) vh.addAndGet(array, ci, 3.0f); + float o = (float) vh.getAndSetRelease(array, ci, 1.0f); }); + + checkIOOBE(() -> { + float o = (float) vh.getAndAdd(array, ci, 1.0f); + }); + + checkIOOBE(() -> { + float o = (float) vh.getAndAddAcquire(array, ci, 1.0f); + }); + + checkIOOBE(() -> { + float o = (float) vh.getAndAddRelease(array, ci, 1.0f); + }); + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java index 930ba12eb89..2fbcc9cb46d 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { }); + } @@ -309,6 +323,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { }); + } @@ -404,11 +419,11 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, 0x01234567, 0x89ABCDEF); + success = vh.weakCompareAndSetPlain(recv, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(recv); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -434,34 +449,157 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, 0x89ABCDEF, 0x01234567); + success = vh.weakCompareAndSet(recv, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(recv); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int value"); + assertEquals(x, 0x01234567, "weakCompareAndSet int value"); } // Compare set and get { + vh.set(recv, 0x01234567); + int o = (int) vh.getAndSet(recv, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) vh.get(recv); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - vh.set(recv, 0x01234567); + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndSetAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndSetRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) vh.get(recv); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd(recv, 0xCAFEBABE); + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndAdd(recv, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) vh.addAndGet(recv, 0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndAddAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndAddRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddReleaseint"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseOr(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseOrAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseOrRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseAnd(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseAndAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseAndRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseXor(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseXorAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseXorRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessInt recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(0x01234567, 0x89ABCDEF); + success = vh.weakCompareAndSetPlain(0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -587,34 +725,157 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(0x89ABCDEF, 0x01234567); + success = vh.weakCompareAndSet(0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get { + vh.set(0x01234567); + int o = (int) vh.getAndSet(0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) vh.get(); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - vh.set(0x01234567); + { + vh.set(0x01234567); + + int o = (int) vh.getAndSetAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) vh.get(); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndSetRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) vh.get(); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd( 0xCAFEBABE); + vh.set(0x01234567); + + int o = (int) vh.getAndAdd(0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) vh.addAndGet(0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndAddAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndAddRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddReleaseint"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseOr(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseOrAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseOrRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseAnd(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseAndAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseAndRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseXor(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseXorAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseXorRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, 0x01234567, 0x89ABCDEF); + success = vh.weakCompareAndSetPlain(array, i, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -743,29 +1004,151 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, 0x89ABCDEF, 0x01234567); + success = vh.weakCompareAndSet(array, i, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get { + vh.set(array, i, 0x01234567); + int o = (int) vh.getAndSet(array, i, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - vh.set(array, i, 0x01234567); + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndSetAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndSetRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd(array, i, 0xCAFEBABE); + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndAdd(array, i, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) vh.addAndGet(array, i, 0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndAddAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndAddRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddReleaseint"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseOr(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseOrAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseOrRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseAnd(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseAndAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseAndRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseXor(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseXorAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseXorRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } } @@ -775,6 +1158,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, 0x01234567, 0x89ABCDEF); + boolean r = vh.weakCompareAndSetPlain(array, ci, 0x01234567, 0x89ABCDEF); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, 0x01234567, 0x89ABCDEF); + boolean r = vh.weakCompareAndSet(array, ci, 0x01234567, 0x89ABCDEF); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { }); checkIOOBE(() -> { - int o = (int) vh.getAndAdd(array, ci, 0xCAFEBABE); + int o = (int) vh.getAndSetAcquire(array, ci, 0x01234567); }); checkIOOBE(() -> { - int o = (int) vh.addAndGet(array, ci, 0xCAFEBABE); + int o = (int) vh.getAndSetRelease(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAdd(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAddAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, 0x01234567); }); } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java index 257e56b3b32..d94cdc131d2 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { }); + } @@ -309,6 +323,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { }); + } @@ -404,11 +419,11 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = vh.weakCompareAndSetPlain(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(recv); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -434,34 +449,157 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = vh.weakCompareAndSet(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(recv); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long value"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long value"); } // Compare set and get { + vh.set(recv, 0x0123456789ABCDEFL); + long o = (long) vh.getAndSet(recv, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) vh.get(recv); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - vh.set(recv, 0x0123456789ABCDEFL); + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) vh.get(recv); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd(recv, 0xDEADBEEFDEADBEEFL); + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAdd(recv, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) vh.addAndGet(recv, 0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOr(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAnd(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXor(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessLong recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = vh.weakCompareAndSetPlain(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -587,34 +725,157 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = vh.weakCompareAndSet(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get { + vh.set(0x0123456789ABCDEFL); + long o = (long) vh.getAndSet(0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) vh.get(); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - vh.set(0x0123456789ABCDEFL); + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) vh.get(); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) vh.get(); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd( 0xDEADBEEFDEADBEEFL); + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndAdd(0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) vh.addAndGet(0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOr(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAnd(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXor(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = vh.weakCompareAndSetPlain(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -743,29 +1004,151 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = vh.weakCompareAndSet(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get { + vh.set(array, i, 0x0123456789ABCDEFL); + long o = (long) vh.getAndSet(array, i, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - vh.set(array, i, 0x0123456789ABCDEFL); + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd(array, i, 0xDEADBEEFDEADBEEFL); + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAdd(array, i, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) vh.addAndGet(array, i, 0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOr(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAnd(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXor(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } } @@ -775,6 +1158,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + boolean r = vh.weakCompareAndSetPlain(array, ci, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + boolean r = vh.weakCompareAndSet(array, ci, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { }); checkIOOBE(() -> { - long o = (long) vh.getAndAdd(array, ci, 0xDEADBEEFDEADBEEFL); + long o = (long) vh.getAndSetAcquire(array, ci, 0x0123456789ABCDEFL); }); checkIOOBE(() -> { - long o = (long) vh.addAndGet(array, ci, 0xDEADBEEFDEADBEEFL); + long o = (long) vh.getAndSetRelease(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAdd(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAddAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, 0x0123456789ABCDEFL); }); } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java index 53535de28c9..7ff96eb10ea 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { }); + } @@ -309,6 +323,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { }); + } @@ -404,11 +419,11 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, (short)0x0123, (short)0x4567); + success = vh.weakCompareAndSetPlain(recv, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) vh.get(recv); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -434,34 +449,157 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, (short)0x4567, (short)0x0123); + success = vh.weakCompareAndSet(recv, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) vh.get(recv); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short value"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short value"); } // Compare set and get { + vh.set(recv, (short)0x0123); + short o = (short) vh.getAndSet(recv, (short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) vh.get(recv); assertEquals(x, (short)0x4567, "getAndSet short value"); } - vh.set(recv, (short)0x0123); + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndSetAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndSetRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) vh.getAndAdd(recv, (short)0x89AB); + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndAdd(recv, (short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) vh.addAndGet(recv, (short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndAddAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndAddRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddReleaseshort"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseOr(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseOrAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseOrRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseAnd(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseAndAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseAndRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseXor(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseXorAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseXorRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessShort recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet((short)0x0123, (short)0x4567); + success = vh.weakCompareAndSetPlain((short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) vh.get(); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -587,34 +725,157 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease((short)0x4567, (short)0x0123); + success = vh.weakCompareAndSet((short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) vh.get(); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get { + vh.set((short)0x0123); + short o = (short) vh.getAndSet((short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) vh.get(); assertEquals(x, (short)0x4567, "getAndSet short value"); } - vh.set((short)0x0123); + { + vh.set((short)0x0123); + + short o = (short) vh.getAndSetAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndSetRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) vh.get(); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) vh.getAndAdd( (short)0x89AB); + vh.set((short)0x0123); + + short o = (short) vh.getAndAdd((short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) vh.addAndGet((short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndAddAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndAddRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddReleaseshort"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseOr((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseOrAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseOrRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseAnd((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseAndAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseAndRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseXor((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseXorAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseXorRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, (short)0x0123, (short)0x4567); + success = vh.weakCompareAndSetPlain(array, i, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) vh.get(array, i); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -743,29 +1004,151 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, (short)0x4567, (short)0x0123); + success = vh.weakCompareAndSet(array, i, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) vh.get(array, i); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get { + vh.set(array, i, (short)0x0123); + short o = (short) vh.getAndSet(array, i, (short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) vh.get(array, i); assertEquals(x, (short)0x4567, "getAndSet short value"); } - vh.set(array, i, (short)0x0123); + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndSetAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndSetRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) vh.getAndAdd(array, i, (short)0x89AB); + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndAdd(array, i, (short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) vh.addAndGet(array, i, (short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndAddAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndAddRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddReleaseshort"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseOr(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseOrAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseOrRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseAnd(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseAndAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseAndRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseXor(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseXorAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseXorRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } } @@ -775,6 +1158,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, (short)0x0123, (short)0x4567); + boolean r = vh.weakCompareAndSetPlain(array, ci, (short)0x0123, (short)0x4567); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, (short)0x0123, (short)0x4567); + boolean r = vh.weakCompareAndSet(array, ci, (short)0x0123, (short)0x4567); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { }); checkIOOBE(() -> { - short o = (short) vh.getAndAdd(array, ci, (short)0x89AB); + short o = (short) vh.getAndSetAcquire(array, ci, (short)0x0123); }); checkIOOBE(() -> { - short o = (short) vh.addAndGet(array, ci, (short)0x89AB); + short o = (short) vh.getAndSetRelease(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndAdd(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndAddAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndAddRelease(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseOr(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseOrAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseOrRelease(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseAnd(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseAndAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseAndRelease(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseXor(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseXorAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseXorRelease(array, ci, (short)0x0123); }); } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java index 0ac329d65f8..0904505db40 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java @@ -103,14 +103,27 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -266,7 +279,47 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { }); checkUOE(() -> { - String o = (String) vh.addAndGet(recv, "foo"); + String o = (String) vh.getAndAddAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease(recv, "foo"); }); } @@ -321,7 +374,47 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { }); checkUOE(() -> { - String o = (String) vh.addAndGet("foo"); + String o = (String) vh.getAndAddAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease("foo"); }); } @@ -418,11 +511,11 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, "foo", "bar"); + success = vh.weakCompareAndSetPlain(recv, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) vh.get(recv); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -448,21 +541,42 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, "bar", "foo"); + success = vh.weakCompareAndSet(recv, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(recv); - assertEquals(x, "foo", "weakCompareAndSetVolatile String value"); + assertEquals(x, "foo", "weakCompareAndSet String value"); } // Compare set and get { + vh.set(recv, "foo"); + String o = (String) vh.getAndSet(recv, "bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) vh.get(recv); assertEquals(x, "bar", "getAndSet String value"); } + { + vh.set(recv, "foo"); + + String o = (String) vh.getAndSetAcquire(recv, "bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) vh.get(recv); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + { + vh.set(recv, "foo"); + + String o = (String) vh.getAndSetRelease(recv, "bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) vh.get(recv); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } static void testInstanceFieldUnsupported(VarHandleTestAccessString recv, VarHandle vh) { @@ -472,7 +586,47 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { }); checkUOE(() -> { - String o = (String) vh.addAndGet(recv, "foo"); + String o = (String) vh.getAndAddAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease(recv, "foo"); }); } @@ -569,11 +723,11 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet("foo", "bar"); + success = vh.weakCompareAndSetPlain("foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) vh.get(); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -599,21 +753,42 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease("bar", "foo"); + success = vh.weakCompareAndSet("bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get { + vh.set("foo"); + String o = (String) vh.getAndSet("bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) vh.get(); assertEquals(x, "bar", "getAndSet String value"); } + { + vh.set("foo"); + + String o = (String) vh.getAndSetAcquire("bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) vh.get(); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + { + vh.set("foo"); + + String o = (String) vh.getAndSetRelease("bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) vh.get(); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } static void testStaticFieldUnsupported(VarHandle vh) { @@ -623,7 +798,47 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { }); checkUOE(() -> { - String o = (String) vh.addAndGet("foo"); + String o = (String) vh.getAndAddAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease("foo"); }); } @@ -723,11 +938,11 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, "foo", "bar"); + success = vh.weakCompareAndSetPlain(array, i, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) vh.get(array, i); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -753,21 +968,42 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, "bar", "foo"); + success = vh.weakCompareAndSet(array, i, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(array, i); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get { + vh.set(array, i, "foo"); + String o = (String) vh.getAndSet(array, i, "bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) vh.get(array, i); assertEquals(x, "bar", "getAndSet String value"); } + { + vh.set(array, i, "foo"); + + String o = (String) vh.getAndSetAcquire(array, i, "bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) vh.get(array, i); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + { + vh.set(array, i, "foo"); + + String o = (String) vh.getAndSetRelease(array, i, "bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) vh.get(array, i); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } } @@ -781,7 +1017,47 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { }); checkUOE(() -> { - String o = (String) vh.addAndGet(array, i, "foo"); + String o = (String) vh.getAndAddAcquire(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease(array, i, "foo"); }); } @@ -840,11 +1116,11 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, "foo", "bar"); + boolean r = vh.weakCompareAndSetPlain(array, ci, "foo", "bar"); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, "foo", "bar"); + boolean r = vh.weakCompareAndSet(array, ci, "foo", "bar"); }); checkIOOBE(() -> { @@ -859,6 +1135,15 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { String o = (String) vh.getAndSet(array, ci, "foo"); }); + checkIOOBE(() -> { + String o = (String) vh.getAndSetAcquire(array, ci, "foo"); + }); + + checkIOOBE(() -> { + String o = (String) vh.getAndSetRelease(array, ci, "foo"); + }); + + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java index dc9db6f2d26..89d22695e55 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java @@ -92,14 +92,27 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -201,11 +214,11 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -220,12 +233,60 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { char o = (char) vh.getAndSet(array, ci, VALUE_1); }); + checkUOE(() -> { + char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { char o = (char) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - char o = (char) vh.addAndGet(array, ci, VALUE_1); + char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -270,11 +331,11 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -289,12 +350,60 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { char o = (char) vh.getAndSet(array, ci, VALUE_1); }); + checkUOE(() -> { + char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { char o = (char) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - char o = (char) vh.addAndGet(array, ci, VALUE_1); + char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -315,11 +424,11 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -333,12 +442,59 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { checkUOE(() -> { char o = (char) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndSetRelease(array, ci, VALUE_1); + }); checkUOE(() -> { char o = (char) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - char o = (char) vh.addAndGet(array, ci, VALUE_1); + char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndAddRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -385,6 +541,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { }); + } } @@ -434,6 +591,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { }); + } } } @@ -518,6 +676,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { }); + } } } @@ -564,6 +723,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { assertEquals(x, VALUE_2, "setOpaque char value"); } + } } } @@ -609,6 +769,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { assertEquals(x, VALUE_2, "setOpaque char value"); } + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java index a713e91b979..5757d1958c1 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java @@ -92,14 +92,27 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -190,7 +203,47 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - double o = (double) vh.addAndGet(array, ci, VALUE_1); + double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -236,11 +289,11 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -255,13 +308,61 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { double o = (double) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - double o = (double) vh.addAndGet(array, ci, VALUE_1); + double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -270,7 +371,46 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - double o = (double) vh.addAndGet(array, ci, VALUE_1); + double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndAddRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -333,11 +473,11 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -352,6 +492,15 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } @@ -418,11 +567,11 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -437,6 +586,15 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } } @@ -494,11 +652,11 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -513,6 +671,14 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + } } @@ -573,11 +739,11 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -592,6 +758,15 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } } @@ -700,11 +875,11 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet double value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain double value"); } { @@ -728,20 +903,44 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile double value"); + assertEquals(x, VALUE_1, "weakCompareAndSet double"); } // Compare set and get { + vh.set(array, i, VALUE_1); + double o = (double) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet double value"); } + { + vh.set(array, i, VALUE_1); + + double o = (double) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire double"); + double x = (double) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire double value"); + } + + { + vh.set(array, i, VALUE_1); + + double o = (double) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease double"); + double x = (double) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease double value"); + } + + } } } @@ -849,11 +1048,11 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet double value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain double value"); } { @@ -877,20 +1076,44 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile double value"); + assertEquals(x, VALUE_1, "weakCompareAndSet double"); } // Compare set and get { + vh.set(array, i, VALUE_1); + double o = (double) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet double value"); } + { + vh.set(array, i, VALUE_1); + + double o = (double) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire double"); + double x = (double) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire double value"); + } + + { + vh.set(array, i, VALUE_1); + + double o = (double) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease double"); + double x = (double) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease double value"); + } + + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java index 3e964dcd46a..89d8fe91502 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java @@ -92,14 +92,27 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -190,7 +203,47 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - float o = (float) vh.addAndGet(array, ci, VALUE_1); + float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -236,11 +289,11 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -255,13 +308,61 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { float o = (float) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - float o = (float) vh.addAndGet(array, ci, VALUE_1); + float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -270,7 +371,46 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - float o = (float) vh.addAndGet(array, ci, VALUE_1); + float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndAddRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -333,11 +473,11 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -352,6 +492,15 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } @@ -418,11 +567,11 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -437,6 +586,15 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } } @@ -494,11 +652,11 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -513,6 +671,14 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + } } @@ -573,11 +739,11 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -592,6 +758,15 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } } @@ -700,11 +875,11 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet float value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain float value"); } { @@ -728,20 +903,44 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile float value"); + assertEquals(x, VALUE_1, "weakCompareAndSet float"); } // Compare set and get { + vh.set(array, i, VALUE_1); + float o = (float) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet float value"); } + { + vh.set(array, i, VALUE_1); + + float o = (float) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire float"); + float x = (float) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire float value"); + } + + { + vh.set(array, i, VALUE_1); + + float o = (float) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease float"); + float x = (float) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease float value"); + } + + } } } @@ -849,11 +1048,11 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet float value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain float value"); } { @@ -877,20 +1076,44 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile float value"); + assertEquals(x, VALUE_1, "weakCompareAndSet float"); } // Compare set and get { + vh.set(array, i, VALUE_1); + float o = (float) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet float value"); } + { + vh.set(array, i, VALUE_1); + + float o = (float) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire float"); + float x = (float) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire float value"); + } + + { + vh.set(array, i, VALUE_1); + + float o = (float) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease float"); + float x = (float) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease float value"); + } + + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java index bbda8c0270f..79e9daba605 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java @@ -92,14 +92,27 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -185,6 +198,7 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { int ci = 1; + } static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) { @@ -229,11 +243,11 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -248,13 +262,61 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { int o = (int) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkROBE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkROBE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -319,11 +381,11 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -338,12 +400,60 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { int o = (int) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkIOOBE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkIOOBE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -411,11 +521,11 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -430,12 +540,60 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { int o = (int) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkIOOBE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkIOOBE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -494,11 +652,11 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -513,14 +671,61 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { int o = (int) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkISE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkISE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); }); + checkISE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); } } } @@ -580,11 +785,11 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -599,12 +804,60 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { int o = (int) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkISE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkISE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -714,11 +967,11 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet int value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain int value"); } { @@ -742,28 +995,153 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile int value"); + assertEquals(x, VALUE_1, "weakCompareAndSet int"); } // Compare set and get { + vh.set(array, i, VALUE_1); + int o = (int) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet int value"); } - vh.set(array, i, VALUE_1); + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd int"); - int c = (int) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd int value"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease int value"); } } } @@ -872,11 +1250,11 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet int value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain int value"); } { @@ -900,28 +1278,153 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile int value"); + assertEquals(x, VALUE_1, "weakCompareAndSet int"); } // Compare set and get { + vh.set(array, i, VALUE_1); + int o = (int) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet int value"); } - vh.set(array, i, VALUE_1); + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd int"); - int c = (int) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd int value"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease int value"); } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java index e203f8e23f7..01cdfcef554 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java @@ -92,14 +92,27 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -185,6 +198,7 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { int ci = 1; + } static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) { @@ -229,11 +243,11 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -248,13 +262,61 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { long o = (long) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkROBE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkROBE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -319,11 +381,11 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -338,12 +400,60 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { long o = (long) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkIOOBE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkIOOBE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -411,11 +521,11 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -430,12 +540,60 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { long o = (long) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkIOOBE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkIOOBE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -494,11 +652,11 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -513,14 +671,61 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { long o = (long) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkISE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkISE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); }); + checkISE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); } } } @@ -580,11 +785,11 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -599,12 +804,60 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { long o = (long) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkISE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkISE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -714,11 +967,11 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet long value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain long value"); } { @@ -742,28 +995,153 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile long value"); + assertEquals(x, VALUE_1, "weakCompareAndSet long"); } // Compare set and get { + vh.set(array, i, VALUE_1); + long o = (long) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet long value"); } - vh.set(array, i, VALUE_1); + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd long"); - long c = (long) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd long value"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease long value"); } } } @@ -872,11 +1250,11 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet long value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain long value"); } { @@ -900,28 +1278,153 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile long value"); + assertEquals(x, VALUE_1, "weakCompareAndSet long"); } // Compare set and get { + vh.set(array, i, VALUE_1); + long o = (long) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet long value"); } - vh.set(array, i, VALUE_1); + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd long"); - long c = (long) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd long value"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease long value"); } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java index d96715ed083..29e45a04c0e 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java @@ -92,14 +92,27 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -201,11 +214,11 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -220,12 +233,60 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { short o = (short) vh.getAndSet(array, ci, VALUE_1); }); + checkUOE(() -> { + short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { short o = (short) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - short o = (short) vh.addAndGet(array, ci, VALUE_1); + short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -270,11 +331,11 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -289,12 +350,60 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { short o = (short) vh.getAndSet(array, ci, VALUE_1); }); + checkUOE(() -> { + short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { short o = (short) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - short o = (short) vh.addAndGet(array, ci, VALUE_1); + short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -315,11 +424,11 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -333,12 +442,59 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { checkUOE(() -> { short o = (short) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndSetRelease(array, ci, VALUE_1); + }); checkUOE(() -> { short o = (short) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - short o = (short) vh.addAndGet(array, ci, VALUE_1); + short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndAddRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -385,6 +541,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { }); + } } @@ -434,6 +591,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { }); + } } } @@ -518,6 +676,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { }); + } } } @@ -564,6 +723,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { assertEquals(x, VALUE_2, "setOpaque short value"); } + } } } @@ -609,6 +769,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { assertEquals(x, VALUE_2, "setOpaque short value"); } + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java index 544fcb3c0ee..99904d32c02 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, true, false); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, false, true); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get @@ -255,6 +255,90 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { assertEquals(x, false, "getAndSet boolean value"); } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessBoolean recv, Handles hs) throws Throwable { @@ -264,6 +348,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { boolean r = (boolean) hs.get(am).invokeExact(recv, true); }); } + } @@ -359,11 +444,11 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(true, false); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -389,21 +474,127 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(false, true); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get { - boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact( false); + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, false, "getAndSet boolean value"); } + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { @@ -413,6 +604,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { boolean r = (boolean) hs.get(am).invokeExact(true); }); } + } @@ -511,11 +703,11 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, true, false); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -541,21 +733,125 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, false, true); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, false, "getAndSet boolean value"); } + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } } @@ -569,6 +865,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { boolean o = (boolean) hs.get(am).invokeExact(array, i, true); }); } + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -607,6 +904,12 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest { }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + boolean o = (boolean) hs.get(am).invokeExact(array, ci, false); + }); + } } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java index 21e09b83953..7ab3b99f949 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (byte)0x01, (byte)0x23); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, (byte)0x23, (byte)0x01); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get @@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { assertEquals(x, (byte)0x23, "getAndSet byte value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); - // get and add, add and get { - byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (byte)0x45); + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, (byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessByte recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((byte)0x01, (byte)0x23); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact((byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -393,34 +496,159 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact((byte)0x23, (byte)0x01); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get { - byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact( (byte)0x23); + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact((byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( (byte)0x45); + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact((byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact((byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (byte)0x01, (byte)0x23); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -549,30 +777,152 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, (byte)0x23, (byte)0x01); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, (byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (byte)0x45); + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, (byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); + } } } @@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest { byte o = (byte) hs.get(am).invokeExact(array, ci, (byte)0x45); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + byte o = (byte) hs.get(am).invokeExact(array, ci, (byte)0x45); + }); + } } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java index 1f2e5ee10c6..762134b625f 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, '\u0123', '\u4567'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, '\u4567', '\u0123'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get @@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { assertEquals(x, '\u4567', "getAndSet char value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); - // get and add, add and get { - char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, '\u89AB'); + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, '\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, '\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndAddRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessChar recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact('\u0123', '\u4567'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact('\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -393,34 +496,159 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact('\u4567', '\u0123'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact('\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get { - char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact( '\u4567'); + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact('\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, '\u4567', "getAndSet char value"); } - hs.get(TestAccessMode.SET).invokeExact('\u0123'); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( '\u89AB'); + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact('\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact('\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndAddRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, '\u0123', '\u4567'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -549,30 +777,152 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, '\u4567', '\u0123'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, '\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, '\u4567', "getAndSet char value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, '\u89AB'); + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, '\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, '\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndAddRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); + } } } @@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest { char o = (char) hs.get(am).invokeExact(array, ci, '\u89AB'); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + char o = (char) hs.get(am).invokeExact(array, ci, '\u89AB'); + }); + } } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java index 26cb426ab81..409d700c474 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1.0d, 2.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 2.0d, 1.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get @@ -255,19 +255,44 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { assertEquals(x, 2.0d, "getAndSet double value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d); - // get and add, add and get { - double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3.0d); + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 2.0d); + assertEquals(o, 1.0d, "getAndAddRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessDouble recv, Handles hs) throws Throwable { + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + double r = (double) hs.get(am).invokeExact(recv, 1.0d); + }); + } } @@ -363,11 +388,11 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1.0d, 2.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -393,34 +418,81 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(2.0d, 1.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get { - double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 2.0d); + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2.0d, "getAndSet double value"); } - hs.get(TestAccessMode.SET).invokeExact(1.0d); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3.0d); + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(2.0d); + assertEquals(o, 1.0d, "getAndAddRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + double r = (double) hs.get(am).invokeExact(1.0d); + }); + } } @@ -519,11 +591,11 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1.0d, 2.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -549,30 +621,69 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 2.0d, 1.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 2.0d, "getAndSet double value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3.0d); + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndAddRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } } @@ -581,6 +692,12 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { final int i = 0; + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + double o = (double) hs.get(am).invokeExact(array, i, 1.0d); + }); + } } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +741,7 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest { double o = (double) hs.get(am).invokeExact(array, ci, 3.0d); }); } + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java index d28e2f41b6e..b826e18d483 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1.0f, 2.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 2.0f, 1.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get @@ -255,19 +255,44 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { assertEquals(x, 2.0f, "getAndSet float value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f); - // get and add, add and get { - float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3.0f); + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 2.0f); + assertEquals(o, 1.0f, "getAndAddRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessFloat recv, Handles hs) throws Throwable { + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + float r = (float) hs.get(am).invokeExact(recv, 1.0f); + }); + } } @@ -363,11 +388,11 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1.0f, 2.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -393,34 +418,81 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(2.0f, 1.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get { - float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 2.0f); + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2.0f, "getAndSet float value"); } - hs.get(TestAccessMode.SET).invokeExact(1.0f); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3.0f); + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(2.0f); + assertEquals(o, 1.0f, "getAndAddRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + float r = (float) hs.get(am).invokeExact(1.0f); + }); + } } @@ -519,11 +591,11 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1.0f, 2.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -549,30 +621,69 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 2.0f, 1.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 2.0f, "getAndSet float value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3.0f); + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndAddRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } } @@ -581,6 +692,12 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { final int i = 0; + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + float o = (float) hs.get(am).invokeExact(array, i, 1.0f); + }); + } } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +741,7 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest { float o = (float) hs.get(am).invokeExact(array, ci, 3.0f); }); } + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java index 56954238e27..da0c63fa155 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0x01234567, 0x89ABCDEF); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 0x89ABCDEF, 0x01234567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get @@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); - // get and add, add and get { - int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xCAFEBABE); + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessInt recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0x01234567, 0x89ABCDEF); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -393,34 +496,159 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(0x89ABCDEF, 0x01234567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get { - int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 0x89ABCDEF); + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - hs.get(TestAccessMode.SET).invokeExact(0x01234567); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 0xCAFEBABE); + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0x01234567, 0x89ABCDEF); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -549,30 +777,152 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 0x89ABCDEF, 0x01234567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xCAFEBABE); + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); + } } } @@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { int o = (int) hs.get(am).invokeExact(array, ci, 0xCAFEBABE); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + int o = (int) hs.get(am).invokeExact(array, ci, 0xCAFEBABE); + }); + } } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java index 848da74e166..6e16e7c82da 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get @@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); - // get and add, add and get { - long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xDEADBEEFDEADBEEFL); + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessLong recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -393,34 +496,159 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get { - long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 0xCAFEBABECAFEBABEL); + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 0xDEADBEEFDEADBEEFL); + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -549,30 +777,152 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xDEADBEEFDEADBEEFL); + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); + } } } @@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { long o = (long) hs.get(am).invokeExact(array, ci, 0xDEADBEEFDEADBEEFL); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + long o = (long) hs.get(am).invokeExact(array, ci, 0xDEADBEEFDEADBEEFL); + }); + } } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java index ca4121e412e..5b6b8ad39c7 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (short)0x0123, (short)0x4567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, (short)0x4567, (short)0x0123); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get @@ -255,19 +255,122 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { assertEquals(x, (short)0x4567, "getAndSet short value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); - // get and add, add and get { - short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (short)0x89AB); + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, (short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessShort recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((short)0x0123, (short)0x4567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact((short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -393,34 +496,159 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact((short)0x4567, (short)0x0123); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get { - short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact( (short)0x4567); + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact((short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, (short)0x4567, "getAndSet short value"); } - hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( (short)0x89AB); + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact((short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact((short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (short)0x0123, (short)0x4567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -549,30 +777,152 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, (short)0x4567, (short)0x0123); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, (short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, (short)0x4567, "getAndSet short value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (short)0x89AB); + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, (short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); + } } } @@ -581,6 +931,7 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest { short o = (short) hs.get(am).invokeExact(array, ci, (short)0x89AB); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + short o = (short) hs.get(am).invokeExact(array, ci, (short)0x89AB); + }); + } } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java index 079d8053606..0eb978588b5 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java @@ -210,11 +210,11 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "foo", "bar"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -240,11 +240,11 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, "bar", "foo"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get @@ -255,6 +255,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { assertEquals(x, "bar", "getAndSet String value"); } + } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable { @@ -264,6 +265,12 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { String r = (String) hs.get(am).invokeExact(recv, "foo"); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + String r = (String) hs.get(am).invokeExact(recv, "foo"); + }); + } } @@ -359,11 +366,11 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("foo", "bar"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact("foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -389,21 +396,44 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact("bar", "foo"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get { - String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact( "bar"); + hs.get(TestAccessMode.SET).invokeExact("foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact("bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, "bar", "getAndSet String value"); } + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact("foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact("bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact("foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact("bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } static void testStaticFieldUnsupported(Handles hs) throws Throwable { @@ -413,6 +443,12 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { String r = (String) hs.get(am).invokeExact("foo"); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + String r = (String) hs.get(am).invokeExact("foo"); + }); + } } @@ -511,11 +547,11 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "foo", "bar"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -541,21 +577,42 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, "bar", "foo"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, "foo"); + String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, "bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, "bar", "getAndSet String value"); } + { + hs.get(TestAccessMode.SET).invokeExact(array, i, "foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, "bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, "foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, "bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } } @@ -569,6 +626,12 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { String o = (String) hs.get(am).invokeExact(array, i, "foo"); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + String o = (String) hs.get(am).invokeExact(array, i, "foo"); + }); + } } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -607,6 +670,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { }); } + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java index 624f98a8407..858913fc99e 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, true, true); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, true, true); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, true); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, true, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, true, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, true, true, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, true, true); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, true, true); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, true, true); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, true); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, true, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, true, true); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, true, true, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,333 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { boolean x = (boolean) vh.getAndSet(recv, true, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndSetAcquire(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndSetAcquire(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndSetAcquire(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetAcquire(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetAcquire(recv, true, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndSetRelease(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndSetRelease(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndSetRelease(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetRelease(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetRelease(recv, true, Void.class); + }); + + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseOr(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseOr(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOr(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOr(recv, true, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseOrAcquire(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrAcquire(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, true, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseOrRelease(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseOr(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOr(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOr(recv, true, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseAnd(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAnd(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAnd(recv, true, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseAndAcquire(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndAcquire(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, true, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseAndRelease(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAnd(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAnd(recv, true, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseXor(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseXor(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXor(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXor(recv, true, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseXorAcquire(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorAcquire(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, true, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseXorRelease(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseXor(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXor(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXor(recv, true, Void.class); + }); } static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeBoolean recv, Handles hs) throws Throwable { @@ -759,6 +1086,43 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact((VarHandleTestMethodTypeBoolean) null, true); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, boolean.class)). + invokeExact(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, boolean.class)). + invokeExact(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) hs.get(am, methodType(boolean.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact(recv, true, Void.class); + }); + } } @@ -891,6 +1255,23 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, true); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(true, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(true, true, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, true); }); @@ -906,23 +1287,6 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, true); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(true, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(true, true, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1049,6 +1413,236 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { boolean x = (boolean) vh.getAndSet(true, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetAcquire(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetAcquire(true, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetRelease(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetRelease(true, Void.class); + }); + + + // GetAndBitwiseOr + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOr(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOr(true, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrAcquire(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrAcquire(true, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrRelease(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrRelease(true, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAnd(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAnd(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAnd(true, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndAcquire(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndAcquire(true, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndRelease(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndRelease(true, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXor(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXor(true, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorAcquire(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorAcquire(true, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorRelease(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorRelease(true, Void.class); + }); } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1163,6 +1757,32 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, boolean.class)). + invokeExact(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) hs.get(am, methodType(int.class, boolean.class)). + invokeExact(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) hs.get(am, methodType(boolean.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean.class, Class.class)). + invokeExact(true, Void.class); + }); + } } @@ -1425,6 +2045,35 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, true, true); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, true, true); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, true); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, true, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, true, true); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, true, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, true, true, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, true, true); }); @@ -1452,35 +2101,6 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, true, true); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, true, true); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, true); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, true, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, true, true); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, true, true); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, true, true, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1679,6 +2299,368 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { boolean x = (boolean) vh.getAndSet(array, 0, true, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndSetAcquire(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndSetAcquire(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + boolean x = (boolean) vh.getAndSetAcquire(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndSetAcquire(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetAcquire(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetAcquire(array, 0, true, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndSetRelease(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndSetRelease(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + boolean x = (boolean) vh.getAndSetRelease(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndSetRelease(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetRelease(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetRelease(array, 0, true, Void.class); + }); + + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseOr(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseOr(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseOr(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOr(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, true, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseOrAcquire(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrAcquire(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, true, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseOrRelease(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseOrRelease(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrRelease(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, true, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseAnd(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseAnd(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAnd(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, true, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseAndAcquire(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndAcquire(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, true, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseAndRelease(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseAndRelease(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndRelease(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, true, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseXor(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseXor(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseXor(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXor(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, true, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseXorAcquire(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorAcquire(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, true, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseXorRelease(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseXorRelease(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorRelease(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, true, Void.class); + }); } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -1880,6 +2862,48 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, boolean.class)). + invokeExact((boolean[]) null, 0, true); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, boolean.class)). + invokeExact(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, boolean.class)). + invokeExact(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, Class.class, boolean.class)). + invokeExact(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, boolean[].class, int.class, boolean.class)). + invokeExact(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) hs.get(am, methodType(int.class, boolean[].class, int.class, boolean.class)). + invokeExact(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) hs.get(am, methodType(boolean.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, boolean.class, Class.class)). + invokeExact(array, 0, true, Void.class); + }); + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java index 692d667ac05..0f9097acd33 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, (byte)0x01, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, (byte)0x01, (byte)0x01); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, (byte)0x01); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, (byte)0x01, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, (byte)0x01, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, (byte)0x01, (byte)0x01, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, (byte)0x01, (byte)0x01); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, (byte)0x01, (byte)0x01); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, (byte)0x01, (byte)0x01); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, (byte)0x01); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, (byte)0x01, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, (byte)0x01, (byte)0x01); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, (byte)0x01, (byte)0x01, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { byte x = (byte) vh.getAndSet(recv, (byte)0x01, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndSetAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndSetAcquire(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndSetAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetAcquire(recv, (byte)0x01, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndSetRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndSetRelease(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndSetRelease(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetRelease(recv, (byte)0x01, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { byte x = (byte) vh.getAndAdd(recv, (byte)0x01, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - byte x = (byte) vh.addAndGet(null, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(null, (byte)0x01); }); checkCCE(() -> { // receiver reference class - byte x = (byte) vh.addAndGet(Void.class, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(Void.class, (byte)0x01); }); checkWMTE(() -> { // value reference class - byte x = (byte) vh.addAndGet(recv, Void.class); + byte x = (byte) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - byte x = (byte) vh.addAndGet(0, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(0, (byte)0x01); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, (byte)0x01); + Void r = (Void) vh.getAndAddAcquire(recv, (byte)0x01); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, (byte)0x01); + boolean x = (boolean) vh.getAndAddAcquire(recv, (byte)0x01); }); // Incorrect arity checkWMTE(() -> { // 0 - byte x = (byte) vh.addAndGet(); + byte x = (byte) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - byte x = (byte) vh.addAndGet(recv, (byte)0x01, Void.class); + byte x = (byte) vh.getAndAddAcquire(recv, (byte)0x01, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndAddRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndAddRelease(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndAddRelease(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddRelease(recv, (byte)0x01, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseOr(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseOr(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseOr(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOr(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseOrAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseOrAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrAcquire(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseOrRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseOr(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseOr(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOr(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseAnd(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseAnd(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseAnd(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAnd(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseAndAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseAndAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndAcquire(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseAndRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseAnd(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseAnd(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAnd(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseXor(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseXor(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseXor(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXor(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseXorAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseXorAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorAcquire(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseXorRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseXor(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseXor(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXor(recv, (byte)0x01, Void.class); }); } @@ -853,6 +1208,43 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { invokeExact(recv, (byte)0x01, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + byte x = (byte) hs.get(am, methodType(byte.class, Class.class, byte.class)). + invokeExact(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) hs.get(am, methodType(byte.class, int.class, byte.class)). + invokeExact(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) hs.get(am, methodType(byte.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact(recv, (byte)0x01, Void.class); + }); + } } @@ -985,6 +1377,23 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain((byte)0x01, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain((byte)0x01, (byte)0x01, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, (byte)0x01); }); @@ -1000,23 +1409,6 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, (byte)0x01); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile((byte)0x01, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile((byte)0x01, (byte)0x01, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { byte x = (byte) vh.getAndSet((byte)0x01, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetAcquire((byte)0x01, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetRelease((byte)0x01, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - byte x = (byte) vh.addAndGet(Void.class); + byte x = (byte) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet((byte)0x01); + Void r = (Void) vh.getAndAddAcquire((byte)0x01); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet((byte)0x01); + boolean x = (boolean) vh.getAndAddAcquire((byte)0x01); }); // Incorrect arity checkWMTE(() -> { // 0 - byte x = (byte) vh.addAndGet(); + byte x = (byte) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - byte x = (byte) vh.addAndGet((byte)0x01, Void.class); + byte x = (byte) vh.getAndAddAcquire((byte)0x01, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddRelease((byte)0x01, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOr((byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrAcquire((byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrRelease((byte)0x01, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAnd(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAnd((byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndAcquire((byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndRelease((byte)0x01, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXor((byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorAcquire((byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorRelease((byte)0x01, Void.class); }); } @@ -1322,6 +1965,32 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { invokeExact((byte)0x01, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) hs.get(am, methodType(byte.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, byte.class)). + invokeExact((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, byte.class)). + invokeExact((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) hs.get(am, methodType(byte.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + byte x = (byte) hs.get(am, methodType(byte.class, byte.class, Class.class)). + invokeExact((byte)0x01, Void.class); + }); + } } @@ -1584,6 +2253,35 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, (byte)0x01, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, (byte)0x01, (byte)0x01); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, (byte)0x01); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, (byte)0x01, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, (byte)0x01, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, (byte)0x01, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, (byte)0x01, (byte)0x01, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, (byte)0x01, (byte)0x01); }); @@ -1611,35 +2309,6 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, (byte)0x01, (byte)0x01); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, (byte)0x01, (byte)0x01); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, (byte)0x01); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, (byte)0x01, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, (byte)0x01, (byte)0x01); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, (byte)0x01, (byte)0x01); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, (byte)0x01, (byte)0x01, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { byte x = (byte) vh.getAndSet(array, 0, (byte)0x01, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndSetAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndSetAcquire(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + byte x = (byte) vh.getAndSetAcquire(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndSetAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndSetRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndSetRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + byte x = (byte) vh.getAndSetRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndSetRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetRelease(array, 0, (byte)0x01, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - byte x = (byte) vh.addAndGet(null, 0, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(null, 0, (byte)0x01); }); checkCCE(() -> { // array reference class - byte x = (byte) vh.addAndGet(Void.class, 0, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(Void.class, 0, (byte)0x01); }); checkWMTE(() -> { // value reference class - byte x = (byte) vh.addAndGet(array, 0, Void.class); + byte x = (byte) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - byte x = (byte) vh.addAndGet(0, 0, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(0, 0, (byte)0x01); }); checkWMTE(() -> { // index reference class - byte x = (byte) vh.addAndGet(array, Void.class, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(array, Void.class, (byte)0x01); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, (byte)0x01); + Void r = (Void) vh.getAndAddAcquire(array, 0, (byte)0x01); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, (byte)0x01); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, (byte)0x01); }); // Incorrect arity checkWMTE(() -> { // 0 - byte x = (byte) vh.addAndGet(); + byte x = (byte) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - byte x = (byte) vh.addAndGet(array, 0, (byte)0x01, Void.class); + byte x = (byte) vh.getAndAddAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndAddRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndAddRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndAddRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndAddRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddRelease(array, 0, (byte)0x01, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseOr(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseOr(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseOr(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseOr(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOr(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseOrAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseOrAcquire(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseOrRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseOrRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseOrRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseOrRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseAnd(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseAnd(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseAnd(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseAnd(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAnd(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseAndAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseAndAcquire(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseAndRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseAndRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseAndRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseAndRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseXor(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseXor(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseXor(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseXor(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXor(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseXorAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseXorAcquire(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseXorRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseXorRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseXorRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseXorRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01, Void.class); }); } @@ -2144,6 +3208,48 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { invokeExact(array, 0, (byte)0x01, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class)). + invokeExact((byte[]) null, 0, (byte)0x01); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class, byte.class)). + invokeExact(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class, byte.class)). + invokeExact(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class, byte.class)). + invokeExact(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, byte.class)). + invokeExact(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class)). + invokeExact(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) hs.get(am, methodType(byte.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, Class.class)). + invokeExact(array, 0, (byte)0x01, Void.class); + }); + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java index 268e521f294..46ffc0f8cc7 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, '\u0123', '\u0123'); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, '\u0123', '\u0123'); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, '\u0123'); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, '\u0123', Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, '\u0123', '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, '\u0123', '\u0123', Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, '\u0123', '\u0123'); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, '\u0123', '\u0123'); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, '\u0123', '\u0123'); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, '\u0123'); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, '\u0123', Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, '\u0123', '\u0123'); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, '\u0123', '\u0123', Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { char x = (char) vh.getAndSet(recv, '\u0123', Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndSetAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndSetAcquire(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndSetAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetAcquire(recv, '\u0123', Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndSetRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndSetRelease(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndSetRelease(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetRelease(recv, '\u0123', Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { char x = (char) vh.getAndAdd(recv, '\u0123', Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - char x = (char) vh.addAndGet(null, '\u0123'); + char x = (char) vh.getAndAddAcquire(null, '\u0123'); }); checkCCE(() -> { // receiver reference class - char x = (char) vh.addAndGet(Void.class, '\u0123'); + char x = (char) vh.getAndAddAcquire(Void.class, '\u0123'); }); checkWMTE(() -> { // value reference class - char x = (char) vh.addAndGet(recv, Void.class); + char x = (char) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - char x = (char) vh.addAndGet(0, '\u0123'); + char x = (char) vh.getAndAddAcquire(0, '\u0123'); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, '\u0123'); + Void r = (Void) vh.getAndAddAcquire(recv, '\u0123'); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, '\u0123'); + boolean x = (boolean) vh.getAndAddAcquire(recv, '\u0123'); }); // Incorrect arity checkWMTE(() -> { // 0 - char x = (char) vh.addAndGet(); + char x = (char) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - char x = (char) vh.addAndGet(recv, '\u0123', Void.class); + char x = (char) vh.getAndAddAcquire(recv, '\u0123', Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndAddRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndAddRelease(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndAddRelease(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddRelease(recv, '\u0123', Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseOr(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseOr(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseOr(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOr(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseOrAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseOrAcquire(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOrAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseOrAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrAcquire(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseOrRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseOr(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseOr(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOr(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseAnd(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseAnd(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseAnd(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAnd(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseAndAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseAndAcquire(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseAndAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndAcquire(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseAndRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseAnd(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseAnd(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAnd(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseXor(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseXor(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseXor(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXor(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseXorAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseXorAcquire(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseXorAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorAcquire(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseXorRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseXor(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseXor(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXor(recv, '\u0123', Void.class); }); } @@ -853,6 +1208,43 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { invokeExact(recv, '\u0123', Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact((VarHandleTestMethodTypeChar) null, '\u0123'); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + char x = (char) hs.get(am, methodType(char.class, Class.class, char.class)). + invokeExact(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) hs.get(am, methodType(char.class, int.class, char.class)). + invokeExact(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) hs.get(am, methodType(char.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact(recv, '\u0123', Void.class); + }); + } } @@ -985,6 +1377,23 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, '\u0123'); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain('\u0123', Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain('\u0123', '\u0123', Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, '\u0123'); }); @@ -1000,23 +1409,6 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, '\u0123'); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile('\u0123', Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile('\u0123', '\u0123', Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { char x = (char) vh.getAndSet('\u0123', Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetAcquire('\u0123', Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetRelease('\u0123', Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - char x = (char) vh.addAndGet(Void.class); + char x = (char) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet('\u0123'); + Void r = (Void) vh.getAndAddAcquire('\u0123'); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet('\u0123'); + boolean x = (boolean) vh.getAndAddAcquire('\u0123'); }); // Incorrect arity checkWMTE(() -> { // 0 - char x = (char) vh.addAndGet(); + char x = (char) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - char x = (char) vh.addAndGet('\u0123', Void.class); + char x = (char) vh.getAndAddAcquire('\u0123', Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddRelease('\u0123', Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOr('\u0123', Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrAcquire('\u0123', Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrRelease('\u0123', Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAnd(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAnd('\u0123', Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndAcquire('\u0123', Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndRelease('\u0123', Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXor('\u0123', Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorAcquire('\u0123', Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorRelease('\u0123', Void.class); }); } @@ -1322,6 +1965,32 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { invokeExact('\u0123', Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) hs.get(am, methodType(char.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, char.class)). + invokeExact('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, char.class)). + invokeExact('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) hs.get(am, methodType(char.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + char x = (char) hs.get(am, methodType(char.class, char.class, Class.class)). + invokeExact('\u0123', Void.class); + }); + } } @@ -1584,6 +2253,35 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, '\u0123', '\u0123'); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, '\u0123', '\u0123'); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, '\u0123'); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, '\u0123', Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, '\u0123', '\u0123'); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, '\u0123', '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, '\u0123', '\u0123', Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, '\u0123', '\u0123'); }); @@ -1611,35 +2309,6 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, '\u0123', '\u0123'); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, '\u0123', '\u0123'); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, '\u0123'); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, '\u0123', Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, '\u0123', '\u0123'); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, '\u0123', '\u0123'); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, '\u0123', '\u0123', Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { char x = (char) vh.getAndSet(array, 0, '\u0123', Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndSetAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndSetAcquire(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + char x = (char) vh.getAndSetAcquire(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndSetAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndSetRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndSetRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + char x = (char) vh.getAndSetRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndSetRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetRelease(array, 0, '\u0123', Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - char x = (char) vh.addAndGet(null, 0, '\u0123'); + char x = (char) vh.getAndAddAcquire(null, 0, '\u0123'); }); checkCCE(() -> { // array reference class - char x = (char) vh.addAndGet(Void.class, 0, '\u0123'); + char x = (char) vh.getAndAddAcquire(Void.class, 0, '\u0123'); }); checkWMTE(() -> { // value reference class - char x = (char) vh.addAndGet(array, 0, Void.class); + char x = (char) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - char x = (char) vh.addAndGet(0, 0, '\u0123'); + char x = (char) vh.getAndAddAcquire(0, 0, '\u0123'); }); checkWMTE(() -> { // index reference class - char x = (char) vh.addAndGet(array, Void.class, '\u0123'); + char x = (char) vh.getAndAddAcquire(array, Void.class, '\u0123'); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, '\u0123'); + Void r = (Void) vh.getAndAddAcquire(array, 0, '\u0123'); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, '\u0123'); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, '\u0123'); }); // Incorrect arity checkWMTE(() -> { // 0 - char x = (char) vh.addAndGet(); + char x = (char) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - char x = (char) vh.addAndGet(array, 0, '\u0123', Void.class); + char x = (char) vh.getAndAddAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndAddRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndAddRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndAddRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndAddRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddRelease(array, 0, '\u0123', Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseOr(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseOr(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseOr(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseOr(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOr(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseOrAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseOrAcquire(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOrAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseOrAcquire(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseOrAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseOrRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseOrRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseOrRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseOrRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrRelease(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseAnd(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseAnd(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseAnd(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseAnd(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAnd(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseAndAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseAndAcquire(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseAndAcquire(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseAndAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseAndRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseAndRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseAndRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseAndRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndRelease(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseXor(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseXor(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseXor(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseXor(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXor(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseXorAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseXorAcquire(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseXorAcquire(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseXorAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseXorRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseXorRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseXorRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseXorRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorRelease(array, 0, '\u0123', Void.class); }); } @@ -2144,6 +3208,48 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { invokeExact(array, 0, '\u0123', Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, char.class)). + invokeExact((char[]) null, 0, '\u0123'); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + char x = (char) hs.get(am, methodType(char.class, Class.class, int.class, char.class)). + invokeExact(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) hs.get(am, methodType(char.class, int.class, int.class, char.class)). + invokeExact(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) hs.get(am, methodType(char.class, char[].class, Class.class, char.class)). + invokeExact(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, char[].class, int.class, char.class)). + invokeExact(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, char[].class, int.class, char.class)). + invokeExact(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) hs.get(am, methodType(char.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, char.class, Class.class)). + invokeExact(array, 0, '\u0123', Void.class); + }); + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java index e3bf8363a15..af37433385c 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 1.0d, 1.0d); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 1.0d, 1.0d); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, 1.0d); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, 1.0d, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 1.0d, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, 1.0d, 1.0d, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 1.0d, 1.0d); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 1.0d, 1.0d); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 1.0d, 1.0d); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, 1.0d); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, 1.0d, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 1.0d, 1.0d); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, 1.0d, 1.0d, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { double x = (double) vh.getAndSet(recv, 1.0d, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + double x = (double) vh.getAndSetAcquire(null, 1.0d); + }); + checkCCE(() -> { // receiver reference class + double x = (double) vh.getAndSetAcquire(Void.class, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + double x = (double) vh.getAndSetAcquire(0, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetAcquire(recv, 1.0d, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + double x = (double) vh.getAndSetRelease(null, 1.0d); + }); + checkCCE(() -> { // receiver reference class + double x = (double) vh.getAndSetRelease(Void.class, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + double x = (double) vh.getAndSetRelease(0, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetRelease(recv, 1.0d, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,35 +669,64 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { double x = (double) vh.getAndAdd(recv, 1.0d, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - double x = (double) vh.addAndGet(null, 1.0d); + double x = (double) vh.getAndAddAcquire(null, 1.0d); }); checkCCE(() -> { // receiver reference class - double x = (double) vh.addAndGet(Void.class, 1.0d); + double x = (double) vh.getAndAddAcquire(Void.class, 1.0d); }); checkWMTE(() -> { // value reference class - double x = (double) vh.addAndGet(recv, Void.class); + double x = (double) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - double x = (double) vh.addAndGet(0, 1.0d); + double x = (double) vh.getAndAddAcquire(0, 1.0d); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, 1.0d); + Void r = (Void) vh.getAndAddAcquire(recv, 1.0d); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, 1.0d); + boolean x = (boolean) vh.getAndAddAcquire(recv, 1.0d); }); // Incorrect arity checkWMTE(() -> { // 0 - double x = (double) vh.addAndGet(); + double x = (double) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - double x = (double) vh.addAndGet(recv, 1.0d, Void.class); + double x = (double) vh.getAndAddAcquire(recv, 1.0d, Void.class); }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + double x = (double) vh.getAndAddRelease(null, 1.0d); + }); + checkCCE(() -> { // receiver reference class + double x = (double) vh.getAndAddRelease(Void.class, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + double x = (double) vh.getAndAddRelease(0, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndAddRelease(recv, 1.0d, Void.class); + }); + } static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeDouble recv, Handles hs) throws Throwable { @@ -853,6 +940,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { invokeExact(recv, 1.0d, Void.class); }); } + } @@ -985,6 +1073,23 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 1.0d); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(1.0d, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(1.0d, 1.0d, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, 1.0d); }); @@ -1000,23 +1105,6 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 1.0d); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(1.0d, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(1.0d, 1.0d, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1231,48 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { double x = (double) vh.getAndSet(1.0d, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetAcquire(1.0d, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetRelease(1.0d, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,25 +1294,47 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - double x = (double) vh.addAndGet(Void.class); + double x = (double) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(1.0d); + Void r = (Void) vh.getAndAddAcquire(1.0d); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(1.0d); + boolean x = (boolean) vh.getAndAddAcquire(1.0d); }); // Incorrect arity checkWMTE(() -> { // 0 - double x = (double) vh.addAndGet(); + double x = (double) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - double x = (double) vh.addAndGet(1.0d, Void.class); + double x = (double) vh.getAndAddAcquire(1.0d, Void.class); }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndAddRelease(1.0d, Void.class); + }); + } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1322,6 +1474,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { invokeExact(1.0d, Void.class); }); } + } @@ -1584,6 +1737,35 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, 1.0d, 1.0d); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, 1.0d, 1.0d); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, 1.0d); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, 1.0d, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, 1.0d, 1.0d); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, 1.0d, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, 1.0d, 1.0d, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, 1.0d, 1.0d); }); @@ -1611,35 +1793,6 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, 1.0d, 1.0d); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, 1.0d, 1.0d); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, 1.0d); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, 1.0d, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, 1.0d, 1.0d); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, 1.0d, 1.0d); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, 1.0d, 1.0d, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +1991,72 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { double x = (double) vh.getAndSet(array, 0, 1.0d, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + double x = (double) vh.getAndSetAcquire(null, 0, 1.0d); + }); + checkCCE(() -> { // array reference class + double x = (double) vh.getAndSetAcquire(Void.class, 0, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + double x = (double) vh.getAndSetAcquire(0, 0, 1.0d); + }); + checkWMTE(() -> { // index reference class + double x = (double) vh.getAndSetAcquire(array, Void.class, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetAcquire(array, 0, 1.0d, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + double x = (double) vh.getAndSetRelease(null, 0, 1.0d); + }); + checkCCE(() -> { // array reference class + double x = (double) vh.getAndSetRelease(Void.class, 0, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + double x = (double) vh.getAndSetRelease(0, 0, 1.0d); + }); + checkWMTE(() -> { // index reference class + double x = (double) vh.getAndSetRelease(array, Void.class, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetRelease(array, 0, 1.0d, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,37 +2090,71 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - double x = (double) vh.addAndGet(null, 0, 1.0d); + double x = (double) vh.getAndAddAcquire(null, 0, 1.0d); }); checkCCE(() -> { // array reference class - double x = (double) vh.addAndGet(Void.class, 0, 1.0d); + double x = (double) vh.getAndAddAcquire(Void.class, 0, 1.0d); }); checkWMTE(() -> { // value reference class - double x = (double) vh.addAndGet(array, 0, Void.class); + double x = (double) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - double x = (double) vh.addAndGet(0, 0, 1.0d); + double x = (double) vh.getAndAddAcquire(0, 0, 1.0d); }); checkWMTE(() -> { // index reference class - double x = (double) vh.addAndGet(array, Void.class, 1.0d); + double x = (double) vh.getAndAddAcquire(array, Void.class, 1.0d); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, 1.0d); + Void r = (Void) vh.getAndAddAcquire(array, 0, 1.0d); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, 1.0d); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, 1.0d); }); // Incorrect arity checkWMTE(() -> { // 0 - double x = (double) vh.addAndGet(); + double x = (double) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - double x = (double) vh.addAndGet(array, 0, 1.0d, Void.class); + double x = (double) vh.getAndAddAcquire(array, 0, 1.0d, Void.class); }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + double x = (double) vh.getAndAddRelease(null, 0, 1.0d); + }); + checkCCE(() -> { // array reference class + double x = (double) vh.getAndAddRelease(Void.class, 0, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + double x = (double) vh.getAndAddRelease(0, 0, 1.0d); + }); + checkWMTE(() -> { // index reference class + double x = (double) vh.getAndAddRelease(array, Void.class, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndAddRelease(array, 0, 1.0d, Void.class); + }); + } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -2144,6 +2397,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { invokeExact(array, 0, 1.0d, Void.class); }); } + } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java index 34617e2102e..b5d6711a3cb 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 1.0f, 1.0f); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 1.0f, 1.0f); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, 1.0f); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, 1.0f, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 1.0f, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, 1.0f, 1.0f, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 1.0f, 1.0f); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 1.0f, 1.0f); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 1.0f, 1.0f); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, 1.0f); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, 1.0f, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 1.0f, 1.0f); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, 1.0f, 1.0f, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { float x = (float) vh.getAndSet(recv, 1.0f, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + float x = (float) vh.getAndSetAcquire(null, 1.0f); + }); + checkCCE(() -> { // receiver reference class + float x = (float) vh.getAndSetAcquire(Void.class, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + float x = (float) vh.getAndSetAcquire(0, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetAcquire(recv, 1.0f, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + float x = (float) vh.getAndSetRelease(null, 1.0f); + }); + checkCCE(() -> { // receiver reference class + float x = (float) vh.getAndSetRelease(Void.class, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + float x = (float) vh.getAndSetRelease(0, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetRelease(recv, 1.0f, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,35 +669,64 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { float x = (float) vh.getAndAdd(recv, 1.0f, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - float x = (float) vh.addAndGet(null, 1.0f); + float x = (float) vh.getAndAddAcquire(null, 1.0f); }); checkCCE(() -> { // receiver reference class - float x = (float) vh.addAndGet(Void.class, 1.0f); + float x = (float) vh.getAndAddAcquire(Void.class, 1.0f); }); checkWMTE(() -> { // value reference class - float x = (float) vh.addAndGet(recv, Void.class); + float x = (float) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - float x = (float) vh.addAndGet(0, 1.0f); + float x = (float) vh.getAndAddAcquire(0, 1.0f); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, 1.0f); + Void r = (Void) vh.getAndAddAcquire(recv, 1.0f); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, 1.0f); + boolean x = (boolean) vh.getAndAddAcquire(recv, 1.0f); }); // Incorrect arity checkWMTE(() -> { // 0 - float x = (float) vh.addAndGet(); + float x = (float) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - float x = (float) vh.addAndGet(recv, 1.0f, Void.class); + float x = (float) vh.getAndAddAcquire(recv, 1.0f, Void.class); }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + float x = (float) vh.getAndAddRelease(null, 1.0f); + }); + checkCCE(() -> { // receiver reference class + float x = (float) vh.getAndAddRelease(Void.class, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + float x = (float) vh.getAndAddRelease(0, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndAddRelease(recv, 1.0f, Void.class); + }); + } static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeFloat recv, Handles hs) throws Throwable { @@ -853,6 +940,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { invokeExact(recv, 1.0f, Void.class); }); } + } @@ -985,6 +1073,23 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 1.0f); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(1.0f, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(1.0f, 1.0f, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, 1.0f); }); @@ -1000,23 +1105,6 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 1.0f); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(1.0f, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(1.0f, 1.0f, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1231,48 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { float x = (float) vh.getAndSet(1.0f, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetAcquire(1.0f, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetRelease(1.0f, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,25 +1294,47 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - float x = (float) vh.addAndGet(Void.class); + float x = (float) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(1.0f); + Void r = (Void) vh.getAndAddAcquire(1.0f); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(1.0f); + boolean x = (boolean) vh.getAndAddAcquire(1.0f); }); // Incorrect arity checkWMTE(() -> { // 0 - float x = (float) vh.addAndGet(); + float x = (float) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - float x = (float) vh.addAndGet(1.0f, Void.class); + float x = (float) vh.getAndAddAcquire(1.0f, Void.class); }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndAddRelease(1.0f, Void.class); + }); + } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1322,6 +1474,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { invokeExact(1.0f, Void.class); }); } + } @@ -1584,6 +1737,35 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, 1.0f, 1.0f); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, 1.0f, 1.0f); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, 1.0f); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, 1.0f, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, 1.0f, 1.0f); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, 1.0f, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, 1.0f, 1.0f, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, 1.0f, 1.0f); }); @@ -1611,35 +1793,6 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, 1.0f, 1.0f); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, 1.0f, 1.0f); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, 1.0f); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, 1.0f, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, 1.0f, 1.0f); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, 1.0f, 1.0f); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, 1.0f, 1.0f, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +1991,72 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { float x = (float) vh.getAndSet(array, 0, 1.0f, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + float x = (float) vh.getAndSetAcquire(null, 0, 1.0f); + }); + checkCCE(() -> { // array reference class + float x = (float) vh.getAndSetAcquire(Void.class, 0, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + float x = (float) vh.getAndSetAcquire(0, 0, 1.0f); + }); + checkWMTE(() -> { // index reference class + float x = (float) vh.getAndSetAcquire(array, Void.class, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetAcquire(array, 0, 1.0f, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + float x = (float) vh.getAndSetRelease(null, 0, 1.0f); + }); + checkCCE(() -> { // array reference class + float x = (float) vh.getAndSetRelease(Void.class, 0, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + float x = (float) vh.getAndSetRelease(0, 0, 1.0f); + }); + checkWMTE(() -> { // index reference class + float x = (float) vh.getAndSetRelease(array, Void.class, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetRelease(array, 0, 1.0f, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,37 +2090,71 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - float x = (float) vh.addAndGet(null, 0, 1.0f); + float x = (float) vh.getAndAddAcquire(null, 0, 1.0f); }); checkCCE(() -> { // array reference class - float x = (float) vh.addAndGet(Void.class, 0, 1.0f); + float x = (float) vh.getAndAddAcquire(Void.class, 0, 1.0f); }); checkWMTE(() -> { // value reference class - float x = (float) vh.addAndGet(array, 0, Void.class); + float x = (float) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - float x = (float) vh.addAndGet(0, 0, 1.0f); + float x = (float) vh.getAndAddAcquire(0, 0, 1.0f); }); checkWMTE(() -> { // index reference class - float x = (float) vh.addAndGet(array, Void.class, 1.0f); + float x = (float) vh.getAndAddAcquire(array, Void.class, 1.0f); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, 1.0f); + Void r = (Void) vh.getAndAddAcquire(array, 0, 1.0f); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, 1.0f); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, 1.0f); }); // Incorrect arity checkWMTE(() -> { // 0 - float x = (float) vh.addAndGet(); + float x = (float) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - float x = (float) vh.addAndGet(array, 0, 1.0f, Void.class); + float x = (float) vh.getAndAddAcquire(array, 0, 1.0f, Void.class); }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + float x = (float) vh.getAndAddRelease(null, 0, 1.0f); + }); + checkCCE(() -> { // array reference class + float x = (float) vh.getAndAddRelease(Void.class, 0, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + float x = (float) vh.getAndAddRelease(0, 0, 1.0f); + }); + checkWMTE(() -> { // index reference class + float x = (float) vh.getAndAddRelease(array, Void.class, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndAddRelease(array, 0, 1.0f, Void.class); + }); + } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -2144,6 +2397,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { invokeExact(array, 0, 1.0f, Void.class); }); } + } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java index 33b33970f80..9f0b995663c 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0x01234567, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0x01234567, 0x01234567); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, 0x01234567); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, 0x01234567, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0x01234567, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, 0x01234567, 0x01234567, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0x01234567, 0x01234567); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0x01234567, 0x01234567); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0x01234567, 0x01234567); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, 0x01234567); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, 0x01234567, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0x01234567, 0x01234567); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, 0x01234567, 0x01234567, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { int x = (int) vh.getAndSet(recv, 0x01234567, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndSetAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndSetAcquire(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndSetAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetAcquire(recv, 0x01234567, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndSetRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndSetRelease(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndSetRelease(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetRelease(recv, 0x01234567, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { int x = (int) vh.getAndAdd(recv, 0x01234567, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - int x = (int) vh.addAndGet(null, 0x01234567); + int x = (int) vh.getAndAddAcquire(null, 0x01234567); }); checkCCE(() -> { // receiver reference class - int x = (int) vh.addAndGet(Void.class, 0x01234567); + int x = (int) vh.getAndAddAcquire(Void.class, 0x01234567); }); checkWMTE(() -> { // value reference class - int x = (int) vh.addAndGet(recv, Void.class); + int x = (int) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - int x = (int) vh.addAndGet(0, 0x01234567); + int x = (int) vh.getAndAddAcquire(0, 0x01234567); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, 0x01234567); + Void r = (Void) vh.getAndAddAcquire(recv, 0x01234567); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, 0x01234567); + boolean x = (boolean) vh.getAndAddAcquire(recv, 0x01234567); }); // Incorrect arity checkWMTE(() -> { // 0 - int x = (int) vh.addAndGet(); + int x = (int) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - int x = (int) vh.addAndGet(recv, 0x01234567, Void.class); + int x = (int) vh.getAndAddAcquire(recv, 0x01234567, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndAddRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndAddRelease(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndAddRelease(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddRelease(recv, 0x01234567, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseOr(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseOr(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseOr(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOr(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseOrAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseOrAcquire(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOrAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseOrAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrAcquire(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseOrRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseOr(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseOr(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOr(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseAnd(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseAnd(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseAnd(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAnd(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseAndAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseAndAcquire(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseAndAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndAcquire(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseAndRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseAnd(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseAnd(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAnd(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseXor(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseXor(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseXor(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXor(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseXorAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseXorAcquire(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseXorAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorAcquire(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseXorRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseXor(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseXor(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXor(recv, 0x01234567, Void.class); }); } @@ -853,6 +1208,43 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { invokeExact(recv, 0x01234567, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact((VarHandleTestMethodTypeInt) null, 0x01234567); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)). + invokeExact(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) hs.get(am, methodType(int.class, int.class, int.class)). + invokeExact(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) hs.get(am, methodType(int.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact(recv, 0x01234567, Void.class); + }); + } } @@ -985,6 +1377,23 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0x01234567); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(0x01234567, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(0x01234567, 0x01234567, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, 0x01234567); }); @@ -1000,23 +1409,6 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0x01234567); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(0x01234567, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(0x01234567, 0x01234567, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { int x = (int) vh.getAndSet(0x01234567, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetAcquire(0x01234567, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetRelease(0x01234567, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - int x = (int) vh.addAndGet(Void.class); + int x = (int) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(0x01234567); + Void r = (Void) vh.getAndAddAcquire(0x01234567); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(0x01234567); + boolean x = (boolean) vh.getAndAddAcquire(0x01234567); }); // Incorrect arity checkWMTE(() -> { // 0 - int x = (int) vh.addAndGet(); + int x = (int) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - int x = (int) vh.addAndGet(0x01234567, Void.class); + int x = (int) vh.getAndAddAcquire(0x01234567, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddRelease(0x01234567, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOr(0x01234567, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrAcquire(0x01234567, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrRelease(0x01234567, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAnd(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAnd(0x01234567, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndAcquire(0x01234567, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndRelease(0x01234567, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXor(0x01234567, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorAcquire(0x01234567, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorRelease(0x01234567, Void.class); }); } @@ -1322,6 +1965,32 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { invokeExact(0x01234567, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) hs.get(am, methodType(int.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, int.class)). + invokeExact(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)). + invokeExact(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) hs.get(am, methodType(int.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)). + invokeExact(0x01234567, Void.class); + }); + } } @@ -1584,6 +2253,35 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, 0x01234567, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, 0x01234567, 0x01234567); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, 0x01234567); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, 0x01234567, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, 0x01234567, 0x01234567); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, 0x01234567, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, 0x01234567, 0x01234567, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, 0x01234567, 0x01234567); }); @@ -1611,35 +2309,6 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, 0x01234567, 0x01234567); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, 0x01234567, 0x01234567); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, 0x01234567); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, 0x01234567, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, 0x01234567, 0x01234567); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, 0x01234567, 0x01234567); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, 0x01234567, 0x01234567, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { int x = (int) vh.getAndSet(array, 0, 0x01234567, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndSetAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndSetAcquire(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + int x = (int) vh.getAndSetAcquire(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndSetAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndSetRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndSetRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + int x = (int) vh.getAndSetRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndSetRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetRelease(array, 0, 0x01234567, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - int x = (int) vh.addAndGet(null, 0, 0x01234567); + int x = (int) vh.getAndAddAcquire(null, 0, 0x01234567); }); checkCCE(() -> { // array reference class - int x = (int) vh.addAndGet(Void.class, 0, 0x01234567); + int x = (int) vh.getAndAddAcquire(Void.class, 0, 0x01234567); }); checkWMTE(() -> { // value reference class - int x = (int) vh.addAndGet(array, 0, Void.class); + int x = (int) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - int x = (int) vh.addAndGet(0, 0, 0x01234567); + int x = (int) vh.getAndAddAcquire(0, 0, 0x01234567); }); checkWMTE(() -> { // index reference class - int x = (int) vh.addAndGet(array, Void.class, 0x01234567); + int x = (int) vh.getAndAddAcquire(array, Void.class, 0x01234567); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, 0x01234567); + Void r = (Void) vh.getAndAddAcquire(array, 0, 0x01234567); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, 0x01234567); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, 0x01234567); }); // Incorrect arity checkWMTE(() -> { // 0 - int x = (int) vh.addAndGet(); + int x = (int) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - int x = (int) vh.addAndGet(array, 0, 0x01234567, Void.class); + int x = (int) vh.getAndAddAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndAddRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndAddRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndAddRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndAddRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddRelease(array, 0, 0x01234567, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseOr(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseOr(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseOr(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseOr(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOr(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseOrAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseOrAcquire(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOrAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseOrAcquire(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseOrAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseOrRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseOrRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseOrRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseOrRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrRelease(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseAnd(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseAnd(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseAnd(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseAnd(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAnd(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseAndAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseAndAcquire(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseAndAcquire(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseAndAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseAndRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseAndRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseAndRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseAndRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndRelease(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseXor(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseXor(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseXor(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseXor(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXor(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseXorAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseXorAcquire(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseXorAcquire(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseXorAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseXorRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseXorRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseXorRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseXorRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorRelease(array, 0, 0x01234567, Void.class); }); } @@ -2144,6 +3208,48 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { invokeExact(array, 0, 0x01234567, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)). + invokeExact((int[]) null, 0, 0x01234567); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)). + invokeExact(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)). + invokeExact(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)). + invokeExact(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)). + invokeExact(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)). + invokeExact(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) hs.get(am, methodType(int.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)). + invokeExact(array, 0, 0x01234567, Void.class); + }); + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java index 654619335fe..576d5a197f2 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, 0x0123456789ABCDEFL, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, 0x0123456789ABCDEFL, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { long x = (long) vh.getAndSet(recv, 0x0123456789ABCDEFL, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndSetAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndSetAcquire(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndSetAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndSetRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndSetRelease(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndSetRelease(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { long x = (long) vh.getAndAdd(recv, 0x0123456789ABCDEFL, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - long x = (long) vh.addAndGet(null, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(null, 0x0123456789ABCDEFL); }); checkCCE(() -> { // receiver reference class - long x = (long) vh.addAndGet(Void.class, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(Void.class, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // value reference class - long x = (long) vh.addAndGet(recv, Void.class); + long x = (long) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - long x = (long) vh.addAndGet(0, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(0, 0x0123456789ABCDEFL); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, 0x0123456789ABCDEFL); + Void r = (Void) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, 0x0123456789ABCDEFL); + boolean x = (boolean) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL); }); // Incorrect arity checkWMTE(() -> { // 0 - long x = (long) vh.addAndGet(); + long x = (long) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - long x = (long) vh.addAndGet(recv, 0x0123456789ABCDEFL, Void.class); + long x = (long) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndAddRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndAddRelease(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndAddRelease(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseOr(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseOr(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseOr(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseOrAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseOrAcquire(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOrAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseOrAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseOrRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseOr(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseOr(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseAnd(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseAnd(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseAnd(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseAndAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseAndAcquire(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseAndAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseAndRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseAnd(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseAnd(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseXor(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseXor(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseXor(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseXorAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseXorAcquire(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseXorAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseXorRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseXor(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseXor(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL, Void.class); }); } @@ -853,6 +1208,43 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { invokeExact(recv, 0x0123456789ABCDEFL, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact((VarHandleTestMethodTypeLong) null, 0x0123456789ABCDEFL); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)). + invokeExact(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) hs.get(am, methodType(long.class, int.class, long.class)). + invokeExact(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) hs.get(am, methodType(long.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact(recv, 0x0123456789ABCDEFL, Void.class); + }); + } } @@ -985,6 +1377,23 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(0x0123456789ABCDEFL, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, 0x0123456789ABCDEFL); }); @@ -1000,23 +1409,6 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(0x0123456789ABCDEFL, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { long x = (long) vh.getAndSet(0x0123456789ABCDEFL, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetRelease(0x0123456789ABCDEFL, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - long x = (long) vh.addAndGet(Void.class); + long x = (long) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(0x0123456789ABCDEFL); + Void r = (Void) vh.getAndAddAcquire(0x0123456789ABCDEFL); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(0x0123456789ABCDEFL); + boolean x = (boolean) vh.getAndAddAcquire(0x0123456789ABCDEFL); }); // Incorrect arity checkWMTE(() -> { // 0 - long x = (long) vh.addAndGet(); + long x = (long) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - long x = (long) vh.addAndGet(0x0123456789ABCDEFL, Void.class); + long x = (long) vh.getAndAddAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddRelease(0x0123456789ABCDEFL, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOr(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAnd(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAnd(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXor(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL, Void.class); }); } @@ -1322,6 +1965,32 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { invokeExact(0x0123456789ABCDEFL, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) hs.get(am, methodType(long.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, long.class)). + invokeExact(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)). + invokeExact(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) hs.get(am, methodType(long.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)). + invokeExact(0x0123456789ABCDEFL, Void.class); + }); + } } @@ -1584,6 +2253,35 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); }); @@ -1611,35 +2309,6 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, 0x0123456789ABCDEFL, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { long x = (long) vh.getAndSet(array, 0, 0x0123456789ABCDEFL, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndSetAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndSetAcquire(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + long x = (long) vh.getAndSetAcquire(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndSetAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndSetRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndSetRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + long x = (long) vh.getAndSetRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndSetRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - long x = (long) vh.addAndGet(null, 0, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(null, 0, 0x0123456789ABCDEFL); }); checkCCE(() -> { // array reference class - long x = (long) vh.addAndGet(Void.class, 0, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(Void.class, 0, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // value reference class - long x = (long) vh.addAndGet(array, 0, Void.class); + long x = (long) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - long x = (long) vh.addAndGet(0, 0, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(0, 0, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // index reference class - long x = (long) vh.addAndGet(array, Void.class, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(array, Void.class, 0x0123456789ABCDEFL); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, 0x0123456789ABCDEFL); + Void r = (Void) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, 0x0123456789ABCDEFL); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL); }); // Incorrect arity checkWMTE(() -> { // 0 - long x = (long) vh.addAndGet(); + long x = (long) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - long x = (long) vh.addAndGet(array, 0, 0x0123456789ABCDEFL, Void.class); + long x = (long) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndAddRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndAddRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndAddRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndAddRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseOr(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseOr(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseOr(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseOr(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseOrAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseOrAcquire(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOrAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseOrAcquire(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseOrAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseOrRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseOrRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseOrRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseOrRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseAnd(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseAnd(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseAnd(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseAnd(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseAndAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseAndAcquire(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseAndAcquire(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseAndAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseAndRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseAndRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseAndRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseAndRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseXor(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseXor(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseXor(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseXor(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseXorAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseXorAcquire(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseXorAcquire(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseXorAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseXorRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseXorRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseXorRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseXorRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL, Void.class); }); } @@ -2144,6 +3208,48 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { invokeExact(array, 0, 0x0123456789ABCDEFL, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)). + invokeExact((long[]) null, 0, 0x0123456789ABCDEFL); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)). + invokeExact(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)). + invokeExact(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)). + invokeExact(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)). + invokeExact(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)). + invokeExact(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) hs.get(am, methodType(long.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)). + invokeExact(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java index 82b6f3cab78..b3f52611dcd 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, (short)0x0123, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, (short)0x0123, (short)0x0123); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, (short)0x0123); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, (short)0x0123, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, (short)0x0123, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, (short)0x0123, (short)0x0123, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, (short)0x0123, (short)0x0123); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, (short)0x0123, (short)0x0123); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, (short)0x0123, (short)0x0123); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, (short)0x0123); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, (short)0x0123, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, (short)0x0123, (short)0x0123); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, (short)0x0123, (short)0x0123, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { short x = (short) vh.getAndSet(recv, (short)0x0123, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndSetAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndSetAcquire(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndSetAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetAcquire(recv, (short)0x0123, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndSetRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndSetRelease(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndSetRelease(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetRelease(recv, (short)0x0123, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { short x = (short) vh.getAndAdd(recv, (short)0x0123, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - short x = (short) vh.addAndGet(null, (short)0x0123); + short x = (short) vh.getAndAddAcquire(null, (short)0x0123); }); checkCCE(() -> { // receiver reference class - short x = (short) vh.addAndGet(Void.class, (short)0x0123); + short x = (short) vh.getAndAddAcquire(Void.class, (short)0x0123); }); checkWMTE(() -> { // value reference class - short x = (short) vh.addAndGet(recv, Void.class); + short x = (short) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - short x = (short) vh.addAndGet(0, (short)0x0123); + short x = (short) vh.getAndAddAcquire(0, (short)0x0123); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, (short)0x0123); + Void r = (Void) vh.getAndAddAcquire(recv, (short)0x0123); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, (short)0x0123); + boolean x = (boolean) vh.getAndAddAcquire(recv, (short)0x0123); }); // Incorrect arity checkWMTE(() -> { // 0 - short x = (short) vh.addAndGet(); + short x = (short) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - short x = (short) vh.addAndGet(recv, (short)0x0123, Void.class); + short x = (short) vh.getAndAddAcquire(recv, (short)0x0123, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndAddRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndAddRelease(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndAddRelease(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddRelease(recv, (short)0x0123, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseOr(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseOr(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseOr(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOr(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseOrAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseOrAcquire(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOrAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseOrAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrAcquire(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseOrRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseOr(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseOr(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOr(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseAnd(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseAnd(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseAnd(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAnd(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseAndAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseAndAcquire(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseAndAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndAcquire(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseAndRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseAnd(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseAnd(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAnd(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseXor(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseXor(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseXor(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXor(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseXorAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseXorAcquire(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseXorAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorAcquire(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseXorRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseXor(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseXor(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXor(recv, (short)0x0123, Void.class); }); } @@ -853,6 +1208,43 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { invokeExact(recv, (short)0x0123, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + short x = (short) hs.get(am, methodType(short.class, Class.class, short.class)). + invokeExact(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) hs.get(am, methodType(short.class, int.class, short.class)). + invokeExact(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) hs.get(am, methodType(short.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact(recv, (short)0x0123, Void.class); + }); + } } @@ -985,6 +1377,23 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain((short)0x0123, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain((short)0x0123, (short)0x0123, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, (short)0x0123); }); @@ -1000,23 +1409,6 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, (short)0x0123); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile((short)0x0123, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile((short)0x0123, (short)0x0123, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { short x = (short) vh.getAndSet((short)0x0123, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetAcquire((short)0x0123, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetRelease((short)0x0123, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - short x = (short) vh.addAndGet(Void.class); + short x = (short) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet((short)0x0123); + Void r = (Void) vh.getAndAddAcquire((short)0x0123); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet((short)0x0123); + boolean x = (boolean) vh.getAndAddAcquire((short)0x0123); }); // Incorrect arity checkWMTE(() -> { // 0 - short x = (short) vh.addAndGet(); + short x = (short) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - short x = (short) vh.addAndGet((short)0x0123, Void.class); + short x = (short) vh.getAndAddAcquire((short)0x0123, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddRelease((short)0x0123, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOr((short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrAcquire((short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrRelease((short)0x0123, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAnd(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAnd((short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndAcquire((short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndRelease((short)0x0123, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXor((short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorAcquire((short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorRelease((short)0x0123, Void.class); }); } @@ -1322,6 +1965,32 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { invokeExact((short)0x0123, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) hs.get(am, methodType(short.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, short.class)). + invokeExact((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, short.class)). + invokeExact((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) hs.get(am, methodType(short.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + short x = (short) hs.get(am, methodType(short.class, short.class, Class.class)). + invokeExact((short)0x0123, Void.class); + }); + } } @@ -1584,6 +2253,35 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, (short)0x0123, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, (short)0x0123, (short)0x0123); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, (short)0x0123); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, (short)0x0123, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, (short)0x0123, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, (short)0x0123, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, (short)0x0123, (short)0x0123, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, (short)0x0123, (short)0x0123); }); @@ -1611,35 +2309,6 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, (short)0x0123, (short)0x0123); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, (short)0x0123, (short)0x0123); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, (short)0x0123); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, (short)0x0123, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, (short)0x0123, (short)0x0123); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, (short)0x0123, (short)0x0123); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, (short)0x0123, (short)0x0123, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { short x = (short) vh.getAndSet(array, 0, (short)0x0123, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndSetAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndSetAcquire(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + short x = (short) vh.getAndSetAcquire(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndSetAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndSetRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndSetRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + short x = (short) vh.getAndSetRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndSetRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetRelease(array, 0, (short)0x0123, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - short x = (short) vh.addAndGet(null, 0, (short)0x0123); + short x = (short) vh.getAndAddAcquire(null, 0, (short)0x0123); }); checkCCE(() -> { // array reference class - short x = (short) vh.addAndGet(Void.class, 0, (short)0x0123); + short x = (short) vh.getAndAddAcquire(Void.class, 0, (short)0x0123); }); checkWMTE(() -> { // value reference class - short x = (short) vh.addAndGet(array, 0, Void.class); + short x = (short) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - short x = (short) vh.addAndGet(0, 0, (short)0x0123); + short x = (short) vh.getAndAddAcquire(0, 0, (short)0x0123); }); checkWMTE(() -> { // index reference class - short x = (short) vh.addAndGet(array, Void.class, (short)0x0123); + short x = (short) vh.getAndAddAcquire(array, Void.class, (short)0x0123); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, (short)0x0123); + Void r = (Void) vh.getAndAddAcquire(array, 0, (short)0x0123); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, (short)0x0123); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, (short)0x0123); }); // Incorrect arity checkWMTE(() -> { // 0 - short x = (short) vh.addAndGet(); + short x = (short) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - short x = (short) vh.addAndGet(array, 0, (short)0x0123, Void.class); + short x = (short) vh.getAndAddAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndAddRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndAddRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndAddRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndAddRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddRelease(array, 0, (short)0x0123, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseOr(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseOr(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseOr(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseOr(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOr(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseOrAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseOrAcquire(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOrAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseOrAcquire(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseOrAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseOrRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseOrRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseOrRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseOrRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseAnd(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseAnd(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseAnd(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseAnd(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAnd(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseAndAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseAndAcquire(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseAndAcquire(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseAndAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseAndRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseAndRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseAndRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseAndRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseXor(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseXor(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseXor(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseXor(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXor(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseXorAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseXorAcquire(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseXorAcquire(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseXorAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseXorRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseXorRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseXorRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseXorRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123, Void.class); }); } @@ -2144,6 +3208,48 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { invokeExact(array, 0, (short)0x0123, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class)). + invokeExact((short[]) null, 0, (short)0x0123); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + short x = (short) hs.get(am, methodType(short.class, Class.class, int.class, short.class)). + invokeExact(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) hs.get(am, methodType(short.class, int.class, int.class, short.class)). + invokeExact(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class, short.class)). + invokeExact(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, short[].class, int.class, short.class)). + invokeExact(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class)). + invokeExact(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) hs.get(am, methodType(short.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, Class.class)). + invokeExact(array, 0, (short)0x0123, Void.class); + }); + } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java index 41d0e6b4702..9e2debed693 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,32 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, "foo", "foo"); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, "foo", "foo"); + }); + checkCCE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, "foo"); + }); + checkCCE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, "foo", Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, "foo", "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, "foo", "foo", Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, "foo", "foo"); }); @@ -376,32 +402,6 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, "foo", "foo"); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, "foo", "foo"); - }); - checkCCE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, "foo"); - }); - checkCCE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, "foo", Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, "foo", "foo"); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, "foo", "foo", Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,65 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { String x = (String) vh.getAndSet(recv, "foo", Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + String x = (String) vh.getAndSetAcquire(null, "foo"); + }); + checkCCE(() -> { // receiver reference class + String x = (String) vh.getAndSetAcquire(Void.class, "foo"); + }); + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + String x = (String) vh.getAndSetAcquire(0, "foo"); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, "foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetAcquire(recv, "foo", Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + String x = (String) vh.getAndSetRelease(null, "foo"); + }); + checkCCE(() -> { // receiver reference class + String x = (String) vh.getAndSetRelease(Void.class, "foo"); + }); + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + String x = (String) vh.getAndSetRelease(0, "foo"); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, "foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetRelease(recv, "foo", Void.class); + }); + + } static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeString recv, Handles hs) throws Throwable { @@ -759,6 +818,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { }); } + } @@ -891,6 +951,23 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkCCE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, "foo"); + }); + checkCCE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain("foo", Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain("foo", "foo", Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkCCE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, "foo"); }); @@ -906,23 +983,6 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkCCE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, "foo"); - }); - checkCCE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile("foo", Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile("foo", "foo", Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkCCE(() -> { // expected reference class @@ -1049,6 +1109,49 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { String x = (String) vh.getAndSet("foo", Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire("foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire("foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetAcquire("foo", Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease("foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease("foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetRelease("foo", Void.class); + }); + + } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1163,6 +1266,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { }); } + } @@ -1425,6 +1529,35 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, "foo", "foo"); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, "foo", "foo"); + }); + checkCCE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, "foo"); + }); + checkCCE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, "foo", Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, "foo", "foo"); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, "foo", "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, "foo", "foo", Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, "foo", "foo"); }); @@ -1452,35 +1585,6 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, "foo", "foo"); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, "foo", "foo"); - }); - checkCCE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, "foo"); - }); - checkCCE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, "foo", Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, "foo", "foo"); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, "foo", "foo"); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, "foo", "foo", Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1679,6 +1783,73 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { String x = (String) vh.getAndSet(array, 0, "foo", Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + String x = (String) vh.getAndSetAcquire(null, 0, "foo"); + }); + checkCCE(() -> { // array reference class + String x = (String) vh.getAndSetAcquire(Void.class, 0, "foo"); + }); + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + String x = (String) vh.getAndSetAcquire(0, 0, "foo"); + }); + checkWMTE(() -> { // index reference class + String x = (String) vh.getAndSetAcquire(array, Void.class, "foo"); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, "foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetAcquire(array, 0, "foo", Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + String x = (String) vh.getAndSetRelease(null, 0, "foo"); + }); + checkCCE(() -> { // array reference class + String x = (String) vh.getAndSetRelease(Void.class, 0, "foo"); + }); + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + String x = (String) vh.getAndSetRelease(0, 0, "foo"); + }); + checkWMTE(() -> { // index reference class + String x = (String) vh.getAndSetRelease(array, Void.class, "foo"); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, "foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetRelease(array, 0, "foo", Void.class); + }); + + } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -1880,6 +2051,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { }); } + } } diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template index a0b48a90bda..3d36bd35efc 100644 --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template @@ -104,30 +104,58 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); #else[CAS] assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); #end[CAS] #if[AtomicAdd] assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); #else[AtomicAdd] assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); #end[AtomicAdd] + +#if[Bitwise] + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); +#else[Bitwise] + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); +#end[Bitwise] } @@ -295,11 +323,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain(recv, $value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value2$); + boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); }); checkUOE(() -> { @@ -313,6 +341,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { $type$ r = ($type$) vh.getAndSet(recv, $value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease(recv, $value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -321,9 +357,51 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(recv, $value1$); + $type$ o = ($type$) vh.getAndAddAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(recv, $value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value1$); + }); +#end[Bitwise] } @@ -389,11 +467,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet($value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain($value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile($value1$, $value2$); + boolean r = vh.weakCompareAndSet($value1$, $value2$); }); checkUOE(() -> { @@ -407,6 +485,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { $type$ r = ($type$) vh.getAndSet($value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire($value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease($value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -415,9 +501,51 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet($value1$); + $type$ o = ($type$) vh.getAndAddAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease($value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease($value1$); + }); +#end[Bitwise] } @@ -514,11 +642,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, $value1$, $value2$); + success = vh.weakCompareAndSetPlain(recv, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(recv); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -544,33 +672,157 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, $value2$, $value1$); + success = vh.weakCompareAndSet(recv, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(recv); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, $value1$, "weakCompareAndSet $type$ value"); } // Compare set and get { + vh.set(recv, $value1$); + $type$ o = ($type$) vh.getAndSet(recv, $value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) vh.get(recv); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndSetAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndSetRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set(recv, $value1$); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd(recv, $value3$); + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndAdd(recv, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet(recv, $value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndAddAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndAddRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndAddRelease$type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOr(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXor(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } static void testInstanceFieldUnsupported(VarHandleTestAccess$Type$ recv, VarHandle vh) { @@ -592,11 +844,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain(recv, $value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value2$); + boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); }); checkUOE(() -> { @@ -610,6 +862,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { $type$ r = ($type$) vh.getAndSet(recv, $value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease(recv, $value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -618,9 +878,51 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(recv, $value1$); + $type$ o = ($type$) vh.getAndAddAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(recv, $value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value1$); + }); +#end[Bitwise] } @@ -717,11 +1019,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet($value1$, $value2$); + success = vh.weakCompareAndSetPlain($value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -747,33 +1049,157 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease($value2$, $value1$); + success = vh.weakCompareAndSet($value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get { + vh.set($value1$); + $type$ o = ($type$) vh.getAndSet($value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) vh.get(); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndSetAcquire($value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndSetRelease($value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set($value1$); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd( $value3$); + vh.set($value1$); + + $type$ o = ($type$) vh.getAndAdd($value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet($value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndAddAcquire($value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndAddRelease($value2$); + assertEquals(o, $value1$, "getAndAddRelease$type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseOr($value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire($value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease($value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseAnd($value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire($value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease($value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseXor($value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire($value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease($value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } static void testStaticFieldUnsupported(VarHandle vh) { @@ -795,11 +1221,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet($value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain($value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile($value1$, $value2$); + boolean r = vh.weakCompareAndSet($value1$, $value2$); }); checkUOE(() -> { @@ -813,6 +1239,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { $type$ r = ($type$) vh.getAndSet($value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire($value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease($value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -821,9 +1255,51 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet($value1$); + $type$ o = ($type$) vh.getAndAddAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease($value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease($value1$); + }); +#end[Bitwise] } @@ -923,11 +1399,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, $value1$, $value2$); + success = vh.weakCompareAndSetPlain(array, i, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -953,33 +1429,157 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, $value2$, $value1$); + success = vh.weakCompareAndSet(array, i, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get { + vh.set(array, i, $value1$); + $type$ o = ($type$) vh.getAndSet(array, i, $value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndSetAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndSetRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set(array, i, $value1$); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd(array, i, $value3$); + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndAdd(array, i, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet(array, i, $value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndAddAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndAddRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndAddRelease$type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOr(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXor(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } } @@ -1005,11 +1605,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, i, $value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain(array, i, $value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, i, $value1$, $value2$); + boolean r = vh.weakCompareAndSet(array, i, $value1$, $value2$); }); checkUOE(() -> { @@ -1023,6 +1623,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { $type$ r = ($type$) vh.getAndSet(array, i, $value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease(array, i, $value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -1031,9 +1639,51 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(array, i, $value1$); + $type$ o = ($type$) vh.getAndAddAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, i, $value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, $value1$); + }); +#end[Bitwise] } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -1092,11 +1742,11 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, $value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain(array, ci, $value1$, $value2$); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, $value1$, $value2$); + boolean r = vh.weakCompareAndSet(array, ci, $value1$, $value2$); }); checkIOOBE(() -> { @@ -1110,17 +1760,67 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkIOOBE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, $value1$); }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, $value1$); + }); #end[CAS] #if[AtomicAdd] checkIOOBE(() -> { - $type$ o = ($type$) vh.getAndAdd(array, ci, $value3$); + $type$ o = ($type$) vh.getAndAdd(array, ci, $value1$); }); checkIOOBE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, $value3$); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, $value1$); }); #end[AtomicAdd] + +#if[Bitwise] + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, $value1$); + }); +#end[Bitwise] } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template index a7aef2b898c..caf18e0566a 100644 --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template @@ -93,30 +93,58 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); #else[CAS] assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); #end[CAS] #if[AtomicAdd] assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); #else[AtomicAdd] assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); #end[AtomicAdd] + +#if[Bitwise] + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); +#else[Bitwise] + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); +#end[Bitwise] } @Test(dataProvider = "typesProvider") @@ -219,11 +247,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -237,6 +265,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { checkUOE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[!AtomicAdd] @@ -245,9 +281,51 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) { @@ -293,11 +371,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -312,6 +390,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); + #else[CAS] checkUOE(() -> { boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); @@ -330,11 +416,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -348,6 +434,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { checkUOE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -356,7 +450,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkROBE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #else[AtomicAdd] checkUOE(() -> { @@ -364,9 +462,87 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] + +#if[Bitwise] + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#else[Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } else { #if[!CAS] @@ -387,11 +563,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -405,6 +581,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { checkUOE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[!AtomicAdd] checkUOE(() -> { @@ -412,9 +596,50 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } } @@ -477,11 +702,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -495,6 +720,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { checkIOOBE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -503,10 +736,52 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] +#if[Bitwise] + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] + } } @@ -573,11 +848,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -591,6 +866,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { checkIOOBE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -599,9 +882,51 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkIOOBE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] + +#if[Bitwise] + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } } } @@ -660,11 +985,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -678,6 +1003,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { checkISE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -686,10 +1019,51 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] +#if[Bitwise] + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } } } @@ -750,11 +1124,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -768,6 +1142,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { checkISE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -776,9 +1158,51 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { }); checkISE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] + +#if[Bitwise] + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } } } @@ -888,11 +1312,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet $type$ value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain $type$ value"); } { @@ -916,32 +1340,159 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, VALUE_1, "weakCompareAndSet $type$"); } // Compare set and get { + vh.set(array, i, VALUE_1); + $type$ o = ($type$) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet $type$ value"); } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set(array, i, VALUE_1); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } } } @@ -1050,11 +1601,11 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet $type$ value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain $type$ value"); } { @@ -1078,32 +1629,159 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, VALUE_1, "weakCompareAndSet $type$"); } // Compare set and get { + vh.set(array, i, VALUE_1); + $type$ o = ($type$) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet $type$ value"); } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set(array, i, VALUE_1); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template index 6df8b203e3a..c82d533878a 100644 --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template @@ -211,11 +211,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -241,11 +241,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, $value2$, $value1$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get @@ -258,16 +258,120 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { #end[CAS] #if[AtomicAdd] - hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); - // get and add, add and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, $value3$); + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, $value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndAddRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccess$Type$ recv, Handles hs) throws Throwable { @@ -298,6 +402,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { }); } #end[AtomicAdd] + +#if[!Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + $type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$); + }); + } +#end[Bitwise] } @@ -394,11 +506,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value1$, $value2$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact($value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -424,33 +536,159 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact($value2$, $value1$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact( $value2$); + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact($value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - hs.get(TestAccessMode.SET).invokeExact($value1$); - // get and add, add and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( $value3$); + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact($value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact($value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndAddRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } static void testStaticFieldUnsupported(Handles hs) throws Throwable { @@ -481,6 +719,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { }); } #end[AtomicAdd] + +#if[!Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + $type$ r = ($type$) hs.get(am).invokeExact($value1$); + }); + } +#end[Bitwise] } @@ -580,11 +826,11 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -610,33 +856,157 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, $value2$, $value1$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, $value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); - // get and add, add and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, $value3$); + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, $value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndAddRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } } @@ -671,6 +1041,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { }); } #end[AtomicAdd] + +#if[!Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + $type$ o = ($type$) hs.get(am).invokeExact(array, i, $value1$); + }); + } +#end[Bitwise] } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -718,6 +1096,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { }); } #end[AtomicAdd] + +#if[Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + $type$ o = ($type$) hs.get(am).invokeExact(array, ci, $value3$); + }); + } +#end[Bitwise] } } } diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template index 15c4610df43..0116e5d61f1 100644 --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template @@ -353,6 +353,32 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, $value1$, $value1$); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, $value1$, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, $value1$, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, $value1$, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, $value1$, $value1$, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, $value1$, $value1$); }); @@ -377,32 +403,6 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, $value1$, $value1$); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, $value1$, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, $value1$, $value1$); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value1$, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { checkWMTE(() -> { // > $type$ x = ($type$) vh.getAndSet(recv, $value1$, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndSetAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndSetAcquire(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndSetAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetAcquire(recv, $value1$, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndSetRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndSetRelease(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndSetRelease(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetRelease(recv, $value1$, Void.class); + }); #end[CAS] #if[AtomicAdd] @@ -614,36 +672,335 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { $type$ x = ($type$) vh.getAndAdd(recv, $value1$, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - $type$ x = ($type$) vh.addAndGet(null, $value1$); + $type$ x = ($type$) vh.getAndAddAcquire(null, $value1$); }); checkCCE(() -> { // receiver reference class - $type$ x = ($type$) vh.addAndGet(Void.class, $value1$); + $type$ x = ($type$) vh.getAndAddAcquire(Void.class, $value1$); }); check{#if[String]?CCE:WMTE}(() -> { // value reference class - $type$ x = ($type$) vh.addAndGet(recv, Void.class); + $type$ x = ($type$) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - $type$ x = ($type$) vh.addAndGet(0, $value1$); + $type$ x = ($type$) vh.getAndAddAcquire(0, $value1$); }); // Incorrect return type check{#if[String]?CCE:WMTE}(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, $value1$); + Void r = (Void) vh.getAndAddAcquire(recv, $value1$); }); checkWMTE(() -> { // primitive class - $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet(recv, $value1$); + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire(recv, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 - $type$ x = ($type$) vh.addAndGet(); + $type$ x = ($type$) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - $type$ x = ($type$) vh.addAndGet(recv, $value1$, Void.class); + $type$ x = ($type$) vh.getAndAddAcquire(recv, $value1$, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndAddRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndAddRelease(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndAddRelease(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddRelease(recv, $value1$, Void.class); }); #end[AtomicAdd] + +#if[Bitwise] + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseOr(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseOr(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOr(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseOrRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseOr(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOr(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseAnd(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseAnd(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAnd(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseAndRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseAnd(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAnd(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseXor(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseXor(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXor(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseXorRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseXor(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXor(recv, $value1$, Void.class); + }); +#end[Bitwise] } static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, Handles hs) throws Throwable { @@ -861,6 +1218,45 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { }); } #end[AtomicAdd] + +#if[Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact((VarHandleTestMethodType$Type$) null, $value1$); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)). + invokeExact(Void.class, $value1$); + }); + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)). + invokeExact(0, $value1$); + }); + // Incorrect return type + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) hs.get(am, methodType($type$.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact(recv, $value1$, Void.class); + }); + } +#end[Bitwise] } @@ -994,6 +1390,23 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain($value1$, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain($value1$, $value1$, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types check{#if[String]?CCE:WMTE}(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, $value1$); }); @@ -1009,23 +1422,6 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - check{#if[String]?CCE:WMTE}(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile($value1$, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile($value1$, $value1$, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types check{#if[String]?CCE:WMTE}(() -> { // expected reference class @@ -1151,6 +1547,48 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { checkWMTE(() -> { // > $type$ x = ($type$) vh.getAndSet($value1$, Void.class); }); + + + // GetAndSetAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetAcquire($value1$, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetRelease($value1$, Void.class); + }); #end[CAS] #if[AtomicAdd] @@ -1175,26 +1613,237 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types check{#if[String]?CCE:WMTE}(() -> { // value reference class - $type$ x = ($type$) vh.addAndGet(Void.class); + $type$ x = ($type$) vh.getAndAddAcquire(Void.class); }); // Incorrect return type check{#if[String]?CCE:WMTE}(() -> { // reference class - Void r = (Void) vh.addAndGet($value1$); + Void r = (Void) vh.getAndAddAcquire($value1$); }); checkWMTE(() -> { // primitive class - $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet($value1$); + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire($value1$); }); // Incorrect arity checkWMTE(() -> { // 0 - $type$ x = ($type$) vh.addAndGet(); + $type$ x = ($type$) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - $type$ x = ($type$) vh.addAndGet($value1$, Void.class); + $type$ x = ($type$) vh.getAndAddAcquire($value1$, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddRelease($value1$, Void.class); }); #end[AtomicAdd] + +#if[Bitwise] + // GetAndBitwiseOr + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOr($value1$, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrAcquire($value1$, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrRelease($value1$, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAnd($value1$, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndAcquire($value1$, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndRelease($value1$, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXor($value1$, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorAcquire($value1$, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorRelease($value1$, Void.class); + }); +#end[Bitwise] } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1338,6 +1987,34 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { }); } #end[AtomicAdd] + +#if[Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)). + invokeExact($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)). + invokeExact($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) hs.get(am, methodType($type$.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)). + invokeExact($value1$, Void.class); + }); + } +#end[Bitwise] } @@ -1601,6 +2278,35 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { // WeakCompareAndSet // Incorrect argument types + checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, $value1$, $value1$); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, $value1$, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, $value1$, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, $value1$, $value1$); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, $value1$, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, $value1$, $value1$, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, $value1$, $value1$); }); @@ -1628,35 +2334,6 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, $value1$, $value1$); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, $value1$, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, $value1$, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, $value1$, $value1$); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, $value1$, $value1$); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, $value1$, $value1$, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1854,6 +2531,72 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { checkWMTE(() -> { // > $type$ x = ($type$) vh.getAndSet(array, 0, $value1$, Void.class); }); + + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndSetAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndSetAcquire(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + $type$ x = ($type$) vh.getAndSetAcquire(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndSetAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndSetRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndSetRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + $type$ x = ($type$) vh.getAndSetRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndSetRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetRelease(array, 0, $value1$, Void.class); + }); #end[CAS] #if[AtomicAdd] @@ -1890,38 +2633,369 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - $type$ x = ($type$) vh.addAndGet(null, 0, $value1$); + $type$ x = ($type$) vh.getAndAddAcquire(null, 0, $value1$); }); checkCCE(() -> { // array reference class - $type$ x = ($type$) vh.addAndGet(Void.class, 0, $value1$); + $type$ x = ($type$) vh.getAndAddAcquire(Void.class, 0, $value1$); }); check{#if[String]?CCE:WMTE}(() -> { // value reference class - $type$ x = ($type$) vh.addAndGet(array, 0, Void.class); + $type$ x = ($type$) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - $type$ x = ($type$) vh.addAndGet(0, 0, $value1$); + $type$ x = ($type$) vh.getAndAddAcquire(0, 0, $value1$); }); checkWMTE(() -> { // index reference class - $type$ x = ($type$) vh.addAndGet(array, Void.class, $value1$); + $type$ x = ($type$) vh.getAndAddAcquire(array, Void.class, $value1$); }); // Incorrect return type check{#if[String]?CCE:WMTE}(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, $value1$); + Void r = (Void) vh.getAndAddAcquire(array, 0, $value1$); }); checkWMTE(() -> { // primitive class - $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet(array, 0, $value1$); + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire(array, 0, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 - $type$ x = ($type$) vh.addAndGet(); + $type$ x = ($type$) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - $type$ x = ($type$) vh.addAndGet(array, 0, $value1$, Void.class); + $type$ x = ($type$) vh.getAndAddAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndAddRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndAddRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndAddRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndAddRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddRelease(array, 0, $value1$, Void.class); }); #end[AtomicAdd] + +#if[Bitwise] + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseOr(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseOr(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseOr(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOr(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseOrRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseAnd(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseAnd(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAnd(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseAndRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseXor(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseXor(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseXor(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXor(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseXorRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, 0, $value1$, Void.class); + }); +#end[Bitwise] } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -2168,6 +3242,50 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { }); } #end[AtomicAdd] + +#if[Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)). + invokeExact(($type$[]) null, 0, $value1$); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)). + invokeExact(Void.class, 0, $value1$); + }); + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)). + invokeExact(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)). + invokeExact(array, Void.class, $value1$); + }); + // Incorrect return type + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)). + invokeExact(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)). + invokeExact(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) hs.get(am, methodType($type$.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)). + invokeExact(array, 0, $value1$, Void.class); + }); + } +#end[Bitwise] } } diff --git a/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh b/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh index 02ae5ae304f..2641f8d58d5 100644 --- a/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh +++ b/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh @@ -22,6 +22,12 @@ do ;; esac + case $type in + boolean|byte|short|char|int|long) + args="$args -KBitwise" + ;; + esac + wrong_primitive_type=boolean case $type in @@ -109,6 +115,12 @@ do ;; esac + case $type in + int|long) + args="$args -KBitwise" + ;; + esac + # The value of `value3` is chosen such that when added to `value1` or `value2` # it will result in carrying of bits over to the next byte, thereby detecting # possible errors in endianness conversion e.g. if say for atomic addition the diff --git a/jdk/test/java/lang/invoke/accessProtectedSuper/BogoLoader.java b/jdk/test/java/lang/invoke/accessProtectedSuper/BogoLoader.java index 190761dd6df..a129ea254a4 100644 --- a/jdk/test/java/lang/invoke/accessProtectedSuper/BogoLoader.java +++ b/jdk/test/java/lang/invoke/accessProtectedSuper/BogoLoader.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ import java.io.BufferedInputStream; diff --git a/jdk/test/java/lang/invoke/accessProtectedSuper/MethodInvoker.java b/jdk/test/java/lang/invoke/accessProtectedSuper/MethodInvoker.java index d14e7ef8a35..fae5e466646 100644 --- a/jdk/test/java/lang/invoke/accessProtectedSuper/MethodInvoker.java +++ b/jdk/test/java/lang/invoke/accessProtectedSuper/MethodInvoker.java @@ -19,7 +19,6 @@ * Please 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 anotherpkg.MethodSupplierOuter; diff --git a/jdk/test/java/lang/invoke/accessProtectedSuper/Test.java b/jdk/test/java/lang/invoke/accessProtectedSuper/Test.java index b83496f692f..96b3fb637a1 100644 --- a/jdk/test/java/lang/invoke/accessProtectedSuper/Test.java +++ b/jdk/test/java/lang/invoke/accessProtectedSuper/Test.java @@ -19,7 +19,6 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ /** diff --git a/jdk/test/java/lang/invoke/accessProtectedSuper/anotherpkg/MethodSupplierOuter.java b/jdk/test/java/lang/invoke/accessProtectedSuper/anotherpkg/MethodSupplierOuter.java index 314f8eab707..cd40ed2050c 100644 --- a/jdk/test/java/lang/invoke/accessProtectedSuper/anotherpkg/MethodSupplierOuter.java +++ b/jdk/test/java/lang/invoke/accessProtectedSuper/anotherpkg/MethodSupplierOuter.java @@ -19,7 +19,6 @@ * Please 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 anotherpkg; diff --git a/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java b/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java index a8bb8badf9b..13ae1e030c5 100644 --- a/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java +++ b/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 diff --git a/jdk/test/java/lang/ref/CleanerTest.java b/jdk/test/java/lang/ref/CleanerTest.java index 25c50dc24c1..c6778669f00 100644 --- a/jdk/test/java/lang/ref/CleanerTest.java +++ b/jdk/test/java/lang/ref/CleanerTest.java @@ -49,7 +49,7 @@ import org.testng.annotations.Test; /* * @test - * @library /test/lib/share/classes /lib/testlibrary /test/lib + * @library /lib/testlibrary /test/lib * @build sun.hotspot.WhiteBox * @build jdk.test.lib.Utils * @modules java.base/jdk.internal diff --git a/jdk/test/java/net/HttpURLConnection/HttpURLConWithProxy.java b/jdk/test/java/net/HttpURLConnection/HttpURLConWithProxy.java new file mode 100644 index 00000000000..3c2ec8922af --- /dev/null +++ b/jdk/test/java/net/HttpURLConnection/HttpURLConWithProxy.java @@ -0,0 +1,106 @@ +/* + * 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 8161016 + * @summary When proxy is set HttpURLConnection should not use DIRECT connection. + * @run main/othervm HttpURLConWithProxy + */ +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.ServerSocket; +import java.net.SocketAddress; +import java.net.URI; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.List; + +public class HttpURLConWithProxy { + + public static void main(String... arg) { + // Remove the default nonProxyHosts to use localhost for testing + System.setProperty("http.nonProxyHosts", ""); + + System.setProperty("http.proxyHost", "1.1.1.1"); + System.setProperty("http.proxyPort", "1111"); + + ServerSocket ss; + URL url; + URLConnection con; + + // Test1: using Proxy set by System Property: + try { + ss = new ServerSocket(0); + url = new URL("http://localhost:" + ss.getLocalPort()); + con = url.openConnection(); + con.setConnectTimeout(10 * 1000); + con.connect(); + throw new RuntimeException("Shouldn't use DIRECT connection " + + "when proxy is invalid/down"); + } catch (IOException ie) { + System.out.println("Test1 Passed with: " + ie.getMessage()); + } + + // Test2: using custom ProxySelector implementation + MyProxySelector myProxySel = new MyProxySelector(); + ProxySelector.setDefault(myProxySel); + try { + ss = new ServerSocket(0); + url = new URL("http://localhost:" + ss.getLocalPort()); + con = url.openConnection(); + con.setConnectTimeout(10 * 1000); + con.connect(); + throw new RuntimeException("Shouldn't use DIRECT connection " + + "when proxy is invalid/down"); + } catch (IOException ie) { + System.out.println("Test2 Passed with: " + ie.getMessage()); + } + } +} + + +class MyProxySelector extends ProxySelector { + + List proxies = new ArrayList<>(); + + MyProxySelector() { + Proxy p1 = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("2.2.2.2", 2222)); + Proxy p2 = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("3.3.3.3", 3333)); + proxies.add(p1); + proxies.add(p2); + } + + @Override + public List select(URI uri) { + return proxies; + } + + @Override + public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { + // System.out.println("MyProxySelector.connectFailed(): "+sa); + } +} diff --git a/jdk/test/java/net/Inet4Address/textToNumericFormat.java b/jdk/test/java/net/Inet4Address/textToNumericFormat.java index 1d010d0b912..7d75bc9f534 100644 --- a/jdk/test/java/net/Inet4Address/textToNumericFormat.java +++ b/jdk/test/java/net/Inet4Address/textToNumericFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/jdk/test/java/net/ProxySelector/B8035158.java b/jdk/test/java/net/ProxySelector/B8035158.java index 21b1e99d702..432e457c303 100644 --- a/jdk/test/java/net/ProxySelector/B8035158.java +++ b/jdk/test/java/net/ProxySelector/B8035158.java @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8035158 8145732 diff --git a/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java index 0b009606624..c31441d8b1a 100644 --- a/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java +++ b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/jdk/test/java/net/URLPermission/nstest/LookupTest.java b/jdk/test/java/net/URLPermission/nstest/LookupTest.java index f69522de22f..d5b9141c1d4 100644 --- a/jdk/test/java/net/URLPermission/nstest/LookupTest.java +++ b/jdk/test/java/net/URLPermission/nstest/LookupTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016 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 diff --git a/jdk/test/java/net/URLPermission/nstest/lookup.sh b/jdk/test/java/net/URLPermission/nstest/lookup.sh index 89798669f53..798e1c168f6 100644 --- a/jdk/test/java/net/URLPermission/nstest/lookup.sh +++ b/jdk/test/java/net/URLPermission/nstest/lookup.sh @@ -27,6 +27,7 @@ # @build jdk.testlibrary.* # @compile -XDignore.symbol.file=true LookupTest.java # @run shell/timeout=50 lookup.sh +# @key intermittent # OS=`uname -s` diff --git a/jdk/test/java/net/httpclient/BasicAuthTest.java b/jdk/test/java/net/httpclient/BasicAuthTest.java index fb227e3f672..b78739e682a 100644 --- a/jdk/test/java/net/httpclient/BasicAuthTest.java +++ b/jdk/test/java/net/httpclient/BasicAuthTest.java @@ -20,6 +20,7 @@ * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any + * questions. */ /** diff --git a/jdk/test/java/net/httpclient/HeadersTest1.java b/jdk/test/java/net/httpclient/HeadersTest1.java index 79f62006722..e3c892ef2c1 100644 --- a/jdk/test/java/net/httpclient/HeadersTest1.java +++ b/jdk/test/java/net/httpclient/HeadersTest1.java @@ -20,6 +20,7 @@ * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any + * questions. */ /** diff --git a/jdk/test/java/net/httpclient/ImmutableHeaders.java b/jdk/test/java/net/httpclient/ImmutableHeaders.java index 7286c2e1b0b..7773061dc30 100644 --- a/jdk/test/java/net/httpclient/ImmutableHeaders.java +++ b/jdk/test/java/net/httpclient/ImmutableHeaders.java @@ -20,6 +20,7 @@ * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any + * questions. */ /** diff --git a/jdk/test/java/net/httpclient/security/Driver.java b/jdk/test/java/net/httpclient/security/Driver.java index 078be5f5e51..3253fe2fd3c 100644 --- a/jdk/test/java/net/httpclient/security/Driver.java +++ b/jdk/test/java/net/httpclient/security/Driver.java @@ -20,6 +20,7 @@ * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any + * questions. */ /** diff --git a/jdk/test/java/net/httpclient/security/Security.java b/jdk/test/java/net/httpclient/security/Security.java index 2108c9fce29..5c282be9a36 100644 --- a/jdk/test/java/net/httpclient/security/Security.java +++ b/jdk/test/java/net/httpclient/security/Security.java @@ -20,6 +20,7 @@ * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any + * questions. */ /** diff --git a/jdk/test/java/nio/channels/Selector/SelectTimeout.java b/jdk/test/java/nio/channels/Selector/SelectTimeout.java new file mode 100644 index 00000000000..aaeff367d84 --- /dev/null +++ b/jdk/test/java/nio/channels/Selector/SelectTimeout.java @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +*/ + +/* + * @test + * @bug 8165000 + * @summary Verify no IOException on OS X for large timeout value in select(). + * @requires (os.family == "mac") + */ +import java.io.IOException; +import java.nio.channels.Selector; + +public class SelectTimeout { + private static final long HUGE_TIMEOUT = 100000001000L; + private static final long SLEEP_MILLIS = 10000; + + private static Exception theException; + + public static void main(String[] args) + throws IOException, InterruptedException { + int failures = 0; + long[] timeouts = + new long[] {0, HUGE_TIMEOUT/2, HUGE_TIMEOUT - 1, HUGE_TIMEOUT}; + for (long t : timeouts) { + if (!test(t)) { + failures++; + } + } + if (failures > 0) { + throw new RuntimeException("Test failed!"); + } else { + System.out.println("Test succeeded"); + } + } + + private static boolean test(final long timeout) + throws InterruptedException, IOException { + theException = null; + + Selector selector = Selector.open(); + + Thread t = new Thread(() -> { + try { + selector.select(timeout); + } catch (IOException ioe) { + theException = ioe; + } + }); + t.start(); + + Thread.currentThread().sleep(SLEEP_MILLIS); + t.interrupt(); + + if (theException == null) { + System.out.printf("Test succeeded with timeout %d%n", timeout); + return true; + } else { + System.err.printf("Test failed with timeout %d%n", timeout); + theException.printStackTrace(); + return false; + } + } +} diff --git a/jdk/test/java/security/SecureRandom/DrbgParametersSpec.java b/jdk/test/java/security/SecureRandom/DrbgParametersSpec.java index 07ada993a35..f633576f4f0 100644 --- a/jdk/test/java/security/SecureRandom/DrbgParametersSpec.java +++ b/jdk/test/java/security/SecureRandom/DrbgParametersSpec.java @@ -24,7 +24,7 @@ /* @test * @bug 8051408 8158534 * @summary Make sure DrbgParameters coded as specified - * @library /test/lib/share/classes + * @library /test/lib */ import jdk.test.lib.Asserts; diff --git a/jdk/test/java/text/Bidi/BidiConformance.java b/jdk/test/java/text/Bidi/BidiConformance.java index 73689659cc3..45e49cb632f 100644 --- a/jdk/test/java/text/Bidi/BidiConformance.java +++ b/jdk/test/java/text/Bidi/BidiConformance.java @@ -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 @@ -25,6 +25,7 @@ * @test * @bug 6850113 8032446 * @summary confirm the behavior of new Bidi implementation. (Backward compatibility) + * @modules java.desktop */ import java.awt.font.NumericShaper; diff --git a/jdk/test/java/text/Bidi/BidiEmbeddingTest.java b/jdk/test/java/text/Bidi/BidiEmbeddingTest.java index 86578f4f1be..fb4d5f7418c 100644 --- a/jdk/test/java/text/Bidi/BidiEmbeddingTest.java +++ b/jdk/test/java/text/Bidi/BidiEmbeddingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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,6 +28,7 @@ * indicate overrides, rather than using bit 7. Also tests Bidi without loading awt classes to * confirm that Bidi can be used without awt. Verify that embedding level 0 is properly mapped * to the base embedding level. + * @modules java.desktop */ import java.awt.Color; diff --git a/jdk/test/java/text/Bidi/Bug7042148.java b/jdk/test/java/text/Bidi/Bug7042148.java index 92c3001dde9..d905a49b746 100644 --- a/jdk/test/java/text/Bidi/Bug7042148.java +++ b/jdk/test/java/text/Bidi/Bug7042148.java @@ -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 @@ -25,6 +25,7 @@ * @test * @bug 7042148 * @summary verify that Bidi.baseIsLeftToRight() returns the correct value even if an incorrect position is set in the given AttributedCharacterIterator. + * @modules java.desktop */ import java.awt.font.*; import java.text.*; diff --git a/jdk/test/java/text/Bidi/Bug7051769.java b/jdk/test/java/text/Bidi/Bug7051769.java index 9b1326021b5..a0737ec0afc 100644 --- a/jdk/test/java/text/Bidi/Bug7051769.java +++ b/jdk/test/java/text/Bidi/Bug7051769.java @@ -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 @@ -26,6 +26,7 @@ * @bug 7051769 8038092 * @summary verify that Bidi.toString() returns the corect result. * The second run is intended to test lazy SharedSectets init for 8038092 + * @modules java.desktop * @run main Bug7051769 * @run main/othervm -DpreloadBidi=true Bug7051769 */ diff --git a/jdk/test/java/text/BreakIterator/NewVSOld_th_TH.java b/jdk/test/java/text/BreakIterator/NewVSOld_th_TH.java index 467cbc574c3..4e114d75bf3 100644 --- a/jdk/test/java/text/BreakIterator/NewVSOld_th_TH.java +++ b/jdk/test/java/text/BreakIterator/NewVSOld_th_TH.java @@ -22,9 +22,10 @@ */ /* - @test - @summary test Comparison of New Collators against Old Collators in the en_US locale -*/ + * @test + * @summary test Comparison of New Collators against Old Collators in the en_US locale + * @modules jdk.localedata + */ import java.io.*; import java.util.Enumeration; diff --git a/jdk/test/java/text/Collator/APITest.java b/jdk/test/java/text/Collator/APITest.java index f2b0a019a29..43782c5ad90 100644 --- a/jdk/test/java/text/Collator/APITest.java +++ b/jdk/test/java/text/Collator/APITest.java @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test Collation API + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff --git a/jdk/test/java/text/Collator/CollationKeyTest.java b/jdk/test/java/text/Collator/CollationKeyTest.java index 9146bf97e9a..901a6347a57 100644 --- a/jdk/test/java/text/Collator/CollationKeyTest.java +++ b/jdk/test/java/text/Collator/CollationKeyTest.java @@ -29,6 +29,7 @@ * RuleBasedCollationKey. This test basically tests on the two features: * 1. Existing code using CollationKey works (backward compatiblility) * 2. CollationKey can be extended by its subclass. + * @modules jdk.localedata */ diff --git a/jdk/test/java/text/Collator/DanishTest.java b/jdk/test/java/text/Collator/DanishTest.java index b5194a83c2a..0c35d22e488 100644 --- a/jdk/test/java/text/Collator/DanishTest.java +++ b/jdk/test/java/text/Collator/DanishTest.java @@ -26,6 +26,7 @@ * @bug 4930708 4174436 5008498 * @library /java/text/testlib * @summary test Danish Collation + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff --git a/jdk/test/java/text/Collator/FinnishTest.java b/jdk/test/java/text/Collator/FinnishTest.java index 6df18ef0146..9efc3cd861d 100644 --- a/jdk/test/java/text/Collator/FinnishTest.java +++ b/jdk/test/java/text/Collator/FinnishTest.java @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test Finnish Collation + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff --git a/jdk/test/java/text/Collator/FrenchTest.java b/jdk/test/java/text/Collator/FrenchTest.java index 939ef322253..38492db023c 100644 --- a/jdk/test/java/text/Collator/FrenchTest.java +++ b/jdk/test/java/text/Collator/FrenchTest.java @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test French Collation + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff --git a/jdk/test/java/text/Collator/G7Test.java b/jdk/test/java/text/Collator/G7Test.java index 0b41566bd2e..f7bdfa4f868 100644 --- a/jdk/test/java/text/Collator/G7Test.java +++ b/jdk/test/java/text/Collator/G7Test.java @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test G7 Collation + * @modules jdk.localedata */ /* * diff --git a/jdk/test/java/text/Collator/JapaneseTest.java b/jdk/test/java/text/Collator/JapaneseTest.java index 2bd5f6d0179..7333da34b12 100644 --- a/jdk/test/java/text/Collator/JapaneseTest.java +++ b/jdk/test/java/text/Collator/JapaneseTest.java @@ -25,6 +25,7 @@ * @test 1.1 02/09/11 * @bug 4176141 4655819 * @summary Regression tests for Japanese Collation + * @modules jdk.localedata */ import java.text.*; diff --git a/jdk/test/java/text/Collator/KoreanTest.java b/jdk/test/java/text/Collator/KoreanTest.java index fd314ee13ed..fb3c5eae941 100644 --- a/jdk/test/java/text/Collator/KoreanTest.java +++ b/jdk/test/java/text/Collator/KoreanTest.java @@ -25,6 +25,7 @@ * @test 1.1 02/09/12 * @bug 4176141 4655819 * @summary Regression tests for Korean Collation + * @modules jdk.localedata */ import java.text.*; diff --git a/jdk/test/java/text/Collator/Regression.java b/jdk/test/java/text/Collator/Regression.java index 958ce29c524..212ab39d557 100644 --- a/jdk/test/java/text/Collator/Regression.java +++ b/jdk/test/java/text/Collator/Regression.java @@ -29,6 +29,7 @@ * 4133509 4139572 4141640 4179126 4179686 4244884 4663220 * @library /java/text/testlib * @summary Regression tests for Collation and associated classes + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff --git a/jdk/test/java/text/Collator/ThaiTest.java b/jdk/test/java/text/Collator/ThaiTest.java index 7d643446434..7a961ed5968 100644 --- a/jdk/test/java/text/Collator/ThaiTest.java +++ b/jdk/test/java/text/Collator/ThaiTest.java @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test Thai Collation + * @modules jdk.localedata */ /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. diff --git a/jdk/test/java/text/Collator/TurkishTest.java b/jdk/test/java/text/Collator/TurkishTest.java index f83ef228e06..d8c078abb4d 100644 --- a/jdk/test/java/text/Collator/TurkishTest.java +++ b/jdk/test/java/text/Collator/TurkishTest.java @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test Turkish Collation + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff --git a/jdk/test/java/text/Collator/VietnameseTest.java b/jdk/test/java/text/Collator/VietnameseTest.java index faa4921073c..6708622d096 100644 --- a/jdk/test/java/text/Collator/VietnameseTest.java +++ b/jdk/test/java/text/Collator/VietnameseTest.java @@ -26,6 +26,7 @@ * @bug 4932968 5015215 * @library /java/text/testlib * @summary test Vietnamese Collation + * @modules jdk.localedata */ /* diff --git a/jdk/test/java/text/Format/DateFormat/Bug4823811.java b/jdk/test/java/text/Format/DateFormat/Bug4823811.java index 524f790e1fb..c2d35e9f64f 100644 --- a/jdk/test/java/text/Format/DateFormat/Bug4823811.java +++ b/jdk/test/java/text/Format/DateFormat/Bug4823811.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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,6 +25,7 @@ * @test * @bug 4823811 8008577 * @summary Confirm that text which includes numbers with a trailing minus sign is parsed correctly. + * @modules jdk.localedata * @run main/othervm -Duser.timezone=GMT+09:00 -Djava.locale.providers=JRE,SPI Bug4823811 */ diff --git a/jdk/test/java/text/Format/DateFormat/Bug6683975.java b/jdk/test/java/text/Format/DateFormat/Bug6683975.java index e0c8cd75f15..1f401058e5a 100644 --- a/jdk/test/java/text/Format/DateFormat/Bug6683975.java +++ b/jdk/test/java/text/Format/DateFormat/Bug6683975.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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,6 +25,7 @@ * @test * @bug 6683975 8008577 * @summary Make sure that date is formatted correctlyin th locale. + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=JRE,SPI Bug6683975 */ import java.text.*; diff --git a/jdk/test/java/text/Format/DateFormat/Bug8139572.java b/jdk/test/java/text/Format/DateFormat/Bug8139572.java index d55196b3a23..13154c836c5 100644 --- a/jdk/test/java/text/Format/DateFormat/Bug8139572.java +++ b/jdk/test/java/text/Format/DateFormat/Bug8139572.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @bug 8139572 * @summary SimpleDateFormat parse month stand-alone format bug * @compile -encoding utf-8 Bug8139572.java + * @modules jdk.localedata * @run main Bug8139572 */ import java.text.ParseException; diff --git a/jdk/test/java/text/Format/DateFormat/ContextMonthNamesTest.java b/jdk/test/java/text/Format/DateFormat/ContextMonthNamesTest.java index 6f38bfb15c1..60632b0fcce 100644 --- a/jdk/test/java/text/Format/DateFormat/ContextMonthNamesTest.java +++ b/jdk/test/java/text/Format/DateFormat/ContextMonthNamesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test * @bug 7079560 8008577 * @summary Unit test for context-sensitive month names + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=JRE,SPI ContextMonthNamesTest */ diff --git a/jdk/test/java/text/Format/DateFormat/DateFormatTest.java b/jdk/test/java/text/Format/DateFormat/DateFormatTest.java index c4f148f3d77..7384a82af0c 100644 --- a/jdk/test/java/text/Format/DateFormat/DateFormatTest.java +++ b/jdk/test/java/text/Format/DateFormat/DateFormatTest.java @@ -26,6 +26,7 @@ * @bug 4052223 4089987 4469904 4326988 4486735 8008577 8045998 8140571 * @summary test DateFormat and SimpleDateFormat. * @library /java/text/testlib + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=COMPAT,SPI DateFormatTest */ diff --git a/jdk/test/java/text/Format/DateFormat/LocaleDateFormats.java b/jdk/test/java/text/Format/DateFormat/LocaleDateFormats.java index bff177ff7e4..9241e59c3bd 100644 --- a/jdk/test/java/text/Format/DateFormat/LocaleDateFormats.java +++ b/jdk/test/java/text/Format/DateFormat/LocaleDateFormats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /** * @test * @bug 8080774 + * @modules jdk.localedata * @run testng/othervm -Djava.locale.providers=JRE,CLDR LocaleDateFormats * @summary This file contains tests for JRE locales date formats */ diff --git a/jdk/test/java/text/Format/DateFormat/NonGregorianFormatTest.java b/jdk/test/java/text/Format/DateFormat/NonGregorianFormatTest.java index 69808d47645..b811900901d 100644 --- a/jdk/test/java/text/Format/DateFormat/NonGregorianFormatTest.java +++ b/jdk/test/java/text/Format/DateFormat/NonGregorianFormatTest.java @@ -25,6 +25,7 @@ * @test * @bug 4833268 6253991 8008577 * @summary Test formatting and parsing with non-Gregorian calendars + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=COMPAT,SPI NonGregorianFormatTest */ diff --git a/jdk/test/java/text/Format/DateFormat/bug4117335.java b/jdk/test/java/text/Format/DateFormat/bug4117335.java index 6c9af2a4716..d9b59eda005 100644 --- a/jdk/test/java/text/Format/DateFormat/bug4117335.java +++ b/jdk/test/java/text/Format/DateFormat/bug4117335.java @@ -25,6 +25,7 @@ * @test * * @bug 4117335 4432617 + * @modules jdk.localedata */ import java.text.DateFormatSymbols ; diff --git a/jdk/test/java/text/Format/MessageFormat/LargeMessageFormat.java b/jdk/test/java/text/Format/MessageFormat/LargeMessageFormat.java index 1a4ca1d092d..55c9869c373 100644 --- a/jdk/test/java/text/Format/MessageFormat/LargeMessageFormat.java +++ b/jdk/test/java/text/Format/MessageFormat/LargeMessageFormat.java @@ -25,6 +25,7 @@ * @test * @bug 4112090 8008577 * @summary verify that MessageFormat can handle large numbers of arguments + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=COMPAT,SPI LargeMessageFormat */ diff --git a/jdk/test/java/text/Format/NumberFormat/Bug8132125.java b/jdk/test/java/text/Format/NumberFormat/Bug8132125.java index e19b2cd17eb..9f713324a21 100644 --- a/jdk/test/java/text/Format/NumberFormat/Bug8132125.java +++ b/jdk/test/java/text/Format/NumberFormat/Bug8132125.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test * @bug 8132125 * @summary Checks Swiss' number elements + * @modules jdk.localedata */ import java.text.*; diff --git a/jdk/test/java/text/Format/NumberFormat/CurrencyFormat.java b/jdk/test/java/text/Format/NumberFormat/CurrencyFormat.java index 96fa3976701..44b53d25ec1 100644 --- a/jdk/test/java/text/Format/NumberFormat/CurrencyFormat.java +++ b/jdk/test/java/text/Format/NumberFormat/CurrencyFormat.java @@ -25,6 +25,7 @@ * @test * @bug 4290801 4942982 5102005 8008577 8021121 * @summary Basic tests for currency formatting. + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=JRE,SPI CurrencyFormat */ diff --git a/jdk/test/java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java b/jdk/test/java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java index ab1069bdfc2..011db2bdea3 100644 --- a/jdk/test/java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java +++ b/jdk/test/java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test International Number Format API + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved diff --git a/jdk/test/java/text/Format/NumberFormat/NumberRegression.java b/jdk/test/java/text/Format/NumberFormat/NumberRegression.java index 0edaa11ccf5..b194d270a5c 100644 --- a/jdk/test/java/text/Format/NumberFormat/NumberRegression.java +++ b/jdk/test/java/text/Format/NumberFormat/NumberRegression.java @@ -34,6 +34,7 @@ * @library /java/text/testlib * @build IntlTest HexDumpReader TestUtils * @modules java.base/sun.util.resources + * jdk.localedata * @compile -XDignore.symbol.file NumberRegression.java * @run main/othervm -Djava.locale.providers=COMPAT,SPI NumberRegression */ diff --git a/jdk/test/java/text/Format/NumberFormat/NumberTest.java b/jdk/test/java/text/Format/NumberFormat/NumberTest.java index ca519bb6dab..cf64a431a55 100644 --- a/jdk/test/java/text/Format/NumberFormat/NumberTest.java +++ b/jdk/test/java/text/Format/NumberFormat/NumberTest.java @@ -27,6 +27,7 @@ * @summary test NumberFormat * @library /java/text/testlib * @modules java.base/sun.util.resources + * jdk.localedata * @compile -XDignore.symbol.file NumberTest.java * @run main/othervm -Djava.locale.providers=COMPAT,SPI NumberTest */ diff --git a/jdk/test/java/util/Arrays/Correct.java b/jdk/test/java/util/Arrays/Correct.java index e9ddc7edef5..f69ea9160ff 100644 --- a/jdk/test/java/util/Arrays/Correct.java +++ b/jdk/test/java/util/Arrays/Correct.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/jdk/test/java/util/Base64/TestBase64.java b/jdk/test/java/util/Base64/TestBase64.java index 0c5e27fd9fd..d28f0d0f88a 100644 --- a/jdk/test/java/util/Base64/TestBase64.java +++ b/jdk/test/java/util/Base64/TestBase64.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,8 +23,11 @@ /** * @test 4235519 8004212 8005394 8007298 8006295 8006315 8006530 8007379 8008925 - * 8014217 8025003 8026330 8028397 8129544 + * 8014217 8025003 8026330 8028397 8129544 8165243 * @summary tests java.util.Base64 + * @library /lib/testlibrary + * @build jdk.testlibrary.* + * @run main TestBase64 * @key randomness */ @@ -35,11 +38,17 @@ import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; import java.util.Arrays; +import java.util.ArrayList; import java.util.Base64; +import java.util.List; import java.util.Random; +import jdk.testlibrary.RandomFactory; + public class TestBase64 { + private static final Random rnd = RandomFactory.getRandom(); + public static void main(String args[]) throws Throwable { int numRuns = 10; int numBytes = 200; @@ -52,7 +61,6 @@ public class TestBase64 { test(Base64.getUrlEncoder(), Base64.getUrlDecoder(), numRuns, numBytes); test(Base64.getMimeEncoder(), Base64.getMimeDecoder(), numRuns, numBytes); - Random rnd = new java.util.Random(); byte[] nl_1 = new byte[] {'\n'}; byte[] nl_2 = new byte[] {'\n', '\r'}; byte[] nl_3 = new byte[] {'\n', '\r', '\n'}; @@ -76,7 +84,7 @@ public class TestBase64 { testNull(Base64.getDecoder()); testNull(Base64.getUrlDecoder()); testNull(Base64.getMimeDecoder()); - checkNull(new Runnable() { public void run() { Base64.getMimeEncoder(10, null); }}); + checkNull(() -> Base64.getMimeEncoder(10, null)); testIOE(Base64.getEncoder()); testIOE(Base64.getUrlEncoder()); @@ -84,26 +92,23 @@ public class TestBase64 { testIOE(Base64.getMimeEncoder(10, new byte[]{'\n'})); byte[] src = new byte[1024]; - new Random().nextBytes(src); + rnd.nextBytes(src); final byte[] decoded = Base64.getEncoder().encode(src); testIOE(Base64.getDecoder(), decoded); testIOE(Base64.getMimeDecoder(), decoded); testIOE(Base64.getUrlDecoder(), Base64.getUrlEncoder().encode(src)); // illegal line separator - checkIAE(new Runnable() { public void run() { Base64.getMimeEncoder(10, new byte[]{'\r', 'N'}); }}); + checkIAE(() -> Base64.getMimeEncoder(10, new byte[]{'\r', 'N'})); // malformed padding/ending testMalformedPadding(); // illegal base64 character decoded[2] = (byte)0xe0; - checkIAE(new Runnable() { - public void run() { Base64.getDecoder().decode(decoded); }}); - checkIAE(new Runnable() { - public void run() { Base64.getDecoder().decode(decoded, new byte[1024]); }}); - checkIAE(new Runnable() { public void run() { - Base64.getDecoder().decode(ByteBuffer.wrap(decoded)); }}); + checkIAE(() -> Base64.getDecoder().decode(decoded)); + checkIAE(() -> Base64.getDecoder().decode(decoded, new byte[1024])); + checkIAE(() -> Base64.getDecoder().decode(ByteBuffer.wrap(decoded))); // test single-non-base64 character for mime decoding testSingleNonBase64MimeDec(); @@ -113,12 +118,20 @@ public class TestBase64 { // test mime decoding with ignored character after padding testDecodeIgnoredAfterPadding(); + + // given invalid args, encoder should not produce output + testEncoderKeepsSilence(Base64.getEncoder()); + testEncoderKeepsSilence(Base64.getUrlEncoder()); + testEncoderKeepsSilence(Base64.getMimeEncoder()); + + // given invalid args, decoder should not consume input + testDecoderKeepsAbstinence(Base64.getDecoder()); + testDecoderKeepsAbstinence(Base64.getUrlDecoder()); + testDecoderKeepsAbstinence(Base64.getMimeDecoder()); } private static void test(Base64.Encoder enc, Base64.Decoder dec, int numRuns, int numBytes) throws Throwable { - Random rnd = new java.util.Random(); - enc.encode(new byte[0]); dec.decode(new byte[0]); @@ -258,48 +271,49 @@ public class TestBase64 { private static final String str_null = null; private static final ByteBuffer bb_null = null; - private static void testNull(final Base64.Encoder enc) { - checkNull(new Runnable() { public void run() { enc.encode(ba_null); }}); - checkNull(new Runnable() { public void run() { enc.encodeToString(ba_null); }}); - checkNull(new Runnable() { public void run() { enc.encode(ba_null, new byte[10]); }}); - checkNull(new Runnable() { public void run() { enc.encode(new byte[10], ba_null); }}); - checkNull(new Runnable() { public void run() { enc.encode(bb_null); }}); - checkNull(new Runnable() { public void run() { enc.wrap((OutputStream)null); }}); + private static void testNull(Base64.Encoder enc) { + checkNull(() -> enc.encode(ba_null)); + checkNull(() -> enc.encodeToString(ba_null)); + checkNull(() -> enc.encode(ba_null, new byte[10])); + checkNull(() -> enc.encode(new byte[10], ba_null)); + checkNull(() -> enc.encode(bb_null)); + checkNull(() -> enc.wrap((OutputStream)null)); } - private static void testNull(final Base64.Decoder dec) { - checkNull(new Runnable() { public void run() { dec.decode(ba_null); }}); - checkNull(new Runnable() { public void run() { dec.decode(str_null); }}); - checkNull(new Runnable() { public void run() { dec.decode(ba_null, new byte[10]); }}); - checkNull(new Runnable() { public void run() { dec.decode(new byte[10], ba_null); }}); - checkNull(new Runnable() { public void run() { dec.decode(bb_null); }}); - checkNull(new Runnable() { public void run() { dec.wrap((InputStream)null); }}); + private static void testNull(Base64.Decoder dec) { + checkNull(() -> dec.decode(ba_null)); + checkNull(() -> dec.decode(str_null)); + checkNull(() -> dec.decode(ba_null, new byte[10])); + checkNull(() -> dec.decode(new byte[10], ba_null)); + checkNull(() -> dec.decode(bb_null)); + checkNull(() -> dec.wrap((InputStream)null)); } + @FunctionalInterface private static interface Testable { public void test() throws Throwable; } - private static void testIOE(final Base64.Encoder enc) throws Throwable { + private static void testIOE(Base64.Encoder enc) throws Throwable { ByteArrayOutputStream baos = new ByteArrayOutputStream(8192); - final OutputStream os = enc.wrap(baos); + OutputStream os = enc.wrap(baos); os.write(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9}); os.close(); - checkIOE(new Testable() { public void test() throws Throwable { os.write(10); }}); - checkIOE(new Testable() { public void test() throws Throwable { os.write(new byte[] {10}); }}); - checkIOE(new Testable() { public void test() throws Throwable { os.write(new byte[] {10}, 1, 4); }}); + checkIOE(() -> os.write(10)); + checkIOE(() -> os.write(new byte[] {10})); + checkIOE(() -> os.write(new byte[] {10}, 1, 4)); } - private static void testIOE(final Base64.Decoder dec, byte[] decoded) throws Throwable { + private static void testIOE(Base64.Decoder dec, byte[] decoded) throws Throwable { ByteArrayInputStream bais = new ByteArrayInputStream(decoded); - final InputStream is = dec.wrap(bais); + InputStream is = dec.wrap(bais); is.read(new byte[10]); is.close(); - checkIOE(new Testable() { public void test() throws Throwable { is.read(); }}); - checkIOE(new Testable() { public void test() throws Throwable { is.read(new byte[] {10}); }}); - checkIOE(new Testable() { public void test() throws Throwable { is.read(new byte[] {10}, 1, 4); }}); - checkIOE(new Testable() { public void test() throws Throwable { is.available(); }}); - checkIOE(new Testable() { public void test() throws Throwable { is.skip(20); }}); + checkIOE(() -> is.read()); + checkIOE(() -> is.read(new byte[] {10})); + checkIOE(() -> is.read(new byte[] {10}, 1, 4)); + checkIOE(() -> is.available()); + checkIOE(() -> is.skip(20)); } private static final void checkNull(Runnable r) { @@ -391,13 +405,13 @@ public class TestBase64 { int pos = (Integer)data[i + 2]; // decode(byte[]) - checkIAE(new Runnable() { public void run() { dec.decode(srcBytes); }}); + checkIAE(() -> dec.decode(srcBytes)); // decode(String) - checkIAE(new Runnable() { public void run() { dec.decode(srcStr); }}); + checkIAE(() -> dec.decode(srcStr)); // decode(ByteBuffer) - checkIAE(new Runnable() { public void run() { dec.decode(srcBB); }}); + checkIAE(() -> dec.decode(srcBB)); // wrap stream checkIOE(new Testable() { @@ -412,10 +426,8 @@ public class TestBase64 { // anything left after padding is "invalid"/IAE, if // not MIME. In case of MIME, non-base64 character(s) // is ignored. - checkIAE(new Runnable() { public void run() { - Base64.getDecoder().decode("AA==\u00D2"); }}); - checkIAE(new Runnable() { public void run() { - Base64.getUrlDecoder().decode("AA==\u00D2"); }}); + checkIAE(() -> Base64.getDecoder().decode("AA==\u00D2")); + checkIAE(() -> Base64.getUrlDecoder().decode("AA==\u00D2")); Base64.getMimeDecoder().decode("AA==\u00D2"); } @@ -516,4 +528,67 @@ public class TestBase64 { } return ret; } + + private static void testEncoderKeepsSilence(Base64.Encoder enc) + throws Throwable { + List vals = new ArrayList<>(List.of(Integer.MIN_VALUE, + Integer.MIN_VALUE + 1, -1111, -2, -1, 0, 1, 2, 3, 1111, + Integer.MAX_VALUE - 1, Integer.MAX_VALUE)); + vals.addAll(List.of(rnd.nextInt(), rnd.nextInt(), rnd.nextInt(), + rnd.nextInt())); + byte[] buf = new byte[] {1, 0, 91}; + for (int off : vals) { + for (int len : vals) { + if (off >= 0 && len >= 0 && off <= buf.length - len) { + // valid args, skip them + continue; + } + // invalid args, test them + System.out.println("testing off=" + off + ", len=" + len); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(100); + try (OutputStream os = enc.wrap(baos)) { + os.write(buf, off, len); + throw new RuntimeException("Expected IOOBEx was not thrown"); + } catch (IndexOutOfBoundsException expected) { + } + if (baos.size() > 0) + throw new RuntimeException("No output was expected, but got " + + baos.size() + " bytes"); + } + } + } + + private static void testDecoderKeepsAbstinence(Base64.Decoder dec) + throws Throwable { + List vals = new ArrayList<>(List.of(Integer.MIN_VALUE, + Integer.MIN_VALUE + 1, -1111, -2, -1, 0, 1, 2, 3, 1111, + Integer.MAX_VALUE - 1, Integer.MAX_VALUE)); + vals.addAll(List.of(rnd.nextInt(), rnd.nextInt(), rnd.nextInt(), + rnd.nextInt())); + byte[] buf = new byte[3]; + for (int off : vals) { + for (int len : vals) { + if (off >= 0 && len >= 0 && off <= buf.length - len) { + // valid args, skip them + continue; + } + // invalid args, test them + System.out.println("testing off=" + off + ", len=" + len); + + String input = "AAAAAAAAAAAAAAAAAAAAAA"; + ByteArrayInputStream bais = + new ByteArrayInputStream(input.getBytes("Latin1")); + try (InputStream is = dec.wrap(bais)) { + is.read(buf, off, len); + throw new RuntimeException("Expected IOOBEx was not thrown"); + } catch (IndexOutOfBoundsException expected) { + } + if (bais.available() != input.length()) + throw new RuntimeException("No input should be consumed, " + + "but consumed " + (input.length() - bais.available()) + + " bytes"); + } + } + } } diff --git a/jdk/test/java/util/Map/FunctionalCMEs.java b/jdk/test/java/util/Map/FunctionalCMEs.java index 6f92b018185..4d83d241c94 100644 --- a/jdk/test/java/util/Map/FunctionalCMEs.java +++ b/jdk/test/java/util/Map/FunctionalCMEs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + import java.util.Arrays; import java.util.ConcurrentModificationException; import java.util.HashMap; diff --git a/jdk/test/java/util/Objects/CheckIndex.java b/jdk/test/java/util/Objects/CheckIndex.java index bcfa1d5b23d..594e806dcd0 100644 --- a/jdk/test/java/util/Objects/CheckIndex.java +++ b/jdk/test/java/util/Objects/CheckIndex.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/concurrent/FutureTask/NegativeTimeout.java b/jdk/test/java/util/concurrent/FutureTask/NegativeTimeout.java index f2e18f6d1bf..37cf4359580 100644 --- a/jdk/test/java/util/concurrent/FutureTask/NegativeTimeout.java +++ b/jdk/test/java/util/concurrent/FutureTask/NegativeTimeout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java b/jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java index d63e619830a..d9b494741ab 100644 --- a/jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java +++ b/jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java @@ -1,4 +1,3 @@ - /* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. diff --git a/jdk/test/java/util/logging/XMLFormatterDate.java b/jdk/test/java/util/logging/XMLFormatterDate.java index ee0eeb98b57..3b0d7029464 100644 --- a/jdk/test/java/util/logging/XMLFormatterDate.java +++ b/jdk/test/java/util/logging/XMLFormatterDate.java @@ -1,4 +1,3 @@ - /* * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -21,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/jdk/test/java/util/regex/PatternStreamTest.java b/jdk/test/java/util/regex/PatternStreamTest.java index 1f02e410321..9809ea20aef 100644 --- a/jdk/test/java/util/regex/PatternStreamTest.java +++ b/jdk/test/java/util/regex/PatternStreamTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/jdk/test/java/util/zip/TestCRC32.java b/jdk/test/java/util/zip/TestCRC32.java index 68c15aed44b..15d919ddb61 100644 --- a/jdk/test/java/util/zip/TestCRC32.java +++ b/jdk/test/java/util/zip/TestCRC32.java @@ -1,6 +1,3 @@ - -import java.util.zip.CRC32; - /* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,6 +21,8 @@ import java.util.zip.CRC32; * questions. */ +import java.util.zip.CRC32; + /** * @test @summary Check that CRC-32 returns the expected CRC value for the * string 123456789 diff --git a/jdk/test/java/util/zip/TestCRC32C.java b/jdk/test/java/util/zip/TestCRC32C.java index bb5ea0447c5..6adf260dbab 100644 --- a/jdk/test/java/util/zip/TestCRC32C.java +++ b/jdk/test/java/util/zip/TestCRC32C.java @@ -1,6 +1,3 @@ - -import java.util.zip.CRC32C; - /* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,6 +21,8 @@ import java.util.zip.CRC32C; * questions. */ +import java.util.zip.CRC32C; + /** * @test @summary Check that CRC-32C returns the expected CRC value for the * string 123456789 diff --git a/jdk/test/java/util/zip/ZipFile/TestZipFile.java b/jdk/test/java/util/zip/ZipFile/TestZipFile.java index 515ed356c2b..25b87ff1242 100644 --- a/jdk/test/java/util/zip/ZipFile/TestZipFile.java +++ b/jdk/test/java/util/zip/ZipFile/TestZipFile.java @@ -8,7 +8,7 @@ * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * diff --git a/jdk/test/javax/imageio/GetReaderWriterInfoNullTest.java b/jdk/test/javax/imageio/GetReaderWriterInfoNullTest.java new file mode 100644 index 00000000000..5e9679cfe7f --- /dev/null +++ b/jdk/test/javax/imageio/GetReaderWriterInfoNullTest.java @@ -0,0 +1,161 @@ +/* + * 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 8163258 + * @summary Test verifies that when we create our own ImageReaderSpi + * implementaion with MIMEType or FileSuffix as null, it should + * not throw NullPointerException when we call + * ImageIO.getReaderMIMETypes() or ImageIO.getReaderFileSuffixes(). + * @run main GetReaderWriterInfoNullTest + */ + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Iterator; +import java.util.Locale; +import javax.imageio.IIOException; +import javax.imageio.ImageReadParam; +import javax.imageio.ImageReader; +import javax.imageio.ImageTypeSpecifier; +import javax.imageio.metadata.IIOMetadata; +import javax.imageio.spi.ImageReaderSpi; +import javax.imageio.stream.ImageInputStream; +import javax.imageio.ImageIO; +import javax.imageio.spi.IIORegistry; + +class TestImageReaderSpi extends ImageReaderSpi { + + public TestImageReaderSpi(String[] FORMATNAMES, String[] SUFFIXES, + String[] MIMETYPES) { + super("J Duke", // vendor + "1.0", // version + FORMATNAMES, // format names + SUFFIXES, // file suffixes + MIMETYPES, // mimetypes + "readTest.TestImageReader", // reader class name + new Class[] { ImageInputStream.class }, // input types + null, // writer class names. + true, // supports native metadata, + null, // [no] native stream metadata format + null, // [no] native stream metadata class + null, // [no] native extra stream metadata format + null, // [no] native extra stream metadata class + true, // supports standard metadata, + null, // metadata format name, + null, // metadata format class name + null, // [no] extra image metadata format + null // [no] extra image metadata format class + ); + } + + @Override + public boolean canDecodeInput(Object source) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getDescription(Locale locale) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ImageReader createReaderInstance(Object extension) + throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} + +class TestImageReader extends ImageReader { + + public TestImageReader(ImageReaderSpi originatingProvider) { + super(originatingProvider); + } + + @Override + public int getNumImages(boolean allowSearch) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getWidth(int imageIndex) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHeight(int imageIndex) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Iterator getImageTypes(int imageIndex) + throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public IIOMetadata getStreamMetadata() throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public IIOMetadata getImageMetadata(int imageIndex) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BufferedImage read(int imageIndex, ImageReadParam param) + throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } +} +public class GetReaderWriterInfoNullTest { + static final String[] FORMATNAMES = {"readTest"}; + static final String[] SUFFIXES = {"readTest"}; + static final String[] MIMETYPES = {"readTest"}; + public static void main (String[] args) throws IIOException { + // Verify getReaderMIMETypes() behavior by keeping MIMEType as null. + TestImageReaderSpi mimeNullReadSpi = + new TestImageReaderSpi(FORMATNAMES, SUFFIXES, null); + IIORegistry.getDefaultInstance(). + registerServiceProvider(mimeNullReadSpi); + ImageIO.getReaderMIMETypes(); + IIORegistry.getDefaultInstance(). + deregisterServiceProvider(mimeNullReadSpi); + + /* + * Verify getReaderFileSuffixes() behavior by keeping + * file suffix as null. + */ + TestImageReaderSpi suffixNullReadSpi = + new TestImageReaderSpi(FORMATNAMES, null, MIMETYPES); + IIORegistry.getDefaultInstance(). + registerServiceProvider(suffixNullReadSpi); + ImageIO.getReaderFileSuffixes(); + IIORegistry.getDefaultInstance(). + deregisterServiceProvider(suffixNullReadSpi); + } +} + diff --git a/jdk/test/javax/imageio/plugins/tiff/TIFFFieldTest.java b/jdk/test/javax/imageio/plugins/tiff/TIFFFieldTest.java index a50929e8a46..936a5e3af68 100644 --- a/jdk/test/javax/imageio/plugins/tiff/TIFFFieldTest.java +++ b/jdk/test/javax/imageio/plugins/tiff/TIFFFieldTest.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8152183 + * @bug 8152183 8149562 * @author a.stepanov * @summary Some checks for TIFFField methods * @run main TIFFFieldTest @@ -455,8 +455,17 @@ public class TIFFFieldTest { TIFFTagSet ts = new TIFFTagSet(tags); boolean ok = false; - try { TIFFField.createFromMetadataNode(ts, null); } - catch (NullPointerException e) { ok = true; } + try { + TIFFField.createFromMetadataNode(ts, null); + } catch (IllegalArgumentException e) { + // createFromMetadataNode() formerly threw a NullPointerException + // if its Node parameter was null, but the specification has been + // modified to allow only IllegalArgumentExceptions, perhaps with + // a cause set. In the present invocation the cause would be set + // to a NullPointerException but this is not explicitly specified + // hence not verified here. + ok = true; + } check(ok, "can create TIFFField from a null node"); TIFFField f = new TIFFField(tag, v); diff --git a/jdk/test/javax/management/remote/mandatory/connection/ObjectInputStreamWithLoaderNullCheckTest.java b/jdk/test/javax/management/remote/mandatory/connection/ObjectInputStreamWithLoaderNullCheckTest.java new file mode 100644 index 00000000000..44a59113732 --- /dev/null +++ b/jdk/test/javax/management/remote/mandatory/connection/ObjectInputStreamWithLoaderNullCheckTest.java @@ -0,0 +1,84 @@ +/* + * 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 8009560 + * @summary Test RMIConnector.ObjectInputStreamWithLoader constructor with + * null Class loader. The test expects a IllegalArgumentException + * thrown when constructor is invoked with null class loader as + * an argument. + * @author Amit Sapre + * @modules java.management + * @run clean ObjectInputStreamWithLoaderNullCheckTest + * @run build ObjectInputStreamWithLoaderNullCheckTest + * @run main ObjectInputStreamWithLoaderNullCheckTest + */ + +import java.lang.reflect.*; +import javax.management.remote.*; +import javax.management.remote.rmi.*; +import java.io.*; + +public class ObjectInputStreamWithLoaderNullCheckTest { + + private static Class innerClass; + + public static void main(String[] args) throws Exception { + + System.out.println(">> == ObjectInputStreamWithLoaderNullCheckTest started..."); + + try { + innerClass = Class.forName("javax.management.remote.rmi.RMIConnector$ObjectInputStreamWithLoader"); + Constructor ctor = innerClass.getDeclaredConstructor(InputStream.class,ClassLoader.class); + ctor.setAccessible(true); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutput objOut = new ObjectOutputStream(baos); + objOut.writeObject(new String("Serialize")); + objOut.close(); + baos.close(); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + + System.out.println(">> == Testing constructor with null class loader."); + Object obj = ctor.newInstance(bais,null); + + System.out.println(">> == Test case failed. No error occured"); + System.exit(1); + } catch (InvocationTargetException ex) { + Throwable cause = ex.getCause(); + System.out.println(">> == InvocationTargetException Cause message : " + cause.toString()); + if (cause instanceof IllegalArgumentException) { + System.out.println(">> == Test case Passed."); + } else { + System.out.println(">> == Test case Failed."); + ex.printStackTrace(); + System.exit(1); + } + } catch (Exception ex) { + System.out.println(">>> == Test case failed with error " + ex.getCause().getMessage()); + ex.printStackTrace(); + System.exit(1); + } + } +} diff --git a/jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java b/jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java index 3f91fc38085..50777b00220 100644 --- a/jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java +++ b/jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -115,9 +115,8 @@ public class DeadListenerTest { mbean.sendNotification(notif); // Make sure notifs are working normally. - long deadline = System.currentTimeMillis() + 2000; - while ((count1Val.get() != 1 || count2Val.get() != 1) && System.currentTimeMillis() < deadline) { - Thread.sleep(10); + while ((count1Val.get() != 1 || count2Val.get() != 1) ) { + Thread.sleep(20); } assertTrue("New value of count1 == 1", count1Val.get() == 1); assertTrue("Initial value of count2 == 1", count2Val.get() == 1); diff --git a/jdk/test/javax/print/attribute/ServiceDialogValidateTest.java b/jdk/test/javax/print/attribute/ServiceDialogValidateTest.java index 4216da6f015..929f76869cf 100644 --- a/jdk/test/javax/print/attribute/ServiceDialogValidateTest.java +++ b/jdk/test/javax/print/attribute/ServiceDialogValidateTest.java @@ -22,7 +22,7 @@ */ /* * @test - * @bug 5049012 + * @bug 5049012 8163922 * @summary Verify if PrintToFile option is disabled for flavors that do not * support Destination * @requires (os.family == "linux") @@ -30,6 +30,8 @@ */ import java.awt.BorderLayout; import java.awt.FlowLayout; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.File; import javax.print.DocFlavor; import javax.print.PrintService; @@ -72,6 +74,9 @@ public class ServiceDialogValidateTest { defService = ServiceUI.printDialog(null, 100, 100, service, defService, flavor, prSet); + ServiceUI.printDialog(null, 100, 100, service, defService, + DocFlavor.SERVICE_FORMATTED.PAGEABLE, + new HashPrintRequestAttributeSet()); } /** @@ -87,7 +92,8 @@ public class ServiceDialogValidateTest { } catch (InterruptedException e) { if (!testPassed && testGeneratedInterrupt) { throw new RuntimeException("PrintToFile option is not disabled " - + "for flavors that do not support destination"); + + "for flavors that do not support destination and/or" + + " disabled for flavors that supports destination"); } } if (!testGeneratedInterrupt) { @@ -110,10 +116,15 @@ public class ServiceDialogValidateTest { private static void doTest(Runnable action) { String description = " Visual inspection of print dialog is required.\n" - + " A print dialog will be shown.\n " - + " Please verify Print-To-File option is disabled.\n" + + " 2 print dialog will be shown.\n " + + " Please verify Print-To-File option is disabled " + + " in the 1st print dialog.\n" + " Press Cancel to close the print dialog.\n" - + " If Print-To-File option is disabled, press PASS else press FAIL"; + + " Please verify Print-To-File option is enabled " + + " in 2nd print dialog\n" + + " Press Cancel to close the print dialog.\n" + + " If the print dialog's Print-to-File behaves as mentioned, " + + " press PASS else press FAIL"; final JDialog dialog = new JDialog(); dialog.setTitle("printSelectionTest"); @@ -148,6 +159,14 @@ public class ServiceDialogValidateTest { dialog.add(mainPanel); dialog.pack(); dialog.setVisible(true); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + System.out.println("main dialog closing"); + testGeneratedInterrupt = false; + mainThread.interrupt(); + } + }); } } diff --git a/jdk/test/javax/print/attribute/ServiceDlgPageRangeTest.java b/jdk/test/javax/print/attribute/ServiceDlgPageRangeTest.java index b35d687b7c0..ab17680cefc 100644 --- a/jdk/test/javax/print/attribute/ServiceDlgPageRangeTest.java +++ b/jdk/test/javax/print/attribute/ServiceDlgPageRangeTest.java @@ -22,13 +22,15 @@ */ /* * @test - * @bug 5080098 + * @bug 5080098 8164205 * @summary Verify if PageRanges option is disabled for Non service-formatted * flavors. * @run main/manual ServiceDlgPageRangeTest */ import java.awt.BorderLayout; import java.awt.FlowLayout; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import javax.print.DocFlavor; import javax.print.PrintService; import javax.print.PrintServiceLookup; diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetInputStream.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetInputStream.java index e1a39d3c500..72a19c9e80a 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetInputStream.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -54,13 +56,13 @@ public class GetInputStream { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { @@ -76,7 +78,9 @@ public class GetInputStream { buff = new ModelByteBuffer(test_byte_array); byte[] b = new byte[test_byte_array.length]; - buff.getInputStream().read(b); + try (InputStream is = buff.getInputStream()) { + is.read(b); + } for (int j = 0; j < b.length; j++) if(b[i] != test_byte_array[i]) throw new RuntimeException("Byte array compare fails!"); diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetRoot.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetRoot.java index b9928253678..829900f8ba9 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetRoot.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetRoot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ public class GetRoot { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Load.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Load.java index 734ed37b4ac..b589048ff98 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Load.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Load.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,8 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -54,13 +55,13 @@ public class Load { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/LoadAll.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/LoadAll.java index e912ee98698..5549393fcda 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/LoadAll.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/LoadAll.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,8 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -56,13 +57,13 @@ public class LoadAll { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArray.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArray.java index edcef873e0a..801926a5c5e 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArray.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ public class NewModelByteBufferByteArray { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java index 3d1ad726598..4c193b9e484 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ public class NewModelByteBufferByteArrayIntInt { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFile.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFile.java index 5a200045671..90b4be57bf2 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFile.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ public class NewModelByteBufferFile { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFileLongLong.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFileLongLong.java index d55466ae5e8..85f93bd852b 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFileLongLong.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFileLongLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ public class NewModelByteBufferFileLongLong { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Available.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Available.java index c4da3ad8183..659f33c66d0 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Available.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Available.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ public class Available { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Close.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Close.java index 2bfd5891953..4785d4097d0 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Close.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Close.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ public class Close { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkReset.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkReset.java index bcd8584834e..f8a3570aef7 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkReset.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkReset.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ public class MarkReset { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java index e505d0b9d96..41ed42e08fa 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ public class MarkSupported { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Read.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Read.java index e8fb2818fca..523adf4eaca 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Read.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Read.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ public class Read { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByte.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByte.java index a847b56783b..ceb33fb25fd 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByte.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByte.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ public class ReadByte { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java index c8c0a0fe64d..1570df03fae 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ public class ReadByteIntInt { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Skip.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Skip.java index 96ce0fef5e8..d80a1c6ada5 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Skip.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Skip.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ public class Skip { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLong.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLong.java index 14eba08157e..ad4dc48ea6e 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLong.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ public class SubbufferLong { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLong.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLong.java index d6f9cd82521..75b7bbc45c2 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLong.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ public class SubbufferLongLong { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLongBoolean.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLongBoolean.java index d59349ce709..df84eaf6601 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLongBoolean.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLongBoolean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ public class SubbufferLongLongBoolean { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Unload.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Unload.java index 1c15fa3a176..8d8895f0266 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Unload.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Unload.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,8 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -54,13 +55,13 @@ public class Unload { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/WriteTo.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/WriteTo.java index 61ebd221659..2f0b1960c90 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/WriteTo.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/WriteTo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,9 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +57,13 @@ public class WriteTo { test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/sound/midi/Gervill/ModelByteBufferWavetable/OpenStream.java b/jdk/test/javax/sound/midi/Gervill/ModelByteBufferWavetable/OpenStream.java index 01e3b7a26af..7e659d46499 100644 --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBufferWavetable/OpenStream.java +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBufferWavetable/OpenStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -99,16 +101,15 @@ public class OpenStream { buffer_wave = new ModelByteBuffer(baos.toByteArray()); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(baos.toByteArray()); - fos.close(); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(baos.toByteArray()); + } buffer_wave_ondisk = new ModelByteBuffer(test_file); } static void tearDown() throws Exception { - if (!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void testOpenStream(ModelByteBufferWavetable wavetable) diff --git a/jdk/test/javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java b/jdk/test/javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java index e32e7723db5..f61126bd609 100644 --- a/jdk/test/javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java +++ b/jdk/test/javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java @@ -26,6 +26,8 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -162,7 +164,7 @@ public final class FrameLengthAfterConversion { ais = AudioSystem.getAudioInputStream(temp); final long frameLength = ais.getFrameLength(); ais.close(); - temp.delete(); + Files.delete(Paths.get(temp.getAbsolutePath())); validate(frameLength); } catch (IllegalArgumentException | UnsupportedAudioFileException | IOException ignored) { diff --git a/jdk/test/javax/sound/sampled/spi/AudioFileWriter/WriteUnsupportedAudioFormat.java b/jdk/test/javax/sound/sampled/spi/AudioFileWriter/WriteUnsupportedAudioFormat.java index 893205944c3..8b0d8993e87 100644 --- a/jdk/test/javax/sound/sampled/spi/AudioFileWriter/WriteUnsupportedAudioFormat.java +++ b/jdk/test/javax/sound/sampled/spi/AudioFileWriter/WriteUnsupportedAudioFormat.java @@ -27,6 +27,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -91,7 +93,6 @@ public final class WriteUnsupportedAudioFormat { } catch (final IOException e) { throw new RuntimeException(e); } - FILE.deleteOnExit(); for (final Boolean end : new boolean[]{false, true}) { for (final int sampleSize : sampleBits) { @@ -134,6 +135,7 @@ public final class WriteUnsupportedAudioFormat { } } } + Files.delete(Paths.get(FILE.getAbsolutePath())); } /** diff --git a/jdk/test/javax/swing/JButton/8151303/PressedIconTest.java b/jdk/test/javax/swing/JButton/8151303/PressedIconTest.java new file mode 100644 index 00000000000..9bf4065b099 --- /dev/null +++ b/jdk/test/javax/swing/JButton/8151303/PressedIconTest.java @@ -0,0 +1,132 @@ +/* + * 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.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.image.BaseMultiResolutionImage; +import java.awt.image.BufferedImage; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; + +/** + * @test + * @bug 8151303 + * @summary [macosx] [hidpi] JButton's low-res. icon is visible when clicking on it + * @run main/othervm PressedIconTest + * @run main/othervm -Dsun.java2d.uiScale=2 PressedIconTest + */ +public class PressedIconTest { + + private final static int IMAGE_SIZE = 300; + + private final static Color COLOR_1X = Color.RED; + private final static Color COLOR_2X = Color.BLUE; + private static JFrame frame; + private static volatile double scale = -1; + private static volatile int centerX; + private static volatile int centerY; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(50); + + SwingUtilities.invokeAndWait(() -> createAndShowGUI()); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + scale = frame.getGraphicsConfiguration().getDefaultTransform() + .getScaleX(); + Point location = frame.getLocation(); + Dimension size = frame.getSize(); + centerX = location.x + size.width / 2; + centerY = location.y + size.height / 2; + }); + robot.waitForIdle(); + + robot.mouseMove(centerX, centerY); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.waitForIdle(); + Thread.sleep(100); + Color color = robot.getPixelColor(centerX, centerY); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + SwingUtilities.invokeAndWait(() -> frame.dispose()); + + if ((scale == 1 && !similar(color, COLOR_1X)) + || (scale == 2 && !similar(color, COLOR_2X))) { + throw new RuntimeException("Colors are different!"); + } + } + + private static void createAndShowGUI() { + frame = new JFrame(); + frame.setSize(IMAGE_SIZE, IMAGE_SIZE); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel panel = new JPanel(new BorderLayout()); + + BufferedImage img1x = generateImage(1, COLOR_1X); + + BufferedImage img2x = generateImage(2, COLOR_2X); + BaseMultiResolutionImage mri = new BaseMultiResolutionImage( + new BufferedImage[]{img1x, img2x}); + Icon mrIcon = new ImageIcon(mri); + + JToggleButton button = new JToggleButton(); + button.setIcon(mrIcon); + panel.add(button, BorderLayout.CENTER); + + frame.getContentPane().add(panel); + frame.setVisible(true); + } + + private static boolean similar(Color c1, Color c2) { + return similar(c1.getRed(), c2.getRed()) + && similar(c1.getGreen(), c2.getGreen()) + && similar(c1.getBlue(), c2.getBlue()); + } + + private static boolean similar(int n, int m) { + return Math.abs(n - m) <= 50; + } + + private static BufferedImage generateImage(int scale, Color c) { + + int size = IMAGE_SIZE * scale; + BufferedImage img = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB); + Graphics g = img.createGraphics(); + g.setColor(c); + g.fillRect(0, 0, size, size); + g.dispose(); + return img; + } +} diff --git a/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java b/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java index f7146318ad0..4c773c0f7b1 100644 --- a/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java +++ b/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java @@ -23,7 +23,7 @@ /* @test * @key headful - * @bug 8129940 8132770 8161470 + * @bug 8129940 8132770 8161470 8163169 * @summary JRadioButton should run custom FocusTraversalKeys for all LaFs * @run main FocusTraversal */ @@ -61,6 +61,7 @@ public class FocusTraversal { public static void main(String[] args) throws Exception { robot = new Robot(); + robot.setAutoDelay(100); robot.waitForIdle(); UIManager.LookAndFeelInfo[] lookAndFeelArray = UIManager.getInstalledLookAndFeels(); diff --git a/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java b/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java index d8146b61b09..3731bed23ea 100644 --- a/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java +++ b/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java @@ -22,9 +22,10 @@ */ /* @test - @bug 8057791 8160438 - @summary Selection in JList is drawn with wrong colors in Nimbus L&F - @run main bug8057791 + @key headful + @bug 8057791 8160438 8163161 + @summary Selection in JList is drawn with wrong colors in Nimbus L&F + @run main/timeout=500 bug8057791 */ import java.awt.Color; import java.awt.Font; diff --git a/jdk/test/jdk/internal/ref/Cleaner/ExitOnThrow.java b/jdk/test/jdk/internal/ref/Cleaner/ExitOnThrow.java index f3308c480e6..aff92170577 100644 --- a/jdk/test/jdk/internal/ref/Cleaner/ExitOnThrow.java +++ b/jdk/test/jdk/internal/ref/Cleaner/ExitOnThrow.java @@ -24,7 +24,7 @@ /* * @test * @bug 4954921 8009259 - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.ref * java.base/jdk.internal.misc * @build jdk.test.lib.* diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/Asserts.java b/jdk/test/lib/testlibrary/jdk/testlibrary/Asserts.java index 594b12e3ede..621885ae50c 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/Asserts.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Asserts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 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 @@ -44,7 +44,7 @@ import java.util.Objects; * * * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public class Asserts { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java index c4815229eb7..7b16a600d78 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 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 @@ -29,7 +29,7 @@ import java.nio.file.Paths; /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public final class JDKToolFinder { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java index 777e8cf5336..cd3b7cea022 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 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 @@ -46,7 +46,7 @@ import java.util.List; * } * * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public class JDKToolLauncher { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java b/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java index 839c3228294..1a641efde90 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java @@ -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 @@ -36,7 +36,7 @@ import java.util.regex.Pattern; * Utility class for verifying output and exit value from a {@code Process}. * * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} + * {@code /test/lib/jdk/test/lib/process} * */ @Deprecated diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java b/jdk/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java index c8a5d7aab12..9759f22b9e9 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java @@ -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 @@ -30,7 +30,7 @@ import java.util.concurrent.Future; /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} + * {@code /test/lib/jdk/test/lib/process} */ @Deprecated class OutputBuffer { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java index 635f37f0b82..59b6d7c04c9 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java @@ -29,7 +29,7 @@ import java.io.IOException; /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public class Platform { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java index e2c2f110fc5..224ab0e067d 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java @@ -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 @@ -43,7 +43,7 @@ import java.util.stream.Collectors; /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} + * {@code /test/lib/jdk/test/lib/process} */ @Deprecated public final class ProcessTools { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java b/jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java index 2f3c205db3c..1107563738f 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 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 @@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean; /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} + * {@code /test/lib/jdk/test/lib/process} */ @Deprecated public final class StreamPumper implements Runnable { diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java index c76339107c8..31008f554f2 100644 --- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java @@ -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 @@ -43,7 +43,7 @@ import java.util.function.Function; * Common library for various test helper functions. * * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public final class Utils { diff --git a/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java b/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java index 826edfb4e58..3d521ad5bc5 100644 --- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java +++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import sun.jvmstat.monitor.VmIdentifier; * @summary setInterval() for local MonitoredHost and local MonitoredVm * @modules jdk.jvmstat/sun.jvmstat.monitor * @library /lib/testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* * @run main TestPollingInterval diff --git a/jdk/test/sun/misc/SunMiscSignalTest.java b/jdk/test/sun/misc/SunMiscSignalTest.java index 2e998ba8d77..33d4d3ac41c 100644 --- a/jdk/test/sun/misc/SunMiscSignalTest.java +++ b/jdk/test/sun/misc/SunMiscSignalTest.java @@ -43,7 +43,7 @@ import sun.misc.SignalHandler; /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules jdk.unsupported * java.base/jdk.internal.misc * @build jdk.test.lib.Platform jdk.test.lib.Utils diff --git a/jdk/test/sun/security/krb5/auto/Unreachable.java b/jdk/test/sun/security/krb5/auto/Unreachable.java index b010b54837e..fdc1aa2ee25 100644 --- a/jdk/test/sun/security/krb5/auto/Unreachable.java +++ b/jdk/test/sun/security/krb5/auto/Unreachable.java @@ -23,31 +23,108 @@ /* * @test - * @bug 7162687 + * @bug 7162687 8015595 * @key intermittent * @summary enhance KDC server availability detection * @compile -XDignore.symbol.file Unreachable.java - * @run main/othervm/timeout=10 Unreachable + * @run main/othervm Unreachable */ - -import java.io.File; +import java.net.PortUnreachableException; +import java.net.SocketTimeoutException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetSocketAddress; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.Executors; import javax.security.auth.login.LoginException; import sun.security.krb5.Config; public class Unreachable { - public static void main(String[] args) throws Exception { - File f = new File( - System.getProperty("test.src", "."), "unreachable.krb5.conf"); - System.setProperty("java.security.krb5.conf", f.getPath()); - Config.refresh(); + // Wait for 20 second until unreachable KDC throws PortUnreachableException. + private static final int TIMEOUT = 20; + private static final String REALM = "RABBIT.HOLE"; + private static final String HOST = "127.0.0.1"; + private static final int PORT = 13434; + private static final String KRB_CONF = "unreachable.krb5.conf"; - // If PortUnreachableException is not received, the login will consume - // about 3*3*30 seconds and the test will timeout. + public static void main(String[] args) throws Exception { + + // - Only PortUnreachableException will allow to continue execution. + // - SocketTimeoutException may occur on Mac because it will not throw + // PortUnreachableException for unreachable port in which case the Test + // execution will be skipped. + // - For Reachable port, the Test execution will get skipped. + // - Any other Exception will be treated as Test failure. + if (!findPortUnreachableExc()) { + System.out.println(String.format("WARNING: Either a reachable " + + "connection found to %s:%s or SocketTimeoutException " + + "occured which means PortUnreachableException not thrown" + + " by the platform.", HOST, PORT)); + return; + } + KDC kdc = KDC.existing(REALM, HOST, PORT); + KDC.saveConfig(KRB_CONF, kdc); + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future future = executor.submit(new Callable() { + @Override + public Exception call() { + System.setProperty("java.security.krb5.conf", KRB_CONF); + try { + Config.refresh(); + // If PortUnreachableException is not received, the login + // will consume about 3*3*30 seconds and the test will + // timeout. + try { + Context.fromUserPass("name", "pass".toCharArray(), true); + } catch (LoginException le) { + // This is OK + } + System.out.println("Execution successful."); + } catch (Exception e) { + return e; + } + return null; + } + }); try { - Context.fromUserPass("name", "pass".toCharArray(), true); - } catch (LoginException le) { - // This is OK + Exception ex = null; + if ((ex = future.get(TIMEOUT, TimeUnit.SECONDS)) != null) { + throw new RuntimeException(ex); + } + } catch (TimeoutException e) { + future.cancel(true); + throw new RuntimeException("PortUnreachableException not thrown."); + } finally { + executor.shutdownNow(); } } + + /** + * If the remote destination to which the socket is connected does not + * exist, or is otherwise unreachable, and if an ICMP destination unreachable + * packet has been received for that address, then a subsequent call to + * send or receive may throw a PortUnreachableException. Note, there is no + * guarantee that the exception will be thrown. + */ + private static boolean findPortUnreachableExc() throws Exception { + try { + InetSocketAddress iaddr = new InetSocketAddress(HOST, PORT); + DatagramSocket dgSocket = new DatagramSocket(); + dgSocket.setSoTimeout(5000); + dgSocket.connect(iaddr); + byte[] data = new byte[]{}; + dgSocket.send(new DatagramPacket(data, data.length, iaddr)); + dgSocket.receive(new DatagramPacket(data, data.length)); + } catch (PortUnreachableException e) { + return true; + } catch (SocketTimeoutException e) { + return false; + } + return false; + } } diff --git a/jdk/test/sun/security/krb5/auto/unreachable.krb5.conf b/jdk/test/sun/security/krb5/auto/unreachable.krb5.conf deleted file mode 100644 index 8ff4cc173aa..00000000000 --- a/jdk/test/sun/security/krb5/auto/unreachable.krb5.conf +++ /dev/null @@ -1,9 +0,0 @@ -[libdefaults] - default_realm = RABBIT.HOLE -[realms] - -RABBIT.HOLE = { - kdc = 127.0.0.1:13434 - kdc = 127.0.0.1:13435 - kdc = 127.0.0.1:13436 -} diff --git a/jdk/test/sun/security/provider/SecureRandom/AutoReseed.java b/jdk/test/sun/security/provider/SecureRandom/AutoReseed.java index 48361f225d5..0cdce177b1e 100644 --- a/jdk/test/sun/security/provider/SecureRandom/AutoReseed.java +++ b/jdk/test/sun/security/provider/SecureRandom/AutoReseed.java @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + import java.security.SecureRandom; import java.security.Security; @@ -27,15 +28,15 @@ import java.security.Security; * @test * @bug 8051408 * @summary make sure nextBytes etc can be called before setSeed + * @run main/othervm -Djava.security.egd=file:/dev/urandom AutoReseed */ public class AutoReseed { public static void main(String[] args) throws Exception { SecureRandom sr; - String old = Security.getProperty("securerandom.drbg.config"); - try { - for (String mech : - new String[]{"Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + boolean pass = true; + for (String mech : new String[]{"Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + try { System.out.println("Testing " + mech + "..."); Security.setProperty("securerandom.drbg.config", mech); @@ -46,9 +47,13 @@ public class AutoReseed { sr.reseed(); sr = SecureRandom.getInstance("DRBG"); sr.generateSeed(10); + } catch (Exception e) { + pass = false; + e.printStackTrace(System.out); } - } finally { - Security.setProperty("securerandom.drbg.config", old); + } + if (!pass) { + throw new RuntimeException("At least one test case failed"); } } } diff --git a/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java b/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java index b812ba5f60e..b10431b6444 100644 --- a/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java +++ b/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java @@ -30,12 +30,13 @@ /* * @test - * @bug 7113275 + * @bug 7113275 8164846 * @summary compatibility issue with MD2 trust anchor and old X509TrustManager - * @run main/othervm TrustTrustedCert PKIX TLSv1.1 - * @run main/othervm TrustTrustedCert SunX509 TLSv1.1 - * @run main/othervm TrustTrustedCert PKIX TLSv1.2 - * @run main/othervm TrustTrustedCert SunX509 TLSv1.2 + * @run main/othervm TrustTrustedCert PKIX TLSv1.1 true + * @run main/othervm TrustTrustedCert PKIX TLSv1.1 false + * @run main/othervm TrustTrustedCert SunX509 TLSv1.1 false + * @run main/othervm TrustTrustedCert PKIX TLSv1.2 false + * @run main/othervm TrustTrustedCert SunX509 TLSv1.2 false */ import java.net.*; @@ -181,23 +182,32 @@ public class TrustTrustedCert { Thread.sleep(50); } - SSLContext context = generateSSLContext(); - SSLSocketFactory sslsf = context.getSocketFactory(); + SSLSocket sslSocket = null; + try { + SSLContext context = generateSSLContext(); + SSLSocketFactory sslsf = context.getSocketFactory(); - SSLSocket sslSocket = - (SSLSocket)sslsf.createSocket("localhost", serverPort); + sslSocket = (SSLSocket)sslsf.createSocket("localhost", serverPort); - // enable the specified TLS protocol - sslSocket.setEnabledProtocols(new String[] {tlsProtocol}); + // enable the specified TLS protocol + sslSocket.setEnabledProtocols(new String[] {tlsProtocol}); - InputStream sslIS = sslSocket.getInputStream(); - OutputStream sslOS = sslSocket.getOutputStream(); - - sslOS.write('B'); - sslOS.flush(); - sslIS.read(); - - sslSocket.close(); + InputStream sslIS = sslSocket.getInputStream(); + OutputStream sslOS = sslSocket.getOutputStream(); + sslOS.write('B'); + sslOS.flush(); + sslIS.read(); + } catch (SSLHandshakeException e) { + // focus in on the CertPathValidatorException + Throwable t = e.getCause().getCause(); + if ((t == null) || (expectFail && + !t.toString().contains("MD5withRSA"))) { + throw new RuntimeException( + "Expected to see MD5withRSA in exception output " + t); + } + } finally { + if (sslSocket != null) sslSocket.close(); + } } /* @@ -206,10 +216,13 @@ public class TrustTrustedCert { */ private static String tmAlgorithm; // trust manager private static String tlsProtocol; // trust manager + // set this flag to test context of CertificateException + private static boolean expectFail; private static void parseArguments(String[] args) { tmAlgorithm = args[0]; tlsProtocol = args[1]; + expectFail = Boolean.parseBoolean(args[2]); } private static SSLContext generateSSLContext() throws Exception { @@ -232,7 +245,7 @@ public class TrustTrustedCert { // generate the private key. PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec( - Base64.getMimeDecoder().decode(targetPrivateKey)); + Base64.getMimeDecoder().decode(targetPrivateKey)); KeyFactory kf = KeyFactory.getInstance("RSA"); RSAPrivateKey priKey = (RSAPrivateKey)kf.generatePrivate(priKeySpec); @@ -338,20 +351,25 @@ public class TrustTrustedCert { volatile Exception clientException = null; public static void main(String[] args) throws Exception { - // MD5 is used in this test case, don't disable MD5 algorithm. - Security.setProperty("jdk.certpath.disabledAlgorithms", + /* + * Get the customized arguments. + */ + parseArguments(args); + + /* + * MD5 is used in this test case, don't disable MD5 algorithm. + * if expectFail is set, we're testing exception message + */ + if (!expectFail) { + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024"); + } Security.setProperty("jdk.tls.disabledAlgorithms", "SSLv3, RC4, DH keySize < 768"); if (debug) System.setProperty("javax.net.debug", "all"); - /* - * Get the customized arguments. - */ - parseArguments(args); - /* * Start the tests. */ @@ -376,7 +394,8 @@ public class TrustTrustedCert { startServer(false); } } catch (Exception e) { - // swallow for now. Show later + System.out.println("Unexpected exception: "); + e.printStackTrace(); } /* @@ -440,7 +459,11 @@ public class TrustTrustedCert { */ System.err.println("Server died..."); serverReady = true; - serverException = e; + if (!expectFail) { + // only record if we weren't expecting. + // client side will record exception + serverException = e; + } } } }; @@ -449,7 +472,11 @@ public class TrustTrustedCert { try { doServerSide(); } catch (Exception e) { - serverException = e; + // only record if we weren't expecting. + // client side will record exception + if (!expectFail) { + serverException = e; + } } finally { serverReady = true; } diff --git a/jdk/test/sun/security/tools/jarsigner/AltProvider.java b/jdk/test/sun/security/tools/jarsigner/AltProvider.java index b93455670b9..2717ef9e22e 100644 --- a/jdk/test/sun/security/tools/jarsigner/AltProvider.java +++ b/jdk/test/sun/security/tools/jarsigner/AltProvider.java @@ -25,7 +25,7 @@ * @test * @bug 4906940 8130302 * @summary -providerPath, -providerClass, -addprovider, and -providerArg - * @library /lib/testlibrary /test/lib/share/classes + * @library /lib/testlibrary /test/lib * @modules java.base/jdk.internal.misc */ diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java index e18b5c76c1d..31384717ac9 100644 --- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java +++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java @@ -24,7 +24,7 @@ /* * @test * @summary Basic test for jhsdb launcher - * @library /test/lib/share/classes + * @library /test/lib * @library /lib/testlibrary * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* diff --git a/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java b/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java index c768dd6eb01..1f88fd325b1 100644 --- a/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java +++ b/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ import jdk.testlibrary.Platform; * @bug 8042397 * @summary Unit test for jmap utility test heap configuration reader * @modules jdk.hotspot.agent/sun.jvm.hotspot - * @library /test/lib/share/classes + * @library /test/lib * @library /lib/testlibrary * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* diff --git a/jdk/test/sun/tools/jinfo/JInfoTest.java b/jdk/test/sun/tools/jinfo/JInfoTest.java index 4710cfb974a..720874ba567 100644 --- a/jdk/test/sun/tools/jinfo/JInfoTest.java +++ b/jdk/test/sun/tools/jinfo/JInfoTest.java @@ -37,7 +37,7 @@ import jdk.test.lib.apps.LingeredApp; * @test * @summary Unit test for jinfo utility * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @build jdk.test.lib.* * @build jdk.test.lib.apps.* * @build jdk.test.lib.process.* diff --git a/jdk/test/sun/tools/jmap/BasicJMapTest.java b/jdk/test/sun/tools/jmap/BasicJMapTest.java index fa333cddea7..c0432deded8 100644 --- a/jdk/test/sun/tools/jmap/BasicJMapTest.java +++ b/jdk/test/sun/tools/jmap/BasicJMapTest.java @@ -37,7 +37,7 @@ import jdk.testlibrary.ProcessTools; * @summary Unit test for jmap utility * @key intermittent * @library /lib/testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @build jdk.testlibrary.* * @build jdk.test.lib.hprof.* * @build jdk.test.lib.hprof.model.* diff --git a/jdk/test/sun/tools/jps/TestJpsSanity.java b/jdk/test/sun/tools/jps/TestJpsSanity.java index 457a667a251..47d15635961 100644 --- a/jdk/test/sun/tools/jps/TestJpsSanity.java +++ b/jdk/test/sun/tools/jps/TestJpsSanity.java @@ -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 @@ -29,7 +29,7 @@ import jdk.test.lib.apps.LingeredApp; * @test * @summary This test verifies jps usage and checks that appropriate error message is shown * when running jps with illegal arguments. - * @library /lib/testlibrary /test/lib/share/classes + * @library /lib/testlibrary /test/lib * @modules jdk.jartool/sun.tools.jar * java.management * java.base/jdk.internal.misc diff --git a/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java b/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java index 771fd128ff7..c51e402e06d 100644 --- a/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java +++ b/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ import jdk.testlibrary.ProcessTools; /* * @test * @summary Test deadlock detection - * @library /test/lib/share/classes + * @library /test/lib * @library /lib/testlibrary * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* diff --git a/jdk/test/sun/util/calendar/zi/TestZoneInfo310.java b/jdk/test/sun/util/calendar/zi/TestZoneInfo310.java index 9d124ffb21d..0c1d7650c48 100644 --- a/jdk/test/sun/util/calendar/zi/TestZoneInfo310.java +++ b/jdk/test/sun/util/calendar/zi/TestZoneInfo310.java @@ -22,11 +22,15 @@ */ /* - *@test - *@bug 8007572 8008161 - *@summary Test whether the TimeZone generated from JSR310 tzdb is the same - *as the one from the tz data from javazic + * @test + * @bug 8007572 8008161 8157792 + * @summary Test whether the TimeZone generated from JSR310 tzdb is the same + * as the one from the tz data from javazic * @modules java.base/sun.util.calendar + * @build BackEnd Checksum DayOfWeek Gen GenDoc Main Mappings Month + * Rule RuleDay RuleRec Simple TestZoneInfo310 Time Timezone + * TzIDOldMapping Zone ZoneInfoFile ZoneInfoOld ZoneRec Zoneinfo + * @run main TestZoneInfo310 */ import java.io.File; @@ -164,10 +168,6 @@ public class TestZoneInfo310 { } for (String zid : zids_new) { - if (zid.equals("Asia/Oral") || zid.equals("Asia/Qyzylorda")) { - // JDK-8157792 tracking this issue - continue; - } ZoneInfoOld zi = toZoneInfoOld(TimeZone.getTimeZone(zid)); ZoneInfoOld ziOLD = (ZoneInfoOld)ZoneInfoOld.getTimeZone(zid); if (! zi.equalsTo(ziOLD)) { diff --git a/jdk/test/sun/util/calendar/zi/Zoneinfo.java b/jdk/test/sun/util/calendar/zi/Zoneinfo.java index 9e48655181f..e58fd188a30 100644 --- a/jdk/test/sun/util/calendar/zi/Zoneinfo.java +++ b/jdk/test/sun/util/calendar/zi/Zoneinfo.java @@ -373,6 +373,7 @@ class Zoneinfo { tz.getOffsetIndex(zrec.getGmtOffset()); int lastGmtOffsetValue = -1; + ZoneRec prevzrec = null; int currentSave = 0; boolean usedZone; for (int zindex = 0; zindex < zone.size(); zindex++) { @@ -441,6 +442,15 @@ class Zoneinfo { currentSave); if (zrec.hasUntil()) { if (transition >= zrec.getUntilTime(currentSave)) { + // If the GMT offset changed from the previous one, + // record fromTime as a transition. + if (!fromTimeUsed && prevzrec != null + && gmtOffset != prevzrec.getGmtOffset()) { + tz.addTransition(fromTime, + tz.getOffsetIndex(gmtOffset+currentSave), + tz.getDstOffsetIndex(currentSave)); + fromTimeUsed = true; // for consistency + } break year_loop; } } @@ -452,8 +462,6 @@ class Zoneinfo { if (fromTime != minTime) { int prevsave; - ZoneRec prevzrec = zone.get(zindex - 1); - // See if until time in the previous // ZoneRec is the same thing as the // local time in the next rule. @@ -555,6 +563,7 @@ class Zoneinfo { fromYear = zrec.getUntilYear(); year = zrec.getUntilYear(); } + prevzrec = zrec; } if (tz.getDSTType() == Timezone.UNDEF_DST) { diff --git a/jdk/test/tools/jar/multiRelease/Basic.java b/jdk/test/tools/jar/multiRelease/Basic.java index 589615ad1e9..9f76b36e06d 100644 --- a/jdk/test/tools/jar/multiRelease/Basic.java +++ b/jdk/test/tools/jar/multiRelease/Basic.java @@ -23,7 +23,7 @@ /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * @build jdk.test.lib.JDKToolFinder jdk.test.lib.Platform * @run testng Basic diff --git a/jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java b/jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java index ae2d3ec5945..d1510affb5e 100644 --- a/jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java +++ b/jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java @@ -22,6 +22,7 @@ */ import java.nio.file.Path; +import java.util.Collection; import java.util.List; import java.util.stream.Collectors; @@ -75,7 +76,7 @@ public class GenerateJLIClassesPluginTest { } - private static List classFilesForSpecies(List species) { + private static List classFilesForSpecies(Collection species) { return species.stream() .map(s -> "/java.base/java/lang/invoke/BoundMethodHandle$Species_" + s + ".class") .collect(Collectors.toList()); diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index 65e43933dec..9023aba0acc 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -504,7 +504,7 @@ $(eval $(call SetupJavaCompilation, $(MODULE), \ $($(MODULE)_ADD_JAVAC_FLAGS) \ --module-source-path $(MODULESOURCEPATH) \ --module-path $(MODULEPATH) \ - -system none, \ + --system none, \ )) TARGETS += $($(MODULE)) $($(MODULE)_COPY_EXTRA) diff --git a/make/Images.gmk b/make/Images.gmk index c7df894ceaf..75a8cb5e04b 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -116,8 +116,10 @@ JMODS := $(wildcard $(IMAGES_OUTPUTDIR)/jmods/*.jmod) JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX) JLINK_ORDER_RESOURCES := **module-info.class +JLINK_JLI_CLASSES := ifeq ($(ENABLE_GENERATE_CLASSLIST), true) JLINK_ORDER_RESOURCES += @$(SUPPORT_OUTPUTDIR)/classlist/classlist + JLINK_JLI_CLASSES := --generate-jli-classes=@$(SUPPORT_OUTPUTDIR)/classlist/jli_trace.out endif JLINK_ORDER_RESOURCES += \ /java.base/java/** \ @@ -131,6 +133,7 @@ JLINK_TOOL := $(JLINK) --module-path $(IMAGES_OUTPUTDIR)/jmods \ --endian $(OPENJDK_BUILD_CPU_ENDIAN) \ --release-info $(BASE_RELEASE_FILE) \ --order-resources=$(call CommaList, $(JLINK_ORDER_RESOURCES)) \ + $(JLINK_JLI_CLASSES) \ # ifeq ($(JLINK_KEEP_PACKAGED_MODULES), true) diff --git a/make/Init.gmk b/make/Init.gmk index 6ed612b28a2..15ae487555c 100644 --- a/make/Init.gmk +++ b/make/Init.gmk @@ -314,6 +314,9 @@ else # HAS_SPEC=true endif on-failure: + $(call CleanupSmartJavac) + $(call StopGlobalTimer) + $(call ReportBuildTimes) $(call PrintFailureReports) $(call PrintBuildLogFailures) $(PRINTF) "Hint: If caused by a warning, try configure --disable-warnings-as-errors.\n\n" diff --git a/make/common/SetupJavaCompilers.gmk b/make/common/SetupJavaCompilers.gmk index 52b2cc337fe..65fc170404d 100644 --- a/make/common/SetupJavaCompilers.gmk +++ b/make/common/SetupJavaCompilers.gmk @@ -88,7 +88,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \ $(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \ JVM := $(JAVA_SMALL), \ JAVAC := $(NEW_JAVAC), \ - FLAGS := --upgrade-module-path $(JDK_OUTPUTDIR)/modules -system none $(DISABLE_WARNINGS), \ + FLAGS := --upgrade-module-path $(JDK_OUTPUTDIR)/modules --system none $(DISABLE_WARNINGS), \ SERVER_DIR := $(SJAVAC_SERVER_DIR), \ SERVER_JVM := $(SJAVAC_SERVER_JAVA))) diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk index 1dd40a0a877..74414a9ca30 100644 --- a/make/common/TestFilesCompilation.gmk +++ b/make/common/TestFilesCompilation.gmk @@ -86,6 +86,7 @@ define SetupTestFilesCompilationBody LANG := C, \ CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$($1_PREFIX)$$(name)), \ LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \ + LIBS := $$($1_LIBS_$$($1_PREFIX)$$(name)), \ OPTIMIZATION := LOW, \ )) \ $$(eval $1 += $$(BUILD_TEST_$$(name)) ) \ diff --git a/make/test/BuildTestLib.gmk b/make/test/BuildTestLib.gmk index 382341a47e4..7593ac74766 100644 --- a/make/test/BuildTestLib.gmk +++ b/make/test/BuildTestLib.gmk @@ -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 @@ -48,7 +48,7 @@ TARGETS += $(BUILD_WB_JAR) # test-lib.jar will contain only hprof classes until JDK-8081381 is resolved $(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \ SETUP := GENERATE_USINGJDKBYTECODE, \ - SRC := $(TEST_LIB_SOURCE_DIR)/share/classes/jdk/test/lib/hprof, \ + SRC := $(TEST_LIB_SOURCE_DIR)/jdk/test/lib/hprof, \ BIN := $(TEST_LIB_SUPPORT)/test-lib_classes, \ JAR := $(TEST_LIB_SUPPORT)/test-lib.jar, \ )) diff --git a/hotspot/test/testlibrary/ClassFileInstaller.java b/test/lib/ClassFileInstaller.java similarity index 100% rename from hotspot/test/testlibrary/ClassFileInstaller.java rename to test/lib/ClassFileInstaller.java diff --git a/hotspot/test/testlibrary/RedefineClassHelper.java b/test/lib/RedefineClassHelper.java similarity index 96% rename from hotspot/test/testlibrary/RedefineClassHelper.java rename to test/lib/RedefineClassHelper.java index 6baddd8e2ec..75768092365 100644 --- a/hotspot/test/testlibrary/RedefineClassHelper.java +++ b/test/lib/RedefineClassHelper.java @@ -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 @@ -23,7 +23,7 @@ import java.io.PrintWriter; import java.lang.instrument.*; -import jdk.test.lib.*; +import jdk.test.lib.InMemoryJavaCompiler; /* * Helper class to write tests that redefine classes. diff --git a/test/lib/share/classes/jdk/test/lib/Asserts.java b/test/lib/jdk/test/lib/Asserts.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/Asserts.java rename to test/lib/jdk/test/lib/Asserts.java index f0be92ef331..8aa0105d994 100644 --- a/test/lib/share/classes/jdk/test/lib/Asserts.java +++ b/test/lib/jdk/test/lib/Asserts.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/BuildHelper.java b/test/lib/jdk/test/lib/BuildHelper.java similarity index 98% rename from hotspot/test/testlibrary/jdk/test/lib/BuildHelper.java rename to test/lib/jdk/test/lib/BuildHelper.java index e9f3cae8e06..1e9d697b35b 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/BuildHelper.java +++ b/test/lib/jdk/test/lib/BuildHelper.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/ByteCodeLoader.java b/test/lib/jdk/test/lib/ByteCodeLoader.java similarity index 97% rename from hotspot/test/testlibrary/jdk/test/lib/ByteCodeLoader.java rename to test/lib/jdk/test/lib/ByteCodeLoader.java index 9e5fa322d48..14f98f8747b 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/ByteCodeLoader.java +++ b/test/lib/jdk/test/lib/ByteCodeLoader.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/DynamicVMOption.java b/test/lib/jdk/test/lib/DynamicVMOption.java similarity index 98% rename from hotspot/test/testlibrary/jdk/test/lib/DynamicVMOption.java rename to test/lib/jdk/test/lib/DynamicVMOption.java index 5d0f1001b73..17f545e126e 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/DynamicVMOption.java +++ b/test/lib/jdk/test/lib/DynamicVMOption.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/FileInstaller.java b/test/lib/jdk/test/lib/FileInstaller.java similarity index 97% rename from hotspot/test/testlibrary/jdk/test/lib/FileInstaller.java rename to test/lib/jdk/test/lib/FileInstaller.java index 7a8e3b8575c..1247deedcb1 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/FileInstaller.java +++ b/test/lib/jdk/test/lib/FileInstaller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/test/testlibrary/jdk/test/lib/InMemoryJavaCompiler.java b/test/lib/jdk/test/lib/InMemoryJavaCompiler.java similarity index 98% rename from hotspot/test/testlibrary/jdk/test/lib/InMemoryJavaCompiler.java rename to test/lib/jdk/test/lib/InMemoryJavaCompiler.java index 8384b28ca5d..5fb78e4441f 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/InMemoryJavaCompiler.java +++ b/test/lib/jdk/test/lib/InMemoryJavaCompiler.java @@ -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 diff --git a/test/lib/share/classes/jdk/test/lib/JDKToolFinder.java b/test/lib/jdk/test/lib/JDKToolFinder.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/JDKToolFinder.java rename to test/lib/jdk/test/lib/JDKToolFinder.java index 3ad008e0005..a9a3598f10d 100644 --- a/test/lib/share/classes/jdk/test/lib/JDKToolFinder.java +++ b/test/lib/jdk/test/lib/JDKToolFinder.java @@ -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 diff --git a/test/lib/share/classes/jdk/test/lib/JDKToolLauncher.java b/test/lib/jdk/test/lib/JDKToolLauncher.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/JDKToolLauncher.java rename to test/lib/jdk/test/lib/JDKToolLauncher.java index 3948d474ec1..38e7b4530bf 100644 --- a/test/lib/share/classes/jdk/test/lib/JDKToolLauncher.java +++ b/test/lib/jdk/test/lib/JDKToolLauncher.java @@ -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 @@ -26,7 +26,7 @@ package jdk.test.lib; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import jdk.test.lib.process.*; +import jdk.test.lib.process.ProcessTools; /** * A utility for constructing command lines for starting JDK tool processes. diff --git a/test/lib/share/classes/jdk/test/lib/Platform.java b/test/lib/jdk/test/lib/Platform.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/Platform.java rename to test/lib/jdk/test/lib/Platform.java index 8c55f091467..ec4fa8b63ba 100644 --- a/test/lib/share/classes/jdk/test/lib/Platform.java +++ b/test/lib/jdk/test/lib/Platform.java @@ -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 @@ -31,7 +31,7 @@ public class Platform { private static final String osName = System.getProperty("os.name"); private static final String dataModel = System.getProperty("sun.arch.data.model"); private static final String vmVersion = System.getProperty("java.vm.version"); - private static final String javaVersion = System.getProperty("java.version"); + private static final String jdkDebug = System.getProperty("jdk.debug"); private static final String osArch = System.getProperty("os.arch"); private static final String userName = System.getProperty("user.name"); private static final String compiler = System.getProperty("sun.management.compiler"); @@ -113,8 +113,7 @@ public class Platform { } public static boolean isDebugBuild() { - return (vmVersion.toLowerCase().contains("debug") || - javaVersion.toLowerCase().contains("debug")); + return (jdkDebug.toLowerCase().contains("debug")); } public static String getVMVersion() { diff --git a/test/lib/share/classes/jdk/test/lib/Utils.java b/test/lib/jdk/test/lib/Utils.java similarity index 91% rename from test/lib/share/classes/jdk/test/lib/Utils.java rename to test/lib/jdk/test/lib/Utils.java index 95e2bbab48a..aececb0301f 100644 --- a/test/lib/share/classes/jdk/test/lib/Utils.java +++ b/test/lib/jdk/test/lib/Utils.java @@ -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 @@ -40,7 +40,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Iterator; +import java.util.Map; +import java.util.HashMap; import java.util.List; +import java.util.Objects; import java.util.Random; import java.util.function.BooleanSupplier; import java.util.concurrent.TimeUnit; @@ -50,8 +53,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import jdk.internal.misc.Unsafe; -import jdk.test.lib.process.*; import static jdk.test.lib.Asserts.assertTrue; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; /** * Common library for various test helper functions. @@ -446,6 +450,23 @@ public final class Utils { return iterator.next(); } + /** + * Returns random element of non empty array + * + * @param a type of array element + * @param array array of elements + * @return random element of array + * @throws IllegalArgumentException if array is empty + */ + public static T getRandomElement(T[] array) + throws IllegalArgumentException { + if (array == null || array.length == 0) { + throw new IllegalArgumentException("Empty or null array"); + } + Random random = getRandomInstance(); + return array[random.nextInt(array.length)]; + } + /** * Wait for condition to be true * @@ -636,5 +657,38 @@ public final class Utils { } return result; } + + public static Object[] getNullValues(Class... types) { + Object[] result = new Object[types.length]; + int i = 0; + for (Class type : types) { + result[i++] = NULL_VALUES.get(type); + } + return result; + } + private static Map, Object> NULL_VALUES = new HashMap<>(); + static { + NULL_VALUES.put(boolean.class, false); + NULL_VALUES.put(byte.class, (byte) 0); + NULL_VALUES.put(short.class, (short) 0); + NULL_VALUES.put(char.class, '\0'); + NULL_VALUES.put(int.class, 0); + NULL_VALUES.put(long.class, 0L); + NULL_VALUES.put(float.class, 0.0f); + NULL_VALUES.put(double.class, 0.0d); + } + + /** + * Returns mandatory property value + * @param propName is a name of property to request + * @return a String with requested property value + */ + public static String getMandatoryProperty(String propName) { + Objects.requireNonNull(propName, "Requested null property"); + String prop = System.getProperty(propName); + Objects.requireNonNull(prop, + String.format("A mandatory property '%s' isn't set", propName)); + return prop; + } } diff --git a/test/lib/share/classes/jdk/test/lib/apps/LingeredApp.java b/test/lib/jdk/test/lib/apps/LingeredApp.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/apps/LingeredApp.java rename to test/lib/jdk/test/lib/apps/LingeredApp.java index d5675a3f635..ac375b62faf 100644 --- a/test/lib/share/classes/jdk/test/lib/apps/LingeredApp.java +++ b/test/lib/jdk/test/lib/apps/LingeredApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/apps/LingeredAppWithDeadlock.java b/test/lib/jdk/test/lib/apps/LingeredAppWithDeadlock.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/apps/LingeredAppWithDeadlock.java rename to test/lib/jdk/test/lib/apps/LingeredAppWithDeadlock.java index 85d96f29f95..2b52c1523db 100644 --- a/test/lib/share/classes/jdk/test/lib/apps/LingeredAppWithDeadlock.java +++ b/test/lib/jdk/test/lib/apps/LingeredAppWithDeadlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/cli/CPUSpecificCommandLineOptionTest.java b/test/lib/jdk/test/lib/cli/CPUSpecificCommandLineOptionTest.java similarity index 97% rename from hotspot/test/testlibrary/jdk/test/lib/cli/CPUSpecificCommandLineOptionTest.java rename to test/lib/jdk/test/lib/cli/CPUSpecificCommandLineOptionTest.java index 328d91fddb1..121d81d8d95 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/cli/CPUSpecificCommandLineOptionTest.java +++ b/test/lib/jdk/test/lib/cli/CPUSpecificCommandLineOptionTest.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/cli/CommandLineOptionTest.java b/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java similarity index 98% rename from hotspot/test/testlibrary/jdk/test/lib/cli/CommandLineOptionTest.java rename to test/lib/jdk/test/lib/cli/CommandLineOptionTest.java index 5fd3326c173..f794ef36090 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/cli/CommandLineOptionTest.java +++ b/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java @@ -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 @@ -28,7 +28,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.function.BooleanSupplier; -import jdk.test.lib.*; +import jdk.test.lib.process.ExitCode; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.Platform; +import jdk.test.lib.Utils; /** * Base class for command line option tests. diff --git a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/AndPredicate.java b/test/lib/jdk/test/lib/cli/predicate/AndPredicate.java similarity index 95% rename from hotspot/test/testlibrary/jdk/test/lib/cli/predicate/AndPredicate.java rename to test/lib/jdk/test/lib/cli/predicate/AndPredicate.java index 5081c3219cd..1e70abc2e00 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/AndPredicate.java +++ b/test/lib/jdk/test/lib/cli/predicate/AndPredicate.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java b/test/lib/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java similarity index 97% rename from hotspot/test/testlibrary/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java rename to test/lib/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java index 228c0270a5b..69f753f5a84 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java +++ b/test/lib/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/NotPredicate.java b/test/lib/jdk/test/lib/cli/predicate/NotPredicate.java similarity index 95% rename from hotspot/test/testlibrary/jdk/test/lib/cli/predicate/NotPredicate.java rename to test/lib/jdk/test/lib/cli/predicate/NotPredicate.java index 846ee0a6273..481f878e228 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/NotPredicate.java +++ b/test/lib/jdk/test/lib/cli/predicate/NotPredicate.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/OrPredicate.java b/test/lib/jdk/test/lib/cli/predicate/OrPredicate.java similarity index 95% rename from hotspot/test/testlibrary/jdk/test/lib/cli/predicate/OrPredicate.java rename to test/lib/jdk/test/lib/cli/predicate/OrPredicate.java index 134eaa6eb80..35f5e979966 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/OrPredicate.java +++ b/test/lib/jdk/test/lib/cli/predicate/OrPredicate.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/CommandExecutor.java b/test/lib/jdk/test/lib/dcmd/CommandExecutor.java similarity index 96% rename from hotspot/test/testlibrary/jdk/test/lib/dcmd/CommandExecutor.java rename to test/lib/jdk/test/lib/dcmd/CommandExecutor.java index dfae041585a..e8c5791f487 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/CommandExecutor.java +++ b/test/lib/jdk/test/lib/dcmd/CommandExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.dcmd; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; /** * Abstract base class for Diagnostic Command executors diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/CommandExecutorException.java b/test/lib/jdk/test/lib/dcmd/CommandExecutorException.java similarity index 94% rename from hotspot/test/testlibrary/jdk/test/lib/dcmd/CommandExecutorException.java rename to test/lib/jdk/test/lib/dcmd/CommandExecutorException.java index 8737e56584d..89aa1b3dee0 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/CommandExecutorException.java +++ b/test/lib/jdk/test/lib/dcmd/CommandExecutorException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/FileJcmdExecutor.java b/test/lib/jdk/test/lib/dcmd/FileJcmdExecutor.java similarity index 97% rename from hotspot/test/testlibrary/jdk/test/lib/dcmd/FileJcmdExecutor.java rename to test/lib/jdk/test/lib/dcmd/FileJcmdExecutor.java index 17ffd91b761..563b65fd20e 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/FileJcmdExecutor.java +++ b/test/lib/jdk/test/lib/dcmd/FileJcmdExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/JMXExecutor.java b/test/lib/jdk/test/lib/dcmd/JMXExecutor.java similarity index 98% rename from hotspot/test/testlibrary/jdk/test/lib/dcmd/JMXExecutor.java rename to test/lib/jdk/test/lib/dcmd/JMXExecutor.java index f0a8d3f0251..677b5db0def 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/JMXExecutor.java +++ b/test/lib/jdk/test/lib/dcmd/JMXExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.dcmd; -import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.process.OutputAnalyzer; import javax.management.*; import javax.management.remote.JMXConnector; diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/JcmdExecutor.java b/test/lib/jdk/test/lib/dcmd/JcmdExecutor.java similarity index 92% rename from hotspot/test/testlibrary/jdk/test/lib/dcmd/JcmdExecutor.java rename to test/lib/jdk/test/lib/dcmd/JcmdExecutor.java index ad593644389..6bf940cda6e 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/JcmdExecutor.java +++ b/test/lib/jdk/test/lib/dcmd/JcmdExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ package jdk.test.lib.dcmd; import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; import java.util.List; diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/MainClassJcmdExecutor.java b/test/lib/jdk/test/lib/dcmd/MainClassJcmdExecutor.java similarity index 95% rename from hotspot/test/testlibrary/jdk/test/lib/dcmd/MainClassJcmdExecutor.java rename to test/lib/jdk/test/lib/dcmd/MainClassJcmdExecutor.java index d651b60009b..84608c11632 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/MainClassJcmdExecutor.java +++ b/test/lib/jdk/test/lib/dcmd/MainClassJcmdExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/PidJcmdExecutor.java b/test/lib/jdk/test/lib/dcmd/PidJcmdExecutor.java similarity index 94% rename from hotspot/test/testlibrary/jdk/test/lib/dcmd/PidJcmdExecutor.java rename to test/lib/jdk/test/lib/dcmd/PidJcmdExecutor.java index f1caddb8b16..25b3f532fc6 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/PidJcmdExecutor.java +++ b/test/lib/jdk/test/lib/dcmd/PidJcmdExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ package jdk.test.lib.dcmd; -import jdk.test.lib.ProcessTools; +import jdk.test.lib.process.ProcessTools; import java.util.Arrays; import java.util.List; diff --git a/test/lib/share/classes/jdk/test/lib/hprof/HprofParser.java b/test/lib/jdk/test/lib/hprof/HprofParser.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/HprofParser.java rename to test/lib/jdk/test/lib/hprof/HprofParser.java index cb39c0d9ac0..88841f9e6d4 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/HprofParser.java +++ b/test/lib/jdk/test/lib/hprof/HprofParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/README b/test/lib/jdk/test/lib/hprof/README similarity index 100% rename from test/lib/share/classes/jdk/test/lib/hprof/README rename to test/lib/jdk/test/lib/hprof/README diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java b/test/lib/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java rename to test/lib/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java index dcaf3624085..4624347ff6b 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java +++ b/test/lib/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/ArrayTypeCodes.java b/test/lib/jdk/test/lib/hprof/model/ArrayTypeCodes.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/ArrayTypeCodes.java rename to test/lib/jdk/test/lib/hprof/model/ArrayTypeCodes.java index d3c9a9eaeb4..c6ac3ac372a 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/ArrayTypeCodes.java +++ b/test/lib/jdk/test/lib/hprof/model/ArrayTypeCodes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/HackJavaValue.java b/test/lib/jdk/test/lib/hprof/model/HackJavaValue.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/HackJavaValue.java rename to test/lib/jdk/test/lib/hprof/model/HackJavaValue.java index fda40a9c07f..6da7b2df648 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/HackJavaValue.java +++ b/test/lib/jdk/test/lib/hprof/model/HackJavaValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaBoolean.java b/test/lib/jdk/test/lib/hprof/model/JavaBoolean.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaBoolean.java rename to test/lib/jdk/test/lib/hprof/model/JavaBoolean.java index 3c298457856..e96766ddba6 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaBoolean.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaBoolean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaByte.java b/test/lib/jdk/test/lib/hprof/model/JavaByte.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaByte.java rename to test/lib/jdk/test/lib/hprof/model/JavaByte.java index aa32ca532c2..e4a1d330008 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaByte.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaByte.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaChar.java b/test/lib/jdk/test/lib/hprof/model/JavaChar.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaChar.java rename to test/lib/jdk/test/lib/hprof/model/JavaChar.java index 629af171d9e..7c04f503efd 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaChar.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaChar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaClass.java b/test/lib/jdk/test/lib/hprof/model/JavaClass.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaClass.java rename to test/lib/jdk/test/lib/hprof/model/JavaClass.java index c25e8adcf79..c2a9563e0aa 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaClass.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaDouble.java b/test/lib/jdk/test/lib/hprof/model/JavaDouble.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaDouble.java rename to test/lib/jdk/test/lib/hprof/model/JavaDouble.java index 347fd4f9c86..3b643029896 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaDouble.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaField.java b/test/lib/jdk/test/lib/hprof/model/JavaField.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaField.java rename to test/lib/jdk/test/lib/hprof/model/JavaField.java index 87dc48e679b..d343f913abd 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaField.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaFloat.java b/test/lib/jdk/test/lib/hprof/model/JavaFloat.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaFloat.java rename to test/lib/jdk/test/lib/hprof/model/JavaFloat.java index 838b72b2ad5..44692125024 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaFloat.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaFloat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaHeapObject.java b/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaHeapObject.java rename to test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java index 6ab1242473b..dbe54f0ef28 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaHeapObject.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java b/test/lib/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java rename to test/lib/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java index d31d382dab8..77607655a8e 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaInt.java b/test/lib/jdk/test/lib/hprof/model/JavaInt.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaInt.java rename to test/lib/jdk/test/lib/hprof/model/JavaInt.java index 4b2e7d2ad8f..9360f858eb8 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaInt.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaLazyReadObject.java b/test/lib/jdk/test/lib/hprof/model/JavaLazyReadObject.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaLazyReadObject.java rename to test/lib/jdk/test/lib/hprof/model/JavaLazyReadObject.java index 3baaf3ca1dd..5428a2b5ede 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaLazyReadObject.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaLazyReadObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaLong.java b/test/lib/jdk/test/lib/hprof/model/JavaLong.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaLong.java rename to test/lib/jdk/test/lib/hprof/model/JavaLong.java index d86dc50658d..28aca95670b 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaLong.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaObject.java b/test/lib/jdk/test/lib/hprof/model/JavaObject.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaObject.java rename to test/lib/jdk/test/lib/hprof/model/JavaObject.java index a419348eff8..74bdb0d6c28 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaObject.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaObjectArray.java b/test/lib/jdk/test/lib/hprof/model/JavaObjectArray.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaObjectArray.java rename to test/lib/jdk/test/lib/hprof/model/JavaObjectArray.java index 4ed0afeaea6..98ae116cafb 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaObjectArray.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaObjectArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaObjectRef.java b/test/lib/jdk/test/lib/hprof/model/JavaObjectRef.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaObjectRef.java rename to test/lib/jdk/test/lib/hprof/model/JavaObjectRef.java index 009c03b0dc7..f0958f7db4c 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaObjectRef.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaObjectRef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaShort.java b/test/lib/jdk/test/lib/hprof/model/JavaShort.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaShort.java rename to test/lib/jdk/test/lib/hprof/model/JavaShort.java index d3bf75952b3..7c4e46acc02 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaShort.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaStatic.java b/test/lib/jdk/test/lib/hprof/model/JavaStatic.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaStatic.java rename to test/lib/jdk/test/lib/hprof/model/JavaStatic.java index b9dc399cf8b..79a5b0d64b7 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaStatic.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaStatic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaThing.java b/test/lib/jdk/test/lib/hprof/model/JavaThing.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaThing.java rename to test/lib/jdk/test/lib/hprof/model/JavaThing.java index 5b14eb68b94..2a663ab443e 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaThing.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaThing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaValue.java b/test/lib/jdk/test/lib/hprof/model/JavaValue.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaValue.java rename to test/lib/jdk/test/lib/hprof/model/JavaValue.java index 30ac6653d28..e7cad68b4d0 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaValue.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaValueArray.java b/test/lib/jdk/test/lib/hprof/model/JavaValueArray.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/hprof/model/JavaValueArray.java rename to test/lib/jdk/test/lib/hprof/model/JavaValueArray.java index 7c0c2c6773f..d65780d527f 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/JavaValueArray.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaValueArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/ReachableExcludes.java b/test/lib/jdk/test/lib/hprof/model/ReachableExcludes.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/ReachableExcludes.java rename to test/lib/jdk/test/lib/hprof/model/ReachableExcludes.java index 6133e539b80..b95183251ab 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/ReachableExcludes.java +++ b/test/lib/jdk/test/lib/hprof/model/ReachableExcludes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/ReachableExcludesImpl.java b/test/lib/jdk/test/lib/hprof/model/ReachableExcludesImpl.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/model/ReachableExcludesImpl.java rename to test/lib/jdk/test/lib/hprof/model/ReachableExcludesImpl.java index 8a15e635523..5038f71ddc0 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/ReachableExcludesImpl.java +++ b/test/lib/jdk/test/lib/hprof/model/ReachableExcludesImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/ReachableObjects.java b/test/lib/jdk/test/lib/hprof/model/ReachableObjects.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/model/ReachableObjects.java rename to test/lib/jdk/test/lib/hprof/model/ReachableObjects.java index da7a4a1e58a..c3fcd7521d4 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/ReachableObjects.java +++ b/test/lib/jdk/test/lib/hprof/model/ReachableObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/ReferenceChain.java b/test/lib/jdk/test/lib/hprof/model/ReferenceChain.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/model/ReferenceChain.java rename to test/lib/jdk/test/lib/hprof/model/ReferenceChain.java index b21ed0bb95e..3b217519447 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/ReferenceChain.java +++ b/test/lib/jdk/test/lib/hprof/model/ReferenceChain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/Root.java b/test/lib/jdk/test/lib/hprof/model/Root.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/model/Root.java rename to test/lib/jdk/test/lib/hprof/model/Root.java index 54a893b9dcd..ae7c08bfeb1 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/Root.java +++ b/test/lib/jdk/test/lib/hprof/model/Root.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/Snapshot.java b/test/lib/jdk/test/lib/hprof/model/Snapshot.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/hprof/model/Snapshot.java rename to test/lib/jdk/test/lib/hprof/model/Snapshot.java index 6150543b36b..fcef29a1b85 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/Snapshot.java +++ b/test/lib/jdk/test/lib/hprof/model/Snapshot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/StackFrame.java b/test/lib/jdk/test/lib/hprof/model/StackFrame.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/model/StackFrame.java rename to test/lib/jdk/test/lib/hprof/model/StackFrame.java index f6e2996b005..723cf64986e 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/StackFrame.java +++ b/test/lib/jdk/test/lib/hprof/model/StackFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/model/StackTrace.java b/test/lib/jdk/test/lib/hprof/model/StackTrace.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/model/StackTrace.java rename to test/lib/jdk/test/lib/hprof/model/StackTrace.java index d581257430c..75c92fc9cdf 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/model/StackTrace.java +++ b/test/lib/jdk/test/lib/hprof/model/StackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/parser/FileReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/parser/FileReadBuffer.java rename to test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java index 716b9469868..7beb2e7dd28 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/parser/FileReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/parser/HprofReader.java b/test/lib/jdk/test/lib/hprof/parser/HprofReader.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/hprof/parser/HprofReader.java rename to test/lib/jdk/test/lib/hprof/parser/HprofReader.java index 15bd6af7fda..693bec6b9b7 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/parser/HprofReader.java +++ b/test/lib/jdk/test/lib/hprof/parser/HprofReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/parser/MappedReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/parser/MappedReadBuffer.java rename to test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java index b3657e6f0c5..c7247fae68f 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/parser/MappedReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/parser/PositionDataInputStream.java b/test/lib/jdk/test/lib/hprof/parser/PositionDataInputStream.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/parser/PositionDataInputStream.java rename to test/lib/jdk/test/lib/hprof/parser/PositionDataInputStream.java index b27e1dc1927..8435dd12a3a 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/parser/PositionDataInputStream.java +++ b/test/lib/jdk/test/lib/hprof/parser/PositionDataInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/parser/PositionInputStream.java b/test/lib/jdk/test/lib/hprof/parser/PositionInputStream.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/parser/PositionInputStream.java rename to test/lib/jdk/test/lib/hprof/parser/PositionInputStream.java index aecc72629ad..0c0e43de8e5 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/parser/PositionInputStream.java +++ b/test/lib/jdk/test/lib/hprof/parser/PositionInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/parser/ReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/parser/ReadBuffer.java rename to test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java index 99c15e5698f..fe548a74ff8 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/parser/ReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/parser/Reader.java b/test/lib/jdk/test/lib/hprof/parser/Reader.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/parser/Reader.java rename to test/lib/jdk/test/lib/hprof/parser/Reader.java index 19ddad5997c..5263035df72 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/parser/Reader.java +++ b/test/lib/jdk/test/lib/hprof/parser/Reader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/util/ArraySorter.java b/test/lib/jdk/test/lib/hprof/util/ArraySorter.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/util/ArraySorter.java rename to test/lib/jdk/test/lib/hprof/util/ArraySorter.java index 4101529dabb..04dbad7ff0b 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/util/ArraySorter.java +++ b/test/lib/jdk/test/lib/hprof/util/ArraySorter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/util/Comparer.java b/test/lib/jdk/test/lib/hprof/util/Comparer.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/hprof/util/Comparer.java rename to test/lib/jdk/test/lib/hprof/util/Comparer.java index b6ae50364ee..182f37edf61 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/util/Comparer.java +++ b/test/lib/jdk/test/lib/hprof/util/Comparer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/util/CompositeEnumeration.java b/test/lib/jdk/test/lib/hprof/util/CompositeEnumeration.java similarity index 97% rename from test/lib/share/classes/jdk/test/lib/hprof/util/CompositeEnumeration.java rename to test/lib/jdk/test/lib/hprof/util/CompositeEnumeration.java index 2c49fad85c1..ddebd0fb3ed 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/util/CompositeEnumeration.java +++ b/test/lib/jdk/test/lib/hprof/util/CompositeEnumeration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/util/Misc.java b/test/lib/jdk/test/lib/hprof/util/Misc.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/util/Misc.java rename to test/lib/jdk/test/lib/hprof/util/Misc.java index 98592f634e2..e654d71d4ce 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/util/Misc.java +++ b/test/lib/jdk/test/lib/hprof/util/Misc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/share/classes/jdk/test/lib/hprof/util/VectorSorter.java b/test/lib/jdk/test/lib/hprof/util/VectorSorter.java similarity index 98% rename from test/lib/share/classes/jdk/test/lib/hprof/util/VectorSorter.java rename to test/lib/jdk/test/lib/hprof/util/VectorSorter.java index 112d90959b6..fb2ac13e175 100644 --- a/test/lib/share/classes/jdk/test/lib/hprof/util/VectorSorter.java +++ b/test/lib/jdk/test/lib/hprof/util/VectorSorter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/hotspot/test/testlibrary/jdk/test/lib/ExitCode.java b/test/lib/jdk/test/lib/process/ExitCode.java similarity index 92% rename from hotspot/test/testlibrary/jdk/test/lib/ExitCode.java rename to test/lib/jdk/test/lib/process/ExitCode.java index 859346d3d06..bb66da17911 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/ExitCode.java +++ b/test/lib/jdk/test/lib/process/ExitCode.java @@ -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 @@ -21,7 +21,7 @@ * questions. */ -package jdk.test.lib; +package jdk.test.lib.process; /** * Exit code values that could be returned by the JVM. diff --git a/hotspot/test/testlibrary/jdk/test/lib/OutputAnalyzer.java b/test/lib/jdk/test/lib/process/OutputAnalyzer.java similarity index 98% rename from hotspot/test/testlibrary/jdk/test/lib/OutputAnalyzer.java rename to test/lib/jdk/test/lib/process/OutputAnalyzer.java index 15f6f53157b..97d9ae0db50 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/OutputAnalyzer.java +++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java @@ -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 @@ -21,7 +21,7 @@ * questions. */ -package jdk.test.lib; +package jdk.test.lib.process; import java.io.IOException; import java.util.Arrays; @@ -41,11 +41,7 @@ public final class OutputAnalyzer { * * @param process Process to analyze * @throws IOException If an I/O error occurs. - * - * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} */ - @Deprecated public OutputAnalyzer(Process process) throws IOException { OutputBuffer output = ProcessTools.getOutput(process); exitValue = process.exitValue(); diff --git a/test/lib/share/classes/jdk/test/lib/process/OutputBuffer.java b/test/lib/jdk/test/lib/process/OutputBuffer.java similarity index 96% rename from test/lib/share/classes/jdk/test/lib/process/OutputBuffer.java rename to test/lib/jdk/test/lib/process/OutputBuffer.java index 23976d8272f..a41e8436ba0 100644 --- a/test/lib/share/classes/jdk/test/lib/process/OutputBuffer.java +++ b/test/lib/jdk/test/lib/process/OutputBuffer.java @@ -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 diff --git a/test/lib/share/classes/jdk/test/lib/process/ProcessTools.java b/test/lib/jdk/test/lib/process/ProcessTools.java similarity index 93% rename from test/lib/share/classes/jdk/test/lib/process/ProcessTools.java rename to test/lib/jdk/test/lib/process/ProcessTools.java index 3189a0fe277..3f4bbb7fa79 100644 --- a/test/lib/share/classes/jdk/test/lib/process/ProcessTools.java +++ b/test/lib/jdk/test/lib/process/ProcessTools.java @@ -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 @@ -28,10 +28,13 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.concurrent.CountDownLatch; +import java.util.List; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -301,6 +304,16 @@ public final class ProcessTools { public static long getProcessId() throws Exception { return ProcessHandle.current().getPid(); } + /** + * Gets the array of strings containing input arguments passed to the VM + * + * @return arguments + */ + public static String[] getVmInputArgs() { + RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); + List args = runtime.getInputArguments(); + return args.toArray(new String[args.size()]); + } /** * Get platform specific VM arguments (e.g. -d64 on 64bit Solaris) @@ -342,16 +355,10 @@ public final class ProcessTools { args.add(javapath); Collections.addAll(args, getPlatformSpecificVMArgs()); + args.add("-cp"); + args.add(System.getProperty("java.class.path")); + if (addTestVmAndJavaOptions) { - // -cp is needed to make sure the same classpath is used whether the test is - // run in AgentVM mode or OtherVM mode. It was added to the hotspot version - // of this API as part of 8077608. However, for the jdk version it is only - // added when addTestVmAndJavaOptions is true in order to minimize - // disruption to existing JDK tests, which have yet to be tested with -cp - // being added. At some point -cp should always be added to be consistent - // with what the hotspot version does. - args.add("-cp"); - args.add(System.getProperty("java.class.path")); Collections.addAll(args, Utils.getTestJavaOpts()); } @@ -377,6 +384,26 @@ public final class ProcessTools { } } + /** + * Executes a test jvm process, waits for it to finish and returns the process output. + * The default jvm options from the test's run command, jtreg, test.vm.opts and test.java.opts, are added. + * The java from the test.jdk is used to execute the command. + * + * The command line will be like: + * {test.jdk}/bin/java {test.fromRun.opts} {test.vm.opts} {test.java.opts} cmds + * + * @param cmds User specifed arguments. + * @return The output from the process. + */ + public static OutputAnalyzer executeTestJvmAllArgs(String... cmds) throws Throwable { + List argsList = new ArrayList<>(); + String[] testArgs = getVmInputArgs(); + Collections.addAll(argsList, testArgs); + Collections.addAll(argsList, Utils.addTestJavaOpts(cmds)); + ProcessBuilder pb = createJavaProcessBuilder(argsList.toArray(new String[argsList.size()])); + return executeProcess(pb); + } + /** * Executes a test jvm process, waits for it to finish and returns the process output. * The default jvm options from jtreg, test.vm.opts and test.java.opts, are added. diff --git a/test/lib/share/classes/jdk/test/lib/process/StreamPumper.java b/test/lib/jdk/test/lib/process/StreamPumper.java similarity index 99% rename from test/lib/share/classes/jdk/test/lib/process/StreamPumper.java rename to test/lib/jdk/test/lib/process/StreamPumper.java index b1780c4ef08..8dd7f0cf0ec 100644 --- a/test/lib/share/classes/jdk/test/lib/process/StreamPumper.java +++ b/test/lib/jdk/test/lib/process/StreamPumper.java @@ -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 diff --git a/hotspot/test/testlibrary/jdk/test/lib/Pair.java b/test/lib/jdk/test/lib/util/Pair.java similarity index 94% rename from hotspot/test/testlibrary/jdk/test/lib/Pair.java rename to test/lib/jdk/test/lib/util/Pair.java index 3e2a3c01ae5..ca29586b045 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/Pair.java +++ b/test/lib/jdk/test/lib/util/Pair.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -package jdk.test.lib; +package jdk.test.lib.util; import java.util.Objects; diff --git a/hotspot/test/testlibrary/jdk/test/lib/Triple.java b/test/lib/jdk/test/lib/util/Triple.java similarity index 95% rename from hotspot/test/testlibrary/jdk/test/lib/Triple.java rename to test/lib/jdk/test/lib/util/Triple.java index d459aa03af5..fbc82532286 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/Triple.java +++ b/test/lib/jdk/test/lib/util/Triple.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -package jdk.test.lib; +package jdk.test.lib.util; import java.util.Objects; diff --git a/hotspot/test/testlibrary/jdk/test/lib/InfiniteLoop.java b/test/lib/jdk/test/lib/wrappers/InfiniteLoop.java similarity index 95% rename from hotspot/test/testlibrary/jdk/test/lib/InfiniteLoop.java rename to test/lib/jdk/test/lib/wrappers/InfiniteLoop.java index 2c1d1a96f7f..dbee901f8c0 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/InfiniteLoop.java +++ b/test/lib/jdk/test/lib/wrappers/InfiniteLoop.java @@ -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 @@ -21,7 +21,7 @@ * questions. */ -package jdk.test.lib; +package jdk.test.lib.wrappers; import java.util.Objects; diff --git a/hotspot/test/testlibrary/jdk/test/lib/TimeLimitedRunner.java b/test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java similarity index 97% rename from hotspot/test/testlibrary/jdk/test/lib/TimeLimitedRunner.java rename to test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java index 4d014fed145..73d53b43b12 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/TimeLimitedRunner.java +++ b/test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java @@ -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 @@ -21,7 +21,7 @@ * questions. */ -package jdk.test.lib; +package jdk.test.lib.wrappers; import java.util.Objects; import java.util.concurrent.Callable; diff --git a/test/lib/share/classes/jdk/test/lib/process/OutputAnalyzer.java b/test/lib/share/classes/jdk/test/lib/process/OutputAnalyzer.java deleted file mode 100644 index fc3a4de2905..00000000000 --- a/test/lib/share/classes/jdk/test/lib/process/OutputAnalyzer.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib.process; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public final class OutputAnalyzer { - - private final String stdout; - private final String stderr; - private final int exitValue; - - /** - * Create an OutputAnalyzer, a utility class for verifying output and exit - * value from a Process - * - * @param process Process to analyze - * @throws IOException If an I/O error occurs. - */ - public OutputAnalyzer(Process process) throws IOException { - OutputBuffer output = ProcessTools.getOutput(process); - exitValue = process.exitValue(); - this.stdout = output.getStdout(); - this.stderr = output.getStderr(); - } - - /** - * Create an OutputAnalyzer, a utility class for verifying output - * - * @param buf String buffer to analyze - */ - public OutputAnalyzer(String buf) { - this(buf, buf); - } - - /** - * Create an OutputAnalyzer, a utility class for verifying output - * - * @param stdout stdout buffer to analyze - * @param stderr stderr buffer to analyze - */ - public OutputAnalyzer(String stdout, String stderr) { - this.stdout = stdout; - this.stderr = stderr; - exitValue = -1; - } - - /** - * Verify that the stdout contents of output buffer is empty - * - * @throws RuntimeException - * If stdout was not empty - */ - public void stdoutShouldBeEmpty() { - if (!getStdout().isEmpty()) { - reportDiagnosticSummary(); - throw new RuntimeException("stdout was not empty"); - } - } - - /** - * Verify that the stderr contents of output buffer is empty - * - * @throws RuntimeException - * If stderr was not empty - */ - public void stderrShouldBeEmpty() { - if (!getStderr().isEmpty()) { - reportDiagnosticSummary(); - throw new RuntimeException("stderr was not empty"); - } - } - - /** - * Verify that the stdout contents of output buffer is not empty - * - * @throws RuntimeException - * If stdout was empty - */ - public void stdoutShouldNotBeEmpty() { - if (getStdout().isEmpty()) { - reportDiagnosticSummary(); - throw new RuntimeException("stdout was empty"); - } - } - - /** - * Verify that the stderr contents of output buffer is not empty - * - * @throws RuntimeException - * If stderr was empty - */ - public void stderrShouldNotBeEmpty() { - if (getStderr().isEmpty()) { - reportDiagnosticSummary(); - throw new RuntimeException("stderr was empty"); - } - } - - /** - * Verify that the stdout and stderr contents of output buffer contains the string - * - * @param expectedString String that buffer should contain - * @throws RuntimeException If the string was not found - */ - public OutputAnalyzer shouldContain(String expectedString) { - if (!stdout.contains(expectedString) && !stderr.contains(expectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + expectedString + "' missing from stdout/stderr \n"); - } - return this; - } - - /** - * Verify that the stdout contents of output buffer contains the string - * - * @param expectedString String that buffer should contain - * @throws RuntimeException If the string was not found - */ - public OutputAnalyzer stdoutShouldContain(String expectedString) { - if (!stdout.contains(expectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + expectedString + "' missing from stdout \n"); - } - return this; - } - - /** - * Verify that the stderr contents of output buffer contains the string - * - * @param expectedString String that buffer should contain - * @throws RuntimeException If the string was not found - */ - public OutputAnalyzer stderrShouldContain(String expectedString) { - if (!stderr.contains(expectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + expectedString + "' missing from stderr \n"); - } - return this; - } - - /** - * Verify that the stdout and stderr contents of output buffer does not contain the string - * - * @param expectedString String that the buffer should not contain - * @throws RuntimeException If the string was found - */ - public OutputAnalyzer shouldNotContain(String notExpectedString) { - if (stdout.contains(notExpectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + notExpectedString + "' found in stdout \n"); - } - if (stderr.contains(notExpectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + notExpectedString + "' found in stderr \n"); - } - return this; - } - - /** - * Verify that the stdout contents of output buffer does not contain the string - * - * @param expectedString String that the buffer should not contain - * @throws RuntimeException If the string was found - */ - public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) { - if (stdout.contains(notExpectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + notExpectedString + "' found in stdout \n"); - } - return this; - } - - /** - * Verify that the stderr contents of output buffer does not contain the string - * - * @param expectedString String that the buffer should not contain - * @throws RuntimeException If the string was found - */ - public OutputAnalyzer stderrShouldNotContain(String notExpectedString) { - if (stderr.contains(notExpectedString)) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + notExpectedString + "' found in stderr \n"); - } - return this; - } - - /** - * Verify that the stdout and stderr contents of output buffer matches - * the pattern - * - * @param pattern - * @throws RuntimeException If the pattern was not found - */ - public OutputAnalyzer shouldMatch(String pattern) { - Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); - Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); - if (!stdoutMatcher.find() && !stderrMatcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' missing from stdout/stderr \n"); - } - return this; - } - - /** - * Verify that the stdout contents of output buffer matches the - * pattern - * - * @param pattern - * @throws RuntimeException If the pattern was not found - */ - public OutputAnalyzer stdoutShouldMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); - if (!matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' missing from stdout \n"); - } - return this; - } - - /** - * Verify that the stderr contents of output buffer matches the - * pattern - * - * @param pattern - * @throws RuntimeException If the pattern was not found - */ - public OutputAnalyzer stderrShouldMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); - if (!matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' missing from stderr \n"); - } - return this; - } - - /** - * Verify that the stdout and stderr contents of output buffer does not - * match the pattern - * - * @param pattern - * @throws RuntimeException If the pattern was found - */ - public OutputAnalyzer shouldNotMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); - if (matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' found in stdout: '" + matcher.group() + "' \n"); - } - matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); - if (matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' found in stderr: '" + matcher.group() + "' \n"); - } - return this; - } - - /** - * Verify that the stdout contents of output buffer does not match the - * pattern - * - * @param pattern - * @throws RuntimeException If the pattern was found - */ - public OutputAnalyzer stdoutShouldNotMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); - if (matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' found in stdout \n"); - } - return this; - } - - /** - * Verify that the stderr contents of output buffer does not match the - * pattern - * - * @param pattern - * @throws RuntimeException If the pattern was found - */ - public OutputAnalyzer stderrShouldNotMatch(String pattern) { - Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); - if (matcher.find()) { - reportDiagnosticSummary(); - throw new RuntimeException("'" + pattern - + "' found in stderr \n"); - } - return this; - } - - /** - * Get the captured group of the first string matching the pattern. - * stderr is searched before stdout. - * - * @param pattern The multi-line pattern to match - * @param group The group to capture - * @return The matched string or null if no match was found - */ - public String firstMatch(String pattern, int group) { - Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr); - Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout); - if (stderrMatcher.find()) { - return stderrMatcher.group(group); - } - if (stdoutMatcher.find()) { - return stdoutMatcher.group(group); - } - return null; - } - - /** - * Get the first string matching the pattern. - * stderr is searched before stdout. - * - * @param pattern The multi-line pattern to match - * @return The matched string or null if no match was found - */ - public String firstMatch(String pattern) { - return firstMatch(pattern, 0); - } - - /** - * Verify the exit value of the process - * - * @param expectedExitValue Expected exit value from process - * @throws RuntimeException If the exit value from the process did not match the expected value - */ - public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) { - if (getExitValue() != expectedExitValue) { - reportDiagnosticSummary(); - throw new RuntimeException("Expected to get exit value of [" - + expectedExitValue + "]\n"); - } - return this; - } - - - /** - * Report summary that will help to diagnose the problem - * Currently includes: - * - standard input produced by the process under test - * - standard output - * - exit code - * Note: the command line is printed by the ProcessTools - */ - private void reportDiagnosticSummary() { - String msg = - " stdout: [" + stdout + "];\n" + - " stderr: [" + stderr + "]\n" + - " exitValue = " + getExitValue() + "\n"; - - System.err.println(msg); - } - - - /** - * Get the contents of the output buffer (stdout and stderr) - * - * @return Content of the output buffer - */ - public String getOutput() { - return stdout + stderr; - } - - /** - * Get the contents of the stdout buffer - * - * @return Content of the stdout buffer - */ - public String getStdout() { - return stdout; - } - - /** - * Get the contents of the stderr buffer - * - * @return Content of the stderr buffer - */ - public String getStderr() { - return stderr; - } - - /** - * Get the process exit value - * - * @return Process exit value - */ - public int getExitValue() { - return exitValue; - } - - /** - * Get the contents of the output buffer (stdout and stderr) as list of strings. - * Output will be split by newlines. - * - * @return Contents of the output buffer as list of strings - */ - public List asLines() { - return asLines(getOutput()); - } - - private List asLines(String buffer) { - return Arrays.asList(buffer.split("(\\r\\n|\\n|\\r)")); - } -}